From 6e9a07d11951a1759b5be8434f92191b9cfe11be Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Sun, 22 Mar 2020 05:33:30 +0100 Subject: [PATCH 001/115] 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 002/115] 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 003/115] 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 004/115] 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 005/115] 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 006/115] 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 007/115] 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 008/115] 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 6a53e02c3c1d2c5216cf68aa9788756feb223abf Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Sun, 5 Apr 2020 14:02:51 +0200 Subject: [PATCH 009/115] FIX better url for get conf with REST API need to be more userfriendly and similar to other api (without a variable with GET varible in URL "?confname=" --- htdocs/api/class/api_setup.class.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/api/class/api_setup.class.php b/htdocs/api/class/api_setup.class.php index 7b47c59dbb7..05d9214389f 100644 --- a/htdocs/api/class/api_setup.class.php +++ b/htdocs/api/class/api_setup.class.php @@ -1409,15 +1409,15 @@ class Setup extends DolibarrApi * * Note that conf variables that stores security key or password hashes can't be loaded with API. * - * @url GET /conf - * - * @param string $confname Name of conf variable to get + * @param string $constante Name of conf variable to get * @return array|mixed Data without useless information * + * @url GET conf/{constante} + * * @throws RestException 403 Forbidden - * @throws RestException 500 Error Bad or unknown value for constname + * @throws RestException 500 Error Bad or unknown value for constname */ - public function getConf($confname) + public function getConf($constante) { global $conf; @@ -1426,14 +1426,14 @@ class Setup extends DolibarrApi throw new RestException(403, 'Error API open to admin users only or to the login user defined with constant API_LOGIN_ALLOWED_FOR_ADMIN_CHECK'); } - if (! preg_match('/^[a-zA-Z0-9_]+$/', $confname) || ! isset($conf->global->$confname)) { + if (! preg_match('/^[a-zA-Z0-9_]+$/', $constante) || ! isset($conf->global->$constante)) { throw new RestException(500, 'Error Bad or unknown value for constname'); } - if (preg_match('/(_pass|password|secret|_key|key$)/i', $confname)) { + if (preg_match('/(_pass|password|secret|_key|key$)/i', $constante)) { throw new RestException(403, 'Forbidden'); } - return $conf->global->$confname; + return $conf->global->$constante; } /** From 1827541f88dab73951f49371d0f4c19d8a0205fa Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Sun, 5 Apr 2020 12:04:25 +0000 Subject: [PATCH 010/115] Fixing style errors. --- htdocs/api/class/api_setup.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/api/class/api_setup.class.php b/htdocs/api/class/api_setup.class.php index 05d9214389f..d6ee0f1a79e 100644 --- a/htdocs/api/class/api_setup.class.php +++ b/htdocs/api/class/api_setup.class.php @@ -1413,7 +1413,7 @@ class Setup extends DolibarrApi * @return array|mixed Data without useless information * * @url GET conf/{constante} - * + * * @throws RestException 403 Forbidden * @throws RestException 500 Error Bad or unknown value for constname */ From 26bc5381e47e2757d4bae54a977c301813216f5c Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Wed, 8 Apr 2020 14:57:34 +0200 Subject: [PATCH 011/115] Update api_setup.class.php --- htdocs/api/class/api_setup.class.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/api/class/api_setup.class.php b/htdocs/api/class/api_setup.class.php index d6ee0f1a79e..5f867c066c7 100644 --- a/htdocs/api/class/api_setup.class.php +++ b/htdocs/api/class/api_setup.class.php @@ -1409,15 +1409,15 @@ class Setup extends DolibarrApi * * Note that conf variables that stores security key or password hashes can't be loaded with API. * - * @param string $constante Name of conf variable to get + * @param string $constantname Name of conf variable to get * @return array|mixed Data without useless information * - * @url GET conf/{constante} + * @url GET conf/{constantname} * * @throws RestException 403 Forbidden * @throws RestException 500 Error Bad or unknown value for constname */ - public function getConf($constante) + public function getConf($constantname) { global $conf; @@ -1426,14 +1426,14 @@ class Setup extends DolibarrApi throw new RestException(403, 'Error API open to admin users only or to the login user defined with constant API_LOGIN_ALLOWED_FOR_ADMIN_CHECK'); } - if (! preg_match('/^[a-zA-Z0-9_]+$/', $constante) || ! isset($conf->global->$constante)) { + if (! preg_match('/^[a-zA-Z0-9_]+$/', $constantname) || ! isset($conf->global->$constantname)) { throw new RestException(500, 'Error Bad or unknown value for constname'); } - if (preg_match('/(_pass|password|secret|_key|key$)/i', $constante)) { + if (preg_match('/(_pass|password|secret|_key|key$)/i', $constantname)) { throw new RestException(403, 'Forbidden'); } - return $conf->global->$constante; + return $conf->global->$constantname; } /** From 4220d6b253d1626d73920072de291ef30c97aeba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 23 Apr 2020 00:38:42 +0200 Subject: [PATCH 012/115] actioncomm note deprecated --- htdocs/comm/action/class/actioncomm.class.php | 15 +++++++-------- test/phpunit/ActionCommTest.php | 2 +- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 8c1e2051a81..09c114375b1 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -380,7 +380,7 @@ class ActionComm extends CommonObject // Clean parameters $this->label = dol_trunc(trim($this->label), 128); $this->location = dol_trunc(trim($this->location), 128); - $this->note = dol_htmlcleanlastbr(trim($this->note)); + $this->note_private = dol_htmlcleanlastbr(trim(empty($this->note_private) ? $this->note : $this->note_private)); if (empty($this->percentage)) $this->percentage = 0; if (empty($this->priority) || !is_numeric($this->priority)) $this->priority = 0; if (empty($this->fulldayevent)) $this->fulldayevent = 0; @@ -488,7 +488,7 @@ class ActionComm extends CommonObject $sql .= ($this->ref_ext ? ("'".$this->db->idate($this->ref_ext)."'") : "null").", "; $sql .= ((isset($this->socid) && $this->socid > 0) ? $this->socid : "null").", "; $sql .= ((isset($this->fk_project) && $this->fk_project > 0) ? $this->fk_project : "null").", "; - $sql .= " '".$this->db->escape($this->note_private ? $this->note_private : $this->note)."', "; + $sql .= " '".$this->db->escape($this->note_private)."', "; $sql .= ((isset($this->contactid) && $this->contactid > 0) ? $this->contactid : "null").", "; $sql .= (isset($user->id) && $user->id > 0 ? $user->id : "null").", "; $sql .= ($userownerid > 0 ? $userownerid : "null").", "; @@ -993,7 +993,7 @@ class ActionComm extends CommonObject // Clean parameters $this->label = trim($this->label); - $this->note = trim($this->note); + $this->note_private = dol_htmlcleanlastbr(trim(empty($this->note_private) ? $this->note : $this->note_private)); if (empty($this->percentage)) $this->percentage = 0; if (empty($this->priority) || !is_numeric($this->priority)) $this->priority = 0; if (empty($this->transparency)) $this->transparency = 0; @@ -1027,7 +1027,7 @@ class ActionComm extends CommonObject $sql .= ", datep = ".(strval($this->datep) != '' ? "'".$this->db->idate($this->datep)."'" : 'null'); $sql .= ", datep2 = ".(strval($this->datef) != '' ? "'".$this->db->idate($this->datef)."'" : 'null'); $sql .= ", durationp = ".(isset($this->durationp) && $this->durationp >= 0 && $this->durationp != '' ? "'".$this->db->escape($this->durationp)."'" : "null"); // deprecated - $sql .= ", note = '".$this->db->escape($this->note_private ? $this->note_private : $this->note)."'"; + $sql .= ", note = '".$this->db->escape($this->note_private)."'"; $sql .= ", fk_project =".($this->fk_project > 0 ? $this->fk_project : "null"); $sql .= ", fk_soc =".($socid > 0 ? $socid : "null"); $sql .= ", fk_contact =".($contactid > 0 ? $contactid : "null"); @@ -1406,8 +1406,8 @@ class ActionComm extends CommonObject $tooltip .= '
'.$langs->trans('Type').': '.$labeltype; if (!empty($this->location)) $tooltip .= '
'.$langs->trans('Location').': '.$this->location; - if (!empty($this->note)) - $tooltip .= '
'.$langs->trans('Note').': '.(dol_textishtml($this->note) ? str_replace(array("\r", "\n"), "", $this->note) : str_replace(array("\r", "\n"), '
', $this->note)); + if (!empty($this->note_private)) + $tooltip .= '
'.$langs->trans('Note').': '.(dol_textishtml($this->note_private) ? str_replace(array("\r", "\n"), "", $this->note_private) : str_replace(array("\r", "\n"), '
', $this->note_private)); $linkclose = ''; if (!empty($conf->global->AGENDA_USE_EVENT_TYPE) && $this->type_color) $linkclose = ' style="background-color:#'.$this->type_color.'"'; @@ -1940,8 +1940,7 @@ class ActionComm extends CommonObject $this->location = 'Location'; $this->transparency = 1; // 1 means opaque $this->priority = 1; - $this->note = "This is a 'public' note"; - $this->note_public = "This is a 'public' note."; + //$this->note_public = "This is a 'public' note."; $this->note_private = "This is a 'private' note."; $this->userownerid = $user->id; diff --git a/test/phpunit/ActionCommTest.php b/test/phpunit/ActionCommTest.php index 6bb7f12250d..34d67341afb 100644 --- a/test/phpunit/ActionCommTest.php +++ b/test/phpunit/ActionCommTest.php @@ -140,7 +140,7 @@ class ActionCommTest extends PHPUnit\Framework\TestCase $localobject->type_code = 'AC_OTH_AUTO'; // Type of event ('AC_OTH', 'AC_OTH_AUTO', 'AC_XXX'...) $localobject->code = 'AC_PHPUNITTEST'; $localobject->label = 'This is a description'; - $localobject->note = 'This is note'; + $localobject->note_private = 'This is note'; $localobject->fk_project = 0; $localobject->datep = $now; $localobject->datef = $now; From 177008ab65a06221663e496809e904ec2363ae8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 23 Apr 2020 00:45:33 +0200 Subject: [PATCH 013/115] actioncomm note deprecated --- htdocs/comm/action/card.php | 9 ++++----- htdocs/comm/action/class/actioncomm.class.php | 12 ++++++------ htdocs/comm/action/list.php | 7 +++---- 3 files changed, 13 insertions(+), 15 deletions(-) diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index fb07acbd337..716e02ae678 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -317,7 +317,7 @@ if (empty($reshook) && $action == 'add') if (GETPOST("doneby") > 0) $object->userdoneid = GETPOST("doneby", "int"); } - $object->note = trim(GETPOST("note")); + $object->note_private = trim(GETPOST("note")); if (isset($_POST["contactid"])) $object->contact = $contact; @@ -465,7 +465,6 @@ if (empty($reshook) && $action == 'update') $object->contactid = key($object->socpeopleassigned); } $object->fk_project = GETPOST("projectid", 'int'); - $object->note = GETPOST("note", "none"); // deprecated $object->note_private = GETPOST("note", "none"); $object->fk_element = GETPOST("fk_element", "int"); $object->elementtype = GETPOST("elementtype", "alphanohtml"); @@ -1122,7 +1121,7 @@ if ($action == 'create') // Description print ''.$langs->trans("Description").''; require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $doleditor = new DolEditor('note', (GETPOST('note', 'none') ?GETPOST('note', 'none') : $object->note), '', 180, 'dolibarr_notes', 'In', true, true, $conf->fckeditor->enabled, ROWS_4, '90%'); + $doleditor = new DolEditor('note', (GETPOST('note', 'none') ?GETPOST('note', 'none') : $object->note_private), '', 180, 'dolibarr_notes', 'In', true, true, $conf->fckeditor->enabled, ROWS_4, '90%'); $doleditor->Create(); print ''; @@ -1188,7 +1187,7 @@ if ($id > 0) $object->contactid = GETPOST("contactid", 'int'); $object->fk_project = GETPOST("projectid", 'int'); - $object->note = GETPOST("note", 'none'); + $object_private = GETPOST("note", 'none'); } if ($result2 < 0 || $result3 < 0 || $result4 < 0 || $result5 < 0) @@ -1540,7 +1539,7 @@ if ($id > 0) print ''.$langs->trans("Description").''; // Editeur wysiwyg require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $doleditor = new DolEditor('note', $object->note, '', 200, 'dolibarr_notes', 'In', true, true, $conf->fckeditor->enabled, ROWS_5, '90%'); + $doleditor = new DolEditor('note', $object->note_private, '', 200, 'dolibarr_notes', 'In', true, true, $conf->fckeditor->enabled, ROWS_5, '90%'); $doleditor->Create(); print ''; diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 09c114375b1..d5b2d542b05 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -733,14 +733,14 @@ class ActionComm extends CommonObject $this->type_short = (($transcode != "Action".$obj->type_code.'Short') ? $transcode : ''); $this->code = $obj->code; - $this->label = $obj->label; - $this->datep = $this->db->jdate($obj->datep); - $this->datef = $this->db->jdate($obj->datep2); + $this->label = $obj->label; + $this->datep = $this->db->jdate($obj->datep); + $this->datef = $this->db->jdate($obj->datep2); - $this->datec = $this->db->jdate($obj->datec); - $this->datem = $this->db->jdate($obj->datem); + $this->datec = $this->db->jdate($obj->datec); + $this->datem = $this->db->jdate($obj->datem); - $this->note = $obj->note; + $this->note = $obj->note; // deprecated $this->note_private = $obj->note; $this->percentage = $obj->percentage; diff --git a/htdocs/comm/action/list.php b/htdocs/comm/action/list.php index 9f28d278ed1..a4b1a9618fb 100644 --- a/htdocs/comm/action/list.php +++ b/htdocs/comm/action/list.php @@ -553,8 +553,7 @@ if ($resql) $actionstatic->type_picto = $obj->type_picto; $actionstatic->label = $obj->label; $actionstatic->location = $obj->location; - $actionstatic->note = dol_htmlentitiesbr($obj->note); // deprecated - $actionstatic->note_public = dol_htmlentitiesbr($obj->note); + $actionstatic->note_private = dol_htmlentitiesbr($obj->note); $actionstatic->fetchResources(); @@ -613,8 +612,8 @@ if ($resql) // Description if (!empty($arrayfields['a.note']['checked'])) { print ''; - $text = dolGetFirstLineOfText(dol_string_nohtmltag($actionstatic->note, 0)); - print $form->textwithtooltip(dol_trunc($text, 40), $actionstatic->note); + $text = dolGetFirstLineOfText(dol_string_nohtmltag($actionstatic->note_private, 0)); + print $form->textwithtooltip(dol_trunc($text, 40), $actionstatic->note_private); 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 014/115] 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 015/115] 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 016/115] 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 f793844862a30715ae7b87c706d03b6730421dd4 Mon Sep 17 00:00:00 2001 From: "Sekan, Tobias" Date: Thu, 23 Apr 2020 11:04:14 +0200 Subject: [PATCH 017/115] Fix missing errror on facture clone --- htdocs/fourn/class/fournisseur.facture.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index bc353e7ef0d..61ac0899bff 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -2674,6 +2674,7 @@ class FactureFournisseur extends CommonInvoice if ($result < 0) { $this->error = $object->error; + $this->errors = $object->errors; $error++; } @@ -3154,7 +3155,7 @@ class SupplierInvoiceLine extends CommonObjectLine dol_syslog(get_class($this)."::delete error -4 ".$this->error, LOG_ERR); } } - + if (!$error) { // Supprime ligne $sql = 'DELETE FROM '.MAIN_DB_PREFIX.'facture_fourn_det '; From 69f4a3e7b08af95fd1a8960820a87f2505b3c1ca Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 23 Apr 2020 11:41:03 +0200 Subject: [PATCH 018/115] Doc --- htdocs/install/mysql/tables/llx_commande.sql | 2 +- htdocs/install/mysql/tables/llx_facture.sql | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/install/mysql/tables/llx_commande.sql b/htdocs/install/mysql/tables/llx_commande.sql index c6b9049a64f..676e768c73b 100644 --- a/htdocs/install/mysql/tables/llx_commande.sql +++ b/htdocs/install/mysql/tables/llx_commande.sql @@ -58,7 +58,7 @@ create table llx_commande last_main_doc varchar(255), -- relative filepath+filename of last main generated document module_source varchar(32), -- name of module when order generated by a dedicated module (POS, ...) - pos_source varchar(32), -- name of POS station when order is generated by a POS module + pos_source varchar(32), -- numero of POS terminal when order is generated by a POS module, IDsession@IDwebsite when order is generated for a website basket. facture tinyint default 0, fk_account integer, -- bank account fk_currency varchar(3), -- currency code diff --git a/htdocs/install/mysql/tables/llx_facture.sql b/htdocs/install/mysql/tables/llx_facture.sql index 5a2d5464cfc..429095e1111 100644 --- a/htdocs/install/mysql/tables/llx_facture.sql +++ b/htdocs/install/mysql/tables/llx_facture.sql @@ -65,7 +65,7 @@ create table llx_facture fk_user_closing integer, -- user closing module_source varchar(32), -- name of module when invoice generated by a dedicated module (POS, ...) - pos_source varchar(32), -- name of POS station when invoice is generated by a POS module + pos_source varchar(32), -- numero of POS terminal when order is generated by a POS module, IDsession@IDwebsite when order is generated for a website basket. fk_fac_rec_source integer, -- facture rec source fk_facture_source integer, -- facture origin if credit notes or replacement invoice fk_projet integer DEFAULT NULL, -- project invoice is linked to From 0999f5e6f26bc39e67b80b2ac9a0ce0cdcfa8d89 Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Thu, 23 Apr 2020 12:12:50 +0200 Subject: [PATCH 019/115] FIX: Error update SQL into stock reception --- htdocs/product/stock/class/mouvementstock.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/product/stock/class/mouvementstock.class.php b/htdocs/product/stock/class/mouvementstock.class.php index e0266172463..2799cbaaf50 100644 --- a/htdocs/product/stock/class/mouvementstock.class.php +++ b/htdocs/product/stock/class/mouvementstock.class.php @@ -515,10 +515,11 @@ class MouvementStock extends CommonObject // Update PMP and denormalized value of stock qty at product level if (! $error) { + $newpmp = price2num($newpmp,'MU'); // $sql = "UPDATE ".MAIN_DB_PREFIX."product SET pmp = ".$newpmp.", stock = ".$this->db->ifsql("stock IS NULL", 0, "stock") . " + ".$qty; // $sql.= " WHERE rowid = ".$fk_product; // Update pmp + denormalized fields because we change content of produt_stock. Warning: Do not use "SET p.stock", does not works with pgsql - $sql = "UPDATE ".MAIN_DB_PREFIX."product as p SET pmp = ".$newpmp.", "; + $sql = "UPDATE ".MAIN_DB_PREFIX."product as p SET pmp = '".$newpmp."', "; $sql.= " stock=(SELECT SUM(ps.reel) FROM ".MAIN_DB_PREFIX."product_stock as ps WHERE ps.fk_product = p.rowid)"; $sql.= " WHERE rowid = ".$fk_product; From da02863242eddf76fda5cdddc17dd916663a40b3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 23 Apr 2020 12:19:51 +0200 Subject: [PATCH 020/115] Code comment --- htdocs/install/mysql/tables/llx_societe_account.sql | 4 ++-- htdocs/societe/class/societeaccount.class.php | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/install/mysql/tables/llx_societe_account.sql b/htdocs/install/mysql/tables/llx_societe_account.sql index feffc7c9bd6..6a78a9a7839 100644 --- a/htdocs/install/mysql/tables/llx_societe_account.sql +++ b/htdocs/install/mysql/tables/llx_societe_account.sql @@ -20,15 +20,15 @@ CREATE TABLE llx_societe_account( -- BEGIN MODULEBUILDER FIELDS rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL, entity integer DEFAULT 1, - key_account varchar(128), -- the id of third party in external web site (for site_account if site_account defined) login varchar(128) NOT NULL, pass_encoding varchar(24), pass_crypted varchar(128), pass_temp varchar(128), -- temporary password when asked for forget password fk_soc integer, + fk_website integer, -- id of local web site site varchar(128), -- name of external web site site_account varchar(128), -- a key to identify the account on external web site - fk_website integer, -- id of local web site + key_account varchar(128), -- the id of third party in external web site (for site_account if site_account defined) note_private text, date_last_login datetime, date_previous_login datetime, diff --git a/htdocs/societe/class/societeaccount.class.php b/htdocs/societe/class/societeaccount.class.php index f90cb17c230..4b3fcc15ec1 100644 --- a/htdocs/societe/class/societeaccount.class.php +++ b/htdocs/societe/class/societeaccount.class.php @@ -79,15 +79,15 @@ class SocieteAccount extends CommonObject public $fields = array( 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'visible'=>-2, 'enabled'=>1, 'position'=>1, 'notnull'=>1, 'index'=>1, 'comment'=>'Id',), 'entity' => array('type'=>'integer', 'label'=>'Entity', 'visible'=>0, 'enabled'=>1, 'position'=>5, 'default'=>1), - 'key_account' => array('type'=>'varchar(128)', 'label'=>'KeyAccount', 'visible'=>1, 'enabled'=>1, 'position'=>10, 'notnull'=>1, 'index'=>1, 'searchall'=>1, 'comment'=>'Key account',), 'login' => array('type'=>'varchar(64)', 'label'=>'Login', 'visible'=>1, 'enabled'=>1, 'position'=>10), 'pass_encoding' => array('type'=>'varchar(24)', 'label'=>'PassEncoding', 'visible'=>0, 'enabled'=>1, 'position'=>30), 'pass_crypted' => array('type'=>'varchar(128)', 'label'=>'Password', 'visible'=>1, 'enabled'=>1, 'position'=>31, 'notnull'=>1), 'pass_temp' => array('type'=>'varchar(128)', 'label'=>'Temp', 'visible'=>0, 'enabled'=>0, 'position'=>32, 'notnull'=>-1,), 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'visible'=>1, 'enabled'=>1, 'position'=>40, 'notnull'=>-1, 'index'=>1), - 'site' => array('type'=>'varchar(128)', 'label'=>'Site', 'visible'=>-1, 'enabled'=>1, 'position'=>41), - 'site_account' => array('type'=>'varchar(128)', 'label'=>'SiteAccount', 'visible'=>-1, 'enabled'=>1, 'position'=>42, 'help'=>'A key to identify the account on external web site'), - 'fk_website' => array('type'=>'integer:Website:website/class/website.class.php', 'label'=>'WebSite', 'visible'=>1, 'enabled'=>1, 'position'=>43, 'notnull'=>-1, 'index'=>1), + 'fk_website' => array('type'=>'integer:Website:website/class/website.class.php', 'label'=>'WebSite', 'visible'=>1, 'enabled'=>1, 'position'=>42, 'notnull'=>-1, 'index'=>1), + 'site' => array('type'=>'varchar(128)', 'label'=>'ExternalSite', 'visible'=>0, 'enabled'=>1, 'position'=>43, 'help'=>'Name of the website or service if this is account on an external website or service'), + 'site_account' => array('type'=>'varchar(128)', 'label'=>'ExternalSiteAccount', 'visible'=>0, 'enabled'=>1, 'position'=>44, 'help'=>'A key to identify the account on external web site if this is an account on an external website'), + 'key_account' => array('type'=>'varchar(128)', 'label'=>'KeyAccount', 'visible'=>0, 'enabled'=>1, 'position'=>48, 'notnull'=>0, 'index'=>1, 'searchall'=>1, 'comment'=>'The id of third party in the external web site (for site_account if site_account defined)',), 'date_last_login' => array('type'=>'datetime', 'label'=>'LastConnexion', 'visible'=>2, 'enabled'=>1, 'position'=>50, 'notnull'=>0,), 'date_previous_login' => array('type'=>'datetime', 'label'=>'PreviousConnexion', 'visible'=>2, 'enabled'=>1, 'position'=>51, 'notnull'=>0,), //'note_public' => array('type'=>'text', 'label'=>'NotePublic', 'visible'=>-1, 'enabled'=>1, 'position'=>45, 'notnull'=>-1,), From 18d3d68caea89d18e4467a50417437b4ce0c23e4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 23 Apr 2020 12:22:24 +0200 Subject: [PATCH 021/115] Fix def --- htdocs/societe/class/societeaccount.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/societe/class/societeaccount.class.php b/htdocs/societe/class/societeaccount.class.php index 4b3fcc15ec1..41fc8633be1 100644 --- a/htdocs/societe/class/societeaccount.class.php +++ b/htdocs/societe/class/societeaccount.class.php @@ -79,7 +79,7 @@ class SocieteAccount extends CommonObject public $fields = array( 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'visible'=>-2, 'enabled'=>1, 'position'=>1, 'notnull'=>1, 'index'=>1, 'comment'=>'Id',), 'entity' => array('type'=>'integer', 'label'=>'Entity', 'visible'=>0, 'enabled'=>1, 'position'=>5, 'default'=>1), - 'login' => array('type'=>'varchar(64)', 'label'=>'Login', 'visible'=>1, 'enabled'=>1, 'position'=>10), + 'login' => array('type'=>'varchar(64)', 'label'=>'Login', 'visible'=>1, 'enabled'=>1, 'notnull'=>1, 'position'=>10), 'pass_encoding' => array('type'=>'varchar(24)', 'label'=>'PassEncoding', 'visible'=>0, 'enabled'=>1, 'position'=>30), 'pass_crypted' => array('type'=>'varchar(128)', 'label'=>'Password', 'visible'=>1, 'enabled'=>1, 'position'=>31, 'notnull'=>1), 'pass_temp' => array('type'=>'varchar(128)', 'label'=>'Temp', 'visible'=>0, 'enabled'=>0, 'position'=>32, 'notnull'=>-1,), From d11396be3e5becdb80fe72c54e30a6fa905ff8c9 Mon Sep 17 00:00:00 2001 From: Drosis Nikos Date: Thu, 23 Apr 2020 13:22:30 +0300 Subject: [PATCH 022/115] Fix check VAT ID HTTP to HTTPS No response to HTTP --- htdocs/societe/checkvat/checkVatPopup.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/societe/checkvat/checkVatPopup.php b/htdocs/societe/checkvat/checkVatPopup.php index 8d004fa4c79..91f24bbb915 100644 --- a/htdocs/societe/checkvat/checkVatPopup.php +++ b/htdocs/societe/checkvat/checkVatPopup.php @@ -28,9 +28,9 @@ require_once NUSOAP_PATH.'/nusoap.php'; $langs->load("companies"); //http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl -$WS_DOL_URL = 'http://ec.europa.eu/taxation_customs/vies/services/checkVatService'; +$WS_DOL_URL = 'https://ec.europa.eu/taxation_customs/vies/services/checkVatService'; //$WS_DOL_URL_WSDL=$WS_DOL_URL.'?wsdl'; -$WS_DOL_URL_WSDL = 'http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl'; +$WS_DOL_URL_WSDL = 'https://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl'; $WS_METHOD = 'checkVat'; From 8f8ae5a4dbed13228655c499b1d62b309d00abb8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 23 Apr 2020 12:33:22 +0200 Subject: [PATCH 023/115] Fix typo --- htdocs/langs/en_US/website.lang | 2 +- htdocs/societe/class/societeaccount.class.php | 7 +++---- htdocs/societe/website.php | 2 ++ 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/htdocs/langs/en_US/website.lang b/htdocs/langs/en_US/website.lang index c3e9870266f..d9b0454c848 100644 --- a/htdocs/langs/en_US/website.lang +++ b/htdocs/langs/en_US/website.lang @@ -77,7 +77,7 @@ BlogPost=Blog post WebsiteAccount=Website account WebsiteAccounts=Website accounts AddWebsiteAccount=Create web site account -BackToListOfThirdParty=Back to list for Third Party +BackToListOfThirdParty=Back to list of third-parties DisableSiteFirst=Disable website first MyContainerTitle=My web site title AnotherContainer=This is how to include content of another page/container (you may have an error here if you enable dynamic code because the embedded subcontainer may not exists) diff --git a/htdocs/societe/class/societeaccount.class.php b/htdocs/societe/class/societeaccount.class.php index 41fc8633be1..98bdeffa637 100644 --- a/htdocs/societe/class/societeaccount.class.php +++ b/htdocs/societe/class/societeaccount.class.php @@ -79,7 +79,7 @@ class SocieteAccount extends CommonObject public $fields = array( 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'visible'=>-2, 'enabled'=>1, 'position'=>1, 'notnull'=>1, 'index'=>1, 'comment'=>'Id',), 'entity' => array('type'=>'integer', 'label'=>'Entity', 'visible'=>0, 'enabled'=>1, 'position'=>5, 'default'=>1), - 'login' => array('type'=>'varchar(64)', 'label'=>'Login', 'visible'=>1, 'enabled'=>1, 'notnull'=>1, 'position'=>10), + 'login' => array('type'=>'varchar(64)', 'label'=>'Login', 'visible'=>1, 'enabled'=>1, 'notnull'=>1, 'position'=>10, 'showoncombobox'=>1), 'pass_encoding' => array('type'=>'varchar(24)', 'label'=>'PassEncoding', 'visible'=>0, 'enabled'=>1, 'position'=>30), 'pass_crypted' => array('type'=>'varchar(128)', 'label'=>'Password', 'visible'=>1, 'enabled'=>1, 'position'=>31, 'notnull'=>1), 'pass_temp' => array('type'=>'varchar(128)', 'label'=>'Temp', 'visible'=>0, 'enabled'=>0, 'position'=>32, 'notnull'=>-1,), @@ -405,11 +405,10 @@ class SocieteAccount extends CommonObject if (!empty($conf->dol_no_mouse_hover)) $notooltip = 1; // Force disable tooltips $result = ''; - $companylink = ''; $this->ref = $this->login; - $label = ''.$langs->trans("SocieteAccount").''; + $label = ''.$langs->trans("WebsiteAccount").''; $label .= '
'; $label .= ''.$langs->trans('Login').': '.$this->ref; //$label.= '' . $langs->trans('WebSite') . ': ' . $this->ref; @@ -429,7 +428,7 @@ class SocieteAccount extends CommonObject { if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { - $label = $langs->trans("ShowsocieteAccount"); + $label = $langs->trans("WebsiteAccount"); $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; } $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; diff --git a/htdocs/societe/website.php b/htdocs/societe/website.php index 7b3bf774a68..dc53f47ff26 100644 --- a/htdocs/societe/website.php +++ b/htdocs/societe/website.php @@ -449,6 +449,8 @@ while ($i < min($num, $limit)) // Store properties in $object $objectwebsiteaccount->id = $obj->rowid; + $objectwebsiteaccount->login = $obj->login; + $objectwebsiteaccount->ref = $obj->login; foreach ($objectwebsiteaccount->fields as $key => $val) { if (property_exists($obj, $key)) $object->$key = $obj->$key; From 46716f2259ee2a337ef200c26c333dfd8577090a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 23 Apr 2020 12:34:37 +0200 Subject: [PATCH 024/115] Typo --- htdocs/langs/en_US/website.lang | 2 +- htdocs/website/websiteaccount_card.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/langs/en_US/website.lang b/htdocs/langs/en_US/website.lang index d9b0454c848..f4d88b0d606 100644 --- a/htdocs/langs/en_US/website.lang +++ b/htdocs/langs/en_US/website.lang @@ -77,7 +77,7 @@ BlogPost=Blog post WebsiteAccount=Website account WebsiteAccounts=Website accounts AddWebsiteAccount=Create web site account -BackToListOfThirdParty=Back to list of third-parties +BackToListForThirdParty=Back to list for the third-party DisableSiteFirst=Disable website first MyContainerTitle=My web site title AnotherContainer=This is how to include content of another page/container (you may have an error here if you enable dynamic code because the embedded subcontainer may not exists) diff --git a/htdocs/website/websiteaccount_card.php b/htdocs/website/websiteaccount_card.php index 046a5005e51..be0c4c3cc41 100644 --- a/htdocs/website/websiteaccount_card.php +++ b/htdocs/website/websiteaccount_card.php @@ -223,7 +223,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Object card // ------------------------------------------------------------ $linkback = ''; - if ($socid) $linkback = ''.$langs->trans("BackToListOfThirdParty").''; + if ($socid) $linkback = ''.$langs->trans("BackToListForThirdParty").''; if ($fk_website) $linkback = ''.$langs->trans("BackToList").''; $morehtmlref = '
'; From 93278b2dca15a5c3cf299d9648ef7ccbcfb51772 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 23 Apr 2020 12:42:03 +0200 Subject: [PATCH 025/115] FIX #13713 --- htdocs/fourn/commande/info.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/htdocs/fourn/commande/info.php b/htdocs/fourn/commande/info.php index efabf409cdc..6764c00f003 100644 --- a/htdocs/fourn/commande/info.php +++ b/htdocs/fourn/commande/info.php @@ -40,6 +40,17 @@ $id=GETPOST('id', 'int'); $ref=GETPOST('ref', 'alpha'); $action = GETPOST('action', 'alpha'); +$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; +$sortfield = GETPOST("sortfield", 'alpha'); +$sortorder = GETPOST("sortorder", 'alpha'); +$page = GETPOST("page", 'int'); +if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1 +$offset = $limit * $page; +$pageprev = $page - 1; +$pagenext = $page + 1; +if (!$sortfield) $sortfield = 'a.datep,a.id'; +if (!$sortorder) $sortorder = 'DESC,DESC'; + if (GETPOST('actioncode', 'array')) { $actioncode=GETPOST('actioncode', 'array', 3); @@ -217,7 +228,7 @@ if (!empty($object->id)) // List of all actions $filters = array(); $filters['search_agenda_label'] = $search_agenda_label; - show_actions_done($conf, $langs, $db, $object, null, 0, $actioncode, '', $filters); + show_actions_done($conf, $langs, $db, $object, null, 0, $actioncode, '', $filters, $sortfield, $sortorder); } // End of page From e1129babbcbe1eab280d22d0fc5c5cb0a973e2e6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 23 Apr 2020 12:44:30 +0200 Subject: [PATCH 026/115] Code comment --- htdocs/fourn/commande/info.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/commande/info.php b/htdocs/fourn/commande/info.php index 6764c00f003..3da0211d3f1 100644 --- a/htdocs/fourn/commande/info.php +++ b/htdocs/fourn/commande/info.php @@ -223,7 +223,7 @@ if (!empty($object->id)) //show_actions_todo($conf,$langs,$db,$object,null,0,$actioncode); // List of done actions - //show_actions_done($conf,$langs,$db,$object,null,0,$actioncode); + //show_actions_done($conf,$langs,$db,$object,null,0,$actioncode, '', $filters, $sortfield, $sortorder); // List of all actions $filters = array(); From 4475df14b4efa0c8e500f1629102bd882138088e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 23 Apr 2020 12:54:28 +0200 Subject: [PATCH 027/115] Finish removal of duplicate hook/trigger --- .../fournisseur.commande.dispatch.class.php | 21 ++------ htdocs/reception/card.php | 39 +++++++-------- htdocs/reception/class/reception.class.php | 49 ++++++------------- 3 files changed, 37 insertions(+), 72 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.commande.dispatch.class.php b/htdocs/fourn/class/fournisseur.commande.dispatch.class.php index 6a7d8a3e8ba..d7b8807bb28 100644 --- a/htdocs/fourn/class/fournisseur.commande.dispatch.class.php +++ b/htdocs/fourn/class/fournisseur.commande.dispatch.class.php @@ -210,22 +210,11 @@ class CommandeFournisseurDispatch extends CommonObject } } - // Actions on extra fields (by external module or standard code) - // TODO le hook fait double emploi avec le trigger !! - $hookmanager->initHooks(array('commandefournisseurdispatchdao')); - $parameters = array('id'=>$this->id); - $reshook = $hookmanager->executeHooks('insertExtraFields', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks - if (empty($reshook)) - { - if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used - { - $result = $this->insertExtraFields(); - - if ($result < 0) - { - $error++; - } - } + // Create extrafields + if (! $error) + { + $result=$this->insertExtraFields(); + if ($result < 0) $error++; } // Commit or rollback diff --git a/htdocs/reception/card.php b/htdocs/reception/card.php index 1269a99d1ea..9c6e8df76f1 100644 --- a/htdocs/reception/card.php +++ b/htdocs/reception/card.php @@ -186,30 +186,25 @@ if (empty($reshook)) if ($action == 'update_extras') { - // Fill array 'array_options' with data from update form - $ret = $extrafields->setOptionalsFromPost(null, $object, GETPOST('attribute')); - if ($ret < 0) $error++; + $object->oldcopy = dol_clone($object); - if (!$error) - { - // Actions on extra fields (by external module or standard code) - // TODO le hook fait double emploi avec le trigger !! - $hookmanager->initHooks(array('receptiondao')); - $parameters = array('id' => $object->id); - $reshook = $hookmanager->executeHooks('insertExtraFields', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks - if (empty($reshook)) { - $result = $object->insertExtraFields(); - if ($result < 0) - { - setEventMessages($object->error, $object->errors, 'errors'); - $error++; - } - } elseif ($reshook < 0) - $error++; - } + // Fill array 'array_options' with data from update form + $ret = $extrafields->setOptionalsFromPost(null, $object, GETPOST('attribute', 'none')); + if ($ret < 0) $error++; - if ($error) - $action = 'edit_extras'; + if (!$error) + { + // Actions on extra fields + $result = $object->insertExtraFields('RECEPTION_MODIFY'); + if ($result < 0) + { + setEventMessages($object->error, $object->errors, 'errors'); + $error++; + } + } + + if ($error) + $action = 'edit_extras'; } // Create reception diff --git a/htdocs/reception/class/reception.class.php b/htdocs/reception/class/reception.class.php index 1679f186a72..b09a5918def 100644 --- a/htdocs/reception/class/reception.class.php +++ b/htdocs/reception/class/reception.class.php @@ -305,24 +305,12 @@ class Reception extends CommonObject } } - // Actions on extra fields (by external module or standard code) - // TODO le hook fait double emploi avec le trigger !! - $action = 'add'; - $hookmanager->initHooks(array('receptiondao')); - $parameters = array('socid'=>$this->id); - $reshook = $hookmanager->executeHooks('insertExtraFields', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks - if (empty($reshook)) + // Create extrafields + if (! $error) { - if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used - { - $result = $this->insertExtraFields(); - if ($result < 0) - { - $error++; - } - } + $result=$this->insertExtraFields(); + if ($result < 0) $error++; } - elseif ($reshook < 0) $error++; if (!$error && !$notrigger) { @@ -330,29 +318,22 @@ class Reception extends CommonObject $result = $this->call_trigger('RECEPTION_CREATE', $user); if ($result < 0) { $error++; } // End call triggers + } - if (!$error) - { - $this->db->commit(); - return $this->id; - } - else - { - foreach ($this->errors as $errmsg) - { - dol_syslog(get_class($this)."::create ".$errmsg, LOG_ERR); - $this->error .= ($this->error ? ', '.$errmsg : $errmsg); - } - $this->db->rollback(); - return -1 * $error; - } + if (!$error) + { + $this->db->commit(); + return $this->id; } else { - $error++; - $this->error = $this->db->lasterror()." - sql=$sql"; + foreach ($this->errors as $errmsg) + { + dol_syslog(get_class($this)."::create ".$errmsg, LOG_ERR); + $this->error .= ($this->error ? ', '.$errmsg : $errmsg); + } $this->db->rollback(); - return -3; + return -1 * $error; } } else From 72c6ac1c7263dcc73aed38f8da1a71faf386c5ee Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 23 Apr 2020 13:21:39 +0200 Subject: [PATCH 028/115] Complete #13708, normalization of code --- htdocs/adherents/class/adherent.class.php | 15 ++++----- .../adherents/class/adherent_type.class.php | 2 +- htdocs/asset/class/asset_type.class.php | 2 +- htdocs/categories/class/categorie.class.php | 6 ++-- htdocs/comm/action/class/actioncomm.class.php | 15 ++++----- htdocs/comm/propal/card.php | 2 +- htdocs/comm/propal/class/propal.class.php | 30 +++++++----------- htdocs/commande/card.php | 2 +- htdocs/commande/class/commande.class.php | 19 +++++------- htdocs/commande/orderstoinvoice.php | 2 +- htdocs/compta/bank/class/account.class.php | 11 +++---- htdocs/compta/facture/card.php | 4 +-- .../facture/class/facture-rec.class.php | 6 ++-- htdocs/compta/facture/class/facture.class.php | 6 ++-- htdocs/contact/class/contact.class.php | 4 +-- htdocs/contrat/card.php | 2 +- htdocs/contrat/class/contrat.class.php | 31 +++++++++---------- htdocs/core/actions_massactions.inc.php | 2 +- htdocs/core/class/commonobject.class.php | 21 ++++++++----- htdocs/don/class/don.class.php | 4 +-- htdocs/expedition/class/expedition.class.php | 11 ++++--- htdocs/fichinter/class/fichinter.class.php | 10 +++--- .../class/fournisseur.commande.class.php | 6 ++-- .../fournisseur.commande.dispatch.class.php | 2 +- .../fourn/class/fournisseur.facture.class.php | 12 +++---- htdocs/fourn/commande/card.php | 4 +-- htdocs/fourn/facture/card.php | 4 +-- htdocs/product/class/product.class.php | 4 +-- htdocs/product/stock/class/entrepot.class.php | 6 ++-- .../product/stock/class/productlot.class.php | 4 +-- htdocs/projet/class/project.class.php | 4 +-- htdocs/projet/class/task.class.php | 4 +-- htdocs/reception/class/reception.class.php | 2 +- htdocs/resource/class/dolresource.class.php | 4 +-- htdocs/salaries/class/paymentsalary.class.php | 4 +-- htdocs/societe/class/societe.class.php | 4 +-- htdocs/supplier_proposal/card.php | 2 +- .../class/supplier_proposal.class.php | 25 +++++++-------- htdocs/ticket/class/ticket.class.php | 16 ++++------ htdocs/user/class/user.class.php | 4 +-- 40 files changed, 149 insertions(+), 169 deletions(-) diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 4225dad5f31..dd2593329e0 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -657,7 +657,7 @@ class Adherent extends CommonObject $action = 'update'; // Actions on extra fields - if (!$error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used + if (!$error) { $result = $this->insertExtraFields(); if ($result < 0) { @@ -927,14 +927,11 @@ class Adherent extends CommonObject // Removed extrafields if (!$error) { - if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used - { - $result = $this->deleteExtraFields(); - if ($result < 0) { - $error++; - $errorflag = -4; - dol_syslog(get_class($this)."::delete erreur ".$errorflag." ".$this->error, LOG_ERR); - } + $result = $this->deleteExtraFields(); + if ($result < 0) { + $error++; + $errorflag = -4; + dol_syslog(get_class($this)."::delete erreur ".$errorflag." ".$this->error, LOG_ERR); } } diff --git a/htdocs/adherents/class/adherent_type.class.php b/htdocs/adherents/class/adherent_type.class.php index 442d8cf091f..46733575c36 100644 --- a/htdocs/adherents/class/adherent_type.class.php +++ b/htdocs/adherents/class/adherent_type.class.php @@ -409,7 +409,7 @@ class AdherentType extends CommonObject $action = 'update'; // Actions on extra fields - if (!$error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used + if (!$error) { $result = $this->insertExtraFields(); if ($result < 0) diff --git a/htdocs/asset/class/asset_type.class.php b/htdocs/asset/class/asset_type.class.php index edb6fdf90c9..56be39a8ad0 100644 --- a/htdocs/asset/class/asset_type.class.php +++ b/htdocs/asset/class/asset_type.class.php @@ -202,7 +202,7 @@ class AssetType extends CommonObject $action = 'update'; // Actions on extra fields - if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used + if (! $error) { $result = $this->insertExtraFields(); if ($result < 0) diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index 9c0985078e7..dc451855c0a 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -461,7 +461,7 @@ class Categorie extends CommonObject $action = 'create'; // Actions on extra fields - if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used + if (!$error) { $result = $this->insertExtraFields(); if ($result < 0) @@ -553,7 +553,7 @@ class Categorie extends CommonObject $action = 'update'; // Actions on extra fields - if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used + if (!$error) { $result = $this->insertExtraFields(); if ($result < 0) @@ -646,7 +646,7 @@ class Categorie extends CommonObject } // Removed extrafields - if (!$error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used + if (!$error) { $result = $this->deleteExtraFields(); if ($result < 0) diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 8c1e2051a81..0cd1eeb5051 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -567,14 +567,11 @@ class ActionComm extends CommonObject if (!$error) { // Actions on extra fields - if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used - { - $result = $this->insertExtraFields(); - if ($result < 0) - { - $error++; - } - } + $result = $this->insertExtraFields(); + if ($result < 0) + { + $error++; + } } if (!$error && !$notrigger) @@ -1048,7 +1045,7 @@ class ActionComm extends CommonObject $action = 'update'; // Actions on extra fields - if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used + if (!$error) { $result = $this->insertExtraFields(); if ($result < 0) diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 92338ebf68e..85927472c56 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -511,7 +511,7 @@ if (empty($reshook)) } // Extrafields - if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && method_exists($lines[$i], 'fetch_optionals')) { + if (method_exists($lines[$i], 'fetch_optionals')) { $lines[$i]->fetch_optionals(); $array_options = $lines[$i]->array_options; } diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 6a2eac53f95..465bb52033c 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -1253,13 +1253,10 @@ class Propal extends CommonObject // Actions on extra fields if (!$error) { - if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used + $result = $this->insertExtraFields(); + if ($result < 0) { - $result = $this->insertExtraFields(); - if ($result < 0) - { - $error++; - } + $error++; } } @@ -1683,7 +1680,7 @@ class Propal extends CommonObject $error++; $this->errors[] = "Error ".$this->db->lasterror(); } - if (!$error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($this->array_options) && count($this->array_options) > 0) + if (!$error) { $result = $this->insertExtraFields(); if ($result < 0) @@ -3053,15 +3050,12 @@ class Propal extends CommonObject // Removed extrafields if (!$error) { - if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used + $result = $this->deleteExtraFields(); + if ($result < 0) { - $result = $this->deleteExtraFields(); - if ($result < 0) - { - $error++; - $errorflag = -4; - dol_syslog(get_class($this)."::delete erreur ".$errorflag." ".$this->error, LOG_ERR); - } + $error++; + $errorflag = -4; + dol_syslog(get_class($this)."::delete erreur ".$errorflag." ".$this->error, LOG_ERR); } } @@ -4152,7 +4146,7 @@ class PropaleLigne extends CommonObjectLine { $this->rowid = $this->db->last_insert_id(MAIN_DB_PREFIX.'propaldet'); - if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used + if (!$error) { $this->id = $this->rowid; $result = $this->insertExtraFields(); @@ -4204,7 +4198,7 @@ class PropaleLigne extends CommonObjectLine if ($this->db->query($sql)) { // Remove extrafields - if ((!$error) && (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))) // For avoid conflicts if trigger used + if (!$error) { $this->id = $this->rowid; $result = $this->deleteExtraFields(); @@ -4334,7 +4328,7 @@ class PropaleLigne extends CommonObjectLine $resql = $this->db->query($sql); if ($resql) { - if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used + if (!$error) { $this->id = $this->rowid; $result = $this->insertExtraFields(); diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index b43a702c2f2..4aad42ca44f 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -384,7 +384,7 @@ if (empty($reshook)) } // Extrafields - if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && method_exists($lines[$i], 'fetch_optionals')) // For avoid conflicts if trigger used + if (method_exists($lines[$i], 'fetch_optionals')) // For avoid conflicts if trigger used { $lines[$i]->fetch_optionals(); $array_options = $lines[$i]->array_options; diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index c39a5a05a13..9a13ae1abdf 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -3342,7 +3342,7 @@ class Commande extends CommonOrder $error++; $this->errors[] = "Error ".$this->db->lasterror(); } - if (!$error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($this->array_options) && count($this->array_options) > 0) + if (!$error) { $result = $this->insertExtraFields(); if ($result < 0) @@ -3437,14 +3437,11 @@ class Commande extends CommonOrder if (!$error) { // Remove extrafields - if ((!$error) && (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))) // For avoid conflicts if trigger used + $result = $this->deleteExtraFields(); + if ($result < 0) { - $result = $this->deleteExtraFields(); - if ($result < 0) - { - $error++; - dol_syslog(get_class($this)."::delete error -4 ".$this->error, LOG_ERR); - } + $error++; + dol_syslog(get_class($this)."::delete error -4 ".$this->error, LOG_ERR); } } @@ -4255,7 +4252,7 @@ class OrderLine extends CommonOrderLine if ($resql) { // Remove extrafields - if ((!$error) && (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))) // For avoid conflicts if trigger used + if (!$error) { $this->id = $this->rowid; $result = $this->deleteExtraFields(); @@ -4401,7 +4398,7 @@ class OrderLine extends CommonOrderLine $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.'commandedet'); $this->rowid = $this->id; - if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used + if (!$error) { $result = $this->insertExtraFields(); if ($result < 0) @@ -4534,7 +4531,7 @@ class OrderLine extends CommonOrderLine $resql = $this->db->query($sql); if ($resql) { - if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used + if (!$error) { $this->id = $this->rowid; $result = $this->insertExtraFields(); diff --git a/htdocs/commande/orderstoinvoice.php b/htdocs/commande/orderstoinvoice.php index bad5034eac5..f230f7935a5 100644 --- a/htdocs/commande/orderstoinvoice.php +++ b/htdocs/commande/orderstoinvoice.php @@ -285,7 +285,7 @@ if (($action == 'create' || $action == 'add') && !$error) } // Extrafields - if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && method_exists($lines[$i], 'fetch_optionals')) { + if (method_exists($lines[$i], 'fetch_optionals')) { $lines[$i]->fetch_optionals(); $array_options = $lines[$i]->array_options; } diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index ab99173b614..58115537b1f 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -823,13 +823,10 @@ class Account extends CommonObject if ($result) { // Actions on extra fields (by external module or standard code) - if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used + if (!$error) { - if (!$error) - { - $result = $this->insertExtraFields(); - if ($result < 0) $error++; - } + $result = $this->insertExtraFields(); + if ($result < 0) $error++; } if (!$error && !$notrigger) @@ -1107,7 +1104,7 @@ class Account extends CommonObject if ($result) { // Remove extrafields - if ((empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))) // For avoid conflicts if trigger used + if (!$error) { $result = $this->deleteExtraFields(); if ($result < 0) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 4f111c26f39..e5cfb1574dc 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -1146,7 +1146,7 @@ if (empty($reshook)) foreach ($facture_source->lines as $line) { // Extrafields - if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && method_exists($line, 'fetch_optionals')) { + if (method_exists($line, 'fetch_optionals')) { // load extrafields $line->fetch_optionals(); } @@ -1644,7 +1644,7 @@ if (empty($reshook)) } // Extrafields - if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && method_exists($lines[$i], 'fetch_optionals')) { + if (method_exists($lines[$i], 'fetch_optionals')) { $lines[$i]->fetch_optionals(); $array_options = $lines[$i]->array_options; } diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index 205ca88290e..bbb926f7772 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -342,7 +342,7 @@ class FactureRec extends CommonInvoice if ($objectline->fetch($result_insert)) { // Extrafields - if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && method_exists($facsrc->lines[$i], 'fetch_optionals')) { + if (method_exists($facsrc->lines[$i], 'fetch_optionals')) { $facsrc->lines[$i]->fetch_optionals($facsrc->lines[$i]->rowid); $objectline->array_options = $facsrc->lines[$i]->array_options; } @@ -438,7 +438,7 @@ class FactureRec extends CommonInvoice $resql = $this->db->query($sql); if ($resql) { - if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used + if (!$error) { $result = $this->insertExtraFields(); if ($result < 0) @@ -2112,7 +2112,7 @@ class FactureLigneRec extends CommonInvoiceLine $resql = $this->db->query($sql); if ($resql) { - if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used + if (!$error) { $result = $this->insertExtraFields(); if ($result < 0) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index b6f9c4d7969..b6f41149331 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -1881,7 +1881,7 @@ class Facture extends CommonInvoice $error++; $this->errors[] = "Error ".$this->db->lasterror(); } - if (!$error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($this->array_options) && count($this->array_options) > 0) + if (!$error) { $result = $this->insertExtraFields(); if ($result < 0) @@ -5237,7 +5237,7 @@ class FactureLigne extends CommonInvoiceLine $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.'facturedet'); $this->rowid = $this->id; // For backward compatibility - if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used + if (!$error) { $result = $this->insertExtraFields(); if ($result < 0) @@ -5423,7 +5423,7 @@ class FactureLigne extends CommonInvoiceLine $resql = $this->db->query($sql); if ($resql) { - if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used + if (!$error) { $this->id = $this->rowid; $result = $this->insertExtraFields(); diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index 7f52195297b..a3cdb1747a0 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -489,7 +489,7 @@ class Contact extends CommonObject $action = 'update'; // Actions on extra fields - if (!$error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) + if (!$error) { $result = $this->insertExtraFields(); if ($result < 0) @@ -1168,7 +1168,7 @@ class Contact extends CommonObject } // Removed extrafields - if ((!$error) && (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))) { + if (!$error) { // For avoid conflicts if trigger used $result = $this->deleteExtraFields(); if ($result < 0) $error++; diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index 9d240a31a79..322d309b15b 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -316,7 +316,7 @@ if (empty($reshook)) // Extrafields $array_options = array(); // For avoid conflicts if trigger used - if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && method_exists($lines[$i], 'fetch_optionals')) { + if (method_exists($lines[$i], 'fetch_optionals')) { $lines[$i]->fetch_optionals(); $array_options = $lines[$i]->array_options; } diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 310aed1cd52..5bf9f1f11c1 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -1035,7 +1035,7 @@ class Contrat extends CommonObject } } - if (!$error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) + if (!$error) { $result = $this->insertExtraFields(); if ($result < 0) @@ -1383,7 +1383,7 @@ class Contrat extends CommonObject $resql = $this->db->query($sql); if (!$resql) { $error++; $this->errors[] = "Error ".$this->db->lasterror(); } - if (!$error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($this->array_options) && count($this->array_options) > 0) + if (!$error) { $result = $this->insertExtraFields(); if ($result < 0) @@ -1588,7 +1588,7 @@ class Contrat extends CommonObject { $contractlineid = $this->db->last_insert_id(MAIN_DB_PREFIX."contratdet"); - if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($array_options) && count($array_options) > 0) // For avoid conflicts if trigger used + if (!$error) { $contractline = new ContratLigne($this->db); $contractline->array_options = $array_options; @@ -1777,7 +1777,7 @@ class Contrat extends CommonObject $result = $this->update_statut($user); if ($result >= 0) { - if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($array_options) && count($array_options) > 0) // For avoid conflicts if trigger used + if (is_array($array_options) && count($array_options) > 0) // For avoid conflicts if trigger used { $contractline = new ContratLigne($this->db); $contractline->fetch($rowid); @@ -1859,18 +1859,15 @@ class Contrat extends CommonObject $error++; } - if (empty($error)) { + if (!$error) { // Remove extrafields - if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used + $contractline = new ContratLigne($this->db); + $contractline->id = $idline; + $result = $contractline->deleteExtraFields(); + if ($result < 0) { - $contractline = new ContratLigne($this->db); - $contractline->id = $idline; - $result = $contractline->deleteExtraFields(); - if ($result < 0) - { - $error++; - $this->error = "Error ".get_class($this)."::deleteline deleteExtraFields error -4 ".$contractline->error; - } + $error++; + $this->error = "Error ".get_class($this)."::deleteline deleteExtraFields error -4 ".$contractline->error; } } @@ -3092,7 +3089,7 @@ class ContratLigne extends CommonObjectLine $error++; } - if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($this->array_options) && count($this->array_options) > 0) // For avoid conflicts if trigger used + if (!$error) // For avoid conflicts if trigger used { $result = $this->insertExtraFields(); if ($result < 0) @@ -3202,6 +3199,8 @@ class ContratLigne extends CommonObjectLine { global $conf, $user; + $error = 0; + // Insertion dans la base $sql = "INSERT INTO ".MAIN_DB_PREFIX."contratdet"; $sql .= " (fk_contrat, label, description, fk_product, qty, vat_src_code, tva_tx,"; @@ -3240,7 +3239,7 @@ class ContratLigne extends CommonObjectLine $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.'contratdet'); // Insert of extrafields - if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($this->array_options) && count($this->array_options) > 0) // For avoid conflicts if trigger used + if (!$error) { $result = $this->insertExtraFields(); if ($result < 0) diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index e8cfa803573..ebae28e9582 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -751,7 +751,7 @@ if ($massaction == 'confirm_createbills') // Create bills from orders } // Extrafields - if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && method_exists($lines[$i], 'fetch_optionals')) { + if (method_exists($lines[$i], 'fetch_optionals')) { $lines[$i]->fetch_optionals(); $array_options = $lines[$i]->array_options; } diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 20dbdf18fd3..3d8871dc07a 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -5351,9 +5351,14 @@ abstract class CommonObject * Delete all extra fields values for the current object. * * @return int <0 if KO, >0 if OK + * @see deleteExtraLanguages(), insertExtraField(), updateExtraField(), setValueFrom() */ public function deleteExtraFields() { + global $conf; + + if (!empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) return 0; + $this->db->begin(); $table_element = $this->table_element; @@ -5383,18 +5388,18 @@ abstract class CommonObject * @param string $trigger If defined, call also the trigger (for example COMPANY_MODIFY) * @param User $userused Object user * @return int -1=error, O=did nothing, 1=OK - * @see insertExtraLanguages(), updateExtraField(), setValueFrom() + * @see insertExtraLanguages(), updateExtraField(), deleteExtraField(), setValueFrom() */ public function insertExtraFields($trigger = '', $userused = null) { global $conf, $langs, $user; + if (!empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) return 0; + if (empty($userused)) $userused = $user; $error = 0; - if (!empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) return 0; // For avoid conflicts if trigger used - if (!empty($this->array_options)) { // Check parameters @@ -5792,18 +5797,18 @@ abstract class CommonObject * @param string $trigger If defined, call also the trigger (for example COMPANY_MODIFY) * @param User $userused Object user * @return int -1=error, O=did nothing, 1=OK - * @see updateExtraLanguages(), setValueFrom(), insertExtraFields() + * @see updateExtraLanguages(), insertExtraFields(), deleteExtraFields(), setValueFrom() */ public function updateExtraField($key, $trigger = null, $userused = null) { global $conf, $langs, $user; + if (!empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) return 0; + if (empty($userused)) $userused = $user; $error = 0; - if (!empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) return 0; // For avoid conflicts if trigger used - if (!empty($this->array_options) && isset($this->array_options["options_".$key])) { // Check parameters @@ -8174,7 +8179,7 @@ abstract class CommonObject } // Update extrafield - if (!$error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($this->array_options) && count($this->array_options) > 0) + if (!$error) { $result = $this->insertExtraFields(); if ($result < 0) @@ -8335,7 +8340,7 @@ abstract class CommonObject if (empty($error)) { // Remove extrafields - if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used + if (!$error) { $tmpobjectline = new $tmpforobjectlineclass($this->db); $tmpobjectline->id = $idline; diff --git a/htdocs/don/class/don.class.php b/htdocs/don/class/don.class.php index 8260656e4d0..102d7e58685 100644 --- a/htdocs/don/class/don.class.php +++ b/htdocs/don/class/don.class.php @@ -432,7 +432,7 @@ class Don extends CommonObject // Update extrafield if (!$error) { - if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used + if (!$error) { $result = $this->insertExtraFields(); if ($result < 0) @@ -519,7 +519,7 @@ class Don extends CommonObject // Update extrafield if (!$error) { - if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used + if (!$error) { $result = $this->insertExtraFields(); if ($result < 0) diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 624add5c075..e1c24106e09 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -380,7 +380,7 @@ class Expedition extends CommonObject } // Actions on extra fields - if (!$error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) + if (!$error) { $result = $this->insertExtraFields(); if ($result < 0) @@ -1046,7 +1046,8 @@ class Expedition extends CommonObject } } $line->entrepot_id = $linebatch->entrepot_id; - $line->origin_line_id = $dbatch['ix_l']; + $line->origin_line_id = $dbatch['ix_l']; // deprecated + $line->fk_origin_line = $dbatch['ix_l']; $line->qty = $dbatch['qty']; $line->detail_batch = $tab; @@ -2617,7 +2618,7 @@ class ExpeditionLigne extends CommonObjectLine { $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."expeditiondet"); - if (!$error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) + if (!$error) { $result = $this->insertExtraFields(); if ($result < 0) @@ -2691,7 +2692,7 @@ class ExpeditionLigne extends CommonObjectLine if (!$error && $this->db->query($sql)) { // Remove extrafields - if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used + if (!$error) { $result = $this->deleteExtraFields(); if ($result < 0) @@ -2895,7 +2896,7 @@ class ExpeditionLigne extends CommonObjectLine if (!$error) { - if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used + if (!$error) { $result = $this->insertExtraFields(); if ($result < 0) diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index f8a62da7ba6..502eb5ccb69 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -305,7 +305,7 @@ class Fichinter extends CommonObject if (!$resql) $error++; } - if (!$error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) + if (!$error) { $result = $this->insertExtraFields(); if ($result < 0) @@ -385,7 +385,7 @@ class Fichinter extends CommonObject dol_syslog(get_class($this)."::update", LOG_DEBUG); if ($this->db->query($sql)) { - if (!$error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used + if (!$error) { $result = $this->insertExtraFields(); if ($result < 0) @@ -1001,7 +1001,7 @@ class Fichinter extends CommonObject if (!$resql) $error++; } - if ((!$error) && (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))) // For avoid conflicts if trigger used + if (!$error) { // Remove extrafields $res = $this->deleteExtraFields(); @@ -1552,7 +1552,7 @@ class FichinterLigne extends CommonObjectLine $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.'fichinterdet'); $this->rowid = $this->id; - if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used + if (!$error) { $result = $this->insertExtraFields(); if ($result < 0) @@ -1623,7 +1623,7 @@ class FichinterLigne extends CommonObjectLine $resql = $this->db->query($sql); if ($resql) { - if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used + if (!$error) { $result = $this->insertExtraFields(); if ($result < 0) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index e5505cbaa9f..c95e403a24c 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -2063,7 +2063,7 @@ class CommandeFournisseur extends CommonOrder } // Remove extrafields - if ((!$error) && (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))) // For avoid conflicts if trigger used + if (!$error) { $result = $this->deleteExtraFields(); if ($result < 0) @@ -3626,7 +3626,7 @@ class CommandeFournisseurLigne extends CommonOrderLine $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.$this->table_element); $this->rowid = $this->id; - if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used + if (!$error) { $result = $this->insertExtraFields(); if ($result < 0) @@ -3716,7 +3716,7 @@ class CommandeFournisseurLigne extends CommonOrderLine $result = $this->db->query($sql); if ($result > 0) { - if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used + if (!$error) { $result = $this->insertExtraFields(); if ($result < 0) diff --git a/htdocs/fourn/class/fournisseur.commande.dispatch.class.php b/htdocs/fourn/class/fournisseur.commande.dispatch.class.php index d7b8807bb28..041958448fa 100644 --- a/htdocs/fourn/class/fournisseur.commande.dispatch.class.php +++ b/htdocs/fourn/class/fournisseur.commande.dispatch.class.php @@ -362,7 +362,7 @@ class CommandeFournisseurDispatch extends CommonObject if (!$error) { - if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used + if (!$error) { if (empty($this->id) && !empty($this->rowid))$this->id = $this->rowid; $result = $this->insertExtraFields(); diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index f2f1bac9257..8bbee47a2cd 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -558,7 +558,7 @@ class FactureFournisseur extends CommonInvoice if ($result > 0) { // Actions on extra fields - if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used + if (!$error) { $result = $this->insertExtraFields(); // This also set $this->error or $this->errors if errors are found if ($result < 0) @@ -977,7 +977,7 @@ class FactureFournisseur extends CommonInvoice } } - if (! $error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($this->array_options) && count($this->array_options)>0) + if (! $error) { $result=$this->insertExtraFields(); if ($result < 0) @@ -1243,7 +1243,7 @@ class FactureFournisseur extends CommonInvoice } // Remove extrafields - if ((!$error) && (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))) // For avoid conflicts if trigger used + if (!$error) { $result = $this->deleteExtraFields(); if ($result < 0) @@ -3145,7 +3145,7 @@ class SupplierInvoiceLine extends CommonObjectLine $this->deleteObjectLinked(); // Remove extrafields - if ((! $error) && (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))) // For avoid conflicts if trigger used + if (! $error) { $result=$this->deleteExtraFields(); if ($result < 0) @@ -3265,7 +3265,7 @@ class SupplierInvoiceLine extends CommonObjectLine $this->rowid = $this->id; $error = 0; - if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used + if (!$error) { $result = $this->insertExtraFields(); if ($result < 0) @@ -3406,7 +3406,7 @@ class SupplierInvoiceLine extends CommonObjectLine $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.$this->table_element); $this->rowid = $this->id; // backward compatibility - if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used + if (!$error) { $result = $this->insertExtraFields(); if ($result < 0) diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index bc86076644c..f2ab694e352 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -1064,7 +1064,7 @@ if (empty($reshook)) if (!$error) { // Actions on extra fields - if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used + if (!$error) { $result = $object->insertExtraFields('ORDER_SUPPLIER_MODIFY'); if ($result < 0) @@ -1190,7 +1190,7 @@ if (empty($reshook)) } // Extrafields - if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && method_exists($lines[$i], 'fetch_optionals')) // For avoid conflicts if + if (method_exists($lines[$i], 'fetch_optionals')) // For avoid conflicts if { $lines[$i]->fetch_optionals(); $array_option = $lines[$i]->array_options; diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 697c8cb74f0..0b63356480c 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -951,7 +951,7 @@ if (empty($reshook)) $product_type = ($lines[$i]->product_type ? $lines[$i]->product_type : 0); // Extrafields - if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && method_exists($lines[$i], 'fetch_optionals')) { + if (method_exists($lines[$i], 'fetch_optionals')) { $lines[$i]->fetch_optionals(); } @@ -1597,7 +1597,7 @@ if (empty($reshook)) if (!$error) { // Actions on extra fields - if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used + if (!$error) { $result = $object->insertExtraFields('BILL_SUPPLIER_MODIFY'); if ($result < 0) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index c37dbaeb3f7..4f4334e4125 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -1052,7 +1052,7 @@ class Product extends CommonObject $action = 'update'; // Actions on extra fields - if (!$error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) { + if (!$error) { $result = $this->insertExtraFields(); if ($result < 0) { $error++; @@ -1265,7 +1265,7 @@ class Product extends CommonObject } // Remove extrafields - if ((!$error) && (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))) // For avoid conflicts if trigger used + if (!$error) { $result = $this->deleteExtraFields(); if ($result < 0) { diff --git a/htdocs/product/stock/class/entrepot.class.php b/htdocs/product/stock/class/entrepot.class.php index 3dd22c9e5c3..db2f84db15a 100644 --- a/htdocs/product/stock/class/entrepot.class.php +++ b/htdocs/product/stock/class/entrepot.class.php @@ -221,7 +221,7 @@ class Entrepot extends CommonObject // Actions on extra fields if (!$error) { - if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used + if (!$error) { $result = $this->insertExtraFields(); if ($result < 0) @@ -319,7 +319,7 @@ class Entrepot extends CommonObject $this->errors[] = "Error ".$this->db->lasterror(); } - if (!$error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($this->array_options) && count($this->array_options) > 0) { + if (!$error) { $result = $this->insertExtraFields(); if ($result < 0) { @@ -383,7 +383,7 @@ class Entrepot extends CommonObject // Removed extrafields if (!$error) { - if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used + if (!$error) { $result = $this->deleteExtraFields(); if ($result < 0) diff --git a/htdocs/product/stock/class/productlot.class.php b/htdocs/product/stock/class/productlot.class.php index 6db4e81db79..f0a5c0a48ea 100644 --- a/htdocs/product/stock/class/productlot.class.php +++ b/htdocs/product/stock/class/productlot.class.php @@ -185,7 +185,7 @@ class Productlot extends CommonObject $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.$this->table_element); // Actions on extra fields - if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used + if (!$error) { $result = $this->insertExtraFields(); if ($result < 0) @@ -359,7 +359,7 @@ class Productlot extends CommonObject } // Actions on extra fields - if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used + if (!$error) { $result = $this->insertExtraFields(); if ($result < 0) diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index 0e793361d2b..674db2cc5d6 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -316,7 +316,7 @@ class Project extends CommonObject // Update extrafield if (!$error) { - if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used + if (!$error) { $result = $this->insertExtraFields(); if ($result < 0) @@ -405,7 +405,7 @@ class Project extends CommonObject // Update extrafield if (!$error) { - if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used + if (!$error) { $result = $this->insertExtraFields(); if ($result < 0) diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index f3f75b716c1..41f6a76afb2 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -205,7 +205,7 @@ class Task extends CommonObject // Update extrafield if (!$error) { - if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used + if (!$error) { $result = $this->insertExtraFields(); if ($result < 0) @@ -384,7 +384,7 @@ class Task extends CommonObject // Update extrafield if (!$error) { - if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used + if (!$error) { $result = $this->insertExtraFields(); if ($result < 0) diff --git a/htdocs/reception/class/reception.class.php b/htdocs/reception/class/reception.class.php index b09a5918def..2bb34859a6b 100644 --- a/htdocs/reception/class/reception.class.php +++ b/htdocs/reception/class/reception.class.php @@ -750,7 +750,7 @@ class Reception extends CommonObject } // extrafields - if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($array_options) && count($array_options) > 0) // For avoid conflicts if trigger used + if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($array_options) && count($array_options) > 0) $line->array_options = $array_options; $line->fk_product = $fk_product; diff --git a/htdocs/resource/class/dolresource.class.php b/htdocs/resource/class/dolresource.class.php index 75c6e50dec3..4cda97b39d1 100644 --- a/htdocs/resource/class/dolresource.class.php +++ b/htdocs/resource/class/dolresource.class.php @@ -136,7 +136,7 @@ class Dolresource extends CommonObject $action = 'create'; // Actions on extra fields - if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used + if (!$error) { $result = $this->insertExtraFields(); if ($result < 0) @@ -309,7 +309,7 @@ class Dolresource extends CommonObject $action = 'update'; // Actions on extra fields - if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used + if (!$error) { $result = $this->insertExtraFields(); if ($result < 0) diff --git a/htdocs/salaries/class/paymentsalary.class.php b/htdocs/salaries/class/paymentsalary.class.php index 44c25b09a13..82cdf3c80ce 100644 --- a/htdocs/salaries/class/paymentsalary.class.php +++ b/htdocs/salaries/class/paymentsalary.class.php @@ -160,7 +160,7 @@ class PaymentSalary extends CommonObject // Update extrafield if (!$error) { - if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used + if (!$error) { $result = $this->insertExtraFields(); if ($result < 0) @@ -449,7 +449,7 @@ class PaymentSalary extends CommonObject // Update extrafield if (!$error) { - if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used + if (!$error) { $result = $this->insertExtraFields(); if ($result < 0) diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index ea175c13c6a..c35b17fe4fa 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -1393,7 +1393,7 @@ class Societe extends CommonObject $action = 'update'; // Actions on extra fields - if (!$error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used + if (!$error) { $result = $this->insertExtraFields(); if ($result < 0) @@ -1771,7 +1771,7 @@ class Societe extends CommonObject } // Removed extrafields - if ((!$error) && (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))) // For avoid conflicts if trigger used + if (!$error) { $result = $this->deleteExtraFields(); if ($result < 0) diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php index 5910f77a819..ee9f5a1d072 100644 --- a/htdocs/supplier_proposal/card.php +++ b/htdocs/supplier_proposal/card.php @@ -353,7 +353,7 @@ if (empty($reshook)) } // Extrafields - if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && method_exists($lines[$i], 'fetch_optionals')) { + if (method_exists($lines[$i], 'fetch_optionals')) { $lines[$i]->fetch_optionals(); $array_options = $lines[$i]->array_options; } diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index 3e69fbc167f..52bb42c4526 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -1063,7 +1063,7 @@ class SupplierProposal extends CommonObject $action = 'update'; // Actions on extra fields - if (!$error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) + if (!$error) { $result = $this->insertExtraFields(); if ($result < 0) @@ -2116,16 +2116,13 @@ class SupplierProposal extends CommonObject // Removed extrafields if (!$error) { - if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used - { - $result = $this->deleteExtraFields(); - if ($result < 0) - { - $error++; - $errorflag = -4; - dol_syslog(get_class($this)."::delete erreur ".$errorflag." ".$this->error, LOG_ERR); - } - } + $result = $this->deleteExtraFields(); + if ($result < 0) + { + $error++; + $errorflag = -4; + dol_syslog(get_class($this)."::delete erreur ".$errorflag." ".$this->error, LOG_ERR); + } } if (!$error) @@ -3106,7 +3103,7 @@ class SupplierProposalLine extends CommonObjectLine { $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX.'supplier_proposaldet'); - if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used + if (!$error) { $result = $this->insertExtraFields(); if ($result < 0) @@ -3155,7 +3152,7 @@ class SupplierProposalLine extends CommonObjectLine if ($this->db->query($sql)) { // Remove extrafields - if ((!$error) && (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))) // For avoid conflicts if trigger used + if (!$error) { $result = $this->deleteExtraFields(); if ($result < 0) @@ -3277,7 +3274,7 @@ class SupplierProposalLine extends CommonObjectLine $resql = $this->db->query($sql); if ($resql) { - if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used + if (!$error) { $result = $this->insertExtraFields(); if ($result < 0) diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index 863c0c03072..172309a233e 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -408,11 +408,9 @@ class Ticket extends CommonObject //Update extrafield if (!$error) { - if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) { // For avoid conflicts if trigger used - $result = $this->insertExtraFields(); - if ($result < 0) { - $error++; - } + $result = $this->insertExtraFields(); + if ($result < 0) { + $error++; } } @@ -838,11 +836,9 @@ class Ticket extends CommonObject if (!$error) { // Update extrafields - if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) { // For avoid conflicts if trigger used - $result = $this->insertExtraFields(); - if ($result < 0) { - $error++; - } + $result = $this->insertExtraFields(); + if ($result < 0) { + $error++; } } diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index f944083f6c5..24bf871af1f 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -1094,7 +1094,7 @@ class User extends CommonObject } // Remove extrafields - if ((!$error) && (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))) // For avoid conflicts if trigger used + if (!$error) { $result = $this->deleteExtraFields(); if ($result < 0) @@ -1762,7 +1762,7 @@ class User extends CommonObject $action = 'update'; // Actions on extra fields - if (!$error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) + if (!$error) { $result = $this->insertExtraFields(); if ($result < 0) From 86928efb950e88fc55fd2222435eb5bc7bb68c26 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 23 Apr 2020 13:35:40 +0200 Subject: [PATCH 029/115] Var not defined --- htdocs/core/class/html.formfile.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index d4e6620c0da..075fb95066b 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -971,6 +971,7 @@ class FormFile // Get object entity if (!empty($conf->multicompany->enabled)) { + $regs = array(); preg_match('/\/([0-9]+)\/[^\/]+\/'.preg_quote($modulesubdir, '/').'$/', $filedir, $regs); $entity = ((!empty($regs[1]) && $regs[1] > 1) ? $regs[1] : 1); // If entity id not found in $filedir this is entity 1 by default } From 3a9add0e7078508ffd79369a659449bfa918edb2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 23 Apr 2020 13:37:43 +0200 Subject: [PATCH 030/115] FIX #13663 --- htdocs/compta/facture/class/facture.class.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index c2c82424b77..f9285eb2d9c 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -1434,9 +1434,10 @@ class Facture extends CommonInvoice $txttoshow = ($user->socid > 0 ? $this->note_public : $this->note_private); if ($txttoshow) { - $notetoshow = $langs->trans("ViewPrivateNote").':
'.dol_string_nohtmltag($txttoshow, 1); + //$notetoshow = $langs->trans("ViewPrivateNote").':
'.dol_string_nohtmltag($txttoshow, 1); + $notetoshow = $langs->trans("ViewPrivateNote").':
'.$txttoshow; $result .= ' '; - $result .= ''; + $result .= ''; $result .= img_picto('', 'note'); $result .= ''; //$result.=img_picto($langs->trans("ViewNote"),'object_generic'); From 436362502c3be8740d03ffe561e8a2954fdcd818 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 23 Apr 2020 13:41:51 +0200 Subject: [PATCH 031/115] CSS --- htdocs/loan/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/loan/card.php b/htdocs/loan/card.php index 9e7b8f2565a..3e96a33c931 100644 --- a/htdocs/loan/card.php +++ b/htdocs/loan/card.php @@ -475,7 +475,7 @@ if ($id > 0) print '
'; print '
'; - print ''; + print '
'; // Capital if ($action == 'edit') From 7972174787ef17a98f86403ce1b517ad4ac638ba Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Thu, 23 Apr 2020 13:44:23 +0200 Subject: [PATCH 032/115] remove debug pring --- .../modules/project/task/doc/doc_generic_task_odt.modules.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php b/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php index 386de7bfdd7..cae24a1ce7e 100644 --- a/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php +++ b/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php @@ -474,7 +474,6 @@ class doc_generic_task_odt extends ModelePDFTask if (!file_exists($dir)) { - print '$dir'.$dir; if (dol_mkdir($dir) < 0) { $this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir); From 6819255b764a2a004ee10770dde354893c9b9f37 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 23 Apr 2020 13:49:18 +0200 Subject: [PATCH 033/115] FIX #13650 --- htdocs/core/modules/modFournisseur.class.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/htdocs/core/modules/modFournisseur.class.php b/htdocs/core/modules/modFournisseur.class.php index 4b7c8ff3ed2..b8539ad41c1 100644 --- a/htdocs/core/modules/modFournisseur.class.php +++ b/htdocs/core/modules/modFournisseur.class.php @@ -346,7 +346,10 @@ class modFournisseur extends DolibarrModules case 'sellist': $tmp=''; $tmpparam=unserialize($obj->param); // $tmp ay be array 'options' => array 'c_currencies:code_iso:code_iso' => null - if ($tmpparam['options'] && is_array($tmpparam['options'])) $tmp=array_shift(array_keys($tmpparam['options'])); + if ($tmpparam['options'] && is_array($tmpparam['options'])) { + $var=array_keys($tmpparam['options']); + $tmp=array_shift($var); + } if (preg_match('/[a-z0-9_]+:[a-z0-9_]+:[a-z0-9_]+/', $tmp)) $typeFilter="List:".$tmp; break; } From defef24c3c39296e1f99bcece7c2a9fc8c6e0b92 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 23 Apr 2020 13:57:27 +0200 Subject: [PATCH 034/115] Fix regression --- htdocs/product/stock/class/entrepot.class.php | 8 ++++---- test/phpunit/EntrepotTest.php | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/product/stock/class/entrepot.class.php b/htdocs/product/stock/class/entrepot.class.php index db2f84db15a..5f98de4993b 100644 --- a/htdocs/product/stock/class/entrepot.class.php +++ b/htdocs/product/stock/class/entrepot.class.php @@ -184,10 +184,10 @@ class Entrepot extends CommonObject $error = 0; - $this->libelle = trim($this->libelle); + if (empty($this->label)) $this->label = $this->libelle; // For backward compatibility - // Si libelle non defini, erreur - if ($this->libelle == '') + $this->label = trim($this->label); + if ($this->label == '') { $this->error = "ErrorFieldRequired"; return 0; @@ -198,7 +198,7 @@ class Entrepot extends CommonObject $this->db->begin(); $sql = "INSERT INTO ".MAIN_DB_PREFIX."entrepot (ref, entity, datec, fk_user_author, fk_parent)"; - $sql .= " VALUES ('".$this->db->escape($this->libelle)."', ".$conf->entity.", '".$this->db->idate($now)."', ".$user->id.", ".($this->fk_parent > 0 ? $this->fk_parent : "NULL").")"; + $sql .= " VALUES ('".$this->db->escape($this->label)."', ".$conf->entity.", '".$this->db->idate($now)."', ".$user->id.", ".($this->fk_parent > 0 ? $this->fk_parent : "NULL").")"; dol_syslog(get_class($this)."::create", LOG_DEBUG); $result = $this->db->query($sql); diff --git a/test/phpunit/EntrepotTest.php b/test/phpunit/EntrepotTest.php index f5468d49c4b..45845cc8033 100644 --- a/test/phpunit/EntrepotTest.php +++ b/test/phpunit/EntrepotTest.php @@ -139,7 +139,7 @@ class EntrepotTest extends PHPUnit\Framework\TestCase $result=$localobject->create($user); print __METHOD__." result=".$result."\n"; - $this->assertLessThanOrEqual($result, 0); + $this->assertGreaterThan(0, $result); return $result; } From 098b7828faa7055a0143163aa808a6fbaf1e5960 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 23 Apr 2020 13:59:40 +0200 Subject: [PATCH 035/115] Removed useless test --- test/phpunit/EntrepotTest.php | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/test/phpunit/EntrepotTest.php b/test/phpunit/EntrepotTest.php index 45845cc8033..2ab2fc2aff3 100644 --- a/test/phpunit/EntrepotTest.php +++ b/test/phpunit/EntrepotTest.php @@ -242,24 +242,4 @@ class EntrepotTest extends PHPUnit\Framework\TestCase return $result; } - - /** - * testEntrepotStatic - * - * @return void - */ - public function testEntrepotStatic() - { - global $conf,$user,$langs,$db; - $conf=$this->savconf; - $user=$this->savuser; - $langs=$this->savlangs; - $db=$this->savdb; - - $localobject=new Entrepot($db); - - //$this->assertLessThan(1, 0); - - return; - } } From 882b39628f81710491c61258b9993bac76adca75 Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Thu, 23 Apr 2020 15:50:42 +0200 Subject: [PATCH 036/115] fix: uniformize extrafeild replacemnt for ODT docs --- .../core/class/commondocgenerator.class.php | 88 +++++++------------ .../task/doc/doc_generic_task_odt.modules.php | 25 ++++-- 2 files changed, 46 insertions(+), 67 deletions(-) diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index a5cb9bf7d35..2317636f42a 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -170,12 +170,13 @@ abstract class CommonDocGenerator * * @param Societe $object Object * @param Translate $outputlangs Language object for output + * @param string $array_key Name of the key for return array * @return array Array of substitution key->code */ - public function get_substitutionarray_thirdparty($object, $outputlangs) + public function get_substitutionarray_thirdparty($object, $outputlangs, $array_key = 'company') { // phpcs:enable - global $conf; + global $conf, $extrafields; if (empty($object->country) && !empty($object->country_code)) { @@ -221,27 +222,14 @@ abstract class CommonDocGenerator 'company_default_bank_bic'=>$object->bank_account->bic ); - // Retrieve extrafields - if (is_array($object->array_options) && count($object->array_options)) - { - require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; - $extrafields = new ExtraFields($this->db); - $extrafields->fetch_name_optionals_label($object->table_element, true); - $object->fetch_optionals(); + // Retrieve extrafields + if (is_array($object->array_options) && count($object->array_options)) + { + $object->fetch_optionals(); - foreach ($extrafields->attributes[$object->table_element]['label'] as $key=>$label) - { - if ($extrafields->attributes[$object->table_element]['type'][$key] == 'price') - { - $object->array_options['options_'.$key] = price($object->array_options['options_'.$key], 0, $outputlangs, 0, 0, -1, $conf->currency); - } - elseif ($extrafields->attributes[$object->table_element]['type'][$key] == 'select' || $extrafields->attributes[$object->table_element]['type'][$key] == 'checkbox') - { - $object->array_options['options_'.$key] = $extrafields->attributes[$object->table_element]['param'][$key]['options'][$object->array_options['options_'.$key]]; - } - $array_thirdparty = array_merge($array_thirdparty, array('company_options_'.$key => $object->array_options ['options_'.$key])); - } - } + $array_thirdparty = $this->fill_substitutionarray_with_extrafields($object, $array_thirdparty, $extrafields, $array_key, $outputlangs); + + } return $array_thirdparty; } @@ -251,13 +239,13 @@ abstract class CommonDocGenerator * * @param Contact $object contact * @param Translate $outputlangs object for output - * @param array $array_key Name of the key for return array + * @param string $array_key Name of the key for return array * @return array Array of substitution key->code */ public function get_substitutionarray_contact($object, $outputlangs, $array_key = 'object') { // phpcs:enable - global $conf; + global $conf, $extrafields; if (empty($object->country) && !empty($object->country_code)) { @@ -298,24 +286,14 @@ abstract class CommonDocGenerator $array_key.'_civility' => $object->civility, ); - // Retrieve extrafields - require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; - $extrafields = new ExtraFields($this->db); - $extrafields->fetch_name_optionals_label($object->table_element, true); - $object->fetch_optionals(); + // Retrieve extrafields + if (is_array($object->array_options) && count($object->array_options)) + { + $object->fetch_optionals(); - foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $label) - { - if ($extrafields->attributes[$object->table_element]['type'][$key] == 'price') - { - $object->array_options['options_'.$key] = price($object->array_options ['options_'.$key], 0, $outputlangs, 0, 0, - 1, $conf->currency); - } - elseif ($extrafields->attributes[$object->table_element]['type'][$key] == 'select' || $extrafields->attributes[$object->table_element]['type'][$key] == 'checkbox') - { - $object->array_options['options_'.$key] = $extrafields->attributes[$object->table_element]['param'][$key]['options'][$object->array_options['options_'.$key]]; - } - $array_contact = array_merge($array_contact, array($array_key.'_options_'.$key => $object->array_options['options_'.$key])); - } + $array_contact = $this->fill_substitutionarray_with_extrafields($object, $array_contact, $extrafields, $array_key, $outputlangs); + + } return $array_contact; } @@ -370,7 +348,7 @@ abstract class CommonDocGenerator public function get_substitutionarray_object($object, $outputlangs, $array_key = 'object') { // phpcs:enable - global $conf; + global $conf, $extrafields; $sumpayed = $sumdeposit = $sumcreditnote = ''; $already_payed_all = 0; @@ -528,14 +506,10 @@ abstract class CommonDocGenerator // Retrieve extrafields if (is_array($object->array_options) && count($object->array_options)) { - $extrafieldkey = $object->element; - - require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; - $extrafields = new ExtraFields($this->db); - $extrafields->fetch_name_optionals_label($extrafieldkey, true); $object->fetch_optionals(); $resarray = $this->fill_substitutionarray_with_extrafields($object, $resarray, $extrafields, $array_key, $outputlangs); + } return $resarray; @@ -605,7 +579,7 @@ abstract class CommonDocGenerator } // Retrieve extrafields - $extrafieldkey = $line->element; + $extrafieldkey = $line->table_element; $array_key = "line"; require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; $extrafields = new ExtraFields($this->db); @@ -672,7 +646,7 @@ abstract class CommonDocGenerator public function get_substitutionarray_shipment($object, $outputlangs, $array_key = 'object') { // phpcs:enable - global $conf; + global $conf, $extrafields; dol_include_once('/core/lib/product.lib.php'); $object->list_delivery_methods($object->shipping_method_id); $calculatedVolume = ($object->trueWidth * $object->trueHeight * $object->trueDepth); @@ -708,16 +682,14 @@ abstract class CommonDocGenerator $array_shipment[$array_key.'_total_vat_'.$line->tva_tx] += $line->total_tva; } - // Retrieve extrafields - if (is_array($object->array_options) && count($object->array_options)) - { - require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; - $extrafields = new ExtraFields($this->db); - $extrafields->fetch_name_optionals_label('expedition', true); - $object->fetch_optionals(); + // Retrieve extrafields + if (is_array($object->array_options) && count($object->array_options)) + { + $object->fetch_optionals(); - $array_shipment = $this->fill_substitutionarray_with_extrafields($object, $array_shipment, $extrafields, $array_key, $outputlangs); - } + $array_shipment = $this->fill_substitutionarray_with_extrafields($object, $array_shipment, $extrafields, $array_key, $outputlangs); + + } return $array_shipment; } diff --git a/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php b/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php index 8a38450697f..1aa8f05d9df 100644 --- a/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php +++ b/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php @@ -130,7 +130,7 @@ class doc_generic_task_odt extends ModelePDFTask public function get_substitutionarray_object($object, $outputlangs, $array_key = 'object') { // phpcs:enable - global $conf; + global $conf, $extrafields; $resarray = array( $array_key.'_id'=>$object->id, @@ -150,14 +150,10 @@ class doc_generic_task_odt extends ModelePDFTask // Retrieve extrafields if (is_array($object->array_options) && count($object->array_options)) { - $extrafieldkey = $object->element; - - require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; - $extrafields = new ExtraFields($this->db); - $extrafields->fetch_name_optionals_label($extrafieldkey, true); $object->fetch_optionals(); $resarray = $this->fill_substitutionarray_with_extrafields($object, $resarray, $extrafields, $array_key, $outputlangs); + } return $resarray; @@ -169,14 +165,15 @@ class doc_generic_task_odt extends ModelePDFTask * * @param array $task Task Object * @param Translate $outputlangs Lang object to use for output + * @param string $array_key Name of the key for return array * @return array Return a substitution array */ - public function get_substitutionarray_tasks($task, $outputlangs) + public function get_substitutionarray_tasks($task, $outputlangs, $array_key = 'task') { // phpcs:enable - global $conf; + global $conf, $extrafields; - return array( + $resarray = array( 'task_ref'=>$task->ref, 'task_fk_project'=>$task->fk_project, 'task_projectref'=>$task->projectref, @@ -192,6 +189,16 @@ class doc_generic_task_odt extends ModelePDFTask 'task_note_private'=>$task->note_private, 'task_note_public'=>$task->note_public ); + + // Retrieve extrafields + if (is_array($task->array_options) && count($task->array_options)) + { + $task->fetch_optionals(); + + $resarray = $this->fill_substitutionarray_with_extrafields($task, $resarray, $extrafields, $array_key, $outputlangs); + } + + return $resarray; } // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps From 68e9d8463a101340b707d20f750206a06971a1a3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 23 Apr 2020 15:52:15 +0200 Subject: [PATCH 037/115] Debug MAIN_USE_ALTERNATE_TRANSLATION_FOR variable --- htdocs/core/class/extralanguages.class.php | 26 +++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/htdocs/core/class/extralanguages.class.php b/htdocs/core/class/extralanguages.class.php index 8f61e84839c..8ae1fd0a4c7 100644 --- a/htdocs/core/class/extralanguages.class.php +++ b/htdocs/core/class/extralanguages.class.php @@ -69,7 +69,9 @@ class ExtraLanguages // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** - * Load array this->attributes + * Load array this->attributes with list of fields per object that need an alternate translation. + * You can set variable MAIN_USE_ALTERNATE_TRANSLATION_FOR=elementA:fieldname,fieldname2;elementB:... + * Example: MAIN_USE_ALTERNATE_TRANSLATION_FOR=societe:name,town;contact:firstname,lastname * * @param string $elementtype Type of element ('' = all, 'adherent', 'commande', 'thirdparty', 'facture', 'propal', 'product', ...). * @param boolean $forceload Force load of extra fields whatever is status of cache. @@ -86,11 +88,25 @@ class ExtraLanguages if ($elementtype == 'contact') $elementtype = 'socpeople'; if ($elementtype == 'order_supplier') $elementtype = 'commande_fournisseur'; - $array_name_label = array( - 'societe' => array('name'=>'Name'), - 'contact' => array('firstname' => 'Firstname', 'lastname' => 'Lastname') - ); + $array_name_label = array(); + if (! empty($conf->global->MAIN_USE_ALTERNATE_TRANSLATION_FOR)) { + $tmpelement = explode(';', $conf->global->MAIN_USE_ALTERNATE_TRANSLATION_FOR); + foreach($tmpelement as $elementstring) { + $reg=array(); + preg_match('/^(.*):(.*)$/', $elementstring, $reg); + $element = $reg[1]; + $array_name_label[$element] = array(); + $tmpfields=explode(',', $reg[2]); + foreach($tmpfields as $field) { + //var_dump($fields); + //$tmpkeyvar = explode(':', $fields); + //$array_name_label[$element][$tmpkeyvar[0]] = $tmpkeyvar[1]; + $array_name_label[$element][$field] = $field; + } + } + } + //var_dump($array_name_label); $this->attributes = $array_name_label; return $array_name_label; From 55a9aa5991c3a4468ef8a90452218b6786f7b183 Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Thu, 23 Apr 2020 15:55:37 +0200 Subject: [PATCH 038/115] fix: missing duration odt task substitution --- .../project/task/doc/doc_generic_task_odt.modules.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php b/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php index 1aa8f05d9df..033aee6b8fa 100644 --- a/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php +++ b/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php @@ -163,7 +163,7 @@ class doc_generic_task_odt extends ModelePDFTask /** * Define array with couple substitution key => substitution value * - * @param array $task Task Object + * @param Task $task Task Object * @param Translate $outputlangs Lang object to use for output * @param string $array_key Name of the key for return array * @return array Return a substitution array @@ -181,7 +181,8 @@ class doc_generic_task_odt extends ModelePDFTask 'task_label'=>$task->label, 'task_description'=>$task->description, 'task_fk_parent'=>$task->fk_parent, - 'task_duration'=>$task->duration, + 'task_duration'=>$task->convertSecondToTime(duration_effective,'allhourmin'), + 'task_planned_workload'=>convertSecondToTime($task->planned_workload,'allhourmin'), 'task_progress'=>$task->progress, 'task_public'=>$task->public, 'task_date_start'=>dol_print_date($task->date_start, 'day'), From 6dafb30ee8e57be64f2ca2c5a6f347c94476f80d Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Thu, 23 Apr 2020 15:57:06 +0200 Subject: [PATCH 039/115] fix time duration substitution --- .../modules/project/task/doc/doc_generic_task_odt.modules.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php b/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php index 033aee6b8fa..6e96699116e 100644 --- a/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php +++ b/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php @@ -181,7 +181,7 @@ class doc_generic_task_odt extends ModelePDFTask 'task_label'=>$task->label, 'task_description'=>$task->description, 'task_fk_parent'=>$task->fk_parent, - 'task_duration'=>$task->convertSecondToTime(duration_effective,'allhourmin'), + 'task_duration'=>convertSecondToTime($task->duration_effective,'allhourmin'), 'task_planned_workload'=>convertSecondToTime($task->planned_workload,'allhourmin'), 'task_progress'=>$task->progress, 'task_public'=>$task->public, From 32385b75e18458a95e7c9bfde6c2659ea9ac7c8d Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Thu, 23 Apr 2020 16:18:31 +0200 Subject: [PATCH 040/115] travis --- htdocs/core/class/commondocgenerator.class.php | 4 ---- .../project/task/doc/doc_generic_task_odt.modules.php | 5 ++--- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index 2317636f42a..5c43f4f83a1 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -228,7 +228,6 @@ abstract class CommonDocGenerator $object->fetch_optionals(); $array_thirdparty = $this->fill_substitutionarray_with_extrafields($object, $array_thirdparty, $extrafields, $array_key, $outputlangs); - } return $array_thirdparty; } @@ -292,7 +291,6 @@ abstract class CommonDocGenerator $object->fetch_optionals(); $array_contact = $this->fill_substitutionarray_with_extrafields($object, $array_contact, $extrafields, $array_key, $outputlangs); - } return $array_contact; } @@ -509,7 +507,6 @@ abstract class CommonDocGenerator $object->fetch_optionals(); $resarray = $this->fill_substitutionarray_with_extrafields($object, $resarray, $extrafields, $array_key, $outputlangs); - } return $resarray; @@ -688,7 +685,6 @@ abstract class CommonDocGenerator $object->fetch_optionals(); $array_shipment = $this->fill_substitutionarray_with_extrafields($object, $array_shipment, $extrafields, $array_key, $outputlangs); - } return $array_shipment; diff --git a/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php b/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php index 6e96699116e..ceb735dc486 100644 --- a/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php +++ b/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php @@ -153,7 +153,6 @@ class doc_generic_task_odt extends ModelePDFTask $object->fetch_optionals(); $resarray = $this->fill_substitutionarray_with_extrafields($object, $resarray, $extrafields, $array_key, $outputlangs); - } return $resarray; @@ -181,8 +180,8 @@ class doc_generic_task_odt extends ModelePDFTask 'task_label'=>$task->label, 'task_description'=>$task->description, 'task_fk_parent'=>$task->fk_parent, - 'task_duration'=>convertSecondToTime($task->duration_effective,'allhourmin'), - 'task_planned_workload'=>convertSecondToTime($task->planned_workload,'allhourmin'), + 'task_duration'=>convertSecondToTime($task->duration_effective, 'allhourmin'), + 'task_planned_workload'=>convertSecondToTime($task->planned_workload, 'allhourmin'), 'task_progress'=>$task->progress, 'task_public'=>$task->public, 'task_date_start'=>dol_print_date($task->date_start, 'day'), From b68e85703ff2530021e870675794ed33c11c30c4 Mon Sep 17 00:00:00 2001 From: simicar29 Date: Thu, 23 Apr 2020 16:29:22 +0200 Subject: [PATCH 041/115] Clean line extrafields when deleting invoice Delete extrafields invoice lines when deleting parent object (sql syntax ok for mariadb & pgsql) Delete extrafields when deleting an invoice line --- htdocs/compta/facture/class/facture.class.php | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index f9285eb2d9c..66cb1aed37d 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -2166,13 +2166,16 @@ class Facture extends CommonInvoice } } - + // Invoice line extrafileds + $main = MAIN_DB_PREFIX . 'facturedet'; + $ef = $main . "_extrafields"; + $sqlef = "DELETE FROM $ef WHERE fk_object IN (SELECT rowid FROM $main WHERE fk_facture = $rowid)"; // Delete invoice line $sql = 'DELETE FROM '.MAIN_DB_PREFIX.'facturedet WHERE fk_facture = '.$rowid; dol_syslog(get_class($this)."::delete", LOG_DEBUG); - if ($this->db->query($sql) && $this->delete_linked_contact()) + if ($this->db->query($sqlef) && $this->db->query($sql) && $this->delete_linked_contact()) { $sql = 'DELETE FROM '.MAIN_DB_PREFIX.'facture WHERE rowid = '.$rowid; @@ -5312,7 +5315,14 @@ class FactureLigne extends CommonInvoiceLine } // End call triggers - + // extrafields + $result = $this->deleteExtraFields(); + if ($result < 0) + { + $this->db->rollback(); + return -1; + } + $sql = "DELETE FROM ".MAIN_DB_PREFIX."facturedet WHERE rowid = ".$this->rowid; dol_syslog(get_class($this)."::delete", LOG_DEBUG); if ($this->db->query($sql)) From aebc04d30a15eb8e2a46bdd44a1875aacc1db3d7 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Thu, 23 Apr 2020 14:33:11 +0000 Subject: [PATCH 042/115] Fixing style errors. --- 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 66cb1aed37d..9b327aadb45 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -5322,7 +5322,7 @@ class FactureLigne extends CommonInvoiceLine $this->db->rollback(); return -1; } - + $sql = "DELETE FROM ".MAIN_DB_PREFIX."facturedet WHERE rowid = ".$this->rowid; dol_syslog(get_class($this)."::delete", LOG_DEBUG); if ($this->db->query($sql)) From ce94788dd906cce4f925fc260180359175c88d5a Mon Sep 17 00:00:00 2001 From: simicar29 Date: Thu, 23 Apr 2020 17:01:40 +0200 Subject: [PATCH 043/115] Clean line extrafields when deleting recurring invoice Delete extrafields recurring invoice lines when deleting parent object Delete extrafields when deleting a recurring invoice line --- .../compta/facture/class/facture-rec.class.php | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index 110f5a9cbb8..f3437308f39 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -664,9 +664,13 @@ class FactureRec extends CommonInvoice $error = 0; $this->db->begin(); + $main = MAIN_DB_PREFIX . 'facturedet_rec'; + $ef = $main . "_extrafields"; + $sqlef = "DELETE FROM $ef WHERE fk_object IN (SELECT rowid FROM $main WHERE fk_facture = $rowid)"; + dol_syslog($sqlef); $sql = "DELETE FROM ".MAIN_DB_PREFIX."facturedet_rec WHERE fk_facture = ".$rowid; dol_syslog($sql); - if ($this->db->query($sql)) + if ($this->db->query($sqlef) && $this->db->query($sql)) { $sql = "DELETE FROM ".MAIN_DB_PREFIX."facture_rec WHERE rowid = ".$rowid; dol_syslog($sql); @@ -675,6 +679,9 @@ class FactureRec extends CommonInvoice // Delete linked object $res = $this->deleteObjectLinked(); if ($res < 0) $error = -3; + // Delete extrafields + $res = $this->deleteExtraFields(); + if ($res < 0) $error = -4; } else { @@ -1881,6 +1888,14 @@ class FactureLigneRec extends CommonInvoiceLine // End call triggers } } + + if (!$error) + { + $result = $this->deleteExtraFields(); + if ($result < 0) { + $error++; + } + } if (!$error) { From 2633e908902d3e20e2cfe35f28447f9842c98582 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Thu, 23 Apr 2020 15:03:14 +0000 Subject: [PATCH 044/115] Fixing style errors. --- htdocs/compta/facture/class/facture-rec.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index f3437308f39..5b72b6d465d 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -1888,7 +1888,7 @@ class FactureLigneRec extends CommonInvoiceLine // End call triggers } } - + if (!$error) { $result = $this->deleteExtraFields(); From cd1368cb71202231393aeb207ddd9fcd3cdfdf72 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 23 Apr 2020 17:10:40 +0200 Subject: [PATCH 045/115] Fix dispatch in ledger for various payment done in same account when there is 2 different transaction in 2 different account (backport v12) --- htdocs/accountancy/journal/bankjournal.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index e9be75990dc..06f5a56f943 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -666,7 +666,7 @@ if (! $error && $action == 'writebookkeeping') { } elseif ($tabtype[$key] == 'payment_various') { $bookkeeping->subledger_account = $k; $bookkeeping->subledger_label = $tabcompany[$key]['name']; - $bookkeeping->numero_compte = $tabpay[$obj->rowid]["account_various"]; + $bookkeeping->numero_compte = $tabpay[$key]["account_various"]; $accountingaccount->fetch(null, $bookkeeping->numero_compte, true); $bookkeeping->label_compte = $accountingaccount->label; @@ -1174,7 +1174,11 @@ if (empty($action) || $action == 'view') { //print ''.$langs->trans("ThirdpartyAccountNotDefined").''; if (! empty($tabcompany[$key]['code_compta'])) { - print ''.$langs->trans("ThirdpartyAccountNotDefinedOrThirdPartyUnknown", $tabcompany[$key]['code_compta']).''; + if (in_array($tabtype[$key], array('payment_various'))) { + // For such case, if subledger is not defined, we won't use subledger accounts. + print ''.$langs->trans("ThirdpartyAccountNotDefinedOrThirdPartyUnknownSubledgerIgnored").''; + } else { + print ''.$langs->trans("ThirdpartyAccountNotDefinedOrThirdPartyUnknown", $tabcompany[$key]['code_compta']).''; } else { From be46b2062ee29fe57181170b21a5241080f895ab Mon Sep 17 00:00:00 2001 From: Marc Guenneugues Date: Thu, 23 Apr 2020 17:51:06 +0200 Subject: [PATCH 046/115] Clean line extrafields when deleting order --- htdocs/commande/class/commande.class.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 52dfde785a4..54506a4a816 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -3396,6 +3396,19 @@ class Commande extends CommonOrder $error++; } + if (!$error) + { + // Delete extrafields of order details + $main = MAIN_DB_PREFIX . 'commandedet'; + $ef = $main . "_extrafields"; + $sql = "DELETE FROM $ef WHERE fk_object IN (SELECT rowid FROM $main WHERE fk_commande = " . $this->id . ")"; + if (!$this->db->query($sql)) + { + $error++; + $this->errors[] = $this->db->lasterror(); + } + } + if (!$error) { // Delete order details From f7d4d78008b132574dc81f6e358bd498b4863f7b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 23 Apr 2020 17:55:55 +0200 Subject: [PATCH 047/115] Fix error 500 --- htdocs/accountancy/journal/bankjournal.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index 06f5a56f943..d2ad7a0503e 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -1179,6 +1179,7 @@ if (empty($action) || $action == 'view') { print ''.$langs->trans("ThirdpartyAccountNotDefinedOrThirdPartyUnknownSubledgerIgnored").''; } else { print ''.$langs->trans("ThirdpartyAccountNotDefinedOrThirdPartyUnknown", $tabcompany[$key]['code_compta']).''; + } } else { From 1101c4e587232905e2caa9c61545c47a8503e888 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 23 Apr 2020 18:01:04 +0200 Subject: [PATCH 048/115] Fix trans --- htdocs/langs/en_US/accountancy.lang | 1 + htdocs/langs/fr_FR/accountancy.lang | 1 + 2 files changed, 2 insertions(+) diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index 4b22f512826..9b80eae930c 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -218,6 +218,7 @@ ListAccounts=List of the accounting accounts UnknownAccountForThirdparty=Unknown third-party account. We will use %s UnknownAccountForThirdpartyBlocking=Unknown third-party account. Blocking error ThirdpartyAccountNotDefinedOrThirdPartyUnknown=Third-party account not defined or third party unknown. We will use %s +ThirdpartyAccountNotDefinedOrThirdPartyUnknownSubledgerIgnored=Third-party unknown and subledger not defined on the payment. We will keep the subledger account value empty. ThirdpartyAccountNotDefinedOrThirdPartyUnknownBlocking=Third-party account not defined or third party unknown. Blocking error. UnknownAccountForThirdpartyAndWaitingAccountNotDefinedBlocking=Unknown third-party account and waiting account not defined. Blocking error PaymentsNotLinkedToProduct=Payment not linked to any product / service diff --git a/htdocs/langs/fr_FR/accountancy.lang b/htdocs/langs/fr_FR/accountancy.lang index 0150ff7d017..7c0602332f3 100644 --- a/htdocs/langs/fr_FR/accountancy.lang +++ b/htdocs/langs/fr_FR/accountancy.lang @@ -218,6 +218,7 @@ ListAccounts=Liste des comptes comptables UnknownAccountForThirdparty=Compte de tiers inconnu. %s sera utilisé UnknownAccountForThirdpartyBlocking=Compte de tiers inconnu. Erreur bloquante. ThirdpartyAccountNotDefinedOrThirdPartyUnknown=Code comptable du tiers non défini ou tiers inconnu. On utilisera %s. +ThirdpartyAccountNotDefinedOrThirdPartyUnknownSubledgerIgnored=Tiers inconnu et code comptable auxiliaire non défini sur le paiement. Nous conserverons la valeur du compte auxiliaire vide. ThirdpartyAccountNotDefinedOrThirdPartyUnknownBlocking=Compte tiers non défini ou inconnu. Erreur bloquante. UnknownAccountForThirdpartyAndWaitingAccountNotDefinedBlocking=Compte tiers inconnu et compte d'attente non défini. Erreur blocante. PaymentsNotLinkedToProduct=Paiement non lié à un produit / service From 94be1870ec2faeffcdf9b9b10cd4ac88e89d916f Mon Sep 17 00:00:00 2001 From: Marc Guenneugues Date: Thu, 23 Apr 2020 18:02:53 +0200 Subject: [PATCH 049/115] Clean line extrafields when deleting proposal --- htdocs/comm/propal/class/propal.class.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 409a1924b70..0962fcd63b6 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -2992,8 +2992,11 @@ class Propal extends CommonObject if (!$error) { + $main = MAIN_DB_PREFIX . 'propaldet'; + $ef = $main . "_extrafields"; + $sqlef = "DELETE FROM $ef WHERE fk_object IN (SELECT rowid FROM $main WHERE fk_propal = " . $this->id . ")"; $sql = "DELETE FROM ".MAIN_DB_PREFIX."propaldet WHERE fk_propal = ".$this->id; - if ($this->db->query($sql)) + if ($this->db->query($sqlef) && $this->db->query($sql)) { $sql = "DELETE FROM ".MAIN_DB_PREFIX."propal WHERE rowid = ".$this->id; if ($this->db->query($sql)) From 039fe922090d4f1812159999927c585c5341269d Mon Sep 17 00:00:00 2001 From: Marc Guenneugues Date: Thu, 23 Apr 2020 18:14:56 +0200 Subject: [PATCH 050/115] Clean line extrafields when deleting supplier invoice --- htdocs/fourn/class/fournisseur.facture.class.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 48ca9ca81f2..8cec13609a0 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -1180,10 +1180,14 @@ class FactureFournisseur extends CommonInvoice if (!$error) { + $main = MAIN_DB_PREFIX . 'facture_fourn_det'; + $ef = $main . "_extrafields"; + $sqlef = "DELETE FROM $ef WHERE fk_object IN (SELECT rowid FROM $main WHERE fk_facture_fourn = $rowid)"; + $resqlef = $this->db->query($sqlef); $sql = 'DELETE FROM '.MAIN_DB_PREFIX.'facture_fourn_det WHERE fk_facture_fourn = '.$rowid.';'; dol_syslog(get_class($this)."::delete", LOG_DEBUG); $resql = $this->db->query($sql); - if ($resql) + if ($resqlef && $resql) { $sql = 'DELETE FROM '.MAIN_DB_PREFIX.'facture_fourn WHERE rowid = '.$rowid; dol_syslog(get_class($this)."::delete", LOG_DEBUG); @@ -3141,6 +3145,11 @@ class SupplierInvoiceLine extends CommonObjectLine $this->deleteObjectLinked(); + $result = $this->deleteExtraFields(); + if ($result < 0) { + $error++; + } + if (!$error) { // Supprime ligne $sql = 'DELETE FROM '.MAIN_DB_PREFIX.'facture_fourn_det '; From b5f48fb815a80e8343b87bf989b882b412ebe22c Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Thu, 23 Apr 2020 16:17:37 +0000 Subject: [PATCH 051/115] Fixing style errors. --- htdocs/fourn/class/fournisseur.facture.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 8cec13609a0..117a99ee2cc 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -3146,9 +3146,9 @@ class SupplierInvoiceLine extends CommonObjectLine $this->deleteObjectLinked(); $result = $this->deleteExtraFields(); - if ($result < 0) { - $error++; - } + if ($result < 0) { + $error++; + } if (!$error) { // Supprime ligne From 8401f68bde8672b76036192d63f26f8cc9610583 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 23 Apr 2020 18:21:17 +0200 Subject: [PATCH 052/115] Update doc_generic_task_odt.modules.php --- .../project/task/doc/doc_generic_task_odt.modules.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php b/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php index ceb735dc486..c56506eb311 100644 --- a/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php +++ b/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php @@ -180,8 +180,10 @@ class doc_generic_task_odt extends ModelePDFTask 'task_label'=>$task->label, 'task_description'=>$task->description, 'task_fk_parent'=>$task->fk_parent, - 'task_duration'=>convertSecondToTime($task->duration_effective, 'allhourmin'), - 'task_planned_workload'=>convertSecondToTime($task->planned_workload, 'allhourmin'), + 'task_duration'=>$task->duration_effective, + 'task_duration_formated'=>convertSecondToTime($task->duration_effective, 'allhourmin'), + 'task_planned_workload'=>$task->planned_workload, + 'task_planned_workload_formated'=>convertSecondToTime($task->planned_workload, 'allhourmin'), 'task_progress'=>$task->progress, 'task_public'=>$task->public, 'task_date_start'=>dol_print_date($task->date_start, 'day'), From 64d877bc7bc8968d3443bb03dcd3f196650ba6d3 Mon Sep 17 00:00:00 2001 From: Marc Guenneugues Date: Thu, 23 Apr 2020 18:27:06 +0200 Subject: [PATCH 053/115] Clean line extrafields when deleting supplier order --- .../class/fournisseur.commande.class.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 0ed924ffb64..76b3cdabc6a 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -1994,6 +1994,17 @@ class CommandeFournisseur extends CommonOrder // End call triggers } + $main = MAIN_DB_PREFIX . 'commande_fournisseurdet'; + $ef = $main . "_extrafields"; + $sql = "DELETE FROM $ef WHERE fk_object IN (SELECT rowid FROM $main WHERE fk_commande = " . $this->id . ")"; + dol_syslog(get_class($this)."::delete extrafields lines", LOG_DEBUG); + if (!$this->db->query($sql)) + { + $this->error = $this->db->lasterror(); + $this->errors[] = $this->db->lasterror(); + $error++; + } + $sql = "DELETE FROM ".MAIN_DB_PREFIX."commande_fournisseurdet WHERE fk_commande =".$this->id; dol_syslog(get_class($this)."::delete", LOG_DEBUG); if (!$this->db->query($sql)) @@ -3700,6 +3711,14 @@ class CommandeFournisseurLigne extends CommonOrderLine $this->db->begin(); + // extrafields + $result = $this->deleteExtraFields(); + if ($result < 0) + { + $this->db->rollback(); + return -1; + } + $sql = 'DELETE FROM '.MAIN_DB_PREFIX."commande_fournisseurdet WHERE rowid=".$this->id; dol_syslog(__METHOD__, LOG_DEBUG); From 4b58213e5b9ee14609c63f5c0ea27eccd3134d42 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Thu, 23 Apr 2020 16:29:36 +0000 Subject: [PATCH 054/115] Fixing style errors. --- htdocs/fourn/class/fournisseur.commande.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 76b3cdabc6a..7de6f6a770e 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -3711,7 +3711,7 @@ class CommandeFournisseurLigne extends CommonOrderLine $this->db->begin(); - // extrafields + // extrafields $result = $this->deleteExtraFields(); if ($result < 0) { From 02c5530e1f94ac7292b763c571e949011d4620f0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 23 Apr 2020 18:31:01 +0200 Subject: [PATCH 055/115] Update mouvementstock.class.php --- htdocs/product/stock/class/mouvementstock.class.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/product/stock/class/mouvementstock.class.php b/htdocs/product/stock/class/mouvementstock.class.php index 2799cbaaf50..1702c4beecc 100644 --- a/htdocs/product/stock/class/mouvementstock.class.php +++ b/htdocs/product/stock/class/mouvementstock.class.php @@ -515,11 +515,12 @@ class MouvementStock extends CommonObject // Update PMP and denormalized value of stock qty at product level if (! $error) { - $newpmp = price2num($newpmp,'MU'); + $newpmp = price2num($newpmp, 'MU'); + // $sql = "UPDATE ".MAIN_DB_PREFIX."product SET pmp = ".$newpmp.", stock = ".$this->db->ifsql("stock IS NULL", 0, "stock") . " + ".$qty; // $sql.= " WHERE rowid = ".$fk_product; // Update pmp + denormalized fields because we change content of produt_stock. Warning: Do not use "SET p.stock", does not works with pgsql - $sql = "UPDATE ".MAIN_DB_PREFIX."product as p SET pmp = '".$newpmp."', "; + $sql = "UPDATE ".MAIN_DB_PREFIX."product as p SET pmp = ".$newpmp.", "; $sql.= " stock=(SELECT SUM(ps.reel) FROM ".MAIN_DB_PREFIX."product_stock as ps WHERE ps.fk_product = p.rowid)"; $sql.= " WHERE rowid = ".$fk_product; From 73ddfb1c81a27ab1e7e69f3d3d597983ecdd9558 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 23 Apr 2020 18:33:25 +0200 Subject: [PATCH 056/115] Use label instead of libelle --- test/phpunit/MouvementStockTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/phpunit/MouvementStockTest.php b/test/phpunit/MouvementStockTest.php index d095736042b..85137234a3b 100644 --- a/test/phpunit/MouvementStockTest.php +++ b/test/phpunit/MouvementStockTest.php @@ -148,13 +148,13 @@ class MouvementStockTest extends PHPUnit\Framework\TestCase // We create a product for tests $warehouse1=new Entrepot($db); $warehouse1->initAsSpecimen(); - $warehouse1->libelle.=' 1'; + $warehouse1->label.=' 1'; $warehouse1->description.=' 1'; $warehouse1id=$warehouse1->create($user); $warehouse2=new Entrepot($db); $warehouse2->initAsSpecimen(); - $warehouse2->libelle.=' 2'; + $warehouse2->label.=' 2'; $warehouse2->description.=' 2'; $warehouse2id=$warehouse2->create($user); From ab5c2b1fd56ba640e0d6ab483f52d2a5b225371c Mon Sep 17 00:00:00 2001 From: Marc Guenneugues Date: Thu, 23 Apr 2020 18:33:58 +0200 Subject: [PATCH 057/115] Clean line extrafields when deleting supplier proposal --- htdocs/supplier_proposal/class/supplier_proposal.class.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index 7fdd5466cd5..d292ebe13bf 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -2061,11 +2061,14 @@ class SupplierProposal extends CommonObject if (! $error) { + $main = MAIN_DB_PREFIX . 'supplier_proposaldet'; + $ef = $main . "_extrafields"; + $sqlef = "DELETE FROM $ef WHERE fk_object IN (SELECT rowid FROM $main WHERE fk_supplier_proposal = " . $this->id . ")"; $sql = "DELETE FROM ".MAIN_DB_PREFIX."supplier_proposaldet WHERE fk_supplier_proposal = ".$this->id; if ($this->db->query($sql)) { $sql = "DELETE FROM ".MAIN_DB_PREFIX."supplier_proposal WHERE rowid = ".$this->id; - if ($this->db->query($sql)) + if ($this->db->query($sqlef) && $this->db->query($sql)) { // Delete linked object $res = $this->deleteObjectLinked(); From 0aa0d62f43d56987126f240dabd98aeb073a57d9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 23 Apr 2020 18:42:59 +0200 Subject: [PATCH 058/115] Fix constant --- htdocs/api/class/api_setup.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/api/class/api_setup.class.php b/htdocs/api/class/api_setup.class.php index f4c73c1b8ec..945a0efdf46 100644 --- a/htdocs/api/class/api_setup.class.php +++ b/htdocs/api/class/api_setup.class.php @@ -1415,7 +1415,7 @@ class Setup extends DolibarrApi * @url GET conf/{constantname} * * @throws RestException 403 Forbidden - * @throws RestException 500 Error Bad or unknown value for constname + * @throws RestException 500 Error Bad or unknown value for constantname */ public function getConf($constantname) { @@ -1427,7 +1427,7 @@ class Setup extends DolibarrApi } if (!preg_match('/^[a-zA-Z0-9_]+$/', $constantname) || ! isset($conf->global->$constantname)) { - throw new RestException(500, 'Error Bad or unknown value for constname'); + throw new RestException(500, 'Error Bad or unknown value for constantname'); } if (preg_match('/(_pass|password|secret|_key|key$)/i', $constantname)) { throw new RestException(403, 'Forbidden'); From 4e6017e5bfb2c156bd28fe1cd96ee5978bd8c2a2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 23 Apr 2020 18:50:20 +0200 Subject: [PATCH 059/115] Look and feel v12 --- htdocs/api/admin/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/api/admin/index.php b/htdocs/api/admin/index.php index 73041f6c386..d0a0e79c855 100644 --- a/htdocs/api/admin/index.php +++ b/htdocs/api/admin/index.php @@ -153,7 +153,7 @@ $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domai // Show message $message = ''; $url = $urlwithroot.'/api/index.php/login?login=auserlogin&password=thepassword[&reset=1]'; -$message .= $langs->trans("UrlToGetKeyToUseAPIs").':
'; +$message .= ''.$langs->trans("UrlToGetKeyToUseAPIs").':
'; $message .= img_picto('', 'globe').' '.$url; print $message; print '
'; From 285f215acfd51ac595a3c44a38a695729d33e95f Mon Sep 17 00:00:00 2001 From: Marc Guenneugues Date: Thu, 23 Apr 2020 18:52:45 +0200 Subject: [PATCH 060/115] Clean line extrafields when deleting fichinter --- htdocs/fichinter/class/fichinter.class.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index 9f180fc24b0..1a4a6817892 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -961,6 +961,16 @@ class Fichinter extends CommonObject } } + if (!$error) + { + $main = MAIN_DB_PREFIX . 'fichinterdet'; + $ef = $main . "_extrafields"; + $sql = "DELETE FROM $ef WHERE fk_object IN (SELECT rowid FROM $main WHERE fk_fichinter = " . $this->id . ")"; + + $resql = $this->db->query($sql); + if (!$resql) $error++; + } + if (!$error) { $sql = "DELETE FROM ".MAIN_DB_PREFIX."fichinterdet"; @@ -1704,6 +1714,13 @@ class FichinterLigne extends CommonObjectLine dol_syslog(get_class($this)."::deleteline lineid=".$this->id); $this->db->begin(); + $result = $this->deleteExtraFields(); + if ($result < 0) { + $error++; + $this->db->rollback(); + return -1; + } + $sql = "DELETE FROM ".MAIN_DB_PREFIX."fichinterdet WHERE rowid = ".$this->id; $resql = $this->db->query($sql); From 548f3007cffcddd67b41391611c5456e61b21977 Mon Sep 17 00:00:00 2001 From: Scrutinizer Auto-Fixer Date: Thu, 23 Apr 2020 16:55:10 +0000 Subject: [PATCH 061/115] Scrutinizer Auto-Fixes This commit consists of patches automatically generated for this project on https://scrutinizer-ci.com --- htdocs/admin/facture_situation.php | 36 ++++++++--------- htdocs/compta/facture/card.php | 38 +++++++++--------- htdocs/compta/facture/class/facture.class.php | 40 +++++++++---------- .../core/class/commondocgenerator.class.php | 2 +- htdocs/core/lib/website.lib.php | 2 +- htdocs/core/modules/modSociete.class.php | 2 +- htdocs/product/class/product.class.php | 2 +- htdocs/product/composition/card.php | 30 +++++++------- .../societe/class/api_thirdparties.class.php | 2 +- htdocs/user/class/usergroup.class.php | 6 +-- htdocs/user/group/perms.php | 2 +- htdocs/website/index.php | 8 ++-- 12 files changed, 85 insertions(+), 85 deletions(-) diff --git a/htdocs/admin/facture_situation.php b/htdocs/admin/facture_situation.php index ce327cc5187..223045db2e9 100644 --- a/htdocs/admin/facture_situation.php +++ b/htdocs/admin/facture_situation.php @@ -36,13 +36,13 @@ require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; // Load translation files required by the page $langs->loadLangs(array('admin', 'errors', 'other', 'bills')); -if (! $user->admin) accessforbidden(); +if (!$user->admin) accessforbidden(); $action = GETPOST('action', 'alpha'); $value = GETPOST('value', 'alpha'); $label = GETPOST('label', 'alpha'); $scandir = GETPOST('scan_dir', 'alpha'); -$type='invoice'; +$type = 'invoice'; /* @@ -57,17 +57,17 @@ include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php'; * View */ -$dirmodels=array_merge(array('/'), (array) $conf->modules_parts['models']); +$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); llxHeader( "", $langs->trans("BillsSetup"), 'EN:Invoice_Configuration|FR:Configuration_module_facture|ES:ConfiguracionFactura' ); -$form=new Form($db); +$form = new Form($db); -$linkback=''.$langs->trans("BackToModuleList").''; +$linkback = ''.$langs->trans("BackToModuleList").''; print load_fiche_titre($langs->trans("BillsSetup"), $linkback, 'title_setup'); $head = invoice_admin_prepare_head(); @@ -106,12 +106,12 @@ $arrayAvailableType = array( ); $selected = array(); $implodeglue = '+'; -if(!empty($conf->global->{$confkey}) && !is_array($conf->global->{$confkey})){ +if (!empty($conf->global->{$confkey}) && !is_array($conf->global->{$confkey})) { $selected = explode('+', $conf->global->{$confkey}); } -$curentInput = (empty($inputCount)?1:($inputCount+1)); -$formSelectInvoiceType = $form->selectarray('value'. $curentInput, $arrayAvailableType, $selected, 1); +$curentInput = (empty($inputCount) ? 1 : ($inputCount + 1)); +$formSelectInvoiceType = $form->selectarray('value'.$curentInput, $arrayAvailableType, $selected, 1); _printInputFormPart($confkey, $langs->trans('AllowedInvoiceForRetainedWarranty'), '', array(), $formSelectInvoiceType); //_printOnOff('INVOICE_RETAINED_WARRANTY_LIMITED_TO_SITUATION', $langs->trans('RetainedwarrantyOnlyForSituation')); @@ -126,7 +126,7 @@ $metas = array( _printInputFormPart('INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_PERCENT', $langs->trans('RetainedwarrantyDefaultPercent'), '', $metas); // Conditions paiements -$inputCount = empty($inputCount)?1:($inputCount+1); +$inputCount = empty($inputCount) ? 1 : ($inputCount + 1); print '
'; print ''; print ''; @@ -178,7 +178,7 @@ function _printOnOff($confkey, $title = false, $desc = '') global $langs; print ''; - print ''; - if($conf->global->INVOICE_USE_RETAINED_WARRANTY){ + if ($conf->global->INVOICE_USE_RETAINED_WARRANTY) { $rwStyle = 'display:none;'; - if(in_array(GETPOST('type', 'int'), $retainedWarrantyInvoiceAvailableType)){ + if (in_array(GETPOST('type', 'int'), $retainedWarrantyInvoiceAvailableType)) { $rwStyle = ''; } $retained_warranty = GETPOST('retained_warranty', 'int'); - if(empty($retained_warranty)){ - if(!empty($objectsrc->retained_warranty)){ // use previous situation value + if (empty($retained_warranty)) { + if (!empty($objectsrc->retained_warranty)) { // use previous situation value $retained_warranty = $objectsrc->retained_warranty; } } - $retained_warranty_js_default = !empty($retained_warranty)?$retained_warranty:$conf->global->INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_PERCENT; + $retained_warranty_js_default = !empty($retained_warranty) ? $retained_warranty : $conf->global->INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_PERCENT; print ''; + if ($num == 0) print ''; $MAX = 100; while ($i < min($num, $MAX)) { $objp = $db->fetch_object($resql); - if($objp->rowid != $id) + if ($objp->rowid != $id) { // check if a product is not already a parent product of this one - $prod_arbo=new Product($db); - $prod_arbo->id=$objp->rowid; + $prod_arbo = new Product($db); + $prod_arbo->id = $objp->rowid; // This type is not supported (not required to have virtual products working). if ($prod_arbo->type == Product::TYPE_ASSEMBLYKIT || $prod_arbo->type == Product::TYPE_STOCKKIT) { - $is_pere=0; + $is_pere = 0; $prod_arbo->get_sousproduits_arbo(); // associations sousproduits $prods_arbo = $prod_arbo->get_arbo_each_prod(); if (count($prods_arbo) > 0) { - foreach($prods_arbo as $key => $value) + foreach ($prods_arbo as $key => $value) { - if ($value[1]==$id) + if ($value[1] == $id) { - $is_pere=1; + $is_pere = 1; } } } - if ($is_pere==1) + if ($is_pere == 1) { $i++; continue; diff --git a/htdocs/societe/class/api_thirdparties.class.php b/htdocs/societe/class/api_thirdparties.class.php index 1100432c854..c50a746c444 100644 --- a/htdocs/societe/class/api_thirdparties.class.php +++ b/htdocs/societe/class/api_thirdparties.class.php @@ -129,7 +129,7 @@ class Thirdparties extends DolibarrApi $sql .= " FROM ".MAIN_DB_PREFIX."societe as t"; if ($category > 0) { if ($mode != 4) $sql .= ", ".MAIN_DB_PREFIX."categorie_societe as c"; - if (!in_array($mode, array(1,2,3))) $sql .= ", ".MAIN_DB_PREFIX."categorie_fournisseur as cc"; + if (!in_array($mode, array(1, 2, 3))) $sql .= ", ".MAIN_DB_PREFIX."categorie_fournisseur as cc"; } if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale $sql .= ", ".MAIN_DB_PREFIX."c_stcomm as st"; diff --git a/htdocs/user/class/usergroup.class.php b/htdocs/user/class/usergroup.class.php index 2cf11c3851f..bc5396e9f51 100644 --- a/htdocs/user/class/usergroup.class.php +++ b/htdocs/user/class/usergroup.class.php @@ -118,12 +118,12 @@ class UserGroup extends CommonObject /** * @var array List of child tables. To test if we can delete object. */ - protected $childtables=array(); + protected $childtables = array(); /** * @var array List of child tables. To know object to delete on cascade. */ - protected $childtablesoncascade = array('usergroup_rights','usergroup_user'); + protected $childtablesoncascade = array('usergroup_rights', 'usergroup_user'); /** @@ -162,7 +162,7 @@ class UserGroup extends CommonObject $this->name = $this->nom; // For compatibility with field name - if($result) + if ($result) { if ($load_members) { diff --git a/htdocs/user/group/perms.php b/htdocs/user/group/perms.php index 8efd7ef38e2..70030dbf1af 100644 --- a/htdocs/user/group/perms.php +++ b/htdocs/user/group/perms.php @@ -77,7 +77,7 @@ if (empty($reshook)) { $editgroup = new Usergroup($db); $result = $editgroup->fetch($id); if ($result > 0) { - $result= $editgroup->addrights($rights, $module, '', $entity); + $result = $editgroup->addrights($rights, $module, '', $entity); if ($result < 0) { setEventMessages($editgroup->error, $editgroup->errors, 'errors'); } diff --git a/htdocs/website/index.php b/htdocs/website/index.php index 32c51d3eef1..0f684ca5232 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -327,8 +327,8 @@ if ($cancel) $savbacktopage = $backtopage; $backtopage = $_SERVER["PHP_SELF"].'?file_manager=1&website='.$websitekey.'&pageid='.$pageid.(GETPOST('section_dir', 'alpha') ? '§ion_dir='.urlencode(GETPOST('section_dir', 'alpha')) : ''); // used after a confirm_deletefile into actions_linkedfiles.inc.php -if ($sortfield) $backtopage.='&sortfield='.$sortfield; -if ($sortorder) $backtopage.='&sortorder='.$sortorder; +if ($sortfield) $backtopage .= '&sortfield='.$sortfield; +if ($sortorder) $backtopage .= '&sortorder='.$sortorder; include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php'; $backtopage = $savbacktopage; @@ -2133,7 +2133,7 @@ print '
'; // Add a margin under toolbar ? $style = ''; -if ($action != 'preview' && $action != 'editcontent' && $action != 'editsource' && ! GETPOST('createpagefromclone', 'alphanohtml')) $style = ' margin-bottom: 5px;'; +if ($action != 'preview' && $action != 'editcontent' && $action != 'editsource' && !GETPOST('createpagefromclone', 'alphanohtml')) $style = ' margin-bottom: 5px;'; if (!GETPOST('hide_websitemenu')) @@ -2437,7 +2437,7 @@ if (!GETPOST('hide_websitemenu')) $preselectedlanguage = GETPOST('newlang', 'aZ09') ? GETPOST('newlang', 'aZ09') : ($objectpage->lang ? $objectpage->lang : $langs->defaultlang); $onlylang = array(); if ($website->otherlang) { - foreach(explode(',', $website->otherlang) as $langkey) { + foreach (explode(',', $website->otherlang) as $langkey) { $onlylang[$langkey] = $langkey; } $textifempty = 1; From 93735bf9cd5c96388736074b53b8e07e375c77e4 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Thu, 23 Apr 2020 16:55:36 +0000 Subject: [PATCH 062/115] Fixing style errors. --- htdocs/fichinter/class/fichinter.class.php | 24 +++++++++++----------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index 1a4a6817892..025a2e13a88 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -961,15 +961,15 @@ class Fichinter extends CommonObject } } - if (!$error) + if (!$error) { - $main = MAIN_DB_PREFIX . 'fichinterdet'; - $ef = $main . "_extrafields"; - $sql = "DELETE FROM $ef WHERE fk_object IN (SELECT rowid FROM $main WHERE fk_fichinter = " . $this->id . ")"; + $main = MAIN_DB_PREFIX . 'fichinterdet'; + $ef = $main . "_extrafields"; + $sql = "DELETE FROM $ef WHERE fk_object IN (SELECT rowid FROM $main WHERE fk_fichinter = " . $this->id . ")"; - $resql = $this->db->query($sql); - if (!$resql) $error++; - } + $resql = $this->db->query($sql); + if (!$resql) $error++; + } if (!$error) { @@ -1715,11 +1715,11 @@ class FichinterLigne extends CommonObjectLine $this->db->begin(); $result = $this->deleteExtraFields(); - if ($result < 0) { - $error++; - $this->db->rollback(); - return -1; - } + if ($result < 0) { + $error++; + $this->db->rollback(); + return -1; + } $sql = "DELETE FROM ".MAIN_DB_PREFIX."fichinterdet WHERE rowid = ".$this->id; $resql = $this->db->query($sql); From a70be95760a3389161cbd2d49b6c82a13c05b1a0 Mon Sep 17 00:00:00 2001 From: Marc Guenneugues Date: Thu, 23 Apr 2020 19:00:47 +0200 Subject: [PATCH 063/115] Clean line extrafields when deleting contrat --- htdocs/contrat/class/contrat.class.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index e40eba40ee2..b265ab59cde 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -1234,6 +1234,22 @@ class Contrat extends CommonObject } } + if (!$error) + { + // Delete contratdet extrafields + $main = MAIN_DB_PREFIX . 'contratdet'; + $ef = $main . "_extrafields"; + $sql = "DELETE FROM $ef WHERE fk_object IN (SELECT rowid FROM $main WHERE fk_contrat = " . $this->id . ")"; + + dol_syslog(get_class($this)."::delete contratdet_extrafields", LOG_DEBUG); + $resql = $this->db->query($sql); + if (!$resql) + { + $this->error = $this->db->error(); + $error++; + } + } + if (!$error) { // Delete contratdet From b8a4c0d83b945214548aa578dfdbd1396624d868 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Thu, 23 Apr 2020 17:02:57 +0000 Subject: [PATCH 064/115] Fixing style errors. --- htdocs/contrat/class/contrat.class.php | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index b265ab59cde..9d90520e1d7 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -1234,21 +1234,21 @@ class Contrat extends CommonObject } } - if (!$error) + if (!$error) { - // Delete contratdet extrafields - $main = MAIN_DB_PREFIX . 'contratdet'; - $ef = $main . "_extrafields"; - $sql = "DELETE FROM $ef WHERE fk_object IN (SELECT rowid FROM $main WHERE fk_contrat = " . $this->id . ")"; + // Delete contratdet extrafields + $main = MAIN_DB_PREFIX . 'contratdet'; + $ef = $main . "_extrafields"; + $sql = "DELETE FROM $ef WHERE fk_object IN (SELECT rowid FROM $main WHERE fk_contrat = " . $this->id . ")"; - dol_syslog(get_class($this)."::delete contratdet_extrafields", LOG_DEBUG); - $resql = $this->db->query($sql); - if (!$resql) - { - $this->error = $this->db->error(); - $error++; - } - } + dol_syslog(get_class($this)."::delete contratdet_extrafields", LOG_DEBUG); + $resql = $this->db->query($sql); + if (!$resql) + { + $this->error = $this->db->error(); + $error++; + } + } if (!$error) { From 3ea8d1895bef4256e8053bc41d5d8118ef44c3e2 Mon Sep 17 00:00:00 2001 From: Marc Guenneugues Date: Thu, 23 Apr 2020 19:09:05 +0200 Subject: [PATCH 065/115] Clean line extrafields when deleting expedition --- htdocs/expedition/class/expedition.class.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index bf20ac42611..006db734a0a 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -1280,15 +1280,23 @@ class Expedition extends CommonObject if (!$error) { + $main = MAIN_DB_PREFIX . 'expeditiondet'; + $ef = $main . "_extrafields"; + $sqlef = "DELETE FROM $ef WHERE fk_object IN (SELECT rowid FROM $main WHERE fk_expedition = " . $this->id . ")"; + $sql = "DELETE FROM ".MAIN_DB_PREFIX."expeditiondet"; $sql .= " WHERE fk_expedition = ".$this->id; - if ($this->db->query($sql)) + if ($this->db->query($sqlef) && $this->db->query($sql)) { // Delete linked object $res = $this->deleteObjectLinked(); if ($res < 0) $error++; + // delete extrafields + $res = $this->deleteExtraFields(); + if ($res < 0) $error++; + if (!$error) { $sql = "DELETE FROM ".MAIN_DB_PREFIX."expedition"; From b4fbb8654824da0c3c50c22233f43b269c22c313 Mon Sep 17 00:00:00 2001 From: Marc Guenneugues Date: Thu, 23 Apr 2020 19:22:25 +0200 Subject: [PATCH 066/115] Clean line extrafields when deleting reception --- .../class/fournisseur.commande.dispatch.class.php | 12 ++++++++++++ htdocs/reception/class/reception.class.php | 13 +++++++++++-- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.commande.dispatch.class.php b/htdocs/fourn/class/fournisseur.commande.dispatch.class.php index b453653c681..bd71918d92d 100644 --- a/htdocs/fourn/class/fournisseur.commande.dispatch.class.php +++ b/htdocs/fourn/class/fournisseur.commande.dispatch.class.php @@ -303,6 +303,7 @@ class CommandeFournisseurDispatch extends CommonObject $this->batch = $obj->batch; $this->eatby = $this->db->jdate($obj->eatby); $this->sellby = $this->db->jdate($obj->sellby); + $this->fetch_optionals(); } $this->db->free($resql); @@ -439,6 +440,16 @@ class CommandeFournisseurDispatch extends CommonObject } } + // Remove extrafields + if (!$error) { + $result = $this->deleteExtraFields(); + if ($result < 0) + { + $error++; + dol_syslog(get_class($this)."::delete error deleteExtraFields ".$this->error, LOG_ERR); + } + } + if (! $error) { $sql = "DELETE FROM ".MAIN_DB_PREFIX.$this->table_element; @@ -689,6 +700,7 @@ class CommandeFournisseurDispatch extends CommonObject $line->batch = $obj->batch; $line->eatby = $this->db->jdate($obj->eatby); $line->sellby = $this->db->jdate($obj->sellby); + $line->fetch_optionals(); $this->lines[$line->id] = $line; } diff --git a/htdocs/reception/class/reception.class.php b/htdocs/reception/class/reception.class.php index 5552d45380e..17e9ea9c1ec 100644 --- a/htdocs/reception/class/reception.class.php +++ b/htdocs/reception/class/reception.class.php @@ -763,8 +763,13 @@ class Reception extends CommonObject } // extrafields + $line->array_options = $supplierorderline->array_options; if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($array_options) && count($array_options) > 0) // For avoid conflicts if trigger used - $line->array_options = $array_options; + { + foreach ($array_options as $key => $value) { + $line->array_options[$key] = $value; + } + } $line->fk_product = $fk_product; $line->fk_commande = $supplierorderline->fk_commande; @@ -938,10 +943,14 @@ class Reception extends CommonObject if (!$error) { + $main = MAIN_DB_PREFIX . 'commande_fournisseur_dispatch'; + $ef = $main . "_extrafields"; + $sqlef = "DELETE FROM $ef WHERE fk_object IN (SELECT rowid FROM $main WHERE fk_reception = " . $this->id . ")"; + $sql = "DELETE FROM ".MAIN_DB_PREFIX."commande_fournisseur_dispatch"; $sql .= " WHERE fk_reception = ".$this->id; - if ($this->db->query($sql)) + if ($this->db->query($sqlef) && $this->db->query($sql)) { // Delete linked object $res = $this->deleteObjectLinked(); From ababad540a311339e1b5266b586097cdad9b22c1 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Thu, 23 Apr 2020 17:29:52 +0000 Subject: [PATCH 067/115] Fixing style errors. --- .../fournisseur.commande.dispatch.class.php | 16 ++++++++-------- htdocs/reception/class/reception.class.php | 8 ++++---- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.commande.dispatch.class.php b/htdocs/fourn/class/fournisseur.commande.dispatch.class.php index bd71918d92d..cec23c590b2 100644 --- a/htdocs/fourn/class/fournisseur.commande.dispatch.class.php +++ b/htdocs/fourn/class/fournisseur.commande.dispatch.class.php @@ -441,14 +441,14 @@ class CommandeFournisseurDispatch extends CommonObject } // Remove extrafields - if (!$error) { - $result = $this->deleteExtraFields(); - if ($result < 0) - { - $error++; - dol_syslog(get_class($this)."::delete error deleteExtraFields ".$this->error, LOG_ERR); - } - } + if (!$error) { + $result = $this->deleteExtraFields(); + if ($result < 0) + { + $error++; + dol_syslog(get_class($this)."::delete error deleteExtraFields ".$this->error, LOG_ERR); + } + } if (! $error) { diff --git a/htdocs/reception/class/reception.class.php b/htdocs/reception/class/reception.class.php index 17e9ea9c1ec..ce718fda964 100644 --- a/htdocs/reception/class/reception.class.php +++ b/htdocs/reception/class/reception.class.php @@ -766,10 +766,10 @@ class Reception extends CommonObject $line->array_options = $supplierorderline->array_options; if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($array_options) && count($array_options) > 0) // For avoid conflicts if trigger used { - foreach ($array_options as $key => $value) { - $line->array_options[$key] = $value; - } - } + foreach ($array_options as $key => $value) { + $line->array_options[$key] = $value; + } + } $line->fk_product = $fk_product; $line->fk_commande = $supplierorderline->fk_commande; From 2ba6e65feb6c29b4cbdf409629ff5fb9069e4cc6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 23 Apr 2020 20:03:41 +0200 Subject: [PATCH 068/115] Fix label --- htdocs/product/stock/class/entrepot.class.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/product/stock/class/entrepot.class.php b/htdocs/product/stock/class/entrepot.class.php index 5f98de4993b..9f764f7d412 100644 --- a/htdocs/product/stock/class/entrepot.class.php +++ b/htdocs/product/stock/class/entrepot.class.php @@ -272,6 +272,7 @@ class Entrepot extends CommonObject $error = 0; if (empty($id)) $id = $this->id; + if (empty($this->label)) $this->label = $this->libelle; // For backward compatibility // Check if new parent is already a child of current warehouse if (!empty($this->fk_parent)) @@ -285,7 +286,7 @@ class Entrepot extends CommonObject } } - $this->libelle = trim($this->libelle); + $this->label = trim($this->label); $this->description = trim($this->description); $this->lieu = trim($this->lieu); @@ -296,7 +297,7 @@ class Entrepot extends CommonObject $this->country_id = ($this->country_id > 0 ? $this->country_id : 0); $sql = "UPDATE ".MAIN_DB_PREFIX."entrepot "; - $sql .= " SET ref = '".$this->db->escape($this->libelle)."'"; + $sql .= " SET ref = '".$this->db->escape($this->label)."'"; $sql .= ", fk_parent = ".(($this->fk_parent > 0) ? $this->fk_parent : "NULL"); $sql .= ", description = '".$this->db->escape($this->description)."'"; $sql .= ", statut = ".$this->statut; From 5756e3be09e2d41fb367559fe597009218941993 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 23 Apr 2020 20:45:51 +0200 Subject: [PATCH 069/115] Look and feel v12 --- htdocs/contrat/agenda.php | 13 ++++++++----- htdocs/contrat/document.php | 1 + 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/htdocs/contrat/agenda.php b/htdocs/contrat/agenda.php index 2b7ca20c6e8..0055b0ba428 100644 --- a/htdocs/contrat/agenda.php +++ b/htdocs/contrat/agenda.php @@ -146,14 +146,16 @@ if ($id > 0) $morehtmlref .= $form->editfieldval("", 'ref', $object->ref, $object, $user->rights->contrat->creer, 'string', '', 0, 2); } + $permtoedit = 0; + $morehtmlref .= '
'; // Ref customer - $morehtmlref .= $form->editfieldkey("RefCustomer", 'ref_customer', $object->ref_customer, $object, $user->rights->contrat->creer, 'string', '', 0, 1); - $morehtmlref .= $form->editfieldval("RefCustomer", 'ref_customer', $object->ref_customer, $object, $user->rights->contrat->creer, 'string', '', null, null, '', 1, 'getFormatedCustomerRef'); + $morehtmlref .= $form->editfieldkey("RefCustomer", 'ref_customer', $object->ref_customer, $object, $permtoedit, 'string', '', 0, 1); + $morehtmlref .= $form->editfieldval("RefCustomer", 'ref_customer', $object->ref_customer, $object, $permtoedit, 'string', '', null, null, '', 1, 'getFormatedCustomerRef'); // Ref supplier $morehtmlref .= '
'; - $morehtmlref .= $form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $user->rights->contrat->creer, 'string', '', 0, 1); - $morehtmlref .= $form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $user->rights->contrat->creer, 'string', '', null, null, '', 1, 'getFormatedSupplierRef'); + $morehtmlref .= $form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $permtoedit, 'string', '', 0, 1); + $morehtmlref .= $form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $permtoedit, 'string', '', null, null, '', 1, 'getFormatedSupplierRef'); // Thirdparty $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1); if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) $morehtmlref .= ' ('.$langs->trans("OtherContracts").')'; @@ -165,7 +167,8 @@ if ($id > 0) if ($user->rights->contrat->creer) { if ($action != 'classify') { - $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' : '; + //$morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).''; + $morehtmlref .= ' : '; } if ($action == 'classify') { //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); diff --git a/htdocs/contrat/document.php b/htdocs/contrat/document.php index 330db63e30c..7d47b5102ac 100644 --- a/htdocs/contrat/document.php +++ b/htdocs/contrat/document.php @@ -136,6 +136,7 @@ if ($object->id) $morehtmlref .= $form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', null, null, '', 1, 'getFormatedSupplierRef'); // Thirdparty $morehtmlref .= '
'.$langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1); + if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) $morehtmlref .= ' ('.$langs->trans("OtherContracts").')'; // Project if (!empty($conf->projet->enabled)) { From dd070cc68046a2ba911d9222e7ab61e8d7044213 Mon Sep 17 00:00:00 2001 From: Matt Sidnell <54064522+pstructures@users.noreply.github.com> Date: Thu, 23 Apr 2020 20:37:15 +0100 Subject: [PATCH 070/115] Update commonobject.class.php --- htdocs/core/class/commonobject.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 7bbf7b6475c..72eff12edca 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -1359,7 +1359,7 @@ abstract class CommonObject } if ($conf->{$modulename}->enabled) { $libelle_element = $langs->trans('ContactDefault_'.$obj->element); - $transkey = "TypeContact_".$this->element."_".$source."_".$obj->code; + $transkey = "TypeContact_".$obj->element."_".$source."_".$obj->code; $libelle_type = ($langs->trans($transkey) != $transkey ? $langs->trans($transkey) : $obj->libelle); if (empty($option)) $tab[$obj->rowid] = $libelle_element.' - '.$libelle_type; From cab4f35438a391fff7301c21320bc2fb7efbf1a0 Mon Sep 17 00:00:00 2001 From: Tobias Sekan Date: Fri, 24 Apr 2020 14:01:08 +0200 Subject: [PATCH 071/115] fix missing vcard values --- htdocs/contact/vcard.php | 60 ++++++++++++++++++++++++++++++---------- 1 file changed, 45 insertions(+), 15 deletions(-) diff --git a/htdocs/contact/vcard.php b/htdocs/contact/vcard.php index 297cadac0be..bf1e8528960 100644 --- a/htdocs/contact/vcard.php +++ b/htdocs/contact/vcard.php @@ -2,6 +2,7 @@ /* Copyright (C) 2004 Rodolphe Quiedeville * Copyright (C) 2004-2010 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2020 Tobias Sekan * * 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 @@ -37,19 +38,19 @@ $id = GETPOST('id', 'int'); $result = restrictedArea($user, 'contact', $id, 'socpeople&societe'); -$result = $contact->fetch($id); +$result=$contact->fetch($id); if ($result <= 0) { dol_print_error($contact->error); exit; } -$physicalperson = 1; +$physicalperson=1; $company = new Societe($db); if ($contact->socid) { - $result = $company->fetch($contact->socid); + $result=$company->fetch($contact->socid); } // We create VCard @@ -57,29 +58,58 @@ $v = new vCard(); $v->setProdId('Dolibarr '.DOL_VERSION); $v->setUid('DOLIBARR-CONTACTID-'.$contact->id); -$v->setName($contact->lastname, $contact->firstname, "", "", ""); -$v->setFormattedName($contact->getFullName($langs)); +$v->setName($contact->lastname, $contact->firstname, "", $contact->civility, ""); +$v->setFormattedName($contact->getFullName($langs, 1)); -// By default, all informations are for work (except phone_perso and phone_mobile) $v->setPhoneNumber($contact->phone_pro, "TYPE=WORK;VOICE"); +//$v->setPhoneNumber($contact->phone_perso,"TYPE=HOME;VOICE"); $v->setPhoneNumber($contact->phone_mobile, "TYPE=CELL;VOICE"); $v->setPhoneNumber($contact->fax, "TYPE=WORK;FAX"); -$v->setAddress("", "", $contact->address, $contact->town, "", $contact->zip, ($contact->country_code ? $contact->country : ''), "TYPE=WORK;POSTAL"); -$v->setLabel("", "", $contact->address, $contact->town, "", $contact->zip, ($contact->country_code ? $contact->country : ''), "TYPE=WORK"); -$v->setEmail($contact->email, 'TYPE=PREF,INTERNET'); -$v->setNote($contact->note); +$country = $contact->country_code ? $contact->country : '' ; +$v->setAddress("", "", $contact->address, $contact->town, $contact->state, $contact->zip, $country, "TYPE=WORK;POSTAL"); +$v->setLabel("", "", $contact->address, $contact->town, $contact->state, $contact->zip, $country, "TYPE=WORK"); + +$v->setEmail($contact->email); +$v->setNote($contact->note); $v->setTitle($contact->poste); // Data from linked company if ($company->id) { $v->setURL($company->url, "TYPE=WORK"); - if (!$contact->phone_pro) $v->setPhoneNumber($company->phone, "TYPE=WORK;VOICE"); - if (!$contact->fax) $v->setPhoneNumber($company->fax, "TYPE=WORK;FAX"); - if (!$contact->zip) $v->setAddress("", "", $company->address, $company->town, "", $company->zip, $company->country, "TYPE=WORK;POSTAL"); - if (empty($contact->email)) $v->setEmail($company->email, 'TYPE=PREF,INTERNET'); + if (! $contact->phone_pro) $v->setPhoneNumber($company->phone, "TYPE=WORK;VOICE"); + if (! $contact->fax) $v->setPhoneNumber($company->fax, "TYPE=WORK;FAX"); + if (! $contact->zip) $v->setAddress("", "", $company->address, $company->town, $company->state, $company->zip, $company->country, "TYPE=WORK;POSTAL"); + + // when company e-mail is empty, use only contact e-mail + if (empty(trim($company->email))) + { + // was set before, don't set twice + } + // when contact e-mail is empty, use only company e-mail + elseif (empty(trim($contact->email))) + { + $v->setEmail($company->email); + } + // when e-mail domain of contact and company are the same, use contact e-mail at first (and company e-mail at second) + elseif (strtolower(end(explode("@", $contact->email))) == strtolower(end(explode("@", $company->email)))) + { + $v->setEmail($contact->email); + + // support by Microsoft Outlook (2019 and possible earlier) + $v->setEmail($company->email, 'INTERNET'); + } + // when e-mail of contact and company complete different use company e-mail at first (and contact e-mail at second) + else + { + $v->setEmail($company->email); + + // support by Microsoft Outlook (2019 and possible earlier) + $v->setEmail($contact->email, 'INTERNET'); + } + // Si contact lie a un tiers non de type "particulier" if ($contact->typent_code != 'TE_PRIVATE') $v->setOrg($company->name); } @@ -95,7 +125,7 @@ $db->close(); $output = $v->getVCard(); -$filename = trim(urldecode($v->getFileName())); // "Nom prenom.vcf" +$filename =trim(urldecode($v->getFileName())); // "Nom prenom.vcf" $filenameurlencoded = dol_sanitizeFileName(urlencode($filename)); //$filename = dol_sanitizeFileName($filename); From 5d9432e4d04f8f73d0f9767e54934dc20086689d Mon Sep 17 00:00:00 2001 From: Tobias Sekan Date: Fri, 24 Apr 2020 14:02:54 +0200 Subject: [PATCH 072/115] fix style --- htdocs/contact/vcard.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/contact/vcard.php b/htdocs/contact/vcard.php index bf1e8528960..75362491424 100644 --- a/htdocs/contact/vcard.php +++ b/htdocs/contact/vcard.php @@ -38,19 +38,19 @@ $id = GETPOST('id', 'int'); $result = restrictedArea($user, 'contact', $id, 'socpeople&societe'); -$result=$contact->fetch($id); +$result = $contact->fetch($id); if ($result <= 0) { dol_print_error($contact->error); exit; } -$physicalperson=1; +$physicalperson = 1; $company = new Societe($db); if ($contact->socid) { - $result=$company->fetch($contact->socid); + $result = $company->fetch($contact->socid); } // We create VCard @@ -125,7 +125,7 @@ $db->close(); $output = $v->getVCard(); -$filename =trim(urldecode($v->getFileName())); // "Nom prenom.vcf" +$filename = trim(urldecode($v->getFileName())); // "Nom prenom.vcf" $filenameurlencoded = dol_sanitizeFileName(urlencode($filename)); //$filename = dol_sanitizeFileName($filename); From 05bb94cd3f105a71ec81162f507dd6cf2522833c Mon Sep 17 00:00:00 2001 From: Tobias Sekan Date: Fri, 24 Apr 2020 14:12:43 +0200 Subject: [PATCH 073/115] fix wrong set e-mail for vCard + docu update --- htdocs/core/class/vcard.class.php | 53 ++++++++++++++++++++++++------- 1 file changed, 42 insertions(+), 11 deletions(-) diff --git a/htdocs/core/class/vcard.class.php b/htdocs/core/class/vcard.class.php index a3948bdeed6..4147b6f086a 100644 --- a/htdocs/core/class/vcard.class.php +++ b/htdocs/core/class/vcard.class.php @@ -1,7 +1,8 @@ * Copyright (C) 2005-2017 Laurent Destailleur - * + * Copyright (C) 2020 Tobias Sekan + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or @@ -135,11 +136,11 @@ class vCard /** * mise en forme du nom complet * - * @param string $family Family - * @param string $first First - * @param string $additional Additionnal - * @param string $prefix Prefix - * @param string $suffix Suffix + * @param string $family Family name + * @param string $first First name + * @param string $additional Additional (e.g. second name, nick name) + * @param string $prefix Prefix (e.g. "Mr.", "Ms.", "Prof.") + * @param string $suffix Suffix (e.g. "sen." for senior, "jun." for junior) * @return void */ public function setName($family = "", $first = "", $additional = "", $prefix = "", $suffix = "") @@ -216,15 +217,17 @@ class vCard } /** - * mise en forme de l'email + * Add a e-mail address to this vCard * - * @param string $address EMail - * @param string $type Vcard type + * @param string $address E-mail address + * @param string $type (optional) The type of the e-mail (typical "PREF;INTERNET" or "INTERNET") * @return void */ - public function setEmail($address, $type = "internet,pref") + public function setEmail($address, $type = "TYPE=INTERNET;PREF") { - $this->properties["EMAIL;TYPE=".$type] = $address; + $key = "EMAIL"; + if ($type != "") $key .= ";".$type; + $this->properties[$key] = $address; } /** @@ -330,4 +333,32 @@ class vCard { return $this->filename; } + + /* Example from Microsoft Outlook 2019 + + BEGIN:VCARD + VERSION:2.1 + + N;LANGUAGE=de:surename;forename;secondname;Sir;jun. + FN:Sir surename secondname forename jun. + ORG:Companyname + TITLE:position + TEL;WORK;VOICE:work-phone-number + TEL;HOME;VOICE:private-phone-number + TEL;CELL;VOICE:mobile-phone-number + TEL;WORK;FAX:fax-phone-number + ADR;WORK;PREF:;;street and number;town;region;012345;Deutschland + LABEL;WORK;PREF;ENCODING=QUOTED-PRINTABLE:street and number=0D=0A= + =0D=0A= + 012345 town region + X-MS-OL-DEFAULT-POSTAL-ADDRESS:2 + URL;WORK:www.mywebpage.de + EMAIL;PREF;INTERNET:test1@test1.de + EMAIL;INTERNET:test2@test2.de + EMAIL;INTERNET:test3@test3.de + X-MS-IMADDRESS:test@jabber.org + REV:20200424T104242Z + + END:VCARD + */ } From 6d4d638ec10acb6c6cd770ac3937ff40c22c3416 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Fri, 24 Apr 2020 12:38:46 +0000 Subject: [PATCH 074/115] Fixing style errors. --- htdocs/core/class/vcard.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/vcard.class.php b/htdocs/core/class/vcard.class.php index 4147b6f086a..fc67eb2f2a0 100644 --- a/htdocs/core/class/vcard.class.php +++ b/htdocs/core/class/vcard.class.php @@ -2,7 +2,7 @@ /* Copyright (C) Kai Blankenhorn * Copyright (C) 2005-2017 Laurent Destailleur * Copyright (C) 2020 Tobias Sekan - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or @@ -333,7 +333,7 @@ class vCard { return $this->filename; } - + /* Example from Microsoft Outlook 2019 BEGIN:VCARD From 42ee9845ad33dfa9a7a623102357c4e13e3ee0cc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 24 Apr 2020 15:21:02 +0200 Subject: [PATCH 075/115] Report error --- htdocs/compta/facture/class/facture.class.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 05661fb01cc..1558b6cbfab 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -5013,8 +5013,7 @@ class FactureLigne extends CommonInvoiceLine $returnPercent = floatval($res['situation_percent']); - if($include_credit_note) { - + if ($include_credit_note) { $sql = 'SELECT fd.situation_percent FROM ' . MAIN_DB_PREFIX . 'facturedet fd'; $sql.= ' JOIN ' . MAIN_DB_PREFIX . 'facture f ON (f.rowid = fd.fk_facture) '; $sql.= ' WHERE fd.fk_prev_id =' . $this->fk_prev_id; @@ -5026,6 +5025,8 @@ class FactureLigne extends CommonInvoiceLine while($obj = $this->db->fetch_object($res)) { $returnPercent = $returnPercent + floatval($obj->situation_percent); } + } else { + dol_print_error($this->db); } } From b2b580f6fb7d89bf9f295c7308c215e95d5aa9ab Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 24 Apr 2020 15:21:38 +0200 Subject: [PATCH 076/115] Report error --- htdocs/compta/facture/class/facture.class.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index d872b02a35d..118bcb790bc 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -5569,7 +5569,7 @@ class FactureLigne extends CommonInvoiceLine $sql = 'SELECT fd.situation_percent FROM '.MAIN_DB_PREFIX.'facturedet fd'; $sql .= ' JOIN '.MAIN_DB_PREFIX.'facture f ON (f.rowid = fd.fk_facture) '; $sql .= ' WHERE fd.fk_prev_id ='.$this->fk_prev_id; - $sql .= ' AND f.situation_cycle_ref = '.$tmpinvoice->situation_cycle_ref; // Prevent cycle outed + $sql .= ' AND f.situation_cycle_ref = '.$invoicecache[$invoiceid]->situation_cycle_ref; // Prevent cycle outed $sql .= ' AND f.type = '.Facture::TYPE_CREDIT_NOTE; $res = $this->db->query($sql); @@ -5577,6 +5577,8 @@ class FactureLigne extends CommonInvoiceLine while ($obj = $this->db->fetch_object($res)) { $returnPercent = $returnPercent + floatval($obj->situation_percent); } + } else { + dol_print_error($this->db); } } From e98671e40489da84d3b9f3728e54dd41f5f6713f Mon Sep 17 00:00:00 2001 From: gauthier Date: Fri, 24 Apr 2020 15:22:38 +0200 Subject: [PATCH 077/115] FIX : Access to undeclared static property: Contact::$table_element --- htdocs/core/tpl/advtarget.tpl.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/tpl/advtarget.tpl.php b/htdocs/core/tpl/advtarget.tpl.php index 07b7744e2f8..a40f1214af1 100644 --- a/htdocs/core/tpl/advtarget.tpl.php +++ b/htdocs/core/tpl/advtarget.tpl.php @@ -459,7 +459,8 @@ if (!empty($conf->categorie->enabled) && $user->rights->categorie->lire) { // Standard Extrafield feature if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) { - $elementype = Contact::$table_element; + $contactstatic = new Contact($db); + $elementype = $contactstatic->table_element; // fetch optionals attributes and labels dol_include_once('/core/class/extrafields.class.php'); $extrafields = new ExtraFields($db); From df917805525cbd22453c9b05c68d4b2785f2290a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 24 Apr 2020 15:57:08 +0200 Subject: [PATCH 078/115] FIX Situation invoice take into account the credit notes. --- htdocs/compta/facture/card.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index d83e13da433..934916fa31e 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -1590,6 +1590,8 @@ if (empty($reshook)) if (!empty($origin) && !empty($originid)) { + include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php'; + $object->origin = $origin; $object->origin_id = $originid; @@ -1601,6 +1603,17 @@ if (empty($reshook)) $line->fetch_optionals($line->id); $line->situation_percent = $line->get_prev_progress($object->id); // get good progress including credit note + // The $line->situation_percent has been modified, so we must recalculate all amounts + $tabprice = calcul_price_total($line->qty, $line->subprice, $line->remise_percent, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, 0, 'HT', 0, $line->product_type, $mysoc, '', $line->situation_percent); + $line->total_ht = $tabprice[0]; + $line->total_tva = $tabprice[1]; + $line->total_ttc = $tabprice[2]; + $line->total_localtax1 = $tabprice[9]; + $line->total_localtax2 = $tabprice[10]; + $line->multicurrency_total_ht = $tabprice[16]; + $line->multicurrency_total_tva = $tabprice[17]; + $line->multicurrency_total_ttc = $tabprice[18]; + // Si fk_remise_except defini on vérifie si la réduction à déjà été appliquée if ($line->fk_remise_except) { @@ -1644,6 +1657,7 @@ if (empty($reshook)) { $nextSituationInvoice = new Facture($db); $nextSituationInvoice->fetch($id); + // create extrafields with data from create form $extralabels = $extrafields->fetch_name_optionals_label($nextSituationInvoice->table_element); $ret = $extrafields->setOptionalsFromPost($extralabels, $nextSituationInvoice); From a685026756fc1046bfb5426947006de9cb4fff5f Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Fri, 24 Apr 2020 17:22:35 +0200 Subject: [PATCH 079/115] fix: remove php warning --- htdocs/compta/accounting-files.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/accounting-files.php b/htdocs/compta/accounting-files.php index b8e10e7d0e3..665ab6ce485 100644 --- a/htdocs/compta/accounting-files.php +++ b/htdocs/compta/accounting-files.php @@ -23,7 +23,7 @@ * \brief Page to show portoflio and files of a thirdparty and download it */ -if ($_GET['action'] == 'dl' || $_POST['action'] == 'dl') { // To not replace token when downloading file +if (array_key_exists('action', $_GET) && $_GET['action'] == 'dl' || array_key_exists('action', $_POST) && $_POST['action'] == 'dl') { // To not replace token when downloading file if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); } From 4564a5cffd7e6c2f1f8ab81db902f8036622d693 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 24 Apr 2020 19:01:08 +0200 Subject: [PATCH 080/115] Update accounting-files.php --- htdocs/compta/accounting-files.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/compta/accounting-files.php b/htdocs/compta/accounting-files.php index 665ab6ce485..83f735c1eeb 100644 --- a/htdocs/compta/accounting-files.php +++ b/htdocs/compta/accounting-files.php @@ -23,7 +23,7 @@ * \brief Page to show portoflio and files of a thirdparty and download it */ -if (array_key_exists('action', $_GET) && $_GET['action'] == 'dl' || array_key_exists('action', $_POST) && $_POST['action'] == 'dl') { // To not replace token when downloading file +if ((array_key_exists('action', $_GET) && $_GET['action'] == 'dl') || (array_key_exists('action', $_POST) && $_POST['action'] == 'dl')) { // To not replace token when downloading file if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); } From df10b86d1fbe6a613160ea8922d617cde6d62faf Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 24 Apr 2020 19:52:34 +0200 Subject: [PATCH 081/115] FIX consistency of price w/wo vat wrong when price entered with tax --- htdocs/core/class/commonobject.class.php | 25 ++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index d4735e4ba8d..157fc718700 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -2807,8 +2807,8 @@ abstract class CommonObject $sql = 'SELECT rowid, qty, '.$fieldup.' as up, remise_percent, total_ht, '.$fieldtva.' as total_tva, total_ttc, '.$fieldlocaltax1.' as total_localtax1, '.$fieldlocaltax2.' as total_localtax2,'; $sql.= ' tva_tx as vatrate, localtax1_tx, localtax2_tx, localtax1_type, localtax2_type, info_bits, product_type'; - if ($this->table_element_line == 'facturedet') $sql.= ', situation_percent'; - $sql.= ', multicurrency_total_ht, multicurrency_total_tva, multicurrency_total_ttc'; + if ($this->table_element_line == 'facturedet') $sql.= ', situation_percent'; + $sql.= ', multicurrency_total_ht, multicurrency_total_tva, multicurrency_total_ttc'; $sql.= ' FROM '.MAIN_DB_PREFIX.$this->table_element_line; $sql.= ' WHERE '.$this->fk_element.' = '.$this->id; if ($exclspec) @@ -2847,18 +2847,23 @@ abstract class CommonObject if (empty($reshook) && $forcedroundingmode == '0') // Check if data on line are consistent. This may solve lines that were not consistent because set with $forcedroundingmode='auto' { + // This part of code is to fix data. We should not call it too often. $localtax_array=array($obj->localtax1_type,$obj->localtax1_tx,$obj->localtax2_type,$obj->localtax2_tx); $tmpcal=calcul_price_total($obj->qty, $obj->up, $obj->remise_percent, $obj->vatrate, $obj->localtax1_tx, $obj->localtax2_tx, 0, 'HT', $obj->info_bits, $obj->product_type, $seller, $localtax_array, (isset($obj->situation_percent) ? $obj->situation_percent : 100), $multicurrency_tx); - $diff=price2num($tmpcal[1] - $obj->total_tva, 'MT', 1); - if ($diff) + + $diff_when_using_price_ht=price2num($tmpcal[1] - $obj->total_tva, 'MT', 1); // If price was set with tax price adn unit price HT has a low number of digits, then we may have a diff on recalculation from unit price HT. + $diff_on_current_total=price2num($obj->total_ttc - $obj->total_ht - $obj->total_tva - $obj->total_localtax1 - $obj->total_localtax2, 'MT', 1); + //var_dump($obj->total_ht.' '.$obj->total_tva.' '.$obj->total_localtax1.' '.$obj->total_localtax2.' =? '.$obj->total_ttc); + //var_dump($diff_when_using_price_ht.' '.$diff_on_current_total); + + if ($diff_when_using_price_ht && $diff_on_current_total) { $sqlfix="UPDATE ".MAIN_DB_PREFIX.$this->table_element_line." SET ".$fieldtva." = ".$tmpcal[1].", total_ttc = ".$tmpcal[2]." WHERE rowid = ".$obj->rowid; - dol_syslog('We found unconsistent data into detailed line (difference of '.$diff.') for line rowid = '.$obj->rowid." (total vat of line calculated=".$tmpcal[1].", database=".$obj->total_tva."). We fix the total_vat and total_ttc of line by running sqlfix = ".$sqlfix); - $resqlfix=$this->db->query($sqlfix); - if (! $resqlfix) dol_print_error($this->db, 'Failed to update line'); - $obj->total_tva = $tmpcal[1]; - $obj->total_ttc = $tmpcal[2]; - // + dol_syslog('We found unconsistent data into detailed line (diff_when_using_price_ht = '.$diff_when_using_price_ht.' and diff_on_current_total = '.$diff_on_current_total.') for line rowid = '.$obj->rowid." (total vat of line calculated=".$tmpcal[1].", database=".$obj->total_tva."). We fix the total_vat and total_ttc of line by running sqlfix = ".$sqlfix, LOG_WARNING); + $resqlfix=$this->db->query($sqlfix); + if (! $resqlfix) dol_print_error($this->db, 'Failed to update line'); + $obj->total_tva = $tmpcal[1]; + $obj->total_ttc = $tmpcal[2]; } } From 6798e9e6f5ab8862450ee9745b0017e8f08a5c68 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 24 Apr 2020 19:52:54 +0200 Subject: [PATCH 082/115] Fix remove warning missing the seller in update_price --- htdocs/fourn/class/fournisseur.facture.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index b62190686b3..e20a3f9e7de 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -1967,7 +1967,7 @@ class FactureFournisseur extends CommonInvoice $this->errors[] = $line->error; } else { // Update total price into invoice record - $res = $this->update_price('', 'auto'); + $res = $this->update_price('', 'auto', 0, $this->thirdparty); } return $res; From 9ed7ff80a1922e9882d57dc0b7a0a2c6097b837c Mon Sep 17 00:00:00 2001 From: Maxime Lecoq Date: Fri, 24 Apr 2020 21:08:47 +0200 Subject: [PATCH 083/115] FIX CUnit->fetch id/rowid --- htdocs/core/class/cunits.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/cunits.class.php b/htdocs/core/class/cunits.class.php index 65baf0056e9..a25250516f4 100644 --- a/htdocs/core/class/cunits.class.php +++ b/htdocs/core/class/cunits.class.php @@ -147,7 +147,7 @@ class CUnits // extends CommonObject /** * Load object in memory from database * - * @param int $id Id object + * @param int $id Id of CUnit object to fetch (rowid) * @param string $code Code * @param string $short_label Short Label ('g', 'kg', ...) * @param string $unit_type Unit type ('size', 'surface', 'volume', 'weight', ...) @@ -168,7 +168,7 @@ class CUnits // extends CommonObject $sql .= " t.active"; $sql .= " FROM ".MAIN_DB_PREFIX."c_units as t"; $sql_where = array(); - if ($id) $sql_where[] = " t.id = ".$id; + if ($id) $sql_where[] = " t.rowid = ".$id; if ($unit_type) $sql_where[] = " t.unit_type = '".$this->db->escape($unit_type)."'"; if ($code) $sql_where[] = " t.code = '".$this->db->escape($code)."'"; if ($short_label) $sql_where[] = " t.short_label = '".$this->db->escape($short_label)."'"; From 3ed11f374a9a8aabcb06753f58bf73ee93f0c1cc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 24 Apr 2020 23:56:57 +0200 Subject: [PATCH 084/115] Look and feel v12 --- htdocs/adherents/class/adherent.class.php | 3 + htdocs/core/lib/functions.lib.php | 13 +- htdocs/core/modules/modAsset.class.php | 2 +- htdocs/core/modules/modDon.class.php | 2 +- htdocs/don/card.php | 6 +- htdocs/don/class/don.class.php | 2 +- htdocs/don/document.php | 2 +- htdocs/don/index.php | 2 +- htdocs/don/info.php | 2 +- htdocs/don/list.php | 6 +- htdocs/don/note.php | 2 +- .../class/fournisseur.commande.class.php | 2 +- htdocs/index.php | 331 ++++++++---------- htdocs/product/class/product.class.php | 13 + htdocs/projet/class/project.class.php | 2 +- htdocs/user/class/user.class.php | 2 + 16 files changed, 189 insertions(+), 203 deletions(-) diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index dd2593329e0..55504a547c2 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -60,6 +60,9 @@ class Adherent extends CommonObject */ public $ismultientitymanaged = 1; + public $picto = 'member'; + + public $mesgs; /** diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 507ef0fef08..44ebb23fe93 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -3148,9 +3148,10 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ 'object_accounting', 'object_action', 'object_account', 'object_barcode', 'object_bom', 'object_category', 'object_bookmark', 'object_bug', 'object_dolly', 'object_dollyrevert', 'object_generic', 'object_folder', 'object_list-alt', 'object_calendar', 'object_calendarweek', 'object_calendarmonth', 'object_calendarday', 'object_calendarperuser', - 'object_cash-register', 'object_company', 'object_contact', 'object_contract', 'object_dynamicprice', + 'object_cash-register', 'object_company', 'object_contact', 'object_contract', 'object_donation', 'object_dynamicprice', 'object_holiday', 'object_hrm', 'object_intervention', 'object_money-bill-alt', 'object_multicurrency', 'object_order', 'object_payment', - 'object_lot', 'object_mrp', 'object_payment', 'object_product', 'object_propal', 'object_supplier_proposal', 'object_service', 'object_stock', + 'object_lot', 'object_mrp', 'object_payment', 'object_product', 'object_propal', + 'object_supplier_invoice', 'object_supplier_order', 'object_supplier_proposal', 'object_service', 'object_stock', 'object_paragraph', 'object_poll', 'object_printer', 'object_project', 'object_projectpub', 'object_propal', 'object_resource', 'object_rss', 'object_projecttask', 'object_technic', 'object_ticket', 'object_trip', 'object_user', 'object_group', 'object_member', 'object_other', 'object_phoning', 'object_phoning_mobile', 'object_phoning_fax', 'object_email', @@ -3178,7 +3179,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ $arrayconvpictotofa = array( 'account'=>'university', 'action'=>'calendar-alt', 'address'=> 'address-book', 'bank_account'=>'university', 'bom'=>'cubes', - 'company'=>'building', 'contact'=>'address-book', 'contract'=>'suitcase', 'dynamicprice'=>'hand-holding-usd', + 'company'=>'building', 'contact'=>'address-book', 'contract'=>'suitcase', 'donation'=>'file-medical', 'dynamicprice'=>'hand-holding-usd', 'setup'=>'cog', 'companies'=>'building', 'products'=>'cube', 'commercial'=>'suitcase', 'invoicing'=>'coins', 'accountancy'=>'money-check-alt', 'accounting'=>'chart-line', 'category'=>'tag', 'dollyrevert'=>'dolly', 'hrm'=>'umbrella-beach', 'members'=>'users', 'ticket'=>'ticket-alt', 'globe'=>'external-link-alt', 'lot'=>'barcode', @@ -3193,7 +3194,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ 'error'=>'exclamation-triangle', 'warning'=>'exclamation-triangle', 'other'=>'square', 'playdisabled'=>'play', 'poll'=>'check-double', 'preview'=>'binoculars', 'project'=>'sitemap', 'projectpub'=>'sitemap', 'projecttask'=>'tasks', 'propal'=>'file-signature', - 'resize'=>'crop', 'supplier_proposal'=>'file-signature', + 'resize'=>'crop', 'supplier_order'=>'dol-order_supplier', 'supplier_proposal'=>'file-signature', 'payment'=>'money-check-alt', 'phoning'=>'phone', 'phoning_mobile'=>'mobile-alt', 'phoning_fax'=>'fax', 'printer'=>'print', 'product'=>'cube', 'service'=>'concierge-bell', 'resource'=>'laptop-house', 'stock'=>'box-open', 'stats' => 'chart-bar', 'split'=>'code-branch', 'technic'=>'cogs', 'ticket'=>'ticket-alt', @@ -3249,7 +3250,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ // Add CSS $arrayconvpictotomorcess = array( 'action'=>'bg-infobox-action', 'account'=>'bg-infobox-bank_account', 'bank_account'=>'bg-infobox-bank_account', 'cash-register'=>'bg-infobox-bank_account', - 'contract'=>'bg-infobox-contrat', 'check'=>'font-status4', 'dollyrevert'=>'flip', 'ecm'=>'bg-infobox-action', + 'contract'=>'bg-infobox-contrat', 'check'=>'font-status4', 'donation'=>'bg-infobox-commande', 'dollyrevert'=>'flip', 'ecm'=>'bg-infobox-action', 'hrm'=>'bg-infobox-adherent', 'group'=>'bg-infobox-adherent', 'intervention'=>'bg-infobox-contrat', 'multicurrency'=>'bg-infobox-bank_account', 'members'=>'bg-infobox-adherent', 'member'=>'bg-infobox-adherent', 'money-bill-alt'=>'bg-infobox-bank_account', @@ -3258,7 +3259,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ 'error'=>'pictoerror', 'warning'=>'pictowarning', 'switch_on'=>'font-status4', 'holiday'=>'bg-infobox-holiday', 'payment'=>'bg-infobox-bank_account', 'poll'=>'bg-infobox-adherent', 'project'=>'bg-infobox-project', 'projecttask'=>'bg-infobox-project', 'propal'=>'bg-infobox-propal', - 'resource'=>'bg-infobox-action', 'supplier_proposal'=>'bg-infobox-supplier_proposal', + 'resource'=>'bg-infobox-action', 'supplier_order'=>'bg-infobox-order_supplier', 'supplier_proposal'=>'bg-infobox-supplier_proposal', 'ticket'=>'bg-infobox-contrat', 'title_hrm'=>'bg-infobox-holiday', 'trip'=>'bg-infobox-expensereport', 'title_agenda'=>'bg-infobox-action', 'list-alt'=>'imgforviewmode', 'calendar'=>'imgforviewmode', 'calendarweek'=>'imgforviewmode', 'calendarmonth'=>'imgforviewmode', 'calendarday'=>'imgforviewmode', 'calendarperuser'=>'imgforviewmode' ); diff --git a/htdocs/core/modules/modAsset.class.php b/htdocs/core/modules/modAsset.class.php index 1efeec1ff43..06e8521b4e5 100644 --- a/htdocs/core/modules/modAsset.class.php +++ b/htdocs/core/modules/modAsset.class.php @@ -69,7 +69,7 @@ class modAsset extends DolibarrModules // Name of image file used for this module. // If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue' // If file is in module/img directory under name object_pictovalue.png, use this->picto='pictovalue@module' - $this->picto = 'generic'; + $this->picto = 'accounting'; // Defined all module parts (triggers, login, substitutions, menus, css, etc...) // for default path (eg: /asset/core/xxxxx) (0=disable, 1=enable) diff --git a/htdocs/core/modules/modDon.class.php b/htdocs/core/modules/modDon.class.php index 003fd61b578..88b7400cc36 100644 --- a/htdocs/core/modules/modDon.class.php +++ b/htdocs/core/modules/modDon.class.php @@ -54,7 +54,7 @@ class modDon extends DolibarrModules $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); // Name of png file (without png) used for this module. // Png file must be in theme/yourtheme/img directory under name object_pictovalue.png. - $this->picto = 'bill'; + $this->picto = 'donation'; // Data directories to create when module is enabled $this->dirs = array("/don/temp"); diff --git a/htdocs/don/card.php b/htdocs/don/card.php index 4eb6123b305..505d2fbed29 100644 --- a/htdocs/don/card.php +++ b/htdocs/don/card.php @@ -318,7 +318,7 @@ if (!empty($conf->projet->enabled)) { $formproject = new FormProjets($db); } if ($action == 'create') { - print load_fiche_titre($langs->trans("AddDonation"), '', 'invoicing'); + print load_fiche_titre($langs->trans("AddDonation"), '', 'object_donation'); print '
'; print ''; @@ -500,7 +500,7 @@ if (!empty($id) && $action == 'edit') print ''; - dol_fiche_head($head, $hselected, $langs->trans("Donation"), 0, 'generic'); + dol_fiche_head($head, $hselected, $langs->trans("Donation"), 0, 'donation'); print '
'.$langs->trans('PaymentConditionsShortRetainedWarranty').' 
'.($title?$title:$langs->trans($confkey)); + print ''.($title ? $title : $langs->trans($confkey)); if (!empty($desc)) { print '
'.$langs->trans($desc).''; } @@ -206,14 +206,14 @@ function _printInputFormPart($confkey, $title = false, $desc = '', $metas = arra { global $langs, $conf, $db, $inputCount; - $inputCount = empty($inputCount)?1:($inputCount+1); - $form=new Form($db); + $inputCount = empty($inputCount) ? 1 : ($inputCount + 1); + $form = new Form($db); $defaultMetas = array( 'name' => 'value'.$inputCount ); - if ($type!='textarea') { + if ($type != 'textarea') { $defaultMetas['type'] = 'text'; $defaultMetas['value'] = $conf->global->{$confkey}; } @@ -229,9 +229,9 @@ function _printInputFormPart($confkey, $title = false, $desc = '', $metas = arra print '
'; if (!empty($help)) { - print $form->textwithtooltip(($title?$title:$langs->trans($confkey)), $langs->trans($help), 2, 1, img_help(1, '')); + print $form->textwithtooltip(($title ? $title : $langs->trans($confkey)), $langs->trans($help), 2, 1, img_help(1, '')); } else { - print $title?$title:$langs->trans($confkey); + print $title ? $title : $langs->trans($confkey); } if (!empty($desc)) { @@ -244,12 +244,12 @@ function _printInputFormPart($confkey, $title = false, $desc = '', $metas = arra print ''; print ''; - if ($type=='textarea') { + if ($type == 'textarea') { print ''; - }elseif($type=='input'){ + }elseif ($type == 'input') { print ''; } - else{ + else { // custom print $type; } diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index e5cfb1574dc..89801a357dd 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -140,8 +140,8 @@ $isdraft = (($object->statut == Facture::STATUS_DRAFT) ? 1 : 0); $result = restrictedArea($user, 'facture', $id, '', '', 'fk_soc', $fieldid, $isdraft); // retained warranty invoice available type -$retainedWarrantyInvoiceAvailableType=array(); -if(!empty($conf->global->INVOICE_USE_RETAINED_WARRANTY)) { +$retainedWarrantyInvoiceAvailableType = array(); +if (!empty($conf->global->INVOICE_USE_RETAINED_WARRANTY)) { $retainedWarrantyInvoiceAvailableType = explode('+', $conf->global->INVOICE_USE_RETAINED_WARRANTY); } @@ -952,7 +952,7 @@ if (empty($reshook)) } $discount->tva_tx = abs($tva_tx); - $discount->vat_src_code =$vat_src_code; + $discount->vat_src_code = $vat_src_code; $result = $discount->create($user); if ($result < 0) @@ -1362,11 +1362,11 @@ if (empty($reshook)) $object->situation_cycle_ref = $object->newCycle(); } - if(in_array($object->type, $retainedWarrantyInvoiceAvailableType)){ + if (in_array($object->type, $retainedWarrantyInvoiceAvailableType)) { $object->retained_warranty = GETPOST('retained_warranty', 'int'); $object->retained_warranty_fk_cond_reglement = GETPOST('retained_warranty_fk_cond_reglement', 'int'); } - else{ + else { $object->retained_warranty = 0; $object->retained_warranty_fk_cond_reglement = 0; } @@ -1772,15 +1772,15 @@ if (empty($reshook)) $object->origin_id = $originid; // retained warranty - if(!empty($conf->global->INVOICE_USE_RETAINED_WARRANTY)) + if (!empty($conf->global->INVOICE_USE_RETAINED_WARRANTY)) { $retained_warranty = GETPOST('retained_warranty', 'int'); - if(price2num($retained_warranty) > 0) + if (price2num($retained_warranty) > 0) { - $object->retained_warranty = price2num($retained_warranty); + $object->retained_warranty = price2num($retained_warranty); } - if(GETPOST('retained_warranty_fk_cond_reglement', 'int') > 0) + if (GETPOST('retained_warranty_fk_cond_reglement', 'int') > 0) { $object->retained_warranty_fk_cond_reglement = GETPOST('retained_warranty_fk_cond_reglement', 'int'); } @@ -2629,10 +2629,10 @@ if (empty($reshook)) $pa_ht = $originLine->pa_ht; $label = $originLine->label; $array_options = $originLine->array_options; - if($object->type == Facture::TYPE_SITUATION){ + if ($object->type == Facture::TYPE_SITUATION) { $situation_percent = 0; } - else{ + else { $situation_percent = 100; } $fk_prev_id = ''; @@ -3393,19 +3393,19 @@ if ($action == 'create') print '
'.$langs->trans('RetainedWarranty').''; print '%'; @@ -3413,11 +3413,11 @@ if ($action == 'create') // Retained warranty payment term print '
'.$langs->trans('PaymentConditionsShortRetainedWarranty').''; $retained_warranty_fk_cond_reglement = GETPOST('retained_warranty_fk_cond_reglement', 'int'); - if(empty($retained_warranty_fk_cond_reglement)){ + if (empty($retained_warranty_fk_cond_reglement)) { $retained_warranty_fk_cond_reglement = $conf->global->INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_COND_ID; - if(!empty($objectsrc->retained_warranty_fk_cond_reglement)){ // use previous situation value + if (!empty($objectsrc->retained_warranty_fk_cond_reglement)) { // use previous situation value $retained_warranty_fk_cond_reglement = $objectsrc->retained_warranty_fk_cond_reglement; - }else{ + } else { $retained_warranty_fk_cond_reglement = $conf->global->INVOICE_SITUATION_DEFAULT_RETAINED_WARRANTY_COND_ID; } } diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 62acafe4bf9..d872b02a35d 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -813,12 +813,12 @@ class Facture extends CommonInvoice $vatrate = $line->tva_tx; if ($line->vat_src_code && !preg_match('/\(.*\)/', $vatrate)) $vatrate .= ' ('.$line->vat_src_code.')'; - if(!empty($conf->global->MAIN_CREATEFROM_KEEP_LINE_ORIGIN_INFORMATION)) { - $originid=$line->origin_id; - $origintype=$line->origin; + if (!empty($conf->global->MAIN_CREATEFROM_KEEP_LINE_ORIGIN_INFORMATION)) { + $originid = $line->origin_id; + $origintype = $line->origin; } else { - $originid=$line->id; - $origintype=$this->element; + $originid = $line->id; + $origintype = $this->element; } $result = $this->addline( @@ -3734,44 +3734,44 @@ class Facture extends CommonInvoice } if (!empty($addon)) { - dol_syslog("Call getNextNumRef with " . $addonConstName . " = " . $conf->global->FACTURE_ADDON . ", thirdparty=" . $soc->nom . ", type=" . $soc->typent_code, LOG_DEBUG); + dol_syslog("Call getNextNumRef with ".$addonConstName." = ".$conf->global->FACTURE_ADDON.", thirdparty=".$soc->nom.", type=".$soc->typent_code, LOG_DEBUG); $mybool = false; - $file = $addon . '.php'; + $file = $addon.'.php'; $classname = $addon; // Include file with class $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); foreach ($dirmodels as $reldir) { - $dir = dol_buildpath($reldir . 'core/modules/' . $moduleName . '/'); + $dir = dol_buildpath($reldir.'core/modules/'.$moduleName.'/'); // Load file with numbering class (if found) - if (is_file($dir . $file) && is_readable($dir . $file)) { - $mybool |= include_once $dir . $file; + if (is_file($dir.$file) && is_readable($dir.$file)) { + $mybool |= include_once $dir.$file; } } // For compatibility if (!$mybool) { - $file = $addon . '/' . $addon . '.modules.php'; - $classname = 'mod_' . $moduleName . '_' . $addon; + $file = $addon.'/'.$addon.'.modules.php'; + $classname = 'mod_'.$moduleName.'_'.$addon; $classname = preg_replace('/\-.*$/', '', $classname); // Include file with class foreach ($conf->file->dol_document_root as $dirroot) { - $dir = $dirroot . '/core/modules/' . $moduleName . '/'; + $dir = $dirroot.'/core/modules/'.$moduleName.'/'; // Load file with numbering class (if found) - if (is_file($dir . $file) && is_readable($dir . $file)) { - $mybool |= include_once $dir . $file; + if (is_file($dir.$file) && is_readable($dir.$file)) { + $mybool |= include_once $dir.$file; } } } if (!$mybool) { - dol_print_error('', 'Failed to include file ' . $file); + dol_print_error('', 'Failed to include file '.$file); return ''; } @@ -3790,7 +3790,7 @@ class Facture extends CommonInvoice return $numref; } else { $langs->load('errors'); - print $langs->trans('Error') . ' ' . $langs->trans('ErrorModuleSetupNotComplete', $langs->transnoentitiesnoconv($moduleSourceName)); + print $langs->trans('Error').' '.$langs->trans('ErrorModuleSetupNotComplete', $langs->transnoentitiesnoconv($moduleSourceName)); return ''; } } @@ -4756,7 +4756,7 @@ class Facture extends CommonInvoice // note : we dont need to test INVOICE_USE_RETAINED_WARRANTY because if $this->retained_warranty is not empty it's because it was set when this conf was active $displayWarranty = false; - if(!empty($this->retained_warranty)) { + if (!empty($this->retained_warranty)) { $displayWarranty = true; if ($this->type == Facture::TYPE_SITUATION && !empty($conf->global->INVOICE_RETAINED_WARRANTY_LIMITED_TO_FINAL_SITUATION)) { @@ -4795,7 +4795,7 @@ class Facture extends CommonInvoice $retainedWarrantyAmount = 0; // Billed - retained warranty - if($this->type == Facture::TYPE_SITUATION && !empty($conf->global->INVOICE_RETAINED_WARRANTY_LIMITED_TO_FINAL_SITUATION)) + if ($this->type == Facture::TYPE_SITUATION && !empty($conf->global->INVOICE_RETAINED_WARRANTY_LIMITED_TO_FINAL_SITUATION)) { $displayWarranty = true; // Check if this situation invoice is 100% for real @@ -4835,7 +4835,7 @@ class Facture extends CommonInvoice $rounding = min($conf->global->MAIN_MAX_DECIMALS_UNIT, $conf->global->MAIN_MAX_DECIMALS_TOT); } - if($rounding>0){ + if ($rounding > 0) { return round($retainedWarrantyAmount, $rounding); } diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index 5c43f4f83a1..4bcfbafa9d8 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -365,7 +365,7 @@ abstract class CommonDocGenerator $remain_to_pay = $sumpayed - $sumdeposit - $sumcreditnote; if ($object->fk_account > 0) { - require_once DOL_DOCUMENT_ROOT .'/compta/bank/class/account.class.php'; + require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; $bank_account = new Account($this->db); $bank_account->fetch($object->fk_account); } diff --git a/htdocs/core/lib/website.lib.php b/htdocs/core/lib/website.lib.php index 2dcabbcafaa..76e910bdecd 100644 --- a/htdocs/core/lib/website.lib.php +++ b/htdocs/core/lib/website.lib.php @@ -352,7 +352,7 @@ function dolWebsiteOutput($content, $contenttype = 'html', $containerid = '') $content = str_replace(' contenteditable="true"', ' contenteditable="false"', $content); - if (! empty($conf->global->WEBSITE_ADD_CSS_TO_BODY)) { + if (!empty($conf->global->WEBSITE_ADD_CSS_TO_BODY)) { $content = str_replace('entity.")"; $resql = $this->db->query($sql); diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 4f4334e4125..e245ec2cf4e 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -4938,7 +4938,7 @@ class Product extends CommonObject { $filterStatus = '4'; if (isset($includedraftpoforvirtual)) $filterStatus = '0,'.$filterStatus; - $result = $this->load_stats_reception(0, $filterStatus, 1); // Use same tables than when module reception is not used. + $result = $this->load_stats_reception(0, $filterStatus, 1); // Use same tables than when module reception is not used. if ($result < 0) dol_print_error($this->db, $this->error); $stock_reception_fournisseur = $this->stats_reception['qty']; } diff --git a/htdocs/product/composition/card.php b/htdocs/product/composition/card.php index d57db91aa82..dbdb6cb6f42 100644 --- a/htdocs/product/composition/card.php +++ b/htdocs/product/composition/card.php @@ -64,14 +64,14 @@ if ($id > 0 || !empty($ref)) * Actions */ -if ($cancel) $action =''; +if ($cancel) $action = ''; // Action association d'un sousproduit if ($action == 'add_prod' && ($user->rights->produit->creer || $user->rights->service->creer)) { - $error=0; + $error = 0; $maxprod = GETPOST("max_prod", 'int'); - for ($i=0; $i < $maxprod; $i++) + for ($i = 0; $i < $maxprod; $i++) { $qty = price2num(GETPOST("prod_qty_".$i, 'alpha'), 'MS'); if ($qty > 0) @@ -109,13 +109,13 @@ if ($action == 'add_prod' && ($user->rights->produit->creer || $user->rights->se } } - if (! $error) + if (!$error) { header("Location: ".$_SERVER["PHP_SELF"].'?id='.$object->id); exit; } } -elseif($action==='save_composed_product') +elseif ($action === 'save_composed_product') { $TProduct = GETPOST('TProduct', 'array'); if (!empty($TProduct)) @@ -540,38 +540,38 @@ if ($id > 0 || !empty($ref)) if ($resql) { $num = $db->num_rows($resql); - $i=0; + $i = 0; - if($num == 0) print '
'.$langs->trans("NoMatchFound").'
'.$langs->trans("NoMatchFound").'
'; @@ -629,7 +629,7 @@ if (!empty($id) && $action != 'edit') $hselected = 'card'; $head = donation_prepare_head($object); - dol_fiche_head($head, $hselected, $langs->trans("Donation"), -1, 'generic'); + dol_fiche_head($head, $hselected, $langs->trans("Donation"), -1, 'donation'); // Print form confirm print $formconfirm; diff --git a/htdocs/don/class/don.class.php b/htdocs/don/class/don.class.php index 102d7e58685..bbd2a9b4577 100644 --- a/htdocs/don/class/don.class.php +++ b/htdocs/don/class/don.class.php @@ -60,7 +60,7 @@ class Don extends CommonObject /** * @var string String with name of icon for object don. Must be the part after the 'object_' into object_myobject.png */ - public $picto = 'generic'; + public $picto = 'donation'; /** * @var string Date of the donation diff --git a/htdocs/don/document.php b/htdocs/don/document.php index dcb245e3e85..f2994b95577 100644 --- a/htdocs/don/document.php +++ b/htdocs/don/document.php @@ -104,7 +104,7 @@ if ($object->id) $head = donation_prepare_head($object); - dol_fiche_head($head, 'documents', $langs->trans("Donation"), -1, 'generic'); + dol_fiche_head($head, 'documents', $langs->trans("Donation"), -1, 'donation'); // Build file list diff --git a/htdocs/don/index.php b/htdocs/don/index.php index 3f74cfa53a1..d8df1f910fc 100644 --- a/htdocs/don/index.php +++ b/htdocs/don/index.php @@ -85,7 +85,7 @@ if ($result) dol_print_error($db); } -print load_fiche_titre($langs->trans("DonationsArea"), '', 'invoicing'); +print load_fiche_titre($langs->trans("DonationsArea"), '', 'object_donation'); print '
'; diff --git a/htdocs/don/info.php b/htdocs/don/info.php index cff4aceae79..170c577dc00 100644 --- a/htdocs/don/info.php +++ b/htdocs/don/info.php @@ -67,7 +67,7 @@ $object->info($id); $head = donation_prepare_head($object); -dol_fiche_head($head, 'info', $langs->trans("Donation"), -1, 'generic'); +dol_fiche_head($head, 'info', $langs->trans("Donation"), -1, 'donation'); $linkback = ''.$langs->trans("BackToList").''; diff --git a/htdocs/don/list.php b/htdocs/don/list.php index cd0d0539f8f..65ec24b1458 100644 --- a/htdocs/don/list.php +++ b/htdocs/don/list.php @@ -77,17 +77,17 @@ $fieldstosearchall = array( 'd.firstname'=>'Firstname', ); + /* * View */ +$donationstatic = new Don($db); $form = new Form($db); if (!empty($conf->projet->enabled)) $projectstatic = new Project($db); llxHeader('', $langs->trans("Donations"), 'EN:Module_Donations|FR:Module_Dons|ES:Módulo_Donaciones'); -$donationstatic = new Don($db); - // Genere requete de liste des dons $sql = "SELECT d.rowid, d.datedon, d.fk_soc as socid, d.firstname, d.lastname, d.societe,"; $sql .= " d.amount, d.fk_statut as status,"; @@ -163,7 +163,7 @@ if ($resql) print ''; print ''; - print_barre_liste($langs->trans("Donations"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'invoicing', 0, $newcardbutton, '', $limit, 0, 0, 1); + print_barre_liste($langs->trans("Donations"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'object_donation', 0, $newcardbutton, '', $limit, 0, 0, 1); if ($search_all) { diff --git a/htdocs/don/note.php b/htdocs/don/note.php index 08b8c05b520..111ea2399a3 100644 --- a/htdocs/don/note.php +++ b/htdocs/don/note.php @@ -83,7 +83,7 @@ if ($id > 0 || !empty($ref)) $head = donation_prepare_head($object); - dol_fiche_head($head, 'note', $langs->trans("Donation"), -1, 'generic'); + dol_fiche_head($head, 'note', $langs->trans("Donation"), -1, 'donation'); $linkback = ''.$langs->trans("BackToList").''; diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 3784b3a9c6a..faf0b76ce33 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -65,7 +65,7 @@ class CommandeFournisseur extends CommonOrder /** * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png */ - public $picto = 'order'; + public $picto = 'supplier_order'; /** * 0=No test on entity, 1=Test with field entity, 2=Test with link by societe diff --git a/htdocs/index.php b/htdocs/index.php index 850a6c3a932..cfa927ef9b1 100644 --- a/htdocs/index.php +++ b/htdocs/index.php @@ -125,212 +125,178 @@ if (empty($user->socid) && empty($conf->global->MAIN_DISABLE_GLOBAL_BOXSTATS)) if (empty($reshook)) { + // Cle array returned by the method load_state_board for each line + $keys = array( + 'users', + 'members', + 'expensereports', + 'holidays', + 'customers', + 'prospects', + 'suppliers', + 'contacts', + 'products', + 'services', + 'projects', + 'proposals', + 'orders', + 'invoices', + 'donations', + 'contracts', + 'interventions', + 'supplier_orders', + 'supplier_invoices', + 'supplier_proposals', + 'ticket' + ); + // Condition to be checked for each display line dashboard $conditions = array( - $user->rights->user->user->lire, - !empty($conf->societe->enabled) && $user->rights->societe->lire && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS_STATS), - !empty($conf->societe->enabled) && $user->rights->societe->lire && empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS_STATS), - !empty($conf->fournisseur->enabled) && $user->rights->fournisseur->lire && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_STATS), - !empty($conf->societe->enabled) && $user->rights->societe->contact->lire, - !empty($conf->adherent->enabled) && $user->rights->adherent->lire, - !empty($conf->product->enabled) && $user->rights->produit->lire, - !empty($conf->service->enabled) && $user->rights->service->lire, - !empty($conf->propal->enabled) && $user->rights->propale->lire, - !empty($conf->commande->enabled) && $user->rights->commande->lire, - !empty($conf->facture->enabled) && $user->rights->facture->lire, - !empty($conf->contrat->enabled) && $user->rights->contrat->lire, - !empty($conf->ficheinter->enabled) && $user->rights->ficheinter->lire, - !empty($conf->supplier_order->enabled) && $user->rights->fournisseur->commande->lire && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_ORDERS_STATS), - !empty($conf->supplier_invoice->enabled) && $user->rights->fournisseur->facture->lire && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_INVOICES_STATS), - !empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposal->lire && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_PROPOSAL_STATS), - !empty($conf->projet->enabled) && $user->rights->projet->lire, - !empty($conf->expensereport->enabled) && $user->rights->expensereport->lire, - !empty($conf->holiday->enabled) && $user->rights->holiday->read, - !empty($conf->don->enabled) && $user->rights->don->lire, - !empty($conf->ticket->enabled) && $user->rights->ticket->read + 'users' => $user->rights->user->user->lire, + 'members' => !empty($conf->societe->enabled) && $user->rights->societe->lire && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS_STATS), + 'customers' => !empty($conf->societe->enabled) && $user->rights->societe->lire && empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS_STATS), + 'prospects' => !empty($conf->fournisseur->enabled) && $user->rights->fournisseur->lire && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_STATS), + 'suppliers' => !empty($conf->societe->enabled) && $user->rights->societe->contact->lire, + 'contacts' => !empty($conf->adherent->enabled) && $user->rights->adherent->lire, + 'products' => !empty($conf->product->enabled) && $user->rights->produit->lire, + 'services' => !empty($conf->service->enabled) && $user->rights->service->lire, + 'proposals' => !empty($conf->propal->enabled) && $user->rights->propale->lire, + 'orders' => !empty($conf->commande->enabled) && $user->rights->commande->lire, + 'invoices' => !empty($conf->facture->enabled) && $user->rights->facture->lire, + 'donations' => !empty($conf->don->enabled) && $user->rights->don->lire, + 'contracts' => !empty($conf->contrat->enabled) && $user->rights->contrat->lire, + 'interventions' => !empty($conf->ficheinter->enabled) && $user->rights->ficheinter->lire, + 'supplier_orders' => !empty($conf->supplier_order->enabled) && $user->rights->fournisseur->commande->lire && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_ORDERS_STATS), + 'supplier_invoices' => !empty($conf->supplier_invoice->enabled) && $user->rights->fournisseur->facture->lire && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_INVOICES_STATS), + 'supplier_proposals' => !empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposal->lire && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_PROPOSAL_STATS), + 'projects' => !empty($conf->projet->enabled) && $user->rights->projet->lire, + 'expensereports' => !empty($conf->expensereport->enabled) && $user->rights->expensereport->lire, + 'holidays' => !empty($conf->holiday->enabled) && $user->rights->holiday->read, + 'ticket' => !empty($conf->ticket->enabled) && $user->rights->ticket->read ); // Class file containing the method load_state_board for each line $includes = array( - DOL_DOCUMENT_ROOT."/user/class/user.class.php", - DOL_DOCUMENT_ROOT."/adherents/class/adherent.class.php", - DOL_DOCUMENT_ROOT."/societe/class/client.class.php", - DOL_DOCUMENT_ROOT."/societe/class/client.class.php", - DOL_DOCUMENT_ROOT."/fourn/class/fournisseur.class.php", - DOL_DOCUMENT_ROOT."/contact/class/contact.class.php", - DOL_DOCUMENT_ROOT."/product/class/product.class.php", - DOL_DOCUMENT_ROOT."/product/class/product.class.php", - DOL_DOCUMENT_ROOT."/comm/propal/class/propal.class.php", - DOL_DOCUMENT_ROOT."/commande/class/commande.class.php", - DOL_DOCUMENT_ROOT."/compta/facture/class/facture.class.php", - DOL_DOCUMENT_ROOT."/don/class/don.class.php", - DOL_DOCUMENT_ROOT."/contrat/class/contrat.class.php", - DOL_DOCUMENT_ROOT."/fichinter/class/fichinter.class.php", - DOL_DOCUMENT_ROOT."/fourn/class/fournisseur.commande.class.php", - DOL_DOCUMENT_ROOT."/fourn/class/fournisseur.facture.class.php", - DOL_DOCUMENT_ROOT."/supplier_proposal/class/supplier_proposal.class.php", - DOL_DOCUMENT_ROOT."/projet/class/project.class.php", - DOL_DOCUMENT_ROOT."/expensereport/class/expensereport.class.php", - DOL_DOCUMENT_ROOT."/holiday/class/holiday.class.php", - DOL_DOCUMENT_ROOT."/ticket/class/ticket.class.php" + 'users' => DOL_DOCUMENT_ROOT."/user/class/user.class.php", + 'members' => DOL_DOCUMENT_ROOT."/adherents/class/adherent.class.php", + 'customers' => DOL_DOCUMENT_ROOT."/societe/class/client.class.php", + 'prospects' => DOL_DOCUMENT_ROOT."/societe/class/client.class.php", + 'suppliers' => DOL_DOCUMENT_ROOT."/fourn/class/fournisseur.class.php", + 'contacts' => DOL_DOCUMENT_ROOT."/contact/class/contact.class.php", + 'products' => DOL_DOCUMENT_ROOT."/product/class/product.class.php", + 'services' => DOL_DOCUMENT_ROOT."/product/class/product.class.php", + 'proposals' => DOL_DOCUMENT_ROOT."/comm/propal/class/propal.class.php", + 'orders' => DOL_DOCUMENT_ROOT."/commande/class/commande.class.php", + 'invoices' => DOL_DOCUMENT_ROOT."/compta/facture/class/facture.class.php", + 'donations' => DOL_DOCUMENT_ROOT."/don/class/don.class.php", + 'contracts' => DOL_DOCUMENT_ROOT."/contrat/class/contrat.class.php", + 'interventions' => DOL_DOCUMENT_ROOT."/fichinter/class/fichinter.class.php", + 'supplier_orders' => DOL_DOCUMENT_ROOT."/fourn/class/fournisseur.commande.class.php", + 'supplier_invoices' => DOL_DOCUMENT_ROOT."/fourn/class/fournisseur.facture.class.php", + 'supplier_proposals' => DOL_DOCUMENT_ROOT."/supplier_proposal/class/supplier_proposal.class.php", + 'projects' => DOL_DOCUMENT_ROOT."/projet/class/project.class.php", + 'expensereports' => DOL_DOCUMENT_ROOT."/expensereport/class/expensereport.class.php", + 'holidays' => DOL_DOCUMENT_ROOT."/holiday/class/holiday.class.php", + 'ticket' => DOL_DOCUMENT_ROOT."/ticket/class/ticket.class.php" ); // Name class containing the method load_state_board for each line $classes = array( - 'User', - 'Adherent', - 'Client', - 'Client', - 'Fournisseur', - 'Contact', - 'Product', - 'Product', - 'Propal', - 'Commande', - 'Facture', - 'Don', - 'Contrat', - 'Fichinter', - 'CommandeFournisseur', - 'FactureFournisseur', - 'SupplierProposal', - 'Project', - 'ExpenseReport', - 'Holiday', - 'Ticket', - ); - // Cle array returned by the method load_state_board for each line - $keys = array( - 'users', - 'members', - 'customers', - 'prospects', - 'suppliers', - 'contacts', - 'products', - 'services', - 'proposals', - 'orders', - 'invoices', - 'donations', - 'contracts', - 'interventions', - 'supplier_orders', - 'supplier_invoices', - 'askprice', - 'projects', - 'expensereports', - 'holidays', - 'ticket' - ); - // Dashboard Icon lines - $icons = array( - 'user', - 'user', - 'company', - 'company', - 'company', - 'contact', - 'product', - 'service', - 'propal', - 'order', - 'bill', - 'generic', - 'contract', - 'intervention', - 'order', - 'bill', - 'propal', - 'project', - 'trip', - 'holiday', - 'ticket', + 'users' => 'User', + 'members' => 'Adherent', + 'customers' => 'Client', + 'prospects' => 'Client', + 'suppliers' => 'Fournisseur', + 'contacts' => 'Contact', + 'products' => 'Product', + 'services' => 'Service', + 'proposals' => 'Propal', + 'orders' => 'Commande', + 'invoices' => 'Facture', + 'donations' => 'Don', + 'contracts' => 'Contrat', + 'interventions' => 'Fichinter', + 'supplier_orders' => 'CommandeFournisseur', + 'supplier_invoices' => 'FactureFournisseur', + 'supplier_proposals' => 'SupplierProposal', + 'projects' => 'Project', + 'expensereports' => 'ExpenseReport', + 'holidays' => 'Holiday', + 'ticket' => 'Ticket', ); // Translation keyword $titres = array( - "Users", - "Members", - "ThirdPartyCustomersStats", - "ThirdPartyProspectsStats", - "Suppliers", - "Contacts", - "Products", - "Services", - "CommercialProposalsShort", - "CustomersOrders", - "BillsCustomers", - "Donations", - "Contracts", - "Interventions", - "SuppliersOrders", - "SuppliersInvoices", - "SupplierProposalShort", - "Projects", - "ExpenseReports", - "Holidays", - "Ticket", + 'users' => "Users", + 'members' => "Members", + 'customers' => "ThirdPartyCustomersStats", + 'prospects' => "ThirdPartyProspectsStats", + 'suppliers' => "Suppliers", + 'contacts' => "Contacts", + 'products' => "Products", + 'services' => "Services", + 'proposals' => "CommercialProposalsShort", + 'orders' => "CustomersOrders", + 'invoices' => "BillsCustomers", + 'donations' => "Donations", + 'contracts' => "Contracts", + 'interventions' => "Interventions", + 'supplier_orders' => "SuppliersOrders", + 'supplier_invoices' => "SuppliersInvoices", + 'supplier_proposals' => "SupplierProposalShort", + 'projects' => "Projects", + 'expensereports' => "ExpenseReports", + 'holidays' => "Holidays", + 'ticket' => "Ticket", ); // Dashboard Link lines $links = array( - DOL_URL_ROOT.'/user/list.php', - DOL_URL_ROOT.'/adherents/list.php?statut=1&mainmenu=members', - DOL_URL_ROOT.'/societe/list.php?type=c&mainmenu=companies', - DOL_URL_ROOT.'/societe/list.php?type=p&mainmenu=companies', - DOL_URL_ROOT.'/societe/list.php?type=f&mainmenu=companies', - DOL_URL_ROOT.'/contact/list.php?mainmenu=companies', - DOL_URL_ROOT.'/product/list.php?type=0&mainmenu=products', - DOL_URL_ROOT.'/product/list.php?type=1&mainmenu=products', - DOL_URL_ROOT.'/comm/propal/list.php?mainmenu=commercial&leftmenu=propals', - DOL_URL_ROOT.'/commande/list.php?mainmenu=commercial&leftmenu=orders', - DOL_URL_ROOT.'/compta/facture/list.php?mainmenu=billing&leftmenu=customers_bills', - DOL_URL_ROOT.'/don/list.php?leftmenu=donations', - DOL_URL_ROOT.'/contrat/list.php?mainmenu=commercial&leftmenu=contracts', - DOL_URL_ROOT.'/fichinter/list.php?mainmenu=commercial&leftmenu=ficheinter', - DOL_URL_ROOT.'/fourn/commande/list.php?mainmenu=commercial&leftmenu=orders_suppliers', - DOL_URL_ROOT.'/fourn/facture/list.php?mainmenu=billing&leftmenu=suppliers_bills', - DOL_URL_ROOT.'/supplier_proposal/list.php?mainmenu=commercial&leftmenu=', - DOL_URL_ROOT.'/projet/list.php?mainmenu=project', - DOL_URL_ROOT.'/expensereport/list.php?mainmenu=hrm&leftmenu=expensereport', - DOL_URL_ROOT.'/holiday/list.php?mainmenu=hrm&leftmenu=holiday', - DOL_URL_ROOT.'/ticket/list.php?leftmenu=ticket' + 'users' => DOL_URL_ROOT.'/user/list.php', + 'members' => DOL_URL_ROOT.'/adherents/list.php?statut=1&mainmenu=members', + 'customers' => DOL_URL_ROOT.'/societe/list.php?type=c&mainmenu=companies', + 'prospects' => DOL_URL_ROOT.'/societe/list.php?type=p&mainmenu=companies', + 'suppliers' => DOL_URL_ROOT.'/societe/list.php?type=f&mainmenu=companies', + 'contacts' => DOL_URL_ROOT.'/contact/list.php?mainmenu=companies', + 'products' => DOL_URL_ROOT.'/product/list.php?type=0&mainmenu=products', + 'services' => DOL_URL_ROOT.'/product/list.php?type=1&mainmenu=products', + 'proposals' => DOL_URL_ROOT.'/comm/propal/list.php?mainmenu=commercial&leftmenu=propals', + 'orders' => DOL_URL_ROOT.'/commande/list.php?mainmenu=commercial&leftmenu=orders', + 'invoices' => DOL_URL_ROOT.'/compta/facture/list.php?mainmenu=billing&leftmenu=customers_bills', + 'donations' => DOL_URL_ROOT.'/don/list.php?leftmenu=donations', + 'contracts' => DOL_URL_ROOT.'/contrat/list.php?mainmenu=commercial&leftmenu=contracts', + 'interventions' => DOL_URL_ROOT.'/fichinter/list.php?mainmenu=commercial&leftmenu=ficheinter', + 'supplier_orders' => DOL_URL_ROOT.'/fourn/commande/list.php?mainmenu=commercial&leftmenu=orders_suppliers', + 'supplier_invoices' => DOL_URL_ROOT.'/fourn/facture/list.php?mainmenu=billing&leftmenu=suppliers_bills', + 'supplier_proposals' => DOL_URL_ROOT.'/supplier_proposal/list.php?mainmenu=commercial&leftmenu=', + 'projects' => DOL_URL_ROOT.'/projet/list.php?mainmenu=project', + 'expensereports' => DOL_URL_ROOT.'/expensereport/list.php?mainmenu=hrm&leftmenu=expensereport', + 'holidays' => DOL_URL_ROOT.'/holiday/list.php?mainmenu=hrm&leftmenu=holiday', + 'ticket' => DOL_URL_ROOT.'/ticket/list.php?leftmenu=ticket' ); // Translation lang files $langfile = array( - "users", - "members", - "companies", - "prospects", - "suppliers", - "companies", - "products", - "products", - "propal", - "orders", - "bills", - "donations", - "contracts", - "interventions", - "bills", - "bills", - "supplier_proposal", - "projects", - "trips", - "holiday", - "ticket" + 'customers' => "companies", + 'contacts' => "companies", + 'services' => "products", + 'proposals' => "propal", + 'invoices' => "bills", + 'supplier_orders' => "orders", + 'supplier_invoices' => "bills", + 'supplier_proposals' => 'supplier_proposal', + 'expensereports' => "trips", + 'holidays' => "holiday", ); // Loop and displays each line of table $boardloaded = array(); - foreach ($keys as $key => $val) + foreach ($keys as $val) { - if ($conditions[$key]) + if ($conditions[$val]) { $boxstatItem = ''; - $classe = $classes[$key]; + $classe = $classes[$val]; // Search in cache if load_state_board is already realized if (!isset($boardloaded[$classe]) || !is_object($boardloaded[$classe])) { - include_once $includes[$key]; // Loading a class cost around 1Mb + include_once $includes[$val]; // Loading a class cost around 1Mb $board = new $classe($db); $board->load_state_board($user); @@ -341,12 +307,13 @@ if (empty($user->socid) && empty($conf->global->MAIN_DISABLE_GLOBAL_BOXSTATS)) $board = $boardloaded[$classe]; } - if (!empty($langfile[$key])) $langs->load($langfile[$key]); - $text = $langs->trans($titres[$key]); - $boxstatItem .= ''; + $langs->load(empty($langfile[$val]) ? $val : $langfile[$val]); + + $text = $langs->trans($titres[$val]); + $boxstatItem .= ''; $boxstatItem .= '
'; $boxstatItem .= ''.$text.'
'; - $boxstatItem .= ''.img_object("", $icons[$key], 'class="inline-block"').' '.($board->nb[$val] ? $board->nb[$val] : 0).''; + $boxstatItem .= ''.img_object("", $board->picto, 'class="inline-block"').' '.($board->nb[$val] ? $board->nb[$val] : 0).''; $boxstatItem .= '
'; $boxstatItem .= '
'; diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index e245ec2cf4e..336c6b85fa4 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -71,6 +71,9 @@ class Product extends CommonObject */ public $ismultientitymanaged = 1; + + public $picto = 'product'; + /** * {@inheritdoc} */ @@ -5632,3 +5635,13 @@ class Product extends CommonObject } } } + + + +/** + * Class to manage products or services + */ +class Service extends Product +{ + public $picto = 'service'; +} diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index 674db2cc5d6..1ee17511304 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -68,7 +68,7 @@ class Project extends CommonObject /** * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png */ - public $picto = 'projectpub'; + public $picto = 'project'; /** * {@inheritdoc} diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 24bf871af1f..23d42ba3e65 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -64,6 +64,8 @@ class User extends CommonObject */ public $ismultientitymanaged = 1; + public $picto = 'user'; + public $id = 0; public $statut; public $ldap_sid; From 291664d1099e1e90f7b8e3126a66fa36502f194d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 25 Apr 2020 01:04:26 +0200 Subject: [PATCH 085/115] Look and feel v12 --- htdocs/compta/localtax/list.php | 2 +- htdocs/core/lib/functions.lib.php | 17 +++++++++-------- .../fourn/class/fournisseur.facture.class.php | 2 +- htdocs/fourn/class/paiementfourn.class.php | 5 ++++- htdocs/fourn/facture/paiement.php | 12 ++++++++++-- 5 files changed, 25 insertions(+), 13 deletions(-) diff --git a/htdocs/compta/localtax/list.php b/htdocs/compta/localtax/list.php index 911eb7e88f3..47a0f44be47 100644 --- a/htdocs/compta/localtax/list.php +++ b/htdocs/compta/localtax/list.php @@ -48,7 +48,7 @@ if ($user->rights->tax->charges->creer) $newcardbutton .= dolGetButtonTitle($langs->trans('NewLocalTaxPayment', ($ltt + 1)), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/compta/localtax/card.php?action=create&localTaxType='.$ltt); } -print load_fiche_titre($langs->transcountry($ltt == 2 ? "LT2Payments" : "LT1Payments", $mysoc->country_code), $newcardbutton, 'invoicing'); +print load_fiche_titre($langs->transcountry($ltt == 2 ? "LT2Payments" : "LT1Payments", $mysoc->country_code), $newcardbutton, 'title_accountancy'); $sql = "SELECT rowid, amount, label, f.datev, f.datep"; $sql .= " FROM ".MAIN_DB_PREFIX."localtax as f "; diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 44ebb23fe93..13727fe8669 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -3141,11 +3141,11 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ if (empty($srconly) && in_array($pictowithouttext, array( '1downarrow', '1uparrow', '1leftarrow', '1rightarrow', '1uparrow_selected', '1downarrow_selected', '1leftarrow_selected', '1rightarrow_selected', - 'address', 'bank_account', 'barcode', 'bank', 'bookmark', 'bom', 'building', 'cash-register', 'check', 'close_title', 'company', 'contact', 'cubes', + 'address', 'bank_account', 'barcode', 'bank', 'bill', 'bookmark', 'bom', 'building', 'cash-register', 'check', 'close_title', 'company', 'contact', 'cubes', 'delete', 'dolly', 'dollyrevert', 'edit', 'ellipsis-h', 'external-link-alt', 'external-link-square-alt', 'filter', 'file-code', 'file-export', 'file-import', 'file-upload', 'folder', 'folder-open', 'globe', 'globe-americas', 'grip', 'grip_title', 'help', 'language', 'list', 'listlight', 'lot', 'map-marker-alt', 'money-bill-alt', 'mrp', 'note', 'stock', - 'object_accounting', 'object_action', 'object_account', 'object_barcode', 'object_bom', + 'object_accounting', 'object_action', 'object_account', 'object_barcode', 'object_bill', 'object_bom', 'object_category', 'object_bookmark', 'object_bug', 'object_dolly', 'object_dollyrevert', 'object_generic', 'object_folder', 'object_list-alt', 'object_calendar', 'object_calendarweek', 'object_calendarmonth', 'object_calendarday', 'object_calendarperuser', 'object_cash-register', 'object_company', 'object_contact', 'object_contract', 'object_donation', 'object_dynamicprice', @@ -3178,7 +3178,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ $pictowithouttext = str_replace('object_', '', $pictowithouttext); $arrayconvpictotofa = array( - 'account'=>'university', 'action'=>'calendar-alt', 'address'=> 'address-book', 'bank_account'=>'university', 'bom'=>'cubes', + 'account'=>'university', 'action'=>'calendar-alt', 'address'=> 'address-book', 'bank_account'=>'university', 'bill'=>'file-invoice-dollar', 'bom'=>'cubes', 'company'=>'building', 'contact'=>'address-book', 'contract'=>'suitcase', 'donation'=>'file-medical', 'dynamicprice'=>'hand-holding-usd', 'setup'=>'cog', 'companies'=>'building', 'products'=>'cube', 'commercial'=>'suitcase', 'invoicing'=>'coins', 'accountancy'=>'money-check-alt', 'accounting'=>'chart-line', 'category'=>'tag', 'dollyrevert'=>'dolly', @@ -3197,7 +3197,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ 'resize'=>'crop', 'supplier_order'=>'dol-order_supplier', 'supplier_proposal'=>'file-signature', 'payment'=>'money-check-alt', 'phoning'=>'phone', 'phoning_mobile'=>'mobile-alt', 'phoning_fax'=>'fax', 'printer'=>'print', 'product'=>'cube', 'service'=>'concierge-bell', 'resource'=>'laptop-house', - 'stock'=>'box-open', 'stats' => 'chart-bar', 'split'=>'code-branch', 'technic'=>'cogs', 'ticket'=>'ticket-alt', + 'stock'=>'box-open', 'stats' => 'chart-bar', 'split'=>'code-branch', 'supplier_invoice'=>'file-invoice-dollar', 'technic'=>'cogs', 'ticket'=>'ticket-alt', 'title_setup'=>'tools', 'title_accountancy'=>'money-check-alt', 'title_bank'=>'university', 'title_hrm'=>'umbrella-beach', 'title_agenda'=>'calendar-alt', 'uparrow'=>'mail-forward', @@ -3249,8 +3249,9 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ // Add CSS $arrayconvpictotomorcess = array( - 'action'=>'bg-infobox-action', 'account'=>'bg-infobox-bank_account', 'bank_account'=>'bg-infobox-bank_account', 'cash-register'=>'bg-infobox-bank_account', - 'contract'=>'bg-infobox-contrat', 'check'=>'font-status4', 'donation'=>'bg-infobox-commande', 'dollyrevert'=>'flip', 'ecm'=>'bg-infobox-action', + 'action'=>'bg-infobox-action', 'account'=>'bg-infobox-bank_account', 'bank_account'=>'bg-infobox-bank_account', 'bill'=>'bg-infobox-commande', + 'cash-register'=>'bg-infobox-bank_account', 'contract'=>'bg-infobox-contrat', 'check'=>'font-status4', + 'donation'=>'bg-infobox-commande', 'dollyrevert'=>'flip', 'ecm'=>'bg-infobox-action', 'hrm'=>'bg-infobox-adherent', 'group'=>'bg-infobox-adherent', 'intervention'=>'bg-infobox-contrat', 'multicurrency'=>'bg-infobox-bank_account', 'members'=>'bg-infobox-adherent', 'member'=>'bg-infobox-adherent', 'money-bill-alt'=>'bg-infobox-bank_account', @@ -3259,8 +3260,8 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ 'error'=>'pictoerror', 'warning'=>'pictowarning', 'switch_on'=>'font-status4', 'holiday'=>'bg-infobox-holiday', 'payment'=>'bg-infobox-bank_account', 'poll'=>'bg-infobox-adherent', 'project'=>'bg-infobox-project', 'projecttask'=>'bg-infobox-project', 'propal'=>'bg-infobox-propal', - 'resource'=>'bg-infobox-action', 'supplier_order'=>'bg-infobox-order_supplier', 'supplier_proposal'=>'bg-infobox-supplier_proposal', - 'ticket'=>'bg-infobox-contrat', 'title_hrm'=>'bg-infobox-holiday', 'trip'=>'bg-infobox-expensereport', 'title_agenda'=>'bg-infobox-action', + 'resource'=>'bg-infobox-action', 'supplier_invoice'=>'bg-infobox-order_supplier', 'supplier_order'=>'bg-infobox-order_supplier', 'supplier_proposal'=>'bg-infobox-supplier_proposal', + 'ticket'=>'bg-infobox-contrat', 'title_accountancy'=>'bg-infobox-bank_account', 'title_hrm'=>'bg-infobox-holiday', 'trip'=>'bg-infobox-expensereport', 'title_agenda'=>'bg-infobox-action', 'list-alt'=>'imgforviewmode', 'calendar'=>'imgforviewmode', 'calendarweek'=>'imgforviewmode', 'calendarmonth'=>'imgforviewmode', 'calendarday'=>'imgforviewmode', 'calendarperuser'=>'imgforviewmode' ); if (!empty($arrayconvpictotomorcess[$pictowithouttext])) { diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index ba0bcfb052c..52c5f15abd3 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -66,7 +66,7 @@ class FactureFournisseur extends CommonInvoice /** * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png */ - public $picto = 'bill'; + public $picto = 'supplier_invoice'; /** * 0=No test on entity, 1=Test with field entity, 2=Test with link by societe diff --git a/htdocs/fourn/class/paiementfourn.class.php b/htdocs/fourn/class/paiementfourn.class.php index ace596b6bb4..a95aefede0f 100644 --- a/htdocs/fourn/class/paiementfourn.class.php +++ b/htdocs/fourn/class/paiementfourn.class.php @@ -67,6 +67,8 @@ class PaiementFourn extends Paiement */ public $type_code; + + /** * Constructor * @@ -583,13 +585,14 @@ class PaiementFourn extends Paiement $result = ''; $text = $this->ref; // Sometimes ref contains label + $reg = array(); if (preg_match('/^\((.*)\)$/i', $text, $reg)) { // Label generique car entre parentheses. On l'affiche en le traduisant if ($reg[1] == 'paiement') $reg[1] = 'Payment'; $text = $langs->trans($reg[1]); } - $label = ''.$langs->trans("ShowPayment").'
'; + $label = ''.$langs->trans("Payment").'
'; $label .= ''.$langs->trans("Ref").': '.$text; if ($this->datepaye ? $this->datepaye : $this->date) $label .= '
'.$langs->trans("Date").': '.dol_print_date($this->datepaye ? $this->datepaye : $this->date, 'dayhour'); diff --git a/htdocs/fourn/facture/paiement.php b/htdocs/fourn/facture/paiement.php index 45d9c8ef967..99b982f5e40 100644 --- a/htdocs/fourn/facture/paiement.php +++ b/htdocs/fourn/facture/paiement.php @@ -822,7 +822,7 @@ if (empty($action) || $action == 'list') if (!$sortorder) $sortorder = 'DESC'; if (!$sortfield) $sortfield = 'p.datep'; - $sql = 'SELECT p.rowid as pid, p.datep as dp, p.amount as pamount, p.num_paiement,'; + $sql = 'SELECT p.rowid as pid, p.ref, p.datep as dp, p.amount as pamount, p.num_paiement,'; $sql .= ' s.rowid as socid, s.nom as name,'; $sql .= ' c.code as paiement_type, c.libelle as paiement_libelle,'; $sql .= ' ba.rowid as bid, ba.label,'; @@ -972,16 +972,24 @@ if (empty($action) || $action == 'list') print_liste_field_titre('', $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'maxwidthsearch '); print "\n"; + $paymentfournstatic = new PaiementFourn($db); + $i = 0; $totalarray = array(); while ($i < min($num, $limit)) { $objp = $db->fetch_object($resql); + $paymentfournstatic->id = $objp->pid; + $paymentfournstatic->ref = $objp->ref; + $paymentfournstatic->datepaye = $objp->dp; + print '
'; // Ref payment - print ''; + print ''; if (!$i) $totalarray['nbfield']++; // Date From c9f242406c8510b95088d4eea6f567a8da66d4d4 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 25 Apr 2020 02:44:24 +0200 Subject: [PATCH 086/115] Look and feel v12 --- htdocs/accountancy/admin/index.php | 2 ++ htdocs/accountancy/customer/list.php | 6 +++--- htdocs/accountancy/journal/bankjournal.php | 2 +- htdocs/accountancy/journal/expensereportsjournal.php | 2 +- htdocs/accountancy/journal/purchasesjournal.php | 2 +- htdocs/accountancy/journal/sellsjournal.php | 2 +- htdocs/accountancy/supplier/list.php | 10 +++++----- 7 files changed, 14 insertions(+), 12 deletions(-) diff --git a/htdocs/accountancy/admin/index.php b/htdocs/accountancy/admin/index.php index 02963557222..006db08fe9c 100644 --- a/htdocs/accountancy/admin/index.php +++ b/htdocs/accountancy/admin/index.php @@ -236,6 +236,7 @@ if (!empty($user->admin)) } print ''; + /* Set this option as a hidden option but keep it for some needs. print ''; print ''; if (!empty($conf->global->ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL)) { @@ -248,6 +249,7 @@ if (!empty($user->admin)) print ''; } print ''; + */ print ''; print ''; diff --git a/htdocs/accountancy/customer/list.php b/htdocs/accountancy/customer/list.php index 9dbb846370c..8d09587ca5a 100644 --- a/htdocs/accountancy/customer/list.php +++ b/htdocs/accountancy/customer/list.php @@ -567,12 +567,12 @@ if ($result) { print ''; // Found accounts - print ''; diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index b3d1e6ce7f8..3372105cd85 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -994,7 +994,7 @@ if (empty($action) || $action == 'view') { print '
'; - if (!empty($conf->global->ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL)) print ''; + if (!empty($conf->global->ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL) && $in_bookkeeping == 'notyet') print ''; if (($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == "") || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1' || ($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == "") || $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == '-1') { diff --git a/htdocs/accountancy/journal/expensereportsjournal.php b/htdocs/accountancy/journal/expensereportsjournal.php index d0a84c1236c..4be0b133143 100644 --- a/htdocs/accountancy/journal/expensereportsjournal.php +++ b/htdocs/accountancy/journal/expensereportsjournal.php @@ -508,7 +508,7 @@ if (empty($action) || $action == 'view') { } print '
'; - if (!empty($conf->global->ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL)) print ''; + if (!empty($conf->global->ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL) && $in_bookkeeping == 'notyet') print ''; if (empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT) || $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT == '-1') { print ''; } diff --git a/htdocs/accountancy/journal/purchasesjournal.php b/htdocs/accountancy/journal/purchasesjournal.php index dd7dc1ca9e1..ee67aaad392 100644 --- a/htdocs/accountancy/journal/purchasesjournal.php +++ b/htdocs/accountancy/journal/purchasesjournal.php @@ -740,7 +740,7 @@ if (empty($action) || $action == 'view') { print ' : '.$langs->trans("AccountancyAreaDescMisc", 4, ''.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").''); } print '
'; - if (!empty($conf->global->ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL)) print ''; + if (!empty($conf->global->ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL) && $in_bookkeeping == 'notyet') print ''; if (($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == "") || $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER == '-1') { print ''; } diff --git a/htdocs/accountancy/journal/sellsjournal.php b/htdocs/accountancy/journal/sellsjournal.php index 80603106cb3..1710a61ccdd 100644 --- a/htdocs/accountancy/journal/sellsjournal.php +++ b/htdocs/accountancy/journal/sellsjournal.php @@ -677,7 +677,7 @@ if (empty($action) || $action == 'view') { print ' : '.$langs->trans("AccountancyAreaDescMisc", 4, ''.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").''); } print '
'; - if (!empty($conf->global->ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL)) print ''; + if (!empty($conf->global->ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL) && $in_bookkeeping == 'notyet') print ''; if (($conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == "") || $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER == '-1') { print ''; } diff --git a/htdocs/accountancy/supplier/list.php b/htdocs/accountancy/supplier/list.php index ce354c789f3..c100868bd63 100644 --- a/htdocs/accountancy/supplier/list.php +++ b/htdocs/accountancy/supplier/list.php @@ -553,21 +553,21 @@ if ($result) { print '
'; // Found accounts - print ''; From 6b114a31ced82e81d5bf35267e4d8e37da5e4ffc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 25 Apr 2020 03:00:41 +0200 Subject: [PATCH 087/115] Look and feel v12 --- htdocs/accountancy/admin/account.php | 4 ++-- htdocs/accountancy/admin/accountmodel.php | 2 +- htdocs/accountancy/admin/categories_list.php | 4 ++-- htdocs/accountancy/admin/journals_list.php | 2 +- htdocs/accountancy/admin/productaccount.php | 3 +-- htdocs/accountancy/index.php | 2 +- htdocs/accountancy/supplier/list.php | 4 ++-- htdocs/admin/dict.php | 2 +- htdocs/compta/resultat/clientfourn.php | 8 +++----- htdocs/core/lib/functions.lib.php | 10 +++++----- htdocs/fourn/class/fournisseur.facture.class.php | 2 +- 11 files changed, 20 insertions(+), 23 deletions(-) diff --git a/htdocs/accountancy/admin/account.php b/htdocs/accountancy/admin/account.php index f735a0a0cfc..86981e5b5de 100644 --- a/htdocs/accountancy/admin/account.php +++ b/htdocs/accountancy/admin/account.php @@ -488,11 +488,11 @@ if ($resql) // Action print '"; // Modify link - if ($canbemodified) print ''; + if ($canbemodified) print ''; else print ''; // Delete link diff --git a/htdocs/accountancy/admin/categories_list.php b/htdocs/accountancy/admin/categories_list.php index 500a0d3cbba..1b2733e2045 100644 --- a/htdocs/accountancy/admin/categories_list.php +++ b/htdocs/accountancy/admin/categories_list.php @@ -408,7 +408,7 @@ llxHeader('', $langs->trans('DictionaryAccountancyCategory')); $titre = $langs->trans($tablib[$id]); $linkback = ''; -$titlepicto = 'title_setup'; +$titlepicto = 'title_accountancy'; print load_fiche_titre($titre, $linkback, $titlepicto); @@ -806,7 +806,7 @@ if ($id) print ""; // Modify link - if ($canbemodified) print ''; + if ($canbemodified) print ''; else print ''; // Delete link diff --git a/htdocs/accountancy/admin/journals_list.php b/htdocs/accountancy/admin/journals_list.php index eccb7450594..e34ce8094dd 100644 --- a/htdocs/accountancy/admin/journals_list.php +++ b/htdocs/accountancy/admin/journals_list.php @@ -657,7 +657,7 @@ if ($id) print ""; // Modify link - if ($canbemodified) print ''; + if ($canbemodified) print ''; else print ''; // Delete link diff --git a/htdocs/accountancy/admin/productaccount.php b/htdocs/accountancy/admin/productaccount.php index c6c76a57621..e32e47b169d 100644 --- a/htdocs/accountancy/admin/productaccount.php +++ b/htdocs/accountancy/admin/productaccount.php @@ -362,7 +362,6 @@ if ($result) print ''; print ''; print ''; - print ''; print load_fiche_titre($langs->trans("ProductsBinding"), '', 'title_accountancy'); print '
'; @@ -412,7 +411,7 @@ if ($result) //print '
'.$buttonsave.'
'; $texte = $langs->trans("ListOfProductsServices"); - print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $buttonsave, $num, $nbtotalofrecords, '', 0, '', '', $limit); + print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $buttonsave, $num, $nbtotalofrecords, '', 0, '', '', $limit, 0, 0, 1); print '
'; print '
'.img_object($langs->trans('ShowPayment'), 'payment').' '.$objp->pid.''; + print $paymentfournstatic->getNomUrl(1); + print '
'.$langs->trans("ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL").'
'.$langs->trans("BANK_DISABLE_DIRECT_INPUT").''.$objp->tva_intra.''; + print ''; $s = ''.(($objp->type_l == 1) ? $langs->trans("DefaultForService") : $langs->trans("DefaultForProduct")).': '; $shelp = ''; if ($suggestedaccountingaccountbydefaultfor == 'eec') $shelp .= $langs->trans("SaleEEC"); elseif ($suggestedaccountingaccountbydefaultfor == 'export') $shelp .= $langs->trans("SaleExport"); - $s .= ($objp->code_sell_l > 0 ? length_accountg($objp->code_sell_l) : $langs->trans("NotDefined")); + $s .= ($objp->code_sell_l > 0 ? length_accountg($objp->code_sell_l) : ''.$langs->trans("NotDefined").''); print $form->textwithpicto($s, $shelp, 1, 'help', '', 0, 2, '', 1); if ($objp->product_id > 0) { @@ -583,7 +583,7 @@ if ($result) { elseif ($suggestedaccountingaccountfor == 'eecwithvat') $shelp = $langs->trans("SaleEECWithVAT"); elseif ($suggestedaccountingaccountfor == 'eecwithoutvatnumber') $shelp = $langs->trans("SaleEECWithoutVATNumber"); elseif ($suggestedaccountingaccountfor == 'export') $shelp = $langs->trans("SaleExport"); - $s .= (empty($objp->code_sell_p) ? $langs->trans("NotDefined") : length_accountg($objp->code_sell_p)); + $s .= (empty($objp->code_sell_p) ? ''.$langs->trans("NotDefined").'' : length_accountg($objp->code_sell_p)); print $form->textwithpicto($s, $shelp, 1, 'help', '', 0, 2, '', 1); } print ''.$objp->tva_intra.''; - $s = ''.(($objp->type_l == 1) ? $langs->trans("DefaultForService") : $langs->trans("DefaultForProduct")).': '; + print ''; + $s = ''.(($objp->type_l == 1) ? $langs->trans("DefaultForService") : $langs->trans("DefaultForProduct")).': '; $shelp = ''; if ($suggestedaccountingaccountbydefaultfor == 'eec') $shelp .= $langs->trans("SaleEEC"); elseif ($suggestedaccountingaccountbydefaultfor == 'export') $shelp .= $langs->trans("SaleExport"); - $s .= ($objp->code_buy_l > 0 ? length_accountg($objp->code_buy_l) : $langs->trans("NotDefined")); + $s .= ($objp->code_buy_l > 0 ? length_accountg($objp->code_buy_l) : ''.$langs->trans("NotDefined").''); print $form->textwithpicto($s, $shelp, 1, 'help', '', 0, 2, '', 1); if ($objp->product_id > 0) { print '
'; - $s = ''.(($objp->type_l == 1) ? $langs->trans("ThisService") : $langs->trans("ThisProduct")).': '; + $s = ''.(($objp->type_l == 1) ? $langs->trans("ThisService") : $langs->trans("ThisProduct")).': '; $shelp = ''; if ($suggestedaccountingaccountfor == 'eec') $shelp = $langs->trans("SaleEEC"); elseif ($suggestedaccountingaccountfor == 'export') $shelp = $langs->trans("SaleExport"); - $s .= (empty($objp->code_buy_p) ? $langs->trans("NotDefined") : length_accountg($objp->code_buy_p)); + $s .= (empty($objp->code_buy_p) ? ''.$langs->trans("NotDefined").'' : length_accountg($objp->code_buy_p)); print $form->textwithpicto($s, $shelp, 1, 'help', '', 0, 2, '', 1); } print '
'; if ($user->rights->accounting->chartofaccount) { - print ''; + print ''; print img_edit(); print ''; print ' '; - print ''; + print ''; print img_delete(); print ''; } diff --git a/htdocs/accountancy/admin/accountmodel.php b/htdocs/accountancy/admin/accountmodel.php index 0ab42d582d1..b31cd23dfa4 100644 --- a/htdocs/accountancy/admin/accountmodel.php +++ b/htdocs/accountancy/admin/accountmodel.php @@ -696,7 +696,7 @@ if ($id) print "'.img_edit().''.img_edit().' '.img_edit().''.img_edit().' '.img_edit().''.img_edit().' 
'; diff --git a/htdocs/accountancy/index.php b/htdocs/accountancy/index.php index bc0cf66a938..4d64c7666d8 100644 --- a/htdocs/accountancy/index.php +++ b/htdocs/accountancy/index.php @@ -88,7 +88,7 @@ if ($conf->accounting->enabled) } - print load_fiche_titre($langs->trans("AccountancyArea"), $resultboxes['selectboxlist'], 'accountancy', 0, '', '', $showtutorial); + print load_fiche_titre($langs->trans("AccountancyArea"), $resultboxes['selectboxlist'], 'title_accountancy', 0, '', '', $showtutorial); print '
'; // hideobject is to start hidden print "
\n"; diff --git a/htdocs/accountancy/supplier/list.php b/htdocs/accountancy/supplier/list.php index c100868bd63..7daf526c658 100644 --- a/htdocs/accountancy/supplier/list.php +++ b/htdocs/accountancy/supplier/list.php @@ -554,7 +554,7 @@ if ($result) { // Found accounts print '
"; // Modify link - if ($canbemodified) print ''; + if ($canbemodified) print ''; else print ''; // Delete link diff --git a/htdocs/compta/resultat/clientfourn.php b/htdocs/compta/resultat/clientfourn.php index 17d2becfc19..44be66a2218 100644 --- a/htdocs/compta/resultat/clientfourn.php +++ b/htdocs/compta/resultat/clientfourn.php @@ -227,17 +227,15 @@ print "\n"; if ($modecompta == 'BOOKKEEPING') { $predefinedgroupwhere = "("; - //$predefinedgroupwhere.= " (pcg_type = 'EXPENSE' and pcg_subtype in ('PRODUCT','SERVICE'))"; $predefinedgroupwhere .= " (pcg_type = 'EXPENSE')"; $predefinedgroupwhere .= " OR "; - //$predefinedgroupwhere.= " (pcg_type = 'INCOME' and pcg_subtype in ('PRODUCT','SERVICE'))"; $predefinedgroupwhere .= " (pcg_type = 'INCOME')"; $predefinedgroupwhere .= ")"; $charofaccountstring = $conf->global->CHARTOFACCOUNTS; $charofaccountstring = dol_getIdFromCode($db, $conf->global->CHARTOFACCOUNTS, 'accounting_system', 'rowid', 'pcg_version'); - $sql = "SELECT f.thirdparty_code as name, -1 as socid, aa.pcg_type, aa.pcg_subtype, sum(f.credit - f.debit) as amount"; + $sql = "SELECT f.thirdparty_code as name, -1 as socid, aa.pcg_type, SUM(f.credit - f.debit) as amount"; $sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as f"; $sql .= ", ".MAIN_DB_PREFIX."accounting_account as aa"; $sql .= " WHERE f.numero_compte = aa.account_number"; @@ -271,7 +269,7 @@ if ($modecompta == 'BOOKKEEPING') print ''; print ''; - print '\n"; + print '\n"; print '\n"; print "\n"; @@ -282,7 +280,7 @@ if ($modecompta == 'BOOKKEEPING') // This make 14 calls for each detail of account (NP, N and month m) if ($showaccountdetail != 'no') { - $tmppredefinedgroupwhere = "pcg_type = '".$db->escape($objp->pcg_type)."' AND pcg_subtype = '".$db->escape($objp->pcg_subtype)."'"; + $tmppredefinedgroupwhere = "pcg_type = '".$db->escape($objp->pcg_type)."'"; $tmppredefinedgroupwhere .= " AND fk_pcg_version = '".$db->escape($charofaccountstring)."'"; //$tmppredefinedgroupwhere.= " AND thirdparty_code = '".$db->escape($objp->name)."'"; diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 13727fe8669..2f49c678d09 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -3141,7 +3141,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ if (empty($srconly) && in_array($pictowithouttext, array( '1downarrow', '1uparrow', '1leftarrow', '1rightarrow', '1uparrow_selected', '1downarrow_selected', '1leftarrow_selected', '1rightarrow_selected', - 'address', 'bank_account', 'barcode', 'bank', 'bill', 'bookmark', 'bom', 'building', 'cash-register', 'check', 'close_title', 'company', 'contact', 'cubes', + 'accountancy', 'address', 'bank_account', 'barcode', 'bank', 'bill', 'bookmark', 'bom', 'building', 'cash-register', 'check', 'close_title', 'company', 'contact', 'cubes', 'delete', 'dolly', 'dollyrevert', 'edit', 'ellipsis-h', 'external-link-alt', 'external-link-square-alt', 'filter', 'file-code', 'file-export', 'file-import', 'file-upload', 'folder', 'folder-open', 'globe', 'globe-americas', 'grip', 'grip_title', 'help', 'language', 'list', 'listlight', 'lot', 'map-marker-alt', 'money-bill-alt', 'mrp', 'note', 'stock', @@ -3160,7 +3160,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ 'note', 'setup', 'sign-out', 'split', 'switch_off', 'switch_on', 'tools', 'unlink', 'uparrow', 'user', 'wrench', 'jabber', 'skype', 'twitter', 'facebook', 'linkedin', 'instagram', 'snapchat', 'youtube', 'google-plus-g', 'whatsapp', 'chevron-left', 'chevron-right', 'chevron-down', 'chevron-top', - 'home', 'companies', 'products', 'commercial', 'invoicing', 'accountancy', 'preview', 'project', 'projectpub', 'hrm', 'members', 'ticket', 'generic', + 'home', 'companies', 'products', 'commercial', 'invoicing', 'preview', 'project', 'projectpub', 'hrm', 'members', 'ticket', 'generic', 'error', 'warning', 'title_setup', 'title_accountancy', 'title_bank', 'title_hrm', 'title_agenda' ) @@ -3178,9 +3178,9 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ $pictowithouttext = str_replace('object_', '', $pictowithouttext); $arrayconvpictotofa = array( - 'account'=>'university', 'action'=>'calendar-alt', 'address'=> 'address-book', 'bank_account'=>'university', 'bill'=>'file-invoice-dollar', 'bom'=>'cubes', + 'account'=>'university', 'accountancy'=>'money-check-alt', 'action'=>'calendar-alt', 'address'=> 'address-book', 'bank_account'=>'university', 'bill'=>'file-invoice-dollar', 'bom'=>'cubes', 'company'=>'building', 'contact'=>'address-book', 'contract'=>'suitcase', 'donation'=>'file-medical', 'dynamicprice'=>'hand-holding-usd', - 'setup'=>'cog', 'companies'=>'building', 'products'=>'cube', 'commercial'=>'suitcase', 'invoicing'=>'coins', 'accountancy'=>'money-check-alt', + 'setup'=>'cog', 'companies'=>'building', 'products'=>'cube', 'commercial'=>'suitcase', 'invoicing'=>'coins', 'accounting'=>'chart-line', 'category'=>'tag', 'dollyrevert'=>'dolly', 'hrm'=>'umbrella-beach', 'members'=>'users', 'ticket'=>'ticket-alt', 'globe'=>'external-link-alt', 'lot'=>'barcode', 'email'=>'at', @@ -3249,7 +3249,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ // Add CSS $arrayconvpictotomorcess = array( - 'action'=>'bg-infobox-action', 'account'=>'bg-infobox-bank_account', 'bank_account'=>'bg-infobox-bank_account', 'bill'=>'bg-infobox-commande', + 'action'=>'bg-infobox-action', 'account'=>'bg-infobox-bank_account', 'accountancy'=>'bg-infobox-bank_account', 'bank_account'=>'bg-infobox-bank_account', 'bill'=>'bg-infobox-commande', 'cash-register'=>'bg-infobox-bank_account', 'contract'=>'bg-infobox-contrat', 'check'=>'font-status4', 'donation'=>'bg-infobox-commande', 'dollyrevert'=>'flip', 'ecm'=>'bg-infobox-action', 'hrm'=>'bg-infobox-adherent', 'group'=>'bg-infobox-adherent', 'intervention'=>'bg-infobox-contrat', diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 52c5f15abd3..ce2de03a762 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -2355,7 +2355,7 @@ class FactureFournisseur extends CommonInvoice if ($this->type == self::TYPE_CREDIT_NOTE) $picto .= 'a'; // Credit note if ($this->type == self::TYPE_DEPOSIT) $picto .= 'd'; // Deposit invoice - $label = ''.$langs->trans("ShowSupplierInvoice").''; + $label = ''.$langs->trans("SupplierInvoice").''; if (!empty($this->ref)) $label .= '
'.$langs->trans('Ref').': '.$this->ref; if (!empty($this->ref_supplier)) From 38f2aad0c6ab4749dac22863ee04b91c432fefae Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 25 Apr 2020 03:19:30 +0200 Subject: [PATCH 088/115] Debug asset module --- htdocs/asset/card.php | 76 +++++++++++++------ htdocs/asset/class/asset.class.php | 8 +- htdocs/core/menus/standard/eldy.lib.php | 2 +- htdocs/core/modules/modAsset.class.php | 2 +- .../modulebuilder/template/myobject_card.php | 4 +- 5 files changed, 60 insertions(+), 32 deletions(-) diff --git a/htdocs/asset/card.php b/htdocs/asset/card.php index ddb2eaed9c4..0a604c023ec 100644 --- a/htdocs/asset/card.php +++ b/htdocs/asset/card.php @@ -34,15 +34,18 @@ $langs->loadLangs(array("asset")); // Get parameters $id = GETPOST('id', 'int'); $ref = GETPOST('ref', 'alpha'); -$action = GETPOST('action', 'alpha'); +$action = GETPOST('action', 'aZ09'); +$confirm = GETPOST('confirm', 'alpha'); $cancel = GETPOST('cancel', 'aZ09'); +$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'myobjectcard'; // To manage different context of search $backtopage = GETPOST('backtopage', 'alpha'); +$backtopageforcancel = GETPOST('backtopageforcancel', 'alpha'); // Initialize technical objects $object = new Asset($db); $extrafields = new ExtraFields($db); $diroutputmassaction = $conf->asset->dir_output.'/temp/massgeneration/'.$user->id; -$hookmanager->initHooks(array('assetcard')); // Note that conf->hooks_modules contains array +$hookmanager->initHooks(array('assetcard', 'globalcard')); // Note that conf->hooks_modules contains array // Fetch optionals attributes and labels $extrafields->fetch_name_optionals_label($object->table_element); @@ -59,23 +62,20 @@ foreach ($object->fields as $key => $val) if (empty($action) && empty($id) && empty($ref)) $action = 'view'; -// Security check - Protection if external user -//if ($user->socid > 0) accessforbidden(); -//if ($user->socid > 0) $socid = $user->socid; -//$result = restrictedArea($user, 'asset', $id); - // Load object include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once. + +$permissiontoread = $user->rights->asset->read; +$permissiontoadd = $user->rights->asset->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php +$permissiontodelete = $user->rights->asset->delete || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT); $permissionnote = $user->rights->asset->write; // Used by the include of actions_setnotes.inc.php $permissiondellink = $user->rights->asset->write; // Used by the include of actions_dellink.inc.php -$permissiontoadd = $user->rights->asset->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php +$upload_dir = $conf->mymodule->multidir_output[isset($object->entity) ? $object->entity : 1]; /* * Actions - * - * Put here all code to do according to value of "action" parameter */ $parameters = array(); @@ -86,16 +86,35 @@ if (empty($reshook)) { $error = 0; - $permissiontoadd = $user->rights->asset->create; - $permissiontodelete = $user->rights->asset->delete; $backurlforlist = dol_buildpath('/asset/list.php', 1); // Actions cancel, add, update or delete include DOL_DOCUMENT_ROOT.'/core/actions_addupdatedelete.inc.php'; + // Actions cancel, add, update, update_extras, confirm_validate, confirm_delete, confirm_deleteline, confirm_clone, confirm_close, confirm_setdraft, confirm_reopen + include DOL_DOCUMENT_ROOT.'/core/actions_addupdatedelete.inc.php'; + + // Actions when linking object each other + include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; + // Actions when printing a doc from card include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php'; + // Action to move up and down lines of object + //include DOL_DOCUMENT_ROOT.'/core/actions_lineupdown.inc.php'; + + // Action to build doc + include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; + + if ($action == 'set_thirdparty' && $permissiontoadd) + { + $object->setValueFrom('fk_soc', GETPOST('fk_soc', 'int'), '', '', 'date', '', $user, 'MYOBJECT_MODIFY'); + } + if ($action == 'classin' && $permissiontoadd) + { + $object->setProject(GETPOST('projectid', 'int')); + } + // Actions to send emails $triggersendname = 'ASSET_SENTBYMAIL'; $autocopy = 'MAIN_MAIL_AUTOCOPY_ASSET_TO'; @@ -143,11 +162,12 @@ if ($action == 'create') print ''; print ''; print ''; - print ''; - + if ($backtopage) print ''; + if ($backtopageforcancel) print ''; + dol_fiche_head(array(), ''); - print '
'; - $s = ''.(($objp->type_l == 1) ? $langs->trans("DefaultForService") : $langs->trans("DefaultForProduct")).': '; + $s = ''.(($objp->type_l == 1) ? $langs->trans("DefaultForService") : $langs->trans("DefaultForProduct")).': '; $shelp = ''; if ($suggestedaccountingaccountbydefaultfor == 'eec') $shelp .= $langs->trans("SaleEEC"); elseif ($suggestedaccountingaccountbydefaultfor == 'export') $shelp .= $langs->trans("SaleExport"); @@ -563,7 +563,7 @@ if ($result) { if ($objp->product_id > 0) { print '
'; - $s = ''.(($objp->type_l == 1) ? $langs->trans("ThisService") : $langs->trans("ThisProduct")).': '; + $s = ''.(($objp->type_l == 1) ? $langs->trans("ThisService") : $langs->trans("ThisProduct")).': '; $shelp = ''; if ($suggestedaccountingaccountfor == 'eec') $shelp = $langs->trans("SaleEEC"); elseif ($suggestedaccountingaccountfor == 'export') $shelp = $langs->trans("SaleExport"); diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index 7d12ffca433..3c19121d424 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -1718,7 +1718,7 @@ if ($id) print "
'.img_edit().''.img_edit().' 
 '.$objp->pcg_type.($objp->pcg_subtype != 'XXXXXX' ? ' - '.$objp->pcg_subtype : '').($objp->name ? ' ('.$objp->name.')' : '')."'.$objp->pcg_type.($objp->name ? ' ('.$objp->name.')' : '')."'.price($objp->amount)."
'."\n"; + print '
'."\n"; // Common attributes include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_add.tpl.php'; @@ -166,6 +186,8 @@ if ($action == 'create') print ''; print ''; + + //dol_set_focus('input[name="ref"]'); } // Part to edit record @@ -178,10 +200,12 @@ if (($id || $ref) && $action == 'edit') print ''; print ''; print ''; - + if ($backtopage) print ''; + if ($backtopageforcancel) print ''; + dol_fiche_head(); - print '
'."\n"; + print '
'."\n"; // Common attributes include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_edit.tpl.php'; @@ -206,7 +230,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $res = $object->fetch_optionals(); $head = asset_prepare_head($object); - dol_fiche_head($head, 'card', $langs->trans("Asset"), -1, 'generic'); + dol_fiche_head($head, 'card', $langs->trans("Asset"), -1, $object->picto); $formconfirm = ''; @@ -255,10 +279,12 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print '
'."\n"; // Common attributes - //$keyforbreak='fieldkeytoswithonsecondcolumn'; + //$keyforbreak='fieldkeytoswitchonsecondcolumn'; // We change column just after this field + //unset($object->fields['fk_project']); // Hide field already shown in banner + //unset($object->fields['fk_soc']); // Hide field already shown in banner include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php'; - // Other attributes + // Other attributes. Fields from hook formObjectOptions and Extrafields. include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; print '
'; @@ -266,7 +292,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print '
'; print '
'; - print '

'; + print '
'; dol_fiche_end(); @@ -349,14 +375,14 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea } //Select mail models is same action as presend - /* if (GETPOST('modelselected')) $action = 'presend'; // Presend form - $modelmail='inventory'; + /* + $modelmail='asset'; $defaulttopic='InformationMessage'; - $diroutput = $conf->product->dir_output.'/inventory'; - $trackid = 'stockinv'.$object->id; + $diroutput = $conf->asset->dir_output.'/asset'; + $trackid = 'asset'.$object->id; include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php'; */ diff --git a/htdocs/asset/class/asset.class.php b/htdocs/asset/class/asset.class.php index 6fe78edad60..7c9d91d79e7 100644 --- a/htdocs/asset/class/asset.class.php +++ b/htdocs/asset/class/asset.class.php @@ -77,12 +77,12 @@ class Asset extends CommonObject */ public $fields = array( 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'visible'=>-1, 'enabled'=>1, 'position'=>1, 'notnull'=>1, 'index'=>1, 'comment'=>"Id",), - 'ref' => array('type'=>'varchar(10)', 'label'=>'Ref', 'visible'=>1, 'enabled'=>1, 'position'=>10, 'notnull'=>1, 'index'=>1, 'searchall'=>1, 'comment'=>"Reference of object",), - 'entity' => array('type'=>'integer', 'label'=>'Entity', 'visible'=>-1, 'enabled'=>1, 'position'=>20, 'notnull'=>1, 'index'=>1,), - 'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'visible'=>1, 'enabled'=>1, 'position'=>30, 'notnull'=>-1, 'searchall'=>1, 'help'=>"Help text",), + 'ref' => array('type'=>'varchar(10)', 'label'=>'Ref', 'visible'=>1, 'enabled'=>1, 'position'=>10, 'notnull'=>1, 'index'=>1, 'searchall'=>1, 'comment'=>"Reference of object", 'showoncombobox'=>1), + 'entity' => array('type'=>'integer', 'label'=>'Entity', 'visible'=>0, 'enabled'=>1, 'position'=>20, 'notnull'=>1, 'index'=>1,), + 'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'visible'=>1, 'enabled'=>1, 'position'=>30, 'notnull'=>-1, 'searchall'=>1), 'amount_ht' => array('type'=>'double(24,8)', 'label'=>'AmountHTShort', 'visible'=>1, 'enabled'=>1, 'position'=>40, 'notnull'=>-1, 'isameasure'=>'1', 'help'=>"Help text",), 'amount_vat' => array('type'=>'double(24,8)', 'label'=>'AmountVAT', 'visible'=>1, 'enabled'=>1, 'position'=>40, 'notnull'=>-1, 'isameasure'=>'1', 'help'=>"Help text",), - 'fk_asset_type' => array('type'=>'integer:AssetType:asset/class/asset_type.class.php', 'label'=>'AssetsType', 'visible'=>1, 'enabled'=>1, 'position'=>50, 'notnull'=>-1, 'index'=>1, 'searchall'=>1, 'help'=>"LinkToThirparty",), + 'fk_asset_type' => array('type'=>'integer:AssetType:asset/class/asset_type.class.php', 'label'=>'AssetsType', 'visible'=>1, 'enabled'=>1, 'position'=>50, 'notnull'=>1, 'index'=>1, 'searchall'=>1, 'help'=>"LinkToThirparty",), 'description' => array('type'=>'text', 'label'=>'Description', 'visible'=>-1, 'enabled'=>1, 'position'=>90, 'notnull'=>-1,), 'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'visible'=>-1, 'enabled'=>1, 'position'=>91, 'notnull'=>-1,), 'note_private' => array('type'=>'html', 'label'=>'NotePrivate', 'visible'=>-1, 'enabled'=>1, 'position'=>92, 'notnull'=>-1,), diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index dba6dd2f4a4..9f32435ef66 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -1447,7 +1447,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM $newmenu->add("/asset/list.php?leftmenu=asset&mainmenu=accountancy", $langs->trans("MenuListAssets"), 1, $user->rights->asset->read); $newmenu->add("/asset/type.php?leftmenu=asset_type", $langs->trans("MenuTypeAssets"), 1, $user->rights->asset->read, '', $mainmenu, 'asset_type'); if ($usemenuhider || empty($leftmenu) || preg_match('/asset_type/', $leftmenu)) { - $newmenu->add("/asset/type.php?leftmenu=asset_type&action=create", $langs->trans("MenuNewTypeAssets"), 2, $user->rights->asset->configurer); + $newmenu->add("/asset/type.php?leftmenu=asset_type&action=create", $langs->trans("MenuNewTypeAssets"), 2, (empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->write) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $user->rights->asset->setup_advance)); $newmenu->add("/asset/type.php?leftmenu=asset_type", $langs->trans("MenuListTypeAssets"), 2, $user->rights->asset->read); } } diff --git a/htdocs/core/modules/modAsset.class.php b/htdocs/core/modules/modAsset.class.php index 06e8521b4e5..4feb38536ce 100644 --- a/htdocs/core/modules/modAsset.class.php +++ b/htdocs/core/modules/modAsset.class.php @@ -200,7 +200,7 @@ class modAsset extends DolibarrModules $this->rights[$r][1] = 'Setup types of asset'; // Permission label $this->rights[$r][2] = 'w'; $this->rights[$r][3] = 0; // Permission by default for new user (0/1) - $this->rights[$r][4] = 'advanced_configurer'; // In php code, permission will be checked by test if ($user->rights->asset->level1->level2) + $this->rights[$r][4] = 'setup_advance'; // In php code, permission will be checked by test if ($user->rights->asset->level1->level2) $this->rights[$r][5] = ''; // In php code, permission will be checked by test if ($user->rights->asset->level1->level2) // Menus diff --git a/htdocs/modulebuilder/template/myobject_card.php b/htdocs/modulebuilder/template/myobject_card.php index e299fec88c5..50fcd2629a7 100644 --- a/htdocs/modulebuilder/template/myobject_card.php +++ b/htdocs/modulebuilder/template/myobject_card.php @@ -182,7 +182,9 @@ if (empty($reshook)) $form = new Form($db); $formfile = new FormFile($db); -llxHeader('', $langs->trans('MyObject'), ''); +$title = $langs->trans("MyObject"); +$help_url = ''; +llxHeader('', $title, $help_url); // Example : Adding jquery code print ''; } elseif (GETPOST('action') == 'confirm_delete' && GETPOST('confirm') == 'yes' && GETPOST('socid') > 0) { // La suppression n'a pas été possible - require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php'; + require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; $societe = new Societe($this->db); $societe->fetch(GETPOST('socid')); // On vérifie si il est utilisé if ((in_array($object->forme_juridique_code, array(11, 12, 13, 15, 17, 18, 19, 35, 60, 200, 311, 312, 316, 401, 600, 700, 1005)) || $societe->typent_id == 8) && $societe->isObjectUsed(GETPOST('socid'))) { - require_once DOL_DOCUMENT_ROOT . '/core/class/html.form.class.php'; + require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php'; $form = new Form($this->db); - echo $form->formconfirm($_SERVER["PHP_SELF"] . "?socid=" . GETPOST('socid'), substr($langs->trans("DATAPOLICIES_POPUP_ANONYME_TITLE"), 0, strlen($langs->trans("DATAPOLICIES_POPUP_ANONYME_TITLE")) - 2), $langs->trans("DATAPOLICIES_POPUP_ANONYME_TEXTE"), 'anonymiser', '', '', 1); + echo $form->formconfirm($_SERVER["PHP_SELF"]."?socid=".GETPOST('socid'), substr($langs->trans("DATAPOLICIES_POPUP_ANONYME_TITLE"), 0, strlen($langs->trans("DATAPOLICIES_POPUP_ANONYME_TITLE")) - 2), $langs->trans("DATAPOLICIES_POPUP_ANONYME_TEXTE"), 'anonymiser', '', '', 1); } } if (GETPOST('socid')) { - require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php'; + require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; $societe = new Societe($this->db); $societe->fetch(GETPOST('socid')); if (!in_array($object->forme_juridique_code, array(11, 12, 13, 15, 17, 18, 19, 35, 60, 200, 311, 312, 316, 401, 600, 700, 1005)) && $societe->typent_id != 8) { - require_once DOL_DOCUMENT_ROOT . '/core/class/html.form.class.php'; + require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php'; $jsscript .= ''; } } diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index b6bc5b15a91..e653ab5d3ca 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -1046,7 +1046,7 @@ class Expedition extends CommonObject } } $line->entrepot_id = $linebatch->entrepot_id; - $line->origin_line_id = $dbatch['ix_l']; // deprecated + $line->origin_line_id = $dbatch['ix_l']; // deprecated $line->fk_origin_line = $dbatch['ix_l']; $line->qty = $dbatch['qty']; $line->detail_batch = $tab; diff --git a/htdocs/fourn/class/api_supplier_invoices.class.php b/htdocs/fourn/class/api_supplier_invoices.class.php index 139d87162c6..1f20965fab3 100644 --- a/htdocs/fourn/class/api_supplier_invoices.class.php +++ b/htdocs/fourn/class/api_supplier_invoices.class.php @@ -490,16 +490,16 @@ class SupplierInvoices extends DolibarrApi */ public function getLines($id) { - if(! DolibarrApiAccess::$user->rights->fournisseur->facture->creer) { + if (!DolibarrApiAccess::$user->rights->fournisseur->facture->creer) { throw new RestException(401); } $result = $this->invoice->fetch($id); - if( ! $result ) { + if (!$result) { throw new RestException(404, 'Supplier invoice not found'); } - if( ! DolibarrApi::_checkAccessToResource('fournisseur', $this->invoice->id, 'facture_fourn', 'facture')) { + if (!DolibarrApi::_checkAccessToResource('fournisseur', $this->invoice->id, 'facture_fourn', 'facture')) { throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); } $this->invoice->fetch_lines(); @@ -522,16 +522,16 @@ class SupplierInvoices extends DolibarrApi */ public function postLine($id, $request_data = null) { - if(! DolibarrApiAccess::$user->rights->fournisseur->facture->creer) { + if (!DolibarrApiAccess::$user->rights->fournisseur->facture->creer) { throw new RestException(401); } $result = $this->invoice->fetch($id); - if( ! $result ) { + if (!$result) { throw new RestException(404, 'Supplier invoice not found'); } - if( ! DolibarrApi::_checkAccessToResource('fournisseur', $this->invoice->id, 'facture_fourn', 'facture')) { + if (!DolibarrApi::_checkAccessToResource('fournisseur', $this->invoice->id, 'facture_fourn', 'facture')) { throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); } $request_data = (object) $request_data; @@ -586,16 +586,16 @@ class SupplierInvoices extends DolibarrApi */ public function putLine($id, $lineid, $request_data = null) { - if(! DolibarrApiAccess::$user->rights->fournisseur->facture->creer) { + if (!DolibarrApiAccess::$user->rights->fournisseur->facture->creer) { throw new RestException(401); } $result = $this->invoice->fetch($id); - if( ! $result ) { + if (!$result) { throw new RestException(404, 'Supplier invoice not found'); } - if( ! DolibarrApi::_checkAccessToResource('fournisseur', $this->invoice->id, 'facture_fourn', 'facture')) { + if (!DolibarrApi::_checkAccessToResource('fournisseur', $this->invoice->id, 'facture_fourn', 'facture')) { throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); } $request_data = (object) $request_data; @@ -647,20 +647,20 @@ class SupplierInvoices extends DolibarrApi */ public function deleteLine($id, $lineid) { - if(! DolibarrApiAccess::$user->rights->fournisseur->facture->creer) { + if (!DolibarrApiAccess::$user->rights->fournisseur->facture->creer) { throw new RestException(401); } $result = $this->invoice->fetch($id); - if( ! $result ) { + if (!$result) { throw new RestException(404, 'Supplier invoice not found'); } - if(empty($lineid)) { + if (empty($lineid)) { throw new RestException(400, 'Line ID is mandatory'); } - if( ! DolibarrApi::_checkAccessToResource('fournisseur', $this->invoice->id, 'facture_fourn', 'facture')) { + if (!DolibarrApi::_checkAccessToResource('fournisseur', $this->invoice->id, 'facture_fourn', 'facture')) { throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); } diff --git a/htdocs/fourn/class/fournisseur.commande.dispatch.class.php b/htdocs/fourn/class/fournisseur.commande.dispatch.class.php index b809a9fcd37..19ea5880346 100644 --- a/htdocs/fourn/class/fournisseur.commande.dispatch.class.php +++ b/htdocs/fourn/class/fournisseur.commande.dispatch.class.php @@ -211,9 +211,9 @@ class CommandeFournisseurDispatch extends CommonObject } // Create extrafields - if (! $error) + if (!$error) { - $result=$this->insertExtraFields(); + $result = $this->insertExtraFields(); if ($result < 0) $error++; } diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index ce2de03a762..7bc56994fdb 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -977,9 +977,9 @@ class FactureFournisseur extends CommonInvoice } } - if (! $error) + if (!$error) { - $result=$this->insertExtraFields(); + $result = $this->insertExtraFields(); if ($result < 0) { $error++; @@ -3150,9 +3150,9 @@ class SupplierInvoiceLine extends CommonObjectLine $this->deleteObjectLinked(); // Remove extrafields - if (! $error) + if (!$error) { - $result=$this->deleteExtraFields(); + $result = $this->deleteExtraFields(); if ($result < 0) { $error++; diff --git a/htdocs/install/step1.php b/htdocs/install/step1.php index 9d81bca42ce..a5e6b9d3377 100644 --- a/htdocs/install/step1.php +++ b/htdocs/install/step1.php @@ -566,21 +566,21 @@ if (!$error && $db->connected && $action == "set") $error++; } - if (! $error) + if (!$error) { if ($db->connected) { $resultbis = 1; // Create user - $result=$db->DDLCreateUser($dolibarr_main_db_host, $dolibarr_main_db_user, $dolibarr_main_db_pass, $dolibarr_main_db_name); + $result = $db->DDLCreateUser($dolibarr_main_db_host, $dolibarr_main_db_user, $dolibarr_main_db_pass, $dolibarr_main_db_name); // Create user bis if ($databasefortest == 'mysql') { - if (! in_array($dolibarr_main_db_host, array('127.0.0.1', '::1', 'localhost', 'localhost.local'))) + if (!in_array($dolibarr_main_db_host, array('127.0.0.1', '::1', 'localhost', 'localhost.local'))) { - $resultbis=$db->DDLCreateUser('%', $dolibarr_main_db_user, $dolibarr_main_db_pass, $dolibarr_main_db_name); + $resultbis = $db->DDLCreateUser('%', $dolibarr_main_db_user, $dolibarr_main_db_pass, $dolibarr_main_db_name); } } diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 86dd2f128e3..6533b4bfe54 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -2351,7 +2351,7 @@ function main_area($title = '') if (!empty($conf->global->MAIN_ONLY_LOGIN_ALLOWED)) print info_admin($langs->trans("WarningYouAreInMaintenanceMode", $conf->global->MAIN_ONLY_LOGIN_ALLOWED)); // Permit to add user company information on each printed document by set SHOW_SOCINFO_ON_PRINT - if (! empty($conf->global->SHOW_SOCINFO_ON_PRINT) && GETPOST('optioncss', 'aZ09') == 'print' && empty(GETPOST('disable_show_socinfo_on_print', 'az09'))) + if (!empty($conf->global->SHOW_SOCINFO_ON_PRINT) && GETPOST('optioncss', 'aZ09') == 'print' && empty(GETPOST('disable_show_socinfo_on_print', 'az09'))) { global $hookmanager; $hookmanager->initHooks(array('showsocinfoonprint')); diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 336c6b85fa4..e8dd338f4cd 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -4737,7 +4737,7 @@ class Product extends CommonObject $op[1] = "-".trim($nbpiece); $movementstock = new MouvementStock($this->db); - $movementstock->setOrigin($origin_element, $origin_id); // Set ->origin and ->origin->id + $movementstock->setOrigin($origin_element, $origin_id); // Set ->origin and ->origin->id $result = $movementstock->_create($user, $this->id, $id_entrepot, $op[$movement], $movement, $price, $label, $inventorycode); if ($result >= 0) { diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php index 54b70528f9b..7cc5d3966c1 100644 --- a/htdocs/product/fournisseurs.php +++ b/htdocs/product/fournisseurs.php @@ -780,33 +780,33 @@ SCRIPT; if (empty($rowid)) { foreach ($extralabels as $key => $value) { if (!empty($extrafields->attributes["product_fournisseur_price"]['list'][$key]) && ($extrafields->attributes["product_fournisseur_price"]['list'][$key] == 1 || $extrafields->attributes["product_fournisseur_price"]['list'][$key] == 3 || ($action == "update_price" && $extrafields->attributes["product_fournisseur_price"]['list'][$key] == 4))) { - if(!empty($extrafields->attributes["product_fournisseur_price"]['langfile'][$key])) $langs->load($extrafields->attributes["product_fournisseur_price"]['langfile'][$key]); + if (!empty($extrafields->attributes["product_fournisseur_price"]['langfile'][$key])) $langs->load($extrafields->attributes["product_fournisseur_price"]['langfile'][$key]); print 'attributes["product_fournisseur_price"]['required'][$key] ? ' class="fieldrequired"' : '').'>'; if (!empty($extrafields->attributes["product_fournisseur_price"]['help'][$key])) print $form->textwithpicto($langs->trans($value), $langs->trans($extrafields->attributes["product_fournisseur_price"]['help'][$key])); else print $langs->trans($value); - print ''.$extrafields->showInputField($key, GETPOSTISSET('options_' . $key) ? $extrafield_values['options_' . $key] : '', '', '', '', '', 0, 'product_fournisseur_price').''; + print ''.$extrafields->showInputField($key, GETPOSTISSET('options_'.$key) ? $extrafield_values['options_'.$key] : '', '', '', '', '', 0, 'product_fournisseur_price').''; } } } else { $sql = "SELECT"; $sql .= " fk_object"; foreach ($extralabels as $key => $value) { - $sql .= ", " . $key; + $sql .= ", ".$key; } - $sql .= " FROM " . MAIN_DB_PREFIX . "product_fournisseur_price_extrafields"; - $sql .= " WHERE fk_object = " . $rowid; + $sql .= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price_extrafields"; + $sql .= " WHERE fk_object = ".$rowid; $resql = $db->query($sql); if ($resql) { $obj = $db->fetch_object($resql); foreach ($extralabels as $key => $value) { if (!empty($extrafields->attributes["product_fournisseur_price"]['list'][$key]) && ($extrafields->attributes["product_fournisseur_price"]['list'][$key] == 1 || $extrafields->attributes["product_fournisseur_price"]['list'][$key] == 3 || ($action == "update_price" && $extrafields->attributes["product_fournisseur_price"]['list'][$key] == 4))) { - if(!empty($extrafields->attributes["product_fournisseur_price"]['langfile'][$key])) $langs->load($extrafields->attributes["product_fournisseur_price"]['langfile'][$key]); + if (!empty($extrafields->attributes["product_fournisseur_price"]['langfile'][$key])) $langs->load($extrafields->attributes["product_fournisseur_price"]['langfile'][$key]); print 'attributes["product_fournisseur_price"]['required'][$key] ? ' class="fieldrequired"' : '').'>'; if (!empty($extrafields->attributes["product_fournisseur_price"]['help'][$key])) print $form->textwithpicto($langs->trans($value), $langs->trans($extrafields->attributes["product_fournisseur_price"]['help'][$key])); else print $langs->trans($value); - print ''.$extrafields->showInputField($key, GETPOSTISSET('options_' . $key) ? $extrafield_values['options_' . $key] : $obj->{$key}, '', '', '', '', 0, 'product_fournisseur_price'); + print ''.$extrafields->showInputField($key, GETPOSTISSET('options_'.$key) ? $extrafield_values['options_'.$key] : $obj->{$key}, '', '', '', '', 0, 'product_fournisseur_price'); print ''; } @@ -912,7 +912,7 @@ SCRIPT; foreach ($extralabels as $key => $value) { // Show field if not hidden if (!empty($extrafields->attributes["product_fournisseur_price"]['list'][$key]) && $extrafields->attributes["product_fournisseur_price"]['list'][$key] != 3) { - if(!empty($extrafields->attributes["product_fournisseur_price"]['langfile'][$key])) $langs->load($extrafields->attributes["product_fournisseur_price"]['langfile'][$key]); + if (!empty($extrafields->attributes["product_fournisseur_price"]['langfile'][$key])) $langs->load($extrafields->attributes["product_fournisseur_price"]['langfile'][$key]); if (!empty($extrafields->attributes["product_fournisseur_price"]['help'][$key])) $extratitle = $form->textwithpicto($langs->trans($value), $langs->trans($extrafields->attributes["product_fournisseur_price"]['help'][$key])); else $extratitle = $langs->trans($value); print_liste_field_titre($extratitle, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'right '); diff --git a/htdocs/product/stock/class/entrepot.class.php b/htdocs/product/stock/class/entrepot.class.php index 9f764f7d412..510a6469482 100644 --- a/htdocs/product/stock/class/entrepot.class.php +++ b/htdocs/product/stock/class/entrepot.class.php @@ -112,7 +112,7 @@ class Entrepot extends CommonObject /** * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ - public $fields=array( + public $fields = array( 'rowid' =>array('type'=>'integer', 'label'=>'ID', 'enabled'=>1, 'visible'=>0, 'notnull'=>1, 'position'=>10), 'ref' =>array('type'=>'varchar(255)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>1, 'showoncombobox'=>1, 'position'=>25), 'entity' =>array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'notnull'=>1, 'position'=>30), @@ -184,7 +184,7 @@ class Entrepot extends CommonObject $error = 0; - if (empty($this->label)) $this->label = $this->libelle; // For backward compatibility + if (empty($this->label)) $this->label = $this->libelle; // For backward compatibility $this->label = trim($this->label); if ($this->label == '') diff --git a/htdocs/product/stock/list.php b/htdocs/product/stock/list.php index 06d3e46728f..15b92c83acc 100644 --- a/htdocs/product/stock/list.php +++ b/htdocs/product/stock/list.php @@ -97,11 +97,11 @@ $fieldstosearchall = array( ); // Initialize array of search criterias -$search_all=trim(GETPOST("search_all", 'alpha')); -$search=array(); -foreach($object->fields as $key => $val) +$search_all = trim(GETPOST("search_all", 'alpha')); +$search = array(); +foreach ($object->fields as $key => $val) { - if (GETPOST('search_'.$key, 'alpha') !== '') $search[$key]=GETPOST('search_'.$key, 'alpha'); + if (GETPOST('search_'.$key, 'alpha') !== '') $search[$key] = GETPOST('search_'.$key, 'alpha'); } // Definition of fields for list @@ -110,7 +110,7 @@ $arrayfields = array( 'estimatedvalue'=>array('type'=>'float', 'label'=>'EstimatedStockValue', 'enabled'=>1, 'visible'=>-2, 'position'=>71), 'estimatedstockvaluesell'=>array('type'=>'float', 'label'=>'EstimatedStockValueSell', 'enabled'=>1, 'visible'=>-2, 'position'=>72), ); -foreach($object->fields as $key => $val) +foreach ($object->fields as $key => $val) { // If $val['visible']==0, then we never show the field if (!empty($val['visible'])) $arrayfields['t.'.$key] = array('label'=>$val['label'], 'checked'=>(($val['visible'] < 0) ? 0 : 1), 'enabled'=>($val['enabled'] && ($val['visible'] != 3)), 'position'=>$val['position']); @@ -241,20 +241,20 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php'; $parameters = array(); $reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object); // Note that $action and $object may have been modified by hook $sql .= $hookmanager->resPrint; -$sql.= " GROUP BY "; -foreach($object->fields as $key => $val) +$sql .= " GROUP BY "; +foreach ($object->fields as $key => $val) { - $sql.='t.'.$key.', '; + $sql .= 't.'.$key.', '; } // Add fields from extrafields -if (! empty($extrafields->attributes[$object->table_element]['label'])) { - foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.', ' : ''); +if (!empty($extrafields->attributes[$object->table_element]['label'])) { + foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.', ' : ''); } // Add where from hooks -$parameters=array(); -$reshook=$hookmanager->executeHooks('printFieldListGroupBy', $parameters); // Note that $action and $object may have been modified by hook -$sql.=$hookmanager->resPrint; -$sql=preg_replace('/,\s*$/', '', $sql); +$parameters = array(); +$reshook = $hookmanager->executeHooks('printFieldListGroupBy', $parameters); // Note that $action and $object may have been modified by hook +$sql .= $hookmanager->resPrint; +$sql = preg_replace('/,\s*$/', '', $sql); $totalnboflines = 0; $result = $db->query($sql); if ($result) @@ -408,7 +408,7 @@ print ''; foreach ($object->fields as $key => $val) { - if($key == 'statut'){ continue; } + if ($key == 'statut') { continue; } $cssforfield = (empty($val['css']) ? '' : $val['css']); if ($key == 'status') $cssforfield .= ($cssforfield ? ' ' : '').'center'; elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'center'; @@ -421,7 +421,7 @@ foreach ($object->fields as $key => $val) elseif (strpos($val['type'], 'integer:') === 0 || strpos($val['type'], 'sellist:') === 0) { print $object->showInputField($val, $key, $search[$key], '', '', 'search_', 'maxwidth150', 1); } - elseif (! preg_match('/^(date|timestamp)/', $val['type'])) print ''; + elseif (!preg_match('/^(date|timestamp)/', $val['type'])) print ''; print ''; } } @@ -466,7 +466,7 @@ print ''; foreach ($object->fields as $key => $val) { - if($key == 'statut'){ continue; } + if ($key == 'statut') { continue; } $cssforfield = (empty($val['css']) ? '' : $val['css']); if ($key == 'status') $cssforfield .= ($cssforfield ? ' ' : '').'center'; elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'center'; @@ -525,7 +525,7 @@ if ($num) $warehouse->fk_parent = $obj->fk_parent; $warehouse->statut = $obj->statut; - foreach ($object->fields as $key => $val){ + foreach ($object->fields as $key => $val) { $warehouse->{$key} = $obj->{$key}; } @@ -535,7 +535,7 @@ if ($num) foreach ($warehouse->fields as $key => $val) { - if($key == 'statut'){ continue; } + if ($key == 'statut') { continue; } $cssforfield = (empty($val['css']) ? '' : $val['css']); if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) $cssforfield .= ($cssforfield ? ' ' : '').'center'; elseif ($key == 'status') $cssforfield .= ($cssforfield ? ' ' : '').'center'; @@ -562,7 +562,7 @@ if ($num) // Stock qty if (!empty($arrayfields["stockqty"]['checked'])) { - print '' . price2num($obj->stockqty, 5) . ''; + print ''.price2num($obj->stockqty, 5).''; if (!$i) $totalarray['nbfield']++; if (!$i) $totalarray['pos'][$totalarray['nbfield']] = 'stockqty'; } @@ -599,7 +599,7 @@ if ($num) // Status if (!empty($arrayfields['t.statut']['checked'])) { - print '' . $warehouse->LibStatut($obj->statut, 5) . ''; + print ''.$warehouse->LibStatut($obj->statut, 5).''; if (!$i) $totalarray['nbfield']++; } diff --git a/htdocs/projet/index.php b/htdocs/projet/index.php index df6d5b3a13f..3d6903065ab 100644 --- a/htdocs/projet/index.php +++ b/htdocs/projet/index.php @@ -116,7 +116,7 @@ if ($resql) $listofoppstatus[$objp->rowid] = $objp->percent; $listofopplabel[$objp->rowid] = $objp->label; $listofoppcode[$objp->rowid] = $objp->code; - switch($objp->code) { + switch ($objp->code) { case 'PROSP': $colorseries[$objp->rowid] = "-".$badgeStatus0; break; diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index 26b00bae2a9..6f60904c67b 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -713,7 +713,7 @@ while ($i < min($num, $limit)) $object->public = $obj->public; $object->ref = $obj->ref; $object->datee = $db->jdate($obj->date_end); - $object->statut = $obj->status; // deprecated + $object->statut = $obj->status; // deprecated $object->status = $obj->status; $object->public = $obj->public; $object->opp_status = $obj->fk_opp_status; diff --git a/htdocs/public/stripe/ipn.php b/htdocs/public/stripe/ipn.php index 8a3bb00e765..4291cb6f834 100644 --- a/htdocs/public/stripe/ipn.php +++ b/htdocs/public/stripe/ipn.php @@ -111,54 +111,54 @@ $user = new User($db); $user->fetch($conf->global->STRIPE_USER_ACCOUNT_FOR_ACTIONS); $user->getrights(); -if (! empty($conf->multicompany->enabled) && ! empty($conf->stripeconnect->enabled) && is_object($mc)) +if (!empty($conf->multicompany->enabled) && !empty($conf->stripeconnect->enabled) && is_object($mc)) { $sql = "SELECT entity"; - $sql.= " FROM ".MAIN_DB_PREFIX."oauth_token"; - $sql.= " WHERE service = '".$db->escape($service)."' and tokenstring = '%".$db->escape($event->account)."%'"; + $sql .= " FROM ".MAIN_DB_PREFIX."oauth_token"; + $sql .= " WHERE service = '".$db->escape($service)."' and tokenstring = '%".$db->escape($event->account)."%'"; - dol_syslog(get_class($db) . "::fetch", LOG_DEBUG); + dol_syslog(get_class($db)."::fetch", LOG_DEBUG); $result = $db->query($sql); if ($result) { if ($db->num_rows($result)) { $obj = $db->fetch_object($result); - $key=$obj->entity; + $key = $obj->entity; } else { - $key=1; + $key = 1; } } else { - $key=1; + $key = 1; } - $ret=$mc->switchEntity($key); - if (! $res && file_exists("../../main.inc.php")) $res=@include "../../main.inc.php"; - if (! $res) die("Include of main fails"); + $ret = $mc->switchEntity($key); + if (!$res && file_exists("../../main.inc.php")) $res = @include "../../main.inc.php"; + if (!$res) die("Include of main fails"); } // list of action -$stripe=new Stripe($db); +$stripe = new Stripe($db); // Subject $societeName = $conf->global->MAIN_INFO_SOCIETE_NOM; -if (! empty($conf->global->MAIN_APPLICATION_TITLE)) $societeName = $conf->global->MAIN_APPLICATION_TITLE; +if (!empty($conf->global->MAIN_APPLICATION_TITLE)) $societeName = $conf->global->MAIN_APPLICATION_TITLE; dol_syslog("***** Stripe IPN was called with event->type = ".$event->type); if ($event->type == 'payout.created') { - $error=0; + $error = 0; - $result=dolibarr_set_const($db, $service."_NEXTPAYOUT", date('Y-m-d H:i:s', $event->data->object->arrival_date), 'chaine', 0, '', $conf->entity); + $result = dolibarr_set_const($db, $service."_NEXTPAYOUT", date('Y-m-d H:i:s', $event->data->object->arrival_date), 'chaine', 0, '', $conf->entity); if ($result > 0) { $subject = $societeName.' - [NOTIFICATION] Stripe payout scheduled'; if (!empty($user->email)) { - $sendto = dolGetFirstLastname($user->firstname, $user->lastname) . " <".$user->email.">"; + $sendto = dolGetFirstLastname($user->firstname, $user->lastname)." <".$user->email.">"; } else { $sendto = $conf->global->MAIN_INFO_SOCIETE_MAIL.'" <'.$conf->global->MAIN_INFO_SOCIETE_MAIL.'>'; } diff --git a/htdocs/reception/class/reception.class.php b/htdocs/reception/class/reception.class.php index b4e5d0633c7..dbf6e4b9e29 100644 --- a/htdocs/reception/class/reception.class.php +++ b/htdocs/reception/class/reception.class.php @@ -306,9 +306,9 @@ class Reception extends CommonObject } // Create extrafields - if (! $error) + if (!$error) { - $result=$this->insertExtraFields(); + $result = $this->insertExtraFields(); if ($result < 0) $error++; } diff --git a/htdocs/salaries/list.php b/htdocs/salaries/list.php index fd89ba5dd2d..fd6e7a3ec95 100644 --- a/htdocs/salaries/list.php +++ b/htdocs/salaries/list.php @@ -58,7 +58,7 @@ $optioncss = GETPOST('optioncss', 'alpha'); $filtre = GETPOST("filtre", 'none'); -if (! GETPOST('typeid', 'int')) +if (!GETPOST('typeid', 'int')) { $newfiltre = str_replace('filtre=', '', $filtre); $filterarray = explode('-', $newfiltre); diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index c35b17fe4fa..62140ba5d89 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -3623,7 +3623,7 @@ class Societe extends CommonObject $this->phone = $member->phone; // Prof phone $this->email = $member->email; $this->socialnetworks = $member->socialnetworks; - $this->entity=$member->entity; + $this->entity = $member->entity; $this->client = 1; // A member is a customer by default $this->code_client = ($customercode ? $customercode : -1); diff --git a/htdocs/support/inc.php b/htdocs/support/inc.php index c12526bbe85..7e5b6aaf531 100644 --- a/htdocs/support/inc.php +++ b/htdocs/support/inc.php @@ -66,87 +66,87 @@ if (!file_exists($conffile)) // Load conf file if it is already defined -if (! defined('DONOTLOADCONF') && file_exists($conffile) && filesize($conffile) > 8) // Test on filesize is to ensure that conf file is more that an empty template with just 8) // Test on filesize is to ensure that conf file is more that an empty template with just global->MAIN_LOGTOHTML = 1; // Define prefix -if (! isset($dolibarr_main_db_prefix) || ! $dolibarr_main_db_prefix) $dolibarr_main_db_prefix='llx_'; -define('MAIN_DB_PREFIX', (isset($dolibarr_main_db_prefix)?$dolibarr_main_db_prefix:'')); +if (!isset($dolibarr_main_db_prefix) || !$dolibarr_main_db_prefix) $dolibarr_main_db_prefix = 'llx_'; +define('MAIN_DB_PREFIX', (isset($dolibarr_main_db_prefix) ? $dolibarr_main_db_prefix : '')); -define('DOL_CLASS_PATH', 'class/'); // Filsystem path to class dir -define('DOL_DATA_ROOT', (isset($dolibarr_main_data_root)?$dolibarr_main_data_root:'')); -define('DOL_MAIN_URL_ROOT', (isset($dolibarr_main_url_root)?$dolibarr_main_url_root:'')); // URL relative root -$uri=preg_replace('/^http(s?):\/\//i', '', constant('DOL_MAIN_URL_ROOT')); // $uri contains url without http* -$suburi = strstr($uri, '/'); // $suburi contains url without domain -if ($suburi == '/') $suburi = ''; // If $suburi is /, it is now '' -define('DOL_URL_ROOT', $suburi); // URL relative root ('', '/dolibarr', ...) +define('DOL_CLASS_PATH', 'class/'); // Filsystem path to class dir +define('DOL_DATA_ROOT', (isset($dolibarr_main_data_root) ? $dolibarr_main_data_root : '')); +define('DOL_MAIN_URL_ROOT', (isset($dolibarr_main_url_root) ? $dolibarr_main_url_root : '')); // URL relative root +$uri = preg_replace('/^http(s?):\/\//i', '', constant('DOL_MAIN_URL_ROOT')); // $uri contains url without http* +$suburi = strstr($uri, '/'); // $suburi contains url without domain +if ($suburi == '/') $suburi = ''; // If $suburi is /, it is now '' +define('DOL_URL_ROOT', $suburi); // URL relative root ('', '/dolibarr', ...) -if (empty($character_set_client)) $character_set_client="UTF-8"; -$conf->file->character_set_client=strtoupper($character_set_client); -if (empty($dolibarr_main_db_character_set)) $dolibarr_main_db_character_set=($conf->db->type=='mysql'?'latin1':''); // Old installation -$conf->db->character_set=$dolibarr_main_db_character_set; -if (empty($dolibarr_main_db_collation)) $dolibarr_main_db_collation=($conf->db->type=='mysql'?'latin1_swedish_ci':''); // Old installation -$conf->db->dolibarr_main_db_collation=$dolibarr_main_db_collation; -if (empty($dolibarr_main_db_encryption)) $dolibarr_main_db_encryption=0; +if (empty($character_set_client)) $character_set_client = "UTF-8"; +$conf->file->character_set_client = strtoupper($character_set_client); +if (empty($dolibarr_main_db_character_set)) $dolibarr_main_db_character_set = ($conf->db->type == 'mysql' ? 'latin1' : ''); // Old installation +$conf->db->character_set = $dolibarr_main_db_character_set; +if (empty($dolibarr_main_db_collation)) $dolibarr_main_db_collation = ($conf->db->type == 'mysql' ? 'latin1_swedish_ci' : ''); // Old installation +$conf->db->dolibarr_main_db_collation = $dolibarr_main_db_collation; +if (empty($dolibarr_main_db_encryption)) $dolibarr_main_db_encryption = 0; $conf->db->dolibarr_main_db_encryption = $dolibarr_main_db_encryption; -if (empty($dolibarr_main_db_cryptkey)) $dolibarr_main_db_cryptkey=''; +if (empty($dolibarr_main_db_cryptkey)) $dolibarr_main_db_cryptkey = ''; $conf->db->dolibarr_main_db_cryptkey = $dolibarr_main_db_cryptkey; -if (empty($conf->db->user)) $conf->db->user=''; +if (empty($conf->db->user)) $conf->db->user = ''; // Defini objet langs diff --git a/htdocs/user/perms.php b/htdocs/user/perms.php index 24061a9e949..5d06973abf6 100644 --- a/htdocs/user/perms.php +++ b/htdocs/user/perms.php @@ -294,9 +294,9 @@ print ''."\n"; //print "xx".$conf->global->MAIN_USE_ADVANCED_PERMS; $sql = "SELECT r.id, r.libelle as label, r.module, r.perms, r.subperms, r.module_position"; $sql .= " FROM ".MAIN_DB_PREFIX."rights_def as r"; -$sql .= " WHERE r.libelle NOT LIKE 'tou%'"; // On ignore droits "tous" -$sql .= " AND r.entity = " . $entity; -if (empty($conf->global->MAIN_USE_ADVANCED_PERMS)) $sql .= " AND r.perms NOT LIKE '%_advance'"; // Hide advanced perms if option is not enabled +$sql .= " WHERE r.libelle NOT LIKE 'tou%'"; // On ignore droits "tous" +$sql .= " AND r.entity = ".$entity; +if (empty($conf->global->MAIN_USE_ADVANCED_PERMS)) $sql .= " AND r.perms NOT LIKE '%_advance'"; // Hide advanced perms if option is not enabled $sql .= " ORDER BY r.family_position, r.module_position, r.module, r.id"; $result = $db->query($sql); From 3090eb578bddee0bb2980da54b5e1487bae60742 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 25 Apr 2020 17:18:57 +0200 Subject: [PATCH 097/115] Look and feel v12 --- htdocs/admin/ihm.php | 19 +-- htdocs/commande/index.php | 1 + htdocs/compta/stats/cabyuser.php | 2 +- htdocs/compta/stats/casoc.php | 2 +- .../stats/supplier_turnover_by_thirdparty.php | 2 +- htdocs/core/class/html.formticket.class.php | 4 +- htdocs/core/lib/ajax.lib.php | 4 +- htdocs/core/lib/functions.lib.php | 10 +- htdocs/core/lib/project.lib.php | 2 +- htdocs/core/lib/usergroups.lib.php | 42 ++---- htdocs/margin/admin/margin.php | 16 +-- htdocs/projet/activity/index.php | 4 +- htdocs/projet/tasks.php | 2 +- htdocs/projet/tasks/contact.php | 8 +- htdocs/projet/tasks/list.php | 2 +- htdocs/projet/tasks/stats/index.php | 2 +- htdocs/supplier_proposal/list.php | 4 +- htdocs/ticket/class/ticket.class.php | 133 ++++-------------- htdocs/ticket/index.php | 20 ++- 19 files changed, 105 insertions(+), 174 deletions(-) diff --git a/htdocs/admin/ihm.php b/htdocs/admin/ihm.php index ab67974c920..68ab91c4638 100644 --- a/htdocs/admin/ihm.php +++ b/htdocs/admin/ihm.php @@ -160,7 +160,6 @@ if ($action == 'update') dolibarr_set_const($db, "MAIN_FIRSTNAME_NAME_POSITION", GETPOST("MAIN_FIRSTNAME_NAME_POSITION", 'aZ09'), 'chaine', 0, '', $conf->entity); - dolibarr_set_const($db, "MAIN_HELPCENTER_DISABLELINK", GETPOST('MAIN_HELPCENTER_DISABLELINK', 'aZ09'), 'chaine', 0, '', 0); // Param for all entities dolibarr_set_const($db, "MAIN_MOTD", dol_htmlcleanlastbr(GETPOST("main_motd", 'none')), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_HOME", dol_htmlcleanlastbr(GETPOST("main_home", 'none')), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_HELP_DISABLELINK", GETPOST("MAIN_HELP_DISABLELINK", 'aZ09'), 'chaine', 0, '', 0); // Param for all entities @@ -278,8 +277,10 @@ print ''; // Disable javascript and ajax print ''.$langs->trans("DisableJavascript").''; print ajax_constantonoff("MAIN_DISABLE_JAVASCRIPT", array(), $conf->entity, 0, 0, 1, 0); +print '     '.$langs->trans("DisableJavascriptNote").''; +print ''; +print ''; print ''; -print ' '; print ''; // Max size of lists @@ -392,6 +393,13 @@ print ''.$langs->trans("LoginPage print ' '; print ''; +// Hide helpcenter link on login page +print ''.$langs->trans("DisableLinkToHelpCenter").''; +print ajax_constantonoff("MAIN_HELPCENTER_DISABLELINK", array(), $conf->entity, 0, 0, 0, 0); +print ''; +print ' '; +print ''; + // Message on login page $substitutionarray = getCommonSubstitutionArray($langs, 0, array('object', 'objectamount', 'user')); complete_substitutions_array($substitutionarray, $langs); @@ -407,13 +415,6 @@ $doleditor = new DolEditor('main_home', (isset($conf->global->MAIN_HOME) ? $conf $doleditor->Create(); print ''."\n"; -// Hide helpcenter link on login page -print ''.$langs->trans("DisableLinkToHelpCenter").''; -print $form->selectyesno('MAIN_HELPCENTER_DISABLELINK', isset($conf->global->MAIN_HELPCENTER_DISABLELINK) ? $conf->global->MAIN_HELPCENTER_DISABLELINK : 0, 1); -print ''; -print ' '; -print ''; - // Background print ''; print '
'; diff --git a/htdocs/commande/index.php b/htdocs/commande/index.php index 4ca7086c132..13d67c942ed 100644 --- a/htdocs/commande/index.php +++ b/htdocs/commande/index.php @@ -106,6 +106,7 @@ if ($resql) $total = 0; $totalinprocess = 0; $dataseries = array(); + $colorseries = array(); $vals = array(); // -1=Canceled, 0=Draft, 1=Validated, 2=Accepted/On process, 3=Closed (Sent/Received, billed or not) while ($i < $num) diff --git a/htdocs/compta/stats/cabyuser.php b/htdocs/compta/stats/cabyuser.php index 9a4ce5b0427..4d4f56a1354 100644 --- a/htdocs/compta/stats/cabyuser.php +++ b/htdocs/compta/stats/cabyuser.php @@ -462,7 +462,7 @@ if (count($amount)) { print ''; print ''.$langs->trans("Total").''; if ($modecompta != 'CREANCES-DETTES') { - print ''; + print ''; } else { print ''.price($catotal_ht).''; } diff --git a/htdocs/compta/stats/casoc.php b/htdocs/compta/stats/casoc.php index c563d8c5ae6..bec20998cfa 100644 --- a/htdocs/compta/stats/casoc.php +++ b/htdocs/compta/stats/casoc.php @@ -625,7 +625,7 @@ if (count($amount)) { print ' '; print ' '; if ($modecompta != 'CREANCES-DETTES') { - print ''; + print ''; } else { print ''.price($catotal_ht).''; } diff --git a/htdocs/compta/stats/supplier_turnover_by_thirdparty.php b/htdocs/compta/stats/supplier_turnover_by_thirdparty.php index a9cdef94711..fcae12f744b 100644 --- a/htdocs/compta/stats/supplier_turnover_by_thirdparty.php +++ b/htdocs/compta/stats/supplier_turnover_by_thirdparty.php @@ -574,7 +574,7 @@ if (count($amount)) { print ' '; print ' '; if ($modecompta != 'CREANCES-DETTES') { - print ''; + print ''; } else { print ''.price($catotal_ht).''; } diff --git a/htdocs/core/class/html.formticket.class.php b/htdocs/core/class/html.formticket.class.php index 35e5d00bab8..da41a02491b 100644 --- a/htdocs/core/class/html.formticket.class.php +++ b/htdocs/core/class/html.formticket.class.php @@ -247,7 +247,7 @@ class FormTicket $doleditor->Create(); print ''; - // FK_USER_CREATE + // User of creation if ($this->withusercreate > 0 && $this->fk_user_create) { print ''.$langs->trans("CreatedBy").''; $langs->load("users"); @@ -270,6 +270,7 @@ class FormTicket print ''.$langs->trans("ThirdParty").''; $events = array(); $events[] = array('method' => 'getContacts', 'url' => dol_buildpath('/core/ajax/contacts.php', 1), 'htmlname' => 'contactid', 'params' => array('add-customer-contact' => 'disabled')); + print img_picto('', 'company', 'class="paddingright"'); print $form->select_company($this->withfromsocid, 'socid', '', 1, 1, '', $events, 0, 'minwidth200'); print ''; if (!empty($conf->use_javascript_ajax) && !empty($conf->global->COMPANY_USE_SEARCH_TO_SELECT)) { @@ -330,6 +331,7 @@ class FormTicket print ''.$langs->trans("Contact").''; // If no socid, set to -1 to avoid full contacts list $selectedCompany = ($this->withfromsocid > 0) ? $this->withfromsocid : -1; + print img_picto('', 'contact', 'class="paddingright"'); $nbofcontacts = $form->select_contacts($selectedCompany, $this->withfromcontactid, 'contactid', 3, '', '', 0, 'minwidth200'); print ' '; $formcompany->selectTypeContact($ticketstatic, '', 'type', 'external', '', 0, 'maginleftonly'); diff --git a/htdocs/core/lib/ajax.lib.php b/htdocs/core/lib/ajax.lib.php index c29b82f4329..329d177a33d 100644 --- a/htdocs/core/lib/ajax.lib.php +++ b/htdocs/core/lib/ajax.lib.php @@ -533,8 +533,8 @@ function ajax_constantonoff($code, $input = array(), $entity = null, $revertonof '."\n"; $out .= ''; - $out .= ''.($revertonoff ?img_picto($langs->trans("Enabled"), 'switch_on', '', false, 0, 0, '', '', $marginleftonlyshort) : img_picto($langs->trans("Disabled"), 'switch_off', '', false, 0, 0, '', '', $marginleftonlyshort)).''; - $out .= ''.($revertonoff ?img_picto($langs->trans("Disabled"), 'switch_off', '', false, 0, 0, '', '', $marginleftonlyshort) : img_picto($langs->trans("Enabled"), 'switch_on', '', false, 0, 0, '', '', $marginleftonlyshort)).''; + $out .= ''.($revertonoff ?img_picto($langs->trans("Enabled"), 'switch_on', '', false, 0, 0, '', '', $marginleftonlyshort) : img_picto($langs->trans("Disabled"), 'switch_off', '', false, 0, 0, '', '', $marginleftonlyshort)).''; + $out .= ''.($revertonoff ?img_picto($langs->trans("Disabled"), 'switch_off', '', false, 0, 0, '', '', $marginleftonlyshort) : img_picto($langs->trans("Enabled"), 'switch_on', '', false, 0, 0, '', '', $marginleftonlyshort)).''; $out .= "\n"; } diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 850879e262e..94a32ceacaf 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -3146,20 +3146,20 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ 'delete', 'dolly', 'dollyrevert', 'edit', 'ellipsis-h', 'external-link-alt', 'external-link-square-alt', 'filter', 'file-code', 'file-export', 'file-import', 'file-upload', 'folder', 'folder-open', 'globe', 'globe-americas', 'grip', 'grip_title', 'help', 'intervention', 'language', 'list', 'listlight', 'lot', - 'map-marker-alt', 'money-bill-alt', 'mrp', 'note', 'stock', + 'map-marker-alt', 'money-bill-alt', 'mrp', 'note', 'object_accounting', 'object_action', 'object_account', 'object_barcode', 'object_bill', 'object_billa', 'object_billd', 'object_bom', 'object_category', 'object_bookmark', 'object_bug', 'object_dolly', 'object_dollyrevert', 'object_generic', 'object_folder', 'object_list-alt', 'object_calendar', 'object_calendarweek', 'object_calendarmonth', 'object_calendarday', 'object_calendarperuser', 'object_cash-register', 'object_company', 'object_contact', 'object_contract', 'object_donation', 'object_dynamicprice', - 'object_holiday', 'object_hrm', 'object_intervention', 'object_money-bill-alt', 'object_multicurrency', 'object_order', 'object_payment', + 'object_holiday', 'object_hrm', 'object_intervention', 'object_margin', 'object_money-bill-alt', 'object_multicurrency', 'object_order', 'object_payment', 'object_lot', 'object_mrp', 'object_payment', 'object_product', 'object_propal', 'object_other', 'object_paragraph', 'object_poll', 'object_printer', 'object_project', 'object_projectpub', 'object_propal', 'object_resource', 'object_rss', 'object_projecttask', 'object_supplier_invoice', 'object_supplier_order', 'object_supplier_proposal', 'object_service', 'object_stock', 'object_technic', 'object_ticket', 'object_trip', 'object_user', 'object_group', 'object_member', 'object_phoning', 'object_phoning_mobile', 'object_phoning_fax', 'object_email', 'off', 'on', 'order', - 'paiment', 'play', 'playdisabled', 'poll', 'printer', 'product', 'propal', 'resize', 'service', 'stats', 'trip', - 'note', 'setup', 'sign-out', 'split', 'switch_off', 'switch_on', 'tools', 'unlink', 'uparrow', 'user', 'wrench', + 'paiment', 'play', 'playdisabled', 'poll', 'printer', 'product', 'propal', 'projecttask', 'stock', 'resize', 'service', 'stats', 'trip', + 'setup', 'sign-out', 'split', 'switch_off', 'switch_on', 'tools', 'unlink', 'uparrow', 'user', 'wrench', 'jabber', 'skype', 'twitter', 'facebook', 'linkedin', 'instagram', 'snapchat', 'youtube', 'google-plus-g', 'whatsapp', 'chevron-left', 'chevron-right', 'chevron-down', 'chevron-top', 'home', 'companies', 'products', 'commercial', 'invoicing', 'preview', 'project', 'projectpub', 'supplier_invoice', 'hrm', 'members', 'ticket', 'generic', @@ -3185,7 +3185,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ 'company'=>'building', 'contact'=>'address-book', 'contract'=>'suitcase', 'donation'=>'file-alt', 'dynamicprice'=>'hand-holding-usd', 'setup'=>'cog', 'companies'=>'building', 'products'=>'cube', 'commercial'=>'suitcase', 'invoicing'=>'coins', 'accounting'=>'chart-line', 'category'=>'tag', 'dollyrevert'=>'dolly', - 'hrm'=>'umbrella-beach', 'members'=>'users', 'ticket'=>'ticket-alt', 'globe'=>'external-link-alt', 'lot'=>'barcode', + 'hrm'=>'umbrella-beach', 'margin'=>'calculator', 'members'=>'users', 'ticket'=>'ticket-alt', 'globe'=>'external-link-alt', 'lot'=>'barcode', 'email'=>'at', 'edit'=>'pencil-alt', 'grip_title'=>'arrows-alt', 'grip'=>'arrows-alt', 'help'=>'info-circle', 'generic'=>'file', 'holiday'=>'umbrella-beach', 'member'=>'users', 'mrp'=>'cubes', 'trip'=>'wallet', 'group'=>'users', diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index 428d976ab6d..581a7ebab74 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -2241,7 +2241,7 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) { if (!in_array('prospectionstatus', $hiddenfields)) { - print ''; + print ''; // Because color of prospection status has no meaning yet, it is used if hidden constant is set if (empty($conf->global->USE_COLOR_FOR_PROSPECTION_STATUS)) { $oppStatusCode = dol_getIdFromCode($db, $objp->opp_status, 'c_lead_status', 'rowid', 'code'); diff --git a/htdocs/core/lib/usergroups.lib.php b/htdocs/core/lib/usergroups.lib.php index 5b7c923001b..d41965bdf1f 100644 --- a/htdocs/core/lib/usergroups.lib.php +++ b/htdocs/core/lib/usergroups.lib.php @@ -502,9 +502,8 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) { print yn($conf->global->THEME_TOPMENU_DISABLE_IMAGE); } - print '   ('.$langs->trans("Default").': '.$default.') '; + print '   '.$langs->trans("Default").': '.$default.' '; print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis")); - print ''; print ''; print ''; } @@ -549,9 +548,8 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) if ($color) print ''; else print $langs->trans("Default"); } - print '   ('.$langs->trans("Default").': ffffff) '; + print '   '.$langs->trans("Default").': ffffff '; print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis")); - print ''; print ''; print ''; } @@ -597,9 +595,8 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) if ($color) print ''; else print $langs->trans("Default"); } - print '   ('.$langs->trans("Default").': '.$default.') '; + print '   '.$langs->trans("Default").': '.$default.' '; print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis")); - print ''; print ''; print ''; } @@ -645,9 +642,8 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) if ($color) print ''; else print $langs->trans("Default"); } - print '   ('.$langs->trans("Default").': '.$default.') '; + print '   '.$langs->trans("Default").': '.$default.' '; print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis")); - print ''; print ''; print ''; } @@ -671,9 +667,8 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) { print $formother->showColor($conf->global->THEME_ELDY_TEXTTITLENOTAB, $langs->trans("Default")); } - print '   ('.$langs->trans("Default").': '.$default.') '; + print '   '.$langs->trans("Default").': '.$default.' '; print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis")); - print ''; print ''; print ''; @@ -698,9 +693,8 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) { print $formother->showColor($conf->global->THEME_ELDY_BACKTITLE1, $langs->trans("Default")); } - print '   ('.$langs->trans("Default").': '.$default.') '; // $colorbacktitle1 in CSS + print '   '.$langs->trans("Default").': '.$default.' '; // $colorbacktitle1 in CSS print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis")); - print ''; print ''; print ''; @@ -725,9 +719,8 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) { print $formother->showColor($conf->global->THEME_ELDY_TEXTTITLE, $langs->trans("Default")); } - print '   ('.$langs->trans("Default").': '.$default.') '; + print '   '.$langs->trans("Default").': '.$default.' '; print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis")); - print ''; print ''; print ''; @@ -754,9 +747,8 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) if ($color) print ''; else print $langs->trans("Default"); } - print '   ('.$langs->trans("Default").': '.$default.') '; + print '   '.$langs->trans("Default").': '.$default.' '; print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis")); - print ''; print ''; print ''; } @@ -782,9 +774,8 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) if ($color) print ''; else print $langs->trans("Default"); } - print '   ('.$langs->trans("Default").': '.$default.') '; + print '   '.$langs->trans("Default").': '.$default.' '; print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis")); - print ''; print ''; print ''; } @@ -835,9 +826,8 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) print $langs->trans("Default"); } } - print '   ('.$langs->trans("Default").': '.$default.') '; + print '   '.$langs->trans("Default").': '.$default.' '; print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis")); - print ''; print ''; print ''; } @@ -881,9 +871,8 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) } else print $langs->trans("Default"); } - print '   ('.$langs->trans("Default").': '.$default.') '; + print '   '.$langs->trans("Default").': '.$default.' '; print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis")); - print ''; print ''; } @@ -927,9 +916,8 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) } else print $langs->trans("Default"); } - print '   ('.$langs->trans("Default").': '.$default.') '; + print '   '.$langs->trans("Default").': '.$default.' '; print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis")); - print ''; print ''; print ''; } @@ -959,7 +947,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) if (empty($fuser->conf->MAIN_OPTIMIZEFORTEXTBROWSER)) print ' ('.$langs->trans("ForcedByGlobalSetup").')'; } } - print '   ('.$langs->trans("Default").': '.$default.') '; + print '   '.$langs->trans("Default").': '.$default.' '; print $form->textwithpicto('', $langs->trans("MAIN_OPTIMIZEFORTEXTBROWSERDesc")); print ''; print ''; @@ -979,7 +967,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) { print yn($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER); } - print '   ('.$langs->trans("Default").': '.$default.') '; + print '   wspan class="opacitymedium">'.$langs->trans("Default").': '.$default.' '; print $form->textwithpicto('', $langs->trans("MAIN_OPTIMIZEFORTEXTBROWSERDesc")); print ''; print ''; @@ -1018,7 +1006,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) print yn(0); } } - print '   ('.$langs->trans("Default").': '.$default.') '; + print '   '.$langs->trans("Default").': '.$default.' '; print $form->textwithpicto('', $langs->trans("MAIN_OPTIMIZEFORCOLORBLINDDesc")); print ''; print ''; diff --git a/htdocs/margin/admin/margin.php b/htdocs/margin/admin/margin.php index a2ac11abf7d..5b6cd01ba97 100644 --- a/htdocs/margin/admin/margin.php +++ b/htdocs/margin/admin/margin.php @@ -39,6 +39,7 @@ $action = GETPOST('action', 'alpha'); /* * Action */ + if (preg_match('/set_([a-z0-9_\-]+)/i', $action, $reg)) { $code = $reg[1]; @@ -107,6 +108,8 @@ if ($action == 'contact') * View */ +$form = new Form($db); + llxHeader('', $langs->trans("margesSetup")); @@ -118,16 +121,13 @@ $head = marges_admin_prepare_head(); dol_fiche_head($head, 'parameters', $langs->trans("Margins"), -1, 'margin'); -print load_fiche_titre($langs->trans("MemberMainOptions"), '', ''); print ''; print ''; -print ''; -print ''."\n"; +print ''; +print ''."\n"; print ''."\n"; print ''; -$form = new Form($db); - // GLOBAL DISCOUNT MANAGEMENT print ''; print ''; @@ -162,7 +162,7 @@ print ''; // DISPLAY MARGIN RATES print ''; print ''; -print ''; // DISPLAY MARK RATES print ''; print ''; -print ''; print ''; print ''; -print ''; - print ''; - print ''; - print ''; - print ''; diff --git a/htdocs/projet/tasks/list.php b/htdocs/projet/tasks/list.php index 67131c29ef4..b7a3f33c117 100644 --- a/htdocs/projet/tasks/list.php +++ b/htdocs/projet/tasks/list.php @@ -441,7 +441,7 @@ else else $texthelp .= $langs->trans("TasksOnProjectsPublicDesc"); } -print_barre_liste($form->textwithpicto($title, $texthelp), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'project', 0, $newcardbutton, '', $limit, 0, 0, 1); +print_barre_liste($form->textwithpicto($title, $texthelp), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'projecttask', 0, $newcardbutton, '', $limit, 0, 0, 1); $topicmail = "Information"; $modelmail = "task"; diff --git a/htdocs/projet/tasks/stats/index.php b/htdocs/projet/tasks/stats/index.php index c758664d2c6..bbb275ef5df 100644 --- a/htdocs/projet/tasks/stats/index.php +++ b/htdocs/projet/tasks/stats/index.php @@ -67,7 +67,7 @@ llxHeader('', $langs->trans('Tasks')); $title = $langs->trans("TasksStatistics"); $dir = $conf->projet->dir_output.'/temp'; -print load_fiche_titre($title, '', 'project'); +print load_fiche_titre($title, '', 'projecttask'); dol_mkdir($dir); diff --git a/htdocs/supplier_proposal/list.php b/htdocs/supplier_proposal/list.php index cae4e5a81ad..b4708780c63 100644 --- a/htdocs/supplier_proposal/list.php +++ b/htdocs/supplier_proposal/list.php @@ -534,7 +534,7 @@ if ($resql) // Date if (!empty($arrayfields['sp.date_valid']['checked'])) { - print '"; +print ''; if (empty($reshook)) { @@ -976,12 +976,9 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '') { global $conf, $langs, $user, $db; global $form; - global $region_id; - global $elementList, $sourceList, $localtax_typeList; - global $bc; + global $elementList, $sourceList; $formadmin = new FormAdmin($db); - $formcompany = new FormCompany($db); foreach ($fieldlist as $field => $value) { diff --git a/htdocs/asset/card.php b/htdocs/asset/card.php index 0a604c023ec..110d662c9e8 100644 --- a/htdocs/asset/card.php +++ b/htdocs/asset/card.php @@ -93,19 +93,19 @@ if (empty($reshook)) // Actions cancel, add, update, update_extras, confirm_validate, confirm_delete, confirm_deleteline, confirm_clone, confirm_close, confirm_setdraft, confirm_reopen include DOL_DOCUMENT_ROOT.'/core/actions_addupdatedelete.inc.php'; - + // Actions when linking object each other include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; - + // Actions when printing a doc from card include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php'; // Action to move up and down lines of object //include DOL_DOCUMENT_ROOT.'/core/actions_lineupdown.inc.php'; - + // Action to build doc include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; - + if ($action == 'set_thirdparty' && $permissiontoadd) { $object->setValueFrom('fk_soc', GETPOST('fk_soc', 'int'), '', '', 'date', '', $user, 'MYOBJECT_MODIFY'); @@ -114,7 +114,7 @@ if (empty($reshook)) { $object->setProject(GETPOST('projectid', 'int')); } - + // Actions to send emails $triggersendname = 'ASSET_SENTBYMAIL'; $autocopy = 'MAIN_MAIL_AUTOCOPY_ASSET_TO'; @@ -164,7 +164,7 @@ if ($action == 'create') print ''; if ($backtopage) print ''; if ($backtopageforcancel) print ''; - + dol_fiche_head(array(), ''); print '
'.$langs->trans("Description").''.$langs->trans("Value").''.$langs->trans("MemberMainOptions").''.$langs->trans("Value").''.$langs->trans("Description").'
'.$langs->trans("DisplayMarginRates").''; +print ''; if (!empty($conf->use_javascript_ajax)) { print ajax_constantonoff('DISPLAY_MARGIN_RATES'); @@ -185,7 +185,7 @@ print '
'.$langs->trans("DisplayMarkRates").''; +print ''; if (!empty($conf->use_javascript_ajax)) { print ajax_constantonoff('DISPLAY_MARK_RATES'); @@ -208,7 +208,7 @@ print '
'.$langs->trans("ForceBuyingPriceIfNull").''; +print ''; if (!empty($conf->use_javascript_ajax)) { print ajax_constantonoff('ForceBuyingPriceIfNull'); diff --git a/htdocs/projet/activity/index.php b/htdocs/projet/activity/index.php index 63115350bbc..107bcb4e4e3 100644 --- a/htdocs/projet/activity/index.php +++ b/htdocs/projet/activity/index.php @@ -21,7 +21,7 @@ /** * \file htdocs/projet/activity/index.php * \ingroup projet - * \brief Page activite perso du module projet + * \brief Page on activity of projects */ require "../../main.inc.php"; @@ -92,7 +92,7 @@ else else $tooltiphelp = $langs->trans("TasksPublicDesc"); } -print_barre_liste($form->textwithpicto($title, $tooltiphelp), 0, $_SERVER["PHP_SELF"], '', '', '', '', 0, -1, 'project', 0, $morehtml); +print_barre_liste($form->textwithpicto($title, $tooltiphelp), 0, $_SERVER["PHP_SELF"], '', '', '', '', 0, -1, 'projecttask', 0, $morehtml); print '
'; diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index cb004bc33a0..ebc6a7dc556 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -499,7 +499,7 @@ if ($action == 'create' && $user->rights->projet->creer && (empty($object->third { if ($id > 0 || !empty($ref)) print '
'; - print load_fiche_titre($langs->trans("NewTask"), '', 'project'); + print load_fiche_titre($langs->trans("NewTask"), '', 'projecttask'); if ($object->statut == Project::STATUS_CLOSED) { diff --git a/htdocs/projet/tasks/contact.php b/htdocs/projet/tasks/contact.php index 0c9a09b37c0..415859127db 100644 --- a/htdocs/projet/tasks/contact.php +++ b/htdocs/projet/tasks/contact.php @@ -395,11 +395,11 @@ if ($id > 0 || !empty($ref)) print img_object('', 'user').' '.$langs->trans("Users"); print '
'; + print ''; print $conf->global->MAIN_INFO_SOCIETE_NOM; print ''; + print ''; // On recupere les id des users deja selectionnes if ($object->project->public) $contactsofproject = ''; // Everybody else $contactsofproject = $projectstatic->getListContactId('internal'); @@ -430,13 +430,13 @@ if ($id > 0 || !empty($ref)) print img_object('', 'contact').' '.$langs->trans("ThirdPartyContacts"); print ''; + print ''; $thirdpartyofproject = $projectstatic->getListContactId('thirdparty'); $selectedCompany = isset($_GET["newcompany"]) ? $_GET["newcompany"] : $projectstatic->socid; $selectedCompany = $formcompany->selectCompaniesForNewContact($object, 'id', $selectedCompany, 'newcompany', $thirdpartyofproject, 0, '&withproject='.$withproject); print ''; + print ''; $contactofproject = $projectstatic->getListContactId('external'); $nbofcontacts = $form->select_contacts($selectedCompany, '', 'contactid', 0, '', $contactofproject); print ''; + print ''; //print $langs->trans('Month').': '; print ''; //print ' '.$langs->trans('Year').': '; @@ -545,7 +545,7 @@ if ($resql) // Date if (!empty($arrayfields['sp.date_livraison']['checked'])) { - print ''; + print ''; //print $langs->trans('Month').': '; print ''; //print ' '.$langs->trans('Year').': '; diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index 172309a233e..85c900eaf55 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -1177,116 +1177,41 @@ class Ticket extends CommonObject // phpcs:enable global $langs; - if ($mode == 0) { - return $langs->trans($this->statuts[$status]); + $labelStatus = $this->statuts[$status]; + $labelStatusShort = $this->statuts_short[$status]; + + if ($status == self::STATUS_NOT_READ) { + $statusType = 'status0'; } - elseif ($mode == 1) { - return $langs->trans($this->statuts_short[$status]); + elseif ($status == self::STATUS_READ) { + $statusType = 'status1'; } - elseif ($mode == 2) { - if ($status == self::STATUS_NOT_READ) { - return img_picto($langs->trans($this->statuts_short[$status]), 'statut0.png@ticket').' '.$langs->trans($this->statuts_short[$status]); - } - elseif ($status == self::STATUS_READ) { - return img_picto($langs->trans($this->statuts_short[$status]), 'statut1.png@ticket').' '.$langs->trans($this->statuts_short[$status]); - } - elseif ($status == self::STATUS_ASSIGNED) { - return img_picto($langs->trans($this->statuts_short[$status]), 'statut2.png@ticket').' '.$langs->trans($this->statuts_short[$status]); - } - elseif ($status == self::STATUS_IN_PROGRESS) { - return img_picto($langs->trans($this->statuts_short[$status]), 'statut3.png@ticket').' '.$langs->trans($this->statuts_short[$status]); - } - elseif ($status == self::STATUS_NEED_MORE_INFO) { - return img_picto($langs->trans($this->statuts_short[$status]), 'statut5.png@ticket').' '.$langs->trans($this->statuts_short[$status]); - } - elseif ($status == self::STATUS_WAITING) { - return img_picto($langs->trans($this->statuts_short[$status]), 'statut6.png@ticket').' '.$langs->trans($this->statuts_short[$status]); - } - elseif ($status == self::STATUS_CLOSED) { - return img_picto($langs->trans($this->statuts_short[$status]), 'statut8.png@ticket').' '.$langs->trans($this->statuts_short[$status]); - } - elseif ($status == self::STATUS_CANCELED) { - return img_picto($langs->trans($this->statuts_short[$status]), 'statut9.png@ticket').' '.$langs->trans($this->statuts_short[$status]); - } + elseif ($status == self::STATUS_ASSIGNED) { + $statusType = 'status3'; } - elseif ($mode == 3) { - if ($status == self::STATUS_NOT_READ) { - return img_picto($langs->trans($this->statuts_short[$status]), 'statut0.png@ticket'); - } - elseif ($status == self::STATUS_READ) { - return img_picto($langs->trans($this->statuts_short[$status]), 'statut1.png@ticket'); - } - elseif ($status == self::STATUS_ASSIGNED) { - return img_picto($langs->trans($this->statuts_short[$status]), 'statut2.png@ticket'); - } - elseif ($status == self::STATUS_IN_PROGRESS) { - return img_picto($langs->trans($this->statuts_short[$status]), 'statut3.png@ticket'); - } - elseif ($status == self::STATUS_NEED_MORE_INFO) { - return img_picto($langs->trans($this->statuts_short[$status]), 'statut5.png@ticket'); - } - elseif ($status == self::STATUS_WAITING) { - return img_picto($langs->trans($this->statuts_short[$status]), 'statut6.png@ticket'); - } - elseif ($status == self::STATUS_CLOSED) { - return img_picto($langs->trans($this->statuts_short[$status]), 'statut8.png@ticket'); - } - elseif ($status == self::STATUS_CANCELED) { - return img_picto($langs->trans($this->statuts_short[$status]), 'statut9.png@ticket'); - } + elseif ($status == self::STATUS_IN_PROGRESS) { + $statusType = 'status4'; } - elseif ($mode == 4) { - if ($status == self::STATUS_NOT_READ) { - return img_picto($langs->trans($this->statuts_short[$status]), 'statut0.png@ticket').' '.$langs->trans($this->statuts_short[$status]); - } - elseif ($status == self::STATUS_READ) { - return img_picto($langs->trans($this->statuts_short[$status]), 'statut1.png@ticket').' '.$langs->trans($this->statuts_short[$status]); - } - elseif ($status == self::STATUS_ASSIGNED) { - return img_picto($langs->trans($this->statuts_short[$status]), 'statut2.png@ticket').' '.$langs->trans($this->statuts_short[$status]); - } - elseif ($status == self::STATUS_IN_PROGRESS) { - return img_picto($langs->trans($this->statuts_short[$status]), 'statut3.png@ticket').' '.$langs->trans($this->statuts_short[$status]); - } - elseif ($status == self::STATUS_NEED_MORE_INFO) { - return img_picto($langs->trans($this->statuts_short[$status]), 'statut5.png@ticket').' '.$langs->trans($this->statuts_short[$status]); - } - elseif ($status == self::STATUS_WAITING) { - return img_picto($langs->trans($this->statuts_short[$status]), 'statut6.png@ticket').' '.$langs->trans($this->statuts_short[$status]); - } - elseif ($status == self::STATUS_CLOSED) { - return img_picto($langs->trans($this->statuts_short[$status]), 'statut8.png@ticket').' '.$langs->trans($this->statuts_short[$status]); - } - elseif ($status == self::STATUS_CANCELED) { - return img_picto($langs->trans($this->statuts_short[$status]), 'statut9.png@ticket').' '.$langs->trans($this->statuts_short[$status]); - } + elseif ($status == self::STATUS_WAITING) { + $statusType = 'status3'; } - elseif ($mode == 5 || $mode == 6) { - if ($status == self::STATUS_NOT_READ) { - return $langs->trans($this->statuts_short[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]), 'statut0.png@ticket'); - } - elseif ($status == self::STATUS_READ) { - return $langs->trans($this->statuts_short[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]), 'statut1.png@ticket'); - } - elseif ($status == self::STATUS_ASSIGNED) { - return $langs->trans($this->statuts_short[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]), 'statut2.png@ticket'); - } - elseif ($status == self::STATUS_IN_PROGRESS) { - return $langs->trans($this->statuts_short[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]), 'statut3.png@ticket'); - } - elseif ($status == self::STATUS_NEED_MORE_INFO) { - return $langs->trans($this->statuts_short[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]), 'statut5.png@ticket'); - } - elseif ($status == self::STATUS_WAITING) { - return $langs->trans($this->statuts_short[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]), 'statut6.png@ticket'); - } - elseif ($status == self::STATUS_CLOSED) { - return $langs->trans($this->statuts_short[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]), 'statut8.png@ticket'); - } - elseif ($status == self::STATUS_CANCELED) { - return $langs->trans($this->statuts_short[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]), 'statut9.png@ticket'); - } + elseif ($status == self::STATUS_NEED_MORE_INFO) { + $statusType = 'status9'; } + elseif ($status == self::STATUS_CANCELED) { + $statusType = 'status9'; + } + elseif ($status == self::STATUS_CLOSED) { + $statusType = 'status6'; + } + else { + $labelStatus = $langs->trans('Unknown'); + $labelStatusShort = $langs->trans('Unknown'); + $statusType = 'status0'; + $mode = 0; + } + + return dolGetStatus($langs->trans($labelStatus), $langs->trans($labelStatusShort), '', $statusType, $mode); } diff --git a/htdocs/ticket/index.php b/htdocs/ticket/index.php index 86929157d25..cfd8e3f26f3 100644 --- a/htdocs/ticket/index.php +++ b/htdocs/ticket/index.php @@ -181,15 +181,27 @@ if ($result) { } } + include_once DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/theme_vars.inc.php'; + $dataseries = array(); + $colorseries = array(); + $dataseries[] = array('label' => $langs->trans("Unread"), 'data' => round($tick['unread'])); + $colorseries[Ticket::STATUS_NOT_READ] = '-'.$badgeStatus0; $dataseries[] = array('label' => $langs->trans("Read"), 'data' => round($tick['read'])); - $dataseries[] = array('label' => $langs->trans("NeedMoreInformation"), 'data' => round($tick['needmoreinfo'])); + $colorseries[Ticket::STATUS_READ] = $badgeStatus1; $dataseries[] = array('label' => $langs->trans("Assigned"), 'data' => round($tick['assigned'])); + $colorseries[Ticket::STATUS_ASSIGNED] = $badgeStatus3; $dataseries[] = array('label' => $langs->trans("InProgress"), 'data' => round($tick['inprogress'])); - $dataseries[] = array('label' => $langs->trans("Waiting"), 'data' => round($tick['waiting'])); - $dataseries[] = array('label' => $langs->trans("Closed"), 'data' => round($tick['closed'])); + $colorseries[Ticket::STATUS_IN_PROGRESS] = $badgeStatus4; + $dataseries[] = array('label' => $langs->trans("Suspended"), 'data' => round($tick['waiting'])); + $colorseries[Ticket::STATUS_WAITING] = '-'.$badgeStatus3; + $dataseries[] = array('label' => $langs->trans("NeedMoreInformation"), 'data' => round($tick['needmoreinfo'])); + $colorseries[Ticket::STATUS_NEED_MORE_INFO] = $badgeStatus9; $dataseries[] = array('label' => $langs->trans("Canceled"), 'data' => round($tick['canceled'])); + $colorseries[Ticket::STATUS_CANCELED] = $badgeStatus9; + $dataseries[] = array('label' => $langs->trans("Closed"), 'data' => round($tick['closed'])); + $colorseries[Ticket::STATUS_CLOSED] = $badgeStatus6; } else { dol_print_error($db); } @@ -233,6 +245,8 @@ if (!empty($dataseries) && count($dataseries) > 1) { $mesg = $px1->isGraphKo(); if (!$mesg) { $px1->SetData($data); + $px1->SetDataColor(array_values($colorseries)); + unset($data1); $i = $startyear; $legend = array(); From b426bbe7586d0dd7b7196533032b37d3dabe0551 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 25 Apr 2020 17:47:41 +0200 Subject: [PATCH 098/115] Fix bad code --- htdocs/adherents/class/adherent_type.class.php | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/htdocs/adherents/class/adherent_type.class.php b/htdocs/adherents/class/adherent_type.class.php index 46733575c36..4af80ab4a63 100644 --- a/htdocs/adherents/class/adherent_type.class.php +++ b/htdocs/adherents/class/adherent_type.class.php @@ -183,20 +183,14 @@ class AdherentType extends CommonObject $sql2 .= " SET "; $sql2 .= " label='".$this->db->escape($this->label)."',"; $sql2 .= " description='".$this->db->escape($this->description)."'"; - if (!empty($conf->global->PRODUCT_USE_OTHER_FIELD_IN_TRANSLATION)) { $sql2 .= ", email='".$this->db->escape($this->other)."'"; - } $sql2 .= " WHERE fk_type=".$this->id." AND lang='".$this->db->escape($key)."'"; } else { $sql2 = "INSERT INTO ".MAIN_DB_PREFIX."adherent_type_lang (fk_type, lang, label, description"; - if (!empty($conf->global->PRODUCT_USE_OTHER_FIELD_IN_TRANSLATION)) { $sql2 .= ", email"; - } $sql2 .= ")"; $sql2 .= " VALUES(".$this->id.",'".$this->db->escape($key)."','".$this->db->escape($this->label)."',"; $sql2 .= " '".$this->db->escape($this->description)."'"; - if (!empty($conf->global->PRODUCT_USE_OTHER_FIELD_IN_TRANSLATION)) { $sql2 .= ", '".$this->db->escape($this->other)."'"; - } $sql2 .= ")"; } dol_syslog(get_class($this).'::setMultiLangs key = current_lang = '.$key); @@ -219,20 +213,14 @@ class AdherentType extends CommonObject $sql2 .= " SET "; $sql2 .= " label='".$this->db->escape($this->multilangs["$key"]["label"])."',"; $sql2 .= " description='".$this->db->escape($this->multilangs["$key"]["description"])."'"; - if (!empty($conf->global->PRODUCT_USE_OTHER_FIELD_IN_TRANSLATION)) { $sql2 .= ", email='".$this->db->escape($this->multilangs["$key"]["other"])."'"; - } $sql2 .= " WHERE fk_type=".$this->id." AND lang='".$this->db->escape($key)."'"; } else { $sql2 = "INSERT INTO ".MAIN_DB_PREFIX."adherent_type_lang (fk_type, lang, label, description"; - if (!empty($conf->global->PRODUCT_USE_OTHER_FIELD_IN_TRANSLATION)) { $sql2 .= ", email"; - } $sql2 .= ")"; $sql2 .= " VALUES(".$this->id.",'".$this->db->escape($key)."','".$this->db->escape($this->multilangs["$key"]["label"])."',"; $sql2 .= " '".$this->db->escape($this->multilangs["$key"]["description"])."'"; - if (!empty($conf->global->PRODUCT_USE_OTHER_FIELD_IN_TRANSLATION)) { $sql2 .= ", '".$this->db->escape($this->multilangs["$key"]["other"])."'"; - } $sql2 .= ")"; } From 068a890c36d4a739602d24df38805dee0102073d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 25 Apr 2020 19:13:20 +0200 Subject: [PATCH 099/115] Enable more PHPCS rules --- dev/setup/codesniffer/README | 4 ++++ dev/setup/codesniffer/ruleset.xml | 7 +------ htdocs/admin/mails_templates.php | 7 ++----- htdocs/asset/card.php | 16 ++++++++-------- htdocs/core/class/smtps.class.php | 7 ++----- htdocs/core/modules/modEmailCollector.class.php | 9 ++++++--- htdocs/core/modules/modReceiptPrinter.class.php | 4 +++- htdocs/core/modules/modReception.class.php | 3 ++- htdocs/core/modules/modTicket.class.php | 7 ++++++- htdocs/install/upgrade2.php | 8 +++----- .../test/phpunit/MyModuleFunctionalTest.php | 2 +- 11 files changed, 38 insertions(+), 36 deletions(-) diff --git a/dev/setup/codesniffer/README b/dev/setup/codesniffer/README index 8a68d8a1140..087fb318f6f 100644 --- a/dev/setup/codesniffer/README +++ b/dev/setup/codesniffer/README @@ -6,6 +6,10 @@ This directory contains ruleset files to use to develop Dolibarr EPR & CRM. To install/upgrade phpcs: > sudo pear upgrade PHP_CodeSniffer +To run phpcs: +> cd dolibarrgitrepo +> phpcs --standard=dev/setup/codesniffer/ruleset.xml --extensions=php --parallel=8 . + Note with Eclipse: You must setup the PTI plugin of Eclipse into PHPCodeSniffer menu with: * tab value to 4 * path of code sniffer standard to dev/codesniffer diff --git a/dev/setup/codesniffer/ruleset.xml b/dev/setup/codesniffer/ruleset.xml index 10d6e29bbe2..6b92522d11e 100644 --- a/dev/setup/codesniffer/ruleset.xml +++ b/dev/setup/codesniffer/ruleset.xml @@ -36,8 +36,6 @@ - - @@ -70,9 +68,6 @@ 0 - - 0 - - + diff --git a/htdocs/admin/mails_templates.php b/htdocs/admin/mails_templates.php index cc8a92f819b..37d1f903b4a 100644 --- a/htdocs/admin/mails_templates.php +++ b/htdocs/admin/mails_templates.php @@ -536,7 +536,7 @@ $errors = $hookmanager->errors; // Line to enter new values (input fields) -print "
'."\n"; @@ -186,7 +186,7 @@ if ($action == 'create') print ''; print ''; - + //dol_set_focus('input[name="ref"]'); } @@ -202,7 +202,7 @@ if (($id || $ref) && $action == 'edit') print ''; if ($backtopage) print ''; if ($backtopageforcancel) print ''; - + dol_fiche_head(); print '
'."\n"; diff --git a/htdocs/core/class/smtps.class.php b/htdocs/core/class/smtps.class.php index ba3c8199fca..f65b87944cf 100644 --- a/htdocs/core/class/smtps.class.php +++ b/htdocs/core/class/smtps.class.php @@ -533,12 +533,9 @@ class SMTPs /** * Now send the message * - * @param boolean $_bolTestMsg whether to run this method in 'Test' mode. - * @param boolean $_bolDebug whether to log all communication between this Class and the Mail Server. - * @return boolean|null void - * $_strMsg If this is run in 'Test' mode, the actual message structure will be returned + * @return boolean|null Result */ - public function sendMsg($_bolTestMsg = false, $_bolDebug = false) + public function sendMsg() { global $conf; diff --git a/htdocs/core/modules/modEmailCollector.class.php b/htdocs/core/modules/modEmailCollector.class.php index cba555391d7..46d17f9668c 100644 --- a/htdocs/core/modules/modEmailCollector.class.php +++ b/htdocs/core/modules/modEmailCollector.class.php @@ -282,8 +282,9 @@ class modEmailCollector extends DolibarrModules $tmpresql = $this->db->query($tmpsql); if ($tmpresql) { if ($this->db->num_rows($tmpresql) == 0) { + $descriptionA1 = 'This collector will scan your mailbox to find emails that match some rules and create automatically a ticket (Module Ticket must be enabled) with the email informations. You can use this collector if you provide some support by email, so your ticket request will be automatically generated. If the collector Collect_Responses is also enabled, when you send an email from the ticket, you may also see answers of your customers or partners directly on the ticket view.'; $sqlforexampleA1 = "INSERT INTO ".MAIN_DB_PREFIX."emailcollector_emailcollector (entity, ref, label, description, source_directory, date_creation, fk_user_creat, status)"; - $sqlforexampleA1 .= " VALUES (".$conf->entity.", 'Collect_Ticket_Requets', 'Example to collect ticket requests', 'This collector will scan your mailbox to find emails that match some rules and create automatically a ticket (Module Ticket must be enabled) with the email informations. You can use this collector if you provide some support by email, so your ticket request will be automatically generated. If the collector Collect_Responses is also enabled, when you send an email from the ticket, you may also see answers of your customers or partners directly on the ticket view.', 'INBOX', '".$this->db->idate(dol_now())."', ".$user->id.", 0)"; + $sqlforexampleA1 .= " VALUES (".$conf->entity.", 'Collect_Ticket_Requets', 'Example to collect ticket requests', $this->db->escape($descriptionA1), 'INBOX', '".$this->db->idate(dol_now())."', ".$user->id.", 0)"; $sqlforexampleA2 = "INSERT INTO ".MAIN_DB_PREFIX."emailcollector_emailcollectorfilter (fk_emailcollector, type, date_creation, fk_user_creat, status)"; $sqlforexampleA2 .= " VALUES ((SELECT rowid FROM ".MAIN_DB_PREFIX."emailcollector_emailcollector WHERE ref = 'Collect_Ticket_Requets' and entity = ".$conf->entity."), 'withouttrackingid', '".$this->db->idate(dol_now())."', ".$user->id.", 1)"; $sqlforexampleA3 = "INSERT INTO ".MAIN_DB_PREFIX."emailcollector_emailcollectorfilter (fk_emailcollector, type, rulevalue, date_creation, fk_user_creat, status)"; @@ -301,8 +302,9 @@ class modEmailCollector extends DolibarrModules $tmpresql = $this->db->query($tmpsql); if ($tmpresql) { if ($this->db->num_rows($tmpresql) == 0) { + $descriptionB1 = 'This collector will scan your mailbox to find all emails that are an answer of an email sent from your application. An event with the email response will be recorded at the good place (Module Agenda must be enabled). For example, if your send a commercial proposal, order or invoice by email and your customer answers your email, the system will automatically find the answer and add it into your ERP.'; $sqlforexampleB1 = "INSERT INTO ".MAIN_DB_PREFIX."emailcollector_emailcollector (entity, ref, label, description, source_directory, date_creation, fk_user_creat, status)"; - $sqlforexampleB1 .= " VALUES (".$conf->entity.", 'Collect_Responses', 'Example to collect any email responses', 'This collector will scan your mailbox to find all emails that are an answer of an email sent from your application. An event with the email response will be recorded at the good place (Module Agenda must be enabled). For example, if your send a commercial proposal, order or invoice by email and your customer answers your email, the system will automatically find the answer and add it into your ERP.', 'INBOX', '".$this->db->idate(dol_now())."', ".$user->id.", 0)"; + $sqlforexampleB1 .= " VALUES (".$conf->entity.", 'Collect_Responses', 'Example to collect any email responses', $this->db->escape($descriptionB1), 'INBOX', '".$this->db->idate(dol_now())."', ".$user->id.", 0)"; $sqlforexampleB2 = "INSERT INTO ".MAIN_DB_PREFIX."emailcollector_emailcollectorfilter (fk_emailcollector, type, date_creation, fk_user_creat, status)"; $sqlforexampleB2 .= " VALUES ((SELECT rowid FROM ".MAIN_DB_PREFIX."emailcollector_emailcollector WHERE ref = 'Collect_Responses' and entity = ".$conf->entity."), 'withtrackingid', '".$this->db->idate(dol_now())."', ".$user->id.", 1)"; $sqlforexampleB3 = "INSERT INTO ".MAIN_DB_PREFIX."emailcollector_emailcollectoraction (fk_emailcollector, type, date_creation, fk_user_creat, status)"; @@ -317,8 +319,9 @@ class modEmailCollector extends DolibarrModules $tmpresql = $this->db->query($tmpsql); if ($tmpresql) { if ($this->db->num_rows($tmpresql) == 0) { + $descriptionC1 = "This collector will scan your mailbox to find emails that match some rules and create automatically a lead (Module Project must be enabled) with the email informations. You can use this collector if you want to follow your lead using the module Project (1 lead = 1 project), so your leads will be automatically generated. If the collector Collect_Responses is also enabled, when you send an email from your leads, proposals or any other object, you may also see answers of your customers or partners directly on the application.
Note: With this initial example, the title of the lead is generated including the email. If the thirdparty can't be found in database (new customer), the lead will be attached to the thirdparty with ID 1."; $sqlforexampleC1 = "INSERT INTO ".MAIN_DB_PREFIX."emailcollector_emailcollector (entity, ref, label, description, source_directory, date_creation, fk_user_creat, status)"; - $sqlforexampleC1 .= " VALUES (".$conf->entity.", 'Collect_Leads', 'Example to collect leads', 'This collector will scan your mailbox to find emails that match some rules and create automatically a lead (Module Project must be enabled) with the email informations. You can use this collector if you want to follow your lead using the module Project (1 lead = 1 project), so your leads will be automatically generated. If the collector Collect_Responses is also enabled, when you send an email from your leads, proposals or any other object, you may also see answers of your customers or partners directly on the application.
Note: With this initial example, the title of the lead is generated including the email. If the thirdparty can''t be found in database (new customer), the lead will be attached to the thirdparty with ID 1.', 'INBOX', '".$this->db->idate(dol_now())."', ".$user->id.", 0)"; + $sqlforexampleC1 .= " VALUES (".$conf->entity.", 'Collect_Leads', 'Example to collect leads',$this->db->escape($descriptionC1), 'INBOX', '".$this->db->idate(dol_now())."', ".$user->id.", 0)"; $sqlforexampleC2 = "INSERT INTO ".MAIN_DB_PREFIX."emailcollector_emailcollectorfilter (fk_emailcollector, type, date_creation, fk_user_creat, status)"; $sqlforexampleC2 .= " VALUES ((SELECT rowid FROM ".MAIN_DB_PREFIX."emailcollector_emailcollector WHERE ref = 'Collect_Leads' and entity = ".$conf->entity."), 'withouttrackingid', '".$this->db->idate(dol_now())."', ".$user->id.", 1)"; $sqlforexampleC3 = "INSERT INTO ".MAIN_DB_PREFIX."emailcollector_emailcollectorfilter (fk_emailcollector, type, rulevalue, date_creation, fk_user_creat, status)"; diff --git a/htdocs/core/modules/modReceiptPrinter.class.php b/htdocs/core/modules/modReceiptPrinter.class.php index 47f62a21b08..f761238213a 100644 --- a/htdocs/core/modules/modReceiptPrinter.class.php +++ b/htdocs/core/modules/modReceiptPrinter.class.php @@ -135,11 +135,13 @@ class modReceiptPrinter extends DolibarrModules global $conf, $langs; // Clean before activation $this->remove($options); + + $templateexample = '\r\n\r\n\r\n\r\n\r\nFacture \r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n'; $sql = array( "CREATE TABLE IF NOT EXISTS ".MAIN_DB_PREFIX."printer_receipt (rowid integer AUTO_INCREMENT PRIMARY KEY, name varchar(128), fk_type integer, fk_profile integer, parameter varchar(128), entity integer) ENGINE=innodb;", "CREATE TABLE IF NOT EXISTS ".MAIN_DB_PREFIX."printer_receipt_template (rowid integer AUTO_INCREMENT PRIMARY KEY, name varchar(128), template text, entity integer) ENGINE=innodb;", "DELETE FROM ".MAIN_DB_PREFIX."printer_receipt_template WHERE name = '".$langs->trans('Example')."';", - "INSERT INTO ".MAIN_DB_PREFIX."printer_receipt_template (name,template,entity) VALUES ('".$langs->trans('Example')."', '\r\n\r\n\r\n\r\n\r\nFacture \r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n', 1);", + "INSERT INTO ".MAIN_DB_PREFIX."printer_receipt_template (name,template,entity) VALUES ('".$langs->trans('Example')."', $templateexample, 1);", ); return $this->_init($sql, $options); } diff --git a/htdocs/core/modules/modReception.class.php b/htdocs/core/modules/modReception.class.php index 637afae049d..c09915febb8 100644 --- a/htdocs/core/modules/modReception.class.php +++ b/htdocs/core/modules/modReception.class.php @@ -197,7 +197,8 @@ class modReception extends DolibarrModules $this->export_entities_array[$r] = array( 's.rowid'=>"company", 's.nom'=>'company', 's.address'=>'company', 's.zip'=>'company', 's.town'=>'company', 'd.nom'=>'company', 'co.label'=>'company', 'co.code'=>'company', 's.fk_pays'=>'company', 's.phone'=>'company', 's.siren'=>'company', 's.ape'=>'company', 's.siret'=>'company', 's.idprof4'=>'company', 's.idprof5'=>'company', 's.idprof6'=>'company', - 'c.rowid'=>"reception", 'c.ref'=>"reception", 'c.ref_supplier'=>"reception", 'c.fk_soc'=>"reception", 'c.date_creation'=>"reception", 'c.date_delivery'=>"reception", 'c.tracking_number'=>'reception', 'c.height'=>"reception", 'c.width'=>"reception", 'c.size'=>'reception', 'c.size_units'=>'reception', 'c.weight'=>"reception", 'c.weight_units'=>'reception', 'c.fk_statut'=>"reception", 'c.note_public'=>"reception", 'ed.rowid'=>'reception_line', 'ed.comment'=>'reception_line', 'ed.qty'=>"reception_line", + 'c.rowid'=>"reception", 'c.ref'=>"reception", 'c.ref_supplier'=>"reception", 'c.fk_soc'=>"reception", 'c.date_creation'=>"reception", 'c.date_delivery'=>"reception", 'c.tracking_number'=>'reception', 'c.height'=>"reception", 'c.width'=>"reception", 'c.size'=>'reception', 'c.size_units'=>'reception', 'c.weight'=>"reception", 'c.weight_units'=>'reception', 'c.fk_statut'=>"reception", 'c.note_public'=>"reception", + 'ed.rowid'=>'reception_line', 'ed.comment'=>'reception_line', 'ed.qty'=>"reception_line", 'p.rowid'=>'product', 'p.ref'=>'product', 'p.label'=>'product', 'p.weight'=>'product', 'p.weight_units'=>'product', 'p.volume'=>'product', 'p.volume_units'=>'product' ); if ($idcontacts && !empty($conf->global->RECEPTION_ADD_CONTACTS_IN_EXPORT)) $this->export_entities_array[$r] += array('sp.rowid'=>'contact', 'sp.lastname'=>'contact', 'sp.firstname'=>'contact', 'sp.note_public'=>'contact'); diff --git a/htdocs/core/modules/modTicket.class.php b/htdocs/core/modules/modTicket.class.php index 1fc755455de..0b5e54e9637 100644 --- a/htdocs/core/modules/modTicket.class.php +++ b/htdocs/core/modules/modTicket.class.php @@ -122,7 +122,12 @@ class modTicket extends DolibarrModules 'langs' => 'ticket', 'tabname' => array(MAIN_DB_PREFIX."c_ticket_type", MAIN_DB_PREFIX."c_ticket_severity", MAIN_DB_PREFIX."c_ticket_category", MAIN_DB_PREFIX."c_ticket_resolution"), 'tablib' => array("TicketDictType", "TicketDictSeverity", "TicketDictCategory", "TicketDictResolution"), - 'tabsql' => array('SELECT f.rowid as rowid, f.code, f.pos, f.label, f.active, f.use_default FROM '.MAIN_DB_PREFIX.'c_ticket_type as f', 'SELECT f.rowid as rowid, f.code, f.pos, f.label, f.active, f.use_default FROM '.MAIN_DB_PREFIX.'c_ticket_severity as f', 'SELECT f.rowid as rowid, f.code, f.pos, f.label, f.active, f.use_default FROM '.MAIN_DB_PREFIX.'c_ticket_category as f', 'SELECT f.rowid as rowid, f.code, f.pos, f.label, f.active, f.use_default FROM '.MAIN_DB_PREFIX.'c_ticket_resolution as f'), + 'tabsql' => array( + 'SELECT f.rowid as rowid, f.code, f.pos, f.label, f.active, f.use_default FROM '.MAIN_DB_PREFIX.'c_ticket_type as f', + 'SELECT f.rowid as rowid, f.code, f.pos, f.label, f.active, f.use_default FROM '.MAIN_DB_PREFIX.'c_ticket_severity as f', + 'SELECT f.rowid as rowid, f.code, f.pos, f.label, f.active, f.use_default FROM '.MAIN_DB_PREFIX.'c_ticket_category as f', + 'SELECT f.rowid as rowid, f.code, f.pos, f.label, f.active, f.use_default FROM '.MAIN_DB_PREFIX.'c_ticket_resolution as f' + ), 'tabsqlsort' => array("pos ASC", "pos ASC", "pos ASC", "pos ASC"), 'tabfield' => array("pos,code,label,use_default", "pos,code,label,use_default", "pos,code,label,use_default", "pos,code,label,use_default"), 'tabfieldvalue' => array("pos,code,label,use_default", "pos,code,label,use_default", "pos,code,label,use_default", "pos,code,label,use_default"), diff --git a/htdocs/install/upgrade2.php b/htdocs/install/upgrade2.php index 70f4bb32d19..0fb36466a02 100644 --- a/htdocs/install/upgrade2.php +++ b/htdocs/install/upgrade2.php @@ -498,7 +498,7 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ migrate_reload_modules($db, $langs, $conf, $listofmodule); // Reload menus (this must be always and only into last targeted version) - migrate_reload_menu($db, $langs, $conf, $versionto); + migrate_reload_menu($db, $langs, $conf); } // Can force activation of some module during migration with parameter 'enablemodules=MAIN_MODULE_XXX,MAIN_MODULE_YYY,...' @@ -3624,10 +3624,9 @@ function migrate_mode_reglement($db, $langs, $conf) * @param DoliDB $db Database handler * @param Translate $langs Object langs * @param Conf $conf Object conf - * @param string $versionto Version target * @return void */ -function migrate_clean_association($db, $langs, $conf, $versionto) +function migrate_clean_association($db, $langs, $conf) { $result = $db->DDLDescTable(MAIN_DB_PREFIX."categorie_association"); if ($result) // result defined for version 3.2 or - @@ -4834,10 +4833,9 @@ function migrate_reload_modules($db, $langs, $conf, $listofmodule = array(), $fo * @param DoliDB $db Database handler * @param Translate $langs Object langs * @param Conf $conf Object conf - * @param string $versionto Version target * @return void */ -function migrate_reload_menu($db, $langs, $conf, $versionto) +function migrate_reload_menu($db, $langs, $conf) { global $conf; dolibarr_install_syslog("upgrade2::migrate_reload_menu"); diff --git a/htdocs/modulebuilder/template/test/phpunit/MyModuleFunctionalTest.php b/htdocs/modulebuilder/template/test/phpunit/MyModuleFunctionalTest.php index 3a3870958e8..7c038971ed6 100644 --- a/htdocs/modulebuilder/template/test/phpunit/MyModuleFunctionalTest.php +++ b/htdocs/modulebuilder/template/test/phpunit/MyModuleFunctionalTest.php @@ -17,7 +17,7 @@ */ /** - * \file test/functional/MyModuleFunctionalTest.php + * \file test/phpunit/MyModuleFunctionalTest.php * \ingroup mymodule * \brief Example Selenium test. * From 6caa872280759954ac04127bee6ca85a1e3f0e01 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 25 Apr 2020 19:27:42 +0200 Subject: [PATCH 100/115] Enable more PHPCS rules --- dev/setup/codesniffer/ruleset.xml | 7 ------- htdocs/admin/external_rss.php | 12 ++++++------ htdocs/admin/modulehelp.php | 2 +- htdocs/compta/paiement/rapport.php | 6 ++++-- htdocs/core/class/smtps.class.php | 4 ++-- htdocs/mrp/mo_production.php | 2 +- htdocs/product/price.php | 2 +- htdocs/product/stock/movement_card.php | 12 +++++------- htdocs/product/stock/movement_list.php | 14 +++++--------- 9 files changed, 25 insertions(+), 36 deletions(-) diff --git a/dev/setup/codesniffer/ruleset.xml b/dev/setup/codesniffer/ruleset.xml index 6b92522d11e..9c564c24b0c 100644 --- a/dev/setup/codesniffer/ruleset.xml +++ b/dev/setup/codesniffer/ruleset.xml @@ -120,13 +120,6 @@ - - 0 - - - 0 - - diff --git a/htdocs/admin/external_rss.php b/htdocs/admin/external_rss.php index 51f6c1fd720..b3a66fa112e 100644 --- a/htdocs/admin/external_rss.php +++ b/htdocs/admin/external_rss.php @@ -271,19 +271,19 @@ if ($resql) print ''; print ''; print ''; - print ""."\n"; + print ''."\n"; print ''; print ""; print ""; - print ""."\n"; + print ''."\n"; print ''; print ""; print ""; - print ""."\n"; + print ''."\n"; print ''; @@ -301,7 +301,7 @@ if ($resql) print ''; } print ""; - print ""."\n"; + print ''."\n"; // Logo if ($result > 0 && empty($rss->error)) @@ -315,7 +315,7 @@ if ($resql) if ($imageurl) print ''; else print $langs->trans("None"); print ''; - print ""."\n"; + print ''."\n"; } // Active @@ -323,7 +323,7 @@ if ($resql) print ''; print ''; print ''; - print ""."\n"; + print ''."\n"; print '
".$langs->trans("Title")."global->$keyrsstitle)."\">
".$langs->trans("URL")."global->$keyrssurl)."\">
'.$langs->trans('WidgetEnabled').''.yn($active).'
'."\n"; diff --git a/htdocs/admin/modulehelp.php b/htdocs/admin/modulehelp.php index 339b98be44a..d5bf12f1061 100644 --- a/htdocs/admin/modulehelp.php +++ b/htdocs/admin/modulehelp.php @@ -387,7 +387,7 @@ if ($mode == 'feature') $filedata = dol_buildpath($moduledir.'/sql/data.sql'); if (dol_is_file($filedata)) { - $text .= $langs->trans("Yes").' ('.$moduledir.'/sql/data.sql'.')'; + $text .= $langs->trans("Yes").' ('.$moduledir.'/sql/data.sql)'; } else $text .= $langs->trans("No"); diff --git a/htdocs/compta/paiement/rapport.php b/htdocs/compta/paiement/rapport.php index a0daa698f24..80013d3d865 100644 --- a/htdocs/compta/paiement/rapport.php +++ b/htdocs/compta/paiement/rapport.php @@ -154,9 +154,11 @@ if ($year) { $tfile = $dir.'/'.$year.'/'.$file; $relativepath = $year.'/'.$file; - print ''.''.img_pdf().' '.$file.''; + print ''; + print ''.img_pdf().' '.$file.''; print ''.dol_print_size(dol_filesize($tfile)).''; - print ''.dol_print_date(dol_filemtime($tfile), "dayhour").''; + print ''.dol_print_date(dol_filemtime($tfile), "dayhour").''; + print ''; } } closedir($handle); diff --git a/htdocs/core/class/smtps.class.php b/htdocs/core/class/smtps.class.php index f65b87944cf..f6bc31c2f53 100644 --- a/htdocs/core/class/smtps.class.php +++ b/htdocs/core/class/smtps.class.php @@ -1507,8 +1507,8 @@ class SMTPs } // always end related and end alternative after inline images - $content .= "--".$this->_getBoundary('related')."--"."\r\n"; - $content .= "\r\n"."--".$this->_getBoundary('alternative')."--"."\r\n"; + $content .= "--".$this->_getBoundary('related')."--\r\n"; + $content .= "\r\n--".$this->_getBoundary('alternative')."--\r\n"; $content .= "\r\n"; } else diff --git a/htdocs/mrp/mo_production.php b/htdocs/mrp/mo_production.php index 301cf4a76ae..599cb094aac 100644 --- a/htdocs/mrp/mo_production.php +++ b/htdocs/mrp/mo_production.php @@ -667,7 +667,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print load_fiche_titre($langs->trans('Consumption'), '', '', 0, '', '', $newlinetext); print '
'; - print ''; + print '
'; print ''; print ''; diff --git a/htdocs/product/price.php b/htdocs/product/price.php index a4e9f46fa0a..f2109b94795 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -2048,7 +2048,7 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) print ''; print ""; - print ""; + print ""; print '"; print ''; + .$objp->inventorycode + .''; } if (!empty($arrayfields['m.label']['checked'])) { diff --git a/htdocs/product/stock/movement_list.php b/htdocs/product/stock/movement_list.php index 944462ccdfc..535a0533249 100644 --- a/htdocs/product/stock/movement_list.php +++ b/htdocs/product/stock/movement_list.php @@ -1086,15 +1086,11 @@ if ($resql) if (!empty($arrayfields['m.inventorycode']['checked'])) { // Inventory code - print ''; + print ''; } if (!empty($arrayfields['m.label']['checked'])) { From 1d68510c7d7ccfe27c7089e454a1b10d6feeb812 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 25 Apr 2020 19:32:18 +0200 Subject: [PATCH 101/115] Fix syntax error --- htdocs/core/modules/modEmailCollector.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/modules/modEmailCollector.class.php b/htdocs/core/modules/modEmailCollector.class.php index 46d17f9668c..ed37a3a70ab 100644 --- a/htdocs/core/modules/modEmailCollector.class.php +++ b/htdocs/core/modules/modEmailCollector.class.php @@ -284,7 +284,7 @@ class modEmailCollector extends DolibarrModules if ($this->db->num_rows($tmpresql) == 0) { $descriptionA1 = 'This collector will scan your mailbox to find emails that match some rules and create automatically a ticket (Module Ticket must be enabled) with the email informations. You can use this collector if you provide some support by email, so your ticket request will be automatically generated. If the collector Collect_Responses is also enabled, when you send an email from the ticket, you may also see answers of your customers or partners directly on the ticket view.'; $sqlforexampleA1 = "INSERT INTO ".MAIN_DB_PREFIX."emailcollector_emailcollector (entity, ref, label, description, source_directory, date_creation, fk_user_creat, status)"; - $sqlforexampleA1 .= " VALUES (".$conf->entity.", 'Collect_Ticket_Requets', 'Example to collect ticket requests', $this->db->escape($descriptionA1), 'INBOX', '".$this->db->idate(dol_now())."', ".$user->id.", 0)"; + $sqlforexampleA1 .= " VALUES (".$conf->entity.", 'Collect_Ticket_Requets', 'Example to collect ticket requests', '".$this->db->escape($descriptionA1)."', 'INBOX', '".$this->db->idate(dol_now())."', ".$user->id.", 0)"; $sqlforexampleA2 = "INSERT INTO ".MAIN_DB_PREFIX."emailcollector_emailcollectorfilter (fk_emailcollector, type, date_creation, fk_user_creat, status)"; $sqlforexampleA2 .= " VALUES ((SELECT rowid FROM ".MAIN_DB_PREFIX."emailcollector_emailcollector WHERE ref = 'Collect_Ticket_Requets' and entity = ".$conf->entity."), 'withouttrackingid', '".$this->db->idate(dol_now())."', ".$user->id.", 1)"; $sqlforexampleA3 = "INSERT INTO ".MAIN_DB_PREFIX."emailcollector_emailcollectorfilter (fk_emailcollector, type, rulevalue, date_creation, fk_user_creat, status)"; @@ -304,7 +304,7 @@ class modEmailCollector extends DolibarrModules if ($this->db->num_rows($tmpresql) == 0) { $descriptionB1 = 'This collector will scan your mailbox to find all emails that are an answer of an email sent from your application. An event with the email response will be recorded at the good place (Module Agenda must be enabled). For example, if your send a commercial proposal, order or invoice by email and your customer answers your email, the system will automatically find the answer and add it into your ERP.'; $sqlforexampleB1 = "INSERT INTO ".MAIN_DB_PREFIX."emailcollector_emailcollector (entity, ref, label, description, source_directory, date_creation, fk_user_creat, status)"; - $sqlforexampleB1 .= " VALUES (".$conf->entity.", 'Collect_Responses', 'Example to collect any email responses', $this->db->escape($descriptionB1), 'INBOX', '".$this->db->idate(dol_now())."', ".$user->id.", 0)"; + $sqlforexampleB1 .= " VALUES (".$conf->entity.", 'Collect_Responses', 'Example to collect any email responses', '".$this->db->escape($descriptionB1)."', 'INBOX', '".$this->db->idate(dol_now())."', ".$user->id.", 0)"; $sqlforexampleB2 = "INSERT INTO ".MAIN_DB_PREFIX."emailcollector_emailcollectorfilter (fk_emailcollector, type, date_creation, fk_user_creat, status)"; $sqlforexampleB2 .= " VALUES ((SELECT rowid FROM ".MAIN_DB_PREFIX."emailcollector_emailcollector WHERE ref = 'Collect_Responses' and entity = ".$conf->entity."), 'withtrackingid', '".$this->db->idate(dol_now())."', ".$user->id.", 1)"; $sqlforexampleB3 = "INSERT INTO ".MAIN_DB_PREFIX."emailcollector_emailcollectoraction (fk_emailcollector, type, date_creation, fk_user_creat, status)"; @@ -321,7 +321,7 @@ class modEmailCollector extends DolibarrModules if ($this->db->num_rows($tmpresql) == 0) { $descriptionC1 = "This collector will scan your mailbox to find emails that match some rules and create automatically a lead (Module Project must be enabled) with the email informations. You can use this collector if you want to follow your lead using the module Project (1 lead = 1 project), so your leads will be automatically generated. If the collector Collect_Responses is also enabled, when you send an email from your leads, proposals or any other object, you may also see answers of your customers or partners directly on the application.
Note: With this initial example, the title of the lead is generated including the email. If the thirdparty can't be found in database (new customer), the lead will be attached to the thirdparty with ID 1."; $sqlforexampleC1 = "INSERT INTO ".MAIN_DB_PREFIX."emailcollector_emailcollector (entity, ref, label, description, source_directory, date_creation, fk_user_creat, status)"; - $sqlforexampleC1 .= " VALUES (".$conf->entity.", 'Collect_Leads', 'Example to collect leads',$this->db->escape($descriptionC1), 'INBOX', '".$this->db->idate(dol_now())."', ".$user->id.", 0)"; + $sqlforexampleC1 .= " VALUES (".$conf->entity.", 'Collect_Leads', 'Example to collect leads', '".$this->db->escape($descriptionC1)."', 'INBOX', '".$this->db->idate(dol_now())."', ".$user->id.", 0)"; $sqlforexampleC2 = "INSERT INTO ".MAIN_DB_PREFIX."emailcollector_emailcollectorfilter (fk_emailcollector, type, date_creation, fk_user_creat, status)"; $sqlforexampleC2 .= " VALUES ((SELECT rowid FROM ".MAIN_DB_PREFIX."emailcollector_emailcollector WHERE ref = 'Collect_Leads' and entity = ".$conf->entity."), 'withouttrackingid', '".$this->db->idate(dol_now())."', ".$user->id.", 1)"; $sqlforexampleC3 = "INSERT INTO ".MAIN_DB_PREFIX."emailcollector_emailcollectorfilter (fk_emailcollector, type, rulevalue, date_creation, fk_user_creat, status)"; From 62ca9a984e1d8d4c32b794c0bb0a6526affbfe3f Mon Sep 17 00:00:00 2001 From: Anthony Berton <34568357+bb2a@users.noreply.github.com> Date: Sat, 25 Apr 2020 21:42:59 +0200 Subject: [PATCH 102/115] Update list.php --- htdocs/societe/list.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index 3d72fb1cdd3..282a4f44e8f 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -1153,12 +1153,12 @@ while ($i < min($num, $limit)) } if (!empty($arrayfields['s.phone']['checked'])) { - print "
\n"; + print "\n"; if (!$i) $totalarray['nbfield']++; } if (!empty($arrayfields['s.fax']['checked'])) { - print "\n"; + print "\n"; if (!$i) $totalarray['nbfield']++; } if (!empty($arrayfields['s.url']['checked'])) From 58409ce93e91ae6f6e7cb3b5dc9823f98041e067 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 26 Apr 2020 14:11:25 +0200 Subject: [PATCH 103/115] Look and feel v12 --- htdocs/societe/paymentmodes.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/societe/paymentmodes.php b/htdocs/societe/paymentmodes.php index d440930bbf5..3583d104dbf 100644 --- a/htdocs/societe/paymentmodes.php +++ b/htdocs/societe/paymentmodes.php @@ -1138,11 +1138,11 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' print ''.$langs->trans("CreateCardOnStripe").''; } - print ''; + print ''; print img_picto($langs->trans("Modify"), 'edit'); print ''; print ' '; - print ''; // source='.$companypaymentmodetemp->stripe_card_ref.'& + print ''; // source='.$companypaymentmodetemp->stripe_card_ref.'& print img_picto($langs->trans("Delete"), 'delete'); print ''; } From 06cb0194d562d81f2c14093b3e32e758755ff9f8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 26 Apr 2020 14:12:51 +0200 Subject: [PATCH 104/115] Look and feel v12 --- htdocs/societe/paymentmodes.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/htdocs/societe/paymentmodes.php b/htdocs/societe/paymentmodes.php index 3583d104dbf..6385346ce5d 100644 --- a/htdocs/societe/paymentmodes.php +++ b/htdocs/societe/paymentmodes.php @@ -1547,13 +1547,11 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' print '"; diff --git a/htdocs/accountancy/journal/sellsjournal.php b/htdocs/accountancy/journal/sellsjournal.php index 1710a61ccdd..c3c9f45ed5a 100644 --- a/htdocs/accountancy/journal/sellsjournal.php +++ b/htdocs/accountancy/journal/sellsjournal.php @@ -874,7 +874,7 @@ if (empty($action) || $action == 'view') { $accountoshow = length_accountg($k); if (($accountoshow == "") || $accountoshow == 'NotDefined') { - print ''.$langs->trans("VATAccountNotDefined").' ('.$langs->trans("Sale").')'.''; + print ''.$langs->trans("VATAccountNotDefined").' ('.$langs->trans("Sale").')'; } else print $accountoshow; print ""; diff --git a/htdocs/admin/dolistore/class/dolistore.class.php b/htdocs/admin/dolistore/class/dolistore.class.php index 251322ea798..d250203b3d8 100644 --- a/htdocs/admin/dolistore/class/dolistore.class.php +++ b/htdocs/admin/dolistore/class/dolistore.class.php @@ -213,19 +213,17 @@ class Dolistore { $cat = $this->categories[$i]; if ($cat->is_root_category == 1 && $parent == 0) { - $html .= '
  • '.$cat->name->language[$this->lang - 1].' '.$cat->nb_products_recursive.'

    '; - $html .= self::get_categories($cat->id); - $html .= "
  • \n"; + $html .= '
  • description->language[$this->lang - 1])).'">'.$cat->name->language[$this->lang - 1].' '.$cat->nb_products_recursive.'

    '; + $html .= self::get_categories($cat->id); + $html .= "
  • \n"; } elseif (trim($cat->id_parent) == $parent && $cat->active == 1 && trim($cat->id_parent) != 0) { // si cat est de ce niveau $select = ($cat->id == $this->categorie) ? ' selected' : ''; - $html .= '
  • '.$cat->name->language[$this->lang - 1].' '.$cat->nb_products_recursive.''; - $html .= self::get_categories($cat->id); - $html .= "
  • \n"; - } else { + $html .= '
  • description->language[$this->lang - 1])).'" '; + $html .= '>'.$cat->name->language[$this->lang - 1].' '.$cat->nb_products_recursive.''; + $html .= self::get_categories($cat->id); + $html .= "
  • \n"; } } diff --git a/htdocs/admin/external_rss.php b/htdocs/admin/external_rss.php index b3a66fa112e..8aa1a425778 100644 --- a/htdocs/admin/external_rss.php +++ b/htdocs/admin/external_rss.php @@ -327,7 +327,7 @@ if ($resql) print '
    '.$langs->trans("Product").'
    ".$langs->trans("Default").""."'.$langs->trans($object->price_base_type)."'; diff --git a/htdocs/product/stock/movement_card.php b/htdocs/product/stock/movement_card.php index 2714740eb45..03171fbeac5 100644 --- a/htdocs/product/stock/movement_card.php +++ b/htdocs/product/stock/movement_card.php @@ -1049,14 +1049,12 @@ if ($resql) { // Inventory code print '' - .$objp->inventorycode - .'' - .''.'' - .$objp->inventorycode - .'' - .''.$objp->inventorycode.'".dol_print_phone($obj->phone, $obj->country_code, 0, $obj->rowid)."".dol_print_phone($obj->phone, $obj->country_code, 0, $obj->rowid, 'AC_TEL')."".dol_print_phone($obj->fax, $obj->country_code, 0, $obj->rowid)."".dol_print_phone($obj->fax, $obj->country_code, 0, $obj->rowid, 'AC_TEL')."'; if ($user->rights->societe->creer) { - print ''; + print ''; print img_picto($langs->trans("Modify"), 'edit'); print ''; - print ' '; - - print ''; + print ''; print img_picto($langs->trans("Delete"), 'delete'); print ''; } From a36d0c96c1458c31c20f8a170ef879e7319bd9f8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 26 Apr 2020 22:28:43 +0200 Subject: [PATCH 105/115] Fix sql --- htdocs/core/modules/modReceiptPrinter.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/modReceiptPrinter.class.php b/htdocs/core/modules/modReceiptPrinter.class.php index f761238213a..818c090dcc0 100644 --- a/htdocs/core/modules/modReceiptPrinter.class.php +++ b/htdocs/core/modules/modReceiptPrinter.class.php @@ -141,7 +141,7 @@ class modReceiptPrinter extends DolibarrModules "CREATE TABLE IF NOT EXISTS ".MAIN_DB_PREFIX."printer_receipt (rowid integer AUTO_INCREMENT PRIMARY KEY, name varchar(128), fk_type integer, fk_profile integer, parameter varchar(128), entity integer) ENGINE=innodb;", "CREATE TABLE IF NOT EXISTS ".MAIN_DB_PREFIX."printer_receipt_template (rowid integer AUTO_INCREMENT PRIMARY KEY, name varchar(128), template text, entity integer) ENGINE=innodb;", "DELETE FROM ".MAIN_DB_PREFIX."printer_receipt_template WHERE name = '".$langs->trans('Example')."';", - "INSERT INTO ".MAIN_DB_PREFIX."printer_receipt_template (name,template,entity) VALUES ('".$langs->trans('Example')."', $templateexample, 1);", + "INSERT INTO ".MAIN_DB_PREFIX."printer_receipt_template (name,template,entity) VALUES ('".$langs->trans('Example')."', '".$templateexample."', 1);", ); return $this->_init($sql, $options); } From b20d85b198f432d9dfbdcff4214bd0c60ea2574e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 26 Apr 2020 23:06:52 +0200 Subject: [PATCH 106/115] Fix phpcs --- dev/setup/codesniffer/ruleset.xml | 1 - .../accountancy/journal/purchasesjournal.php | 2 +- htdocs/accountancy/journal/sellsjournal.php | 2 +- .../admin/dolistore/class/dolistore.class.php | 20 ++++++------ htdocs/admin/external_rss.php | 2 +- htdocs/admin/system/perf.php | 4 +-- htdocs/blockedlog/admin/blockedlog_list.php | 28 ++++++++-------- htdocs/categories/index.php | 4 +-- htdocs/compta/tva/clients.php | 18 +++++------ htdocs/core/class/html.form.class.php | 3 +- .../filemanagerdol/connectors/php/util.php | 12 ++----- htdocs/core/js/lib_notification.js.php | 2 +- htdocs/core/lib/cron.lib.php | 2 +- htdocs/core/lib/project.lib.php | 2 +- htdocs/core/lib/website2.lib.php | 4 +-- htdocs/core/lib/xcal.lib.php | 14 ++++---- .../bank/doc/pdf_sepamandate.modules.php | 4 +-- htdocs/install/repair.php | 6 ++-- htdocs/opensurvey/fonctions.php | 2 +- htdocs/product/stock/replenishorders.php | 32 +++++++++---------- htdocs/public/members/public_card.php | 2 +- htdocs/public/opensurvey/studs.php | 2 +- htdocs/public/payment/newpayment.php | 2 +- htdocs/reception/card.php | 8 ++--- htdocs/takepos/admin/terminal.php | 2 +- 25 files changed, 84 insertions(+), 96 deletions(-) diff --git a/dev/setup/codesniffer/ruleset.xml b/dev/setup/codesniffer/ruleset.xml index 9c564c24b0c..e4bdefaecd4 100644 --- a/dev/setup/codesniffer/ruleset.xml +++ b/dev/setup/codesniffer/ruleset.xml @@ -167,7 +167,6 @@ - 0 diff --git a/htdocs/accountancy/journal/purchasesjournal.php b/htdocs/accountancy/journal/purchasesjournal.php index ee67aaad392..59bfd561c6c 100644 --- a/htdocs/accountancy/journal/purchasesjournal.php +++ b/htdocs/accountancy/journal/purchasesjournal.php @@ -936,7 +936,7 @@ if (empty($action) || $action == 'view') { $accountoshow = length_accountg($k); if (($accountoshow == "") || $accountoshow == 'NotDefined') { - print ''.$langs->trans("VATAccountNotDefined").' ('.$langs->trans("Purchase").')'.''; + print ''.$langs->trans("VATAccountNotDefined").' ('.$langs->trans("Purchase").')'; } else print $accountoshow; print "
    '."\n"; - print ""."\n"; + print "\n"; $i++; } diff --git a/htdocs/admin/system/perf.php b/htdocs/admin/system/perf.php index fcfe25ce3d3..dd77c41a673 100644 --- a/htdocs/admin/system/perf.php +++ b/htdocs/admin/system/perf.php @@ -66,7 +66,7 @@ if ($test) print img_picto('', 'tick.png').' '.$langs->trans("NotInstalled"); else { print img_picto('', 'warning').' '.$langs->trans("ModuleActivated", $langs->transnoentities("XDebug")); - print ' - '.$langs->trans("MoreInformation").' XDebug admin page'; + print ' - '.$langs->trans("MoreInformation").' XDebug admin page'; } print '
    '; @@ -123,7 +123,7 @@ if (!$foundcache && $test) { $foundcache++; print img_picto('', 'tick.png').' '.$langs->trans("PHPModuleLoaded", "XCache"); - print ' '.$langs->trans("MoreInformation").' Xcache admin page'; + print ' '.$langs->trans("MoreInformation").' Xcache admin page'; } $test = function_exists('eaccelerator_info'); if (!$foundcache && $test) diff --git a/htdocs/blockedlog/admin/blockedlog_list.php b/htdocs/blockedlog/admin/blockedlog_list.php index d753b3a66ea..66cc3b44848 100644 --- a/htdocs/blockedlog/admin/blockedlog_list.php +++ b/htdocs/blockedlog/admin/blockedlog_list.php @@ -223,20 +223,20 @@ if ($action === 'downloadblockchain') { { $statusofrecordnote = $langs->trans("PreviousFingerprint").': '.$previoushash.($statusofrecordnote ? ' - '.$statusofrecordnote : ''); } - print $obj->rowid - .';'.$obj->date_creation - .';"'.$obj->user_fullname.'"' - .';'.$obj->action - .';'.$obj->element - .';'.$obj->amounts - .';'.$obj->fk_object - .';'.$obj->date_object - .';"'.$obj->ref_object.'"' - .';'.$obj->signature - .';'.$statusofrecord - .';'.$statusofrecordnote - .';"'.str_replace('"', '""', $obj->object_data).'"' - ."\n"; + print $obj->rowid; + print ';'.$obj->date_creation; + print ';"'.str_replace('"', '""', $obj->user_fullname).'"'; + print ';'.$obj->action; + print ';'.$obj->element; + print ';'.$obj->amounts; + print ';'.$obj->fk_object; + print ';'.$obj->date_object; + print ';"'.str_replace('"', '""', $obj->ref_object).'"'; + print ';'.$obj->signature; + print ';'.$statusofrecord; + print ';'.$statusofrecordnote; + print ';"'.str_replace('"', '""', $obj->object_data).'"'; + print "\n"; // Set new previous hash for next fetch $previoushash = $obj->signature; diff --git a/htdocs/categories/index.php b/htdocs/categories/index.php index 2103a4081d3..b36101750f2 100644 --- a/htdocs/categories/index.php +++ b/htdocs/categories/index.php @@ -184,9 +184,7 @@ foreach ($fulltree as $key => $val) 'rowid'=>$val['rowid'], 'fk_menu'=>$val['fk_parent'], 'entry'=>''.$counter. - //''. - ''. - '
    color ? ' style="background: #'.$categstatic->color.';"' : ' style="background: #aaa"').'>'.$li.''.dolGetFirstLineOfText($desc).''.img_view().'
    ' + ''.img_view().'' ); } diff --git a/htdocs/compta/tva/clients.php b/htdocs/compta/tva/clients.php index 0bce99df2ff..bcedba7a074 100644 --- a/htdocs/compta/tva/clients.php +++ b/htdocs/compta/tva/clients.php @@ -191,15 +191,15 @@ if (!empty($conf->global->MAIN_MODULE_ACCOUNTING)) $description .= '
    '.$langs $description .= ($description ? '
    ' : '').$fsearch; if (!empty($conf->global->TAX_REPORT_EXTRA_REPORT)) { - $description .= '
    ' - . ' ' - . $langs->trans('SimpleReport') - . '' - . '
    ' - . ' ' - . $langs->trans('AddExtraReport') - . '' - . '
    '; + $description .= '
    '; + $description .= ' '; + $description .= $langs->trans('SimpleReport'); + $description .= ''; + $description .= '
    '; + $description .= ' '; + $description .= $langs->trans('AddExtraReport'); + $description .= ''; + $description .= '
    '; } $elementcust = $langs->trans("CustomersInvoices"); diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 63500b156a8..954a996b0a8 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -6642,8 +6642,7 @@ class Form $out .= 'function formatResult(record) {'."\n"; if ($elemtype == 'category') { - $out .= ' //return \' \'+record.text+\'\'; - return \' \'+record.text+\'\';'; + $out .= 'return \' \'+record.text+\'\';'; } else { diff --git a/htdocs/core/filemanagerdol/connectors/php/util.php b/htdocs/core/filemanagerdol/connectors/php/util.php index 3ea4baf8c87..1349ed00dad 100644 --- a/htdocs/core/filemanagerdol/connectors/php/util.php +++ b/htdocs/core/filemanagerdol/connectors/php/util.php @@ -56,16 +56,10 @@ function RemoveFromEnd($sourceString, $charToRemove) */ function FindBadUtf8($string) { - $regex = '([\x00-\x7F]'. - '|[\xC2-\xDF][\x80-\xBF]'. - '|\xE0[\xA0-\xBF][\x80-\xBF]'. - '|[\xE1-\xEC\xEE\xEF][\x80-\xBF]{2}'. - '|\xED[\x80-\x9F][\x80-\xBF]'. - '|\xF0[\x90-\xBF][\x80-\xBF]{2}'. - '|[\xF1-\xF3][\x80-\xBF]{3}'. - '|\xF4[\x80-\x8F][\x80-\xBF]{2}'. - '|(.{1}))'; + $regex = '([\x00-\x7F]|[\xC2-\xDF][\x80-\xBF]|\xE0[\xA0-\xBF][\x80-\xBF]|[\xE1-\xEC\xEE\xEF][\x80-\xBF]{2}|\xED[\x80-\x9F][\x80-\xBF]'; + $regex .= '|\xF0[\x90-\xBF][\x80-\xBF]{2}|[\xF1-\xF3][\x80-\xBF]{3}|\xF4[\x80-\x8F][\x80-\xBF]{2}|(.{1}))'; + $matches =array(); while (preg_match('/'.$regex.'/S', $string, $matches)) { if (isset($matches[2])) { return true; diff --git a/htdocs/core/js/lib_notification.js.php b/htdocs/core/js/lib_notification.js.php index 3e4f838fe33..769e0a36157 100644 --- a/htdocs/core/js/lib_notification.js.php +++ b/htdocs/core/js/lib_notification.js.php @@ -75,7 +75,7 @@ if (!($_SERVER['HTTP_REFERER'] === $dolibarr_main_url_root.'/' || $_SERVER['HTTP var audio = null; global->AGENDA_REMINDER_BROWSER_SOUND)) { - print 'audio = new Audio(\''.DOL_URL_ROOT.'/theme/common/sound/notification_agenda.wav'.'\');'; + print 'audio = new Audio(\''.DOL_URL_ROOT.'/theme/common/sound/notification_agenda.wav\');'; } ?> diff --git a/htdocs/core/lib/cron.lib.php b/htdocs/core/lib/cron.lib.php index 8128a449cfd..33ad0a85229 100644 --- a/htdocs/core/lib/cron.lib.php +++ b/htdocs/core/lib/cron.lib.php @@ -107,7 +107,7 @@ function dol_print_cron_urls() print ''.$langs->trans("FileToLaunchCronJobs").':
    '; - $file = '/scripts/cron/cron_run_jobs.php'.' '.(empty($conf->global->CRON_KEY) ? 'securitykey' : ''.$conf->global->CRON_KEY.'').' '.$logintouse.' [cronjobid]'; + $file = '/scripts/cron/cron_run_jobs.php '.(empty($conf->global->CRON_KEY) ? 'securitykey' : ''.$conf->global->CRON_KEY.'').' '.$logintouse.' [cronjobid]'; print '
    \n"; print '
    '; diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index 581a7ebab74..be23fc65cfc 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -642,7 +642,7 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t if ($source == 'internal') $c = new User($db); else $c = new Contact($db); $c->fetch($contacttask['id']); - print $c->getNomUrl(1).' ('.$contacttask['libelle'].')'.'
    '; + print $c->getNomUrl(1).' ('.$contacttask['libelle'].')
    '; } } } diff --git a/htdocs/core/lib/website2.lib.php b/htdocs/core/lib/website2.lib.php index b2b5ef06abf..6ef17220283 100644 --- a/htdocs/core/lib/website2.lib.php +++ b/htdocs/core/lib/website2.lib.php @@ -133,7 +133,7 @@ function dolSavePageContent($filetpl, Website $object, WebsitePage $objectpage) $tplcontent .= "if (! defined('USEDOLIBARRSERVER') && ! defined('USEDOLIBARREDITOR')) {\n"; $tplcontent .= ' $pathdepth = count(explode(\'/\', $_SERVER[\'SCRIPT_NAME\'])) - 2;'."\n"; $tplcontent .= ' require_once ($pathdepth ? str_repeat(\'../\', $pathdepth) : \'./\').\'master.inc.php\';'."\n"; - $tplcontent .= "} // Not already loaded"."\n"; + $tplcontent .= "} // Not already loaded\n"; $tplcontent .= "require_once DOL_DOCUMENT_ROOT.'/core/lib/website.lib.php';\n"; $tplcontent .= "require_once DOL_DOCUMENT_ROOT.'/core/website.inc.php';\n"; $tplcontent .= "ob_start();\n"; @@ -212,7 +212,7 @@ function dolSavePageContent($filetpl, Website $object, WebsitePage $objectpage) $tplcontent .= 'id.');'."\n"; - $tplcontent .= "// END PHP ?>"."\n"; + $tplcontent .= "// END PHP ?>\n"; //var_dump($filetpl);exit; $result = file_put_contents($filetpl, $tplcontent); diff --git a/htdocs/core/lib/xcal.lib.php b/htdocs/core/lib/xcal.lib.php index 4a85c595223..440f1147cbf 100644 --- a/htdocs/core/lib/xcal.lib.php +++ b/htdocs/core/lib/xcal.lib.php @@ -251,7 +251,7 @@ function build_calfile($format, $title, $desc, $events_array, $outputfile) } fwrite($calfileh, "DTEND".$prefix.":".$enddatef."\n"); - fwrite($calfileh, "STATUS:CONFIRMED"."\n"); + fwrite($calfileh, "STATUS:CONFIRMED\n"); if (!empty($transparency)) { @@ -295,7 +295,7 @@ function build_calfile($format, $title, $desc, $events_array, $outputfile) fwrite($calfileh, "SUMMARY:".$encoding.$summary."\n"); fwrite($calfileh, "DESCRIPTION:".$encoding.$description."\n"); - fwrite($calfileh, "STATUS:CONFIRMED"."\n"); + fwrite($calfileh, "STATUS:CONFIRMED\n"); fwrite($calfileh, "CATEGORIES:".$category."\n"); fwrite($calfileh, "LOCATION:".$location."\n"); fwrite($calfileh, "TRANSP:OPAQUE\n"); @@ -381,7 +381,7 @@ function build_rssfile($format, $title, $desc, $events_array, $outputfile, $filt $url = $urlwithroot."/public/agenda/agendaexport.php?format=rss&exportkey=".urlencode($conf->global->MAIN_AGENDA_XCAL_EXPORTKEY); } - fwrite($fichier, ""."\n"); + fwrite($fichier, "\n"); foreach ($events_array as $key => $event) { @@ -480,9 +480,9 @@ function format_cal($format, $string) if ($format === "ical") { // Replace new lines chars by "\n" - $newstring = preg_replace("/"."\r\n"."/i", "\\n", $newstring); - $newstring = preg_replace("/"."\n\r"."/i", "\\n", $newstring); - $newstring = preg_replace("/"."\n"."/i", "\\n", $newstring); + $newstring = preg_replace("/\r\n/i", "\\n", $newstring); + $newstring = preg_replace("/\n\r/i", "\\n", $newstring); + $newstring = preg_replace("/\n/i", "\\n", $newstring); // Must not exceed 75 char. Cut with "\r\n"+Space $newstring = calEncode($newstring); @@ -586,7 +586,7 @@ function quotedPrintEncode($str, $forcal = 0) if ((strlen($newpara) + strlen($char)) >= 76) { // New line with carray-return (CR) and line-feed (LF) - $out .= $newpara."="."\r\n"; + $out .= $newpara."=\r\n"; // extra space for cal if ($forcal) diff --git a/htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php b/htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php index 0ce2f2bbbb2..23868eef643 100644 --- a/htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php +++ b/htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php @@ -227,14 +227,14 @@ class pdf_sepamandate extends ModeleBankAccountDoc $posY += 2; $pdf->SetXY($this->marge_gauche, $posY); - $pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $outputlangs->transnoentitiesnoconv("RUMLong").' ('.$outputlangs->transnoentitiesnoconv("RUM").')'.' : '.$object->rum, 0, 'L'); + $pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $outputlangs->transnoentitiesnoconv("RUMLong").' ('.$outputlangs->transnoentitiesnoconv("RUM").') : '.$object->rum, 0, 'L'); $posY = $pdf->GetY(); $posY += 2; $pdf->SetXY($this->marge_gauche, $posY); $ics = ''; if (!empty($conf->global->PRELEVEMENT_ICS)) $ics = $conf->global->PRELEVEMENT_ICS; - $pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $outputlangs->transnoentitiesnoconv("CreditorIdentifier").' ('.$outputlangs->transnoentitiesnoconv("ICS").')'.' : '.$ics, 0, 'L'); + $pdf->MultiCell($this->page_largeur - $this->marge_gauche - $this->marge_droite, 3, $outputlangs->transnoentitiesnoconv("CreditorIdentifier").' ('.$outputlangs->transnoentitiesnoconv("ICS").') : '.$ics, 0, 'L'); $posY = $pdf->GetY(); $posY += 1; diff --git a/htdocs/install/repair.php b/htdocs/install/repair.php index d129fbeb1e4..2c99c28e7e5 100644 --- a/htdocs/install/repair.php +++ b/htdocs/install/repair.php @@ -1440,9 +1440,9 @@ if ($ok && GETPOST('repair_link_dispatch_lines_supplier_order_lines')) { exit; } while ($obj_dispatch = $db->fetch_object($resql_dispatch)) { - $sql_line = 'SELECT line.rowid, line.qty FROM '.MAIN_DB_PREFIX.'commande_fournisseurdet AS line' - . ' WHERE line.fk_commande = '.$obj_dispatch->fk_commande - . ' AND line.fk_product = '.$obj_dispatch->fk_product; + $sql_line = 'SELECT line.rowid, line.qty FROM '.MAIN_DB_PREFIX.'commande_fournisseurdet AS line'; + $sql_line .= ' WHERE line.fk_commande = '.$obj_dispatch->fk_commande; + $sql_line .= ' AND line.fk_product = '.$obj_dispatch->fk_product; $resql_line = $db->query($sql_line); // s’il y a plusieurs lignes avec le même produit sur cette commande fournisseur, diff --git a/htdocs/opensurvey/fonctions.php b/htdocs/opensurvey/fonctions.php index 09a9c10e789..30529b49f56 100644 --- a/htdocs/opensurvey/fonctions.php +++ b/htdocs/opensurvey/fonctions.php @@ -84,7 +84,7 @@ function llxHeaderSurvey($title, $head = "", $disablejs = 0, $disablehead = 0, $ print ''."\n"; print '
    '."\n"; - print '
    '."\n"; + print ''."\n"; print ''; print ''."\n"; print "\n"; diff --git a/htdocs/product/stock/replenishorders.php b/htdocs/product/stock/replenishorders.php index 9ed74d112eb..25f3e38a81b 100644 --- a/htdocs/product/stock/replenishorders.php +++ b/htdocs/product/stock/replenishorders.php @@ -172,22 +172,22 @@ if ($resql) print ''; print ''; - print ''. - ''. - ''. - ''. - ''. - ''; + print ''; + print ''; + print ''; + print ''; + print ''; diff --git a/htdocs/public/members/public_card.php b/htdocs/public/members/public_card.php index 195a7560631..04fe1f75fca 100644 --- a/htdocs/public/members/public_card.php +++ b/htdocs/public/members/public_card.php @@ -66,7 +66,7 @@ $extrafields = new ExtraFields($db); $morehead = ''; if (!empty($conf->global->MEMBER_PUBLIC_CSS)) $morehead = ''; -else $morehead = ''; +else $morehead = ''; llxHeaderVierge($langs->trans("MemberCard"), $morehead); diff --git a/htdocs/public/opensurvey/studs.php b/htdocs/public/opensurvey/studs.php index ef5458456c5..d0ce716bb7d 100644 --- a/htdocs/public/opensurvey/studs.php +++ b/htdocs/public/opensurvey/studs.php @@ -690,7 +690,7 @@ if ($object->allow_spy) { if (strpos($toutsujet[$i], '@') !== false) { $toutsujetdate = explode("@", $toutsujet[$i]); - $meilleursujet .= dol_print_date($toutsujetdate[0], 'daytext').' ('.dol_print_date($toutsujetdate[0], '%A').')'.' - '.$toutsujetdate[1]; + $meilleursujet .= dol_print_date($toutsujetdate[0], 'daytext').' ('.dol_print_date($toutsujetdate[0], '%A').') - '.$toutsujetdate[1]; } else { $meilleursujet .= dol_print_date($toutsujet[$i], 'daytext').' ('.dol_print_date($toutsujet[$i], '%A').')'; } diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index c3e6553cf92..8b1e8a42574 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -1924,7 +1924,7 @@ if (preg_match('/^dopayment/', $action)) // If we choosed/click on the payment print '
    '; print ''; - print ''; + print ''; print ''; print '
    '. - ''. - ''. - ''. - ''. - ''. - ''. - ''. - ''. - $form->selectDate($search_date, 'search_date', 0, 0, 1, '', 1, 0, 0, ''). - ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print $form->selectDate($search_date, 'search_date', 0, 0, 1, '', 1, 0, 0, ''); + print ''; $searchpicto = $form->showFilterAndCheckAddButtons(0); print $searchpicto; print '
    '; diff --git a/htdocs/reception/card.php b/htdocs/reception/card.php index 9c6e8df76f1..3d8547f9322 100644 --- a/htdocs/reception/card.php +++ b/htdocs/reception/card.php @@ -1858,7 +1858,7 @@ elseif ($id || $ref) print ''; print ''; // Qty to receive or received - print ''.''.''; + print ''; // Warehouse source print ''.$formproduct->selectWarehouses($lines[$i]->fk_entrepot, 'entl'.$line_id, '', 1, 0, $lines[$i]->fk_product, '', 1).''; // Batch number managment @@ -1878,11 +1878,11 @@ elseif ($id || $ref) print ''; print ''; // Qty to receive or received - print ''.''.''; + print ''; // Warehouse source - print ''.''; + print ''; // Batch number managment - print ''.''; + print ''; print ''; } } diff --git a/htdocs/takepos/admin/terminal.php b/htdocs/takepos/admin/terminal.php index 10a679615a9..46d168ddd24 100644 --- a/htdocs/takepos/admin/terminal.php +++ b/htdocs/takepos/admin/terminal.php @@ -264,7 +264,7 @@ if ($conf->global->TAKEPOS_PRINT_METHOD == "receiptprinter") { print ''.$langs->trans('CashDeskReaderKeyCodeForEnter').''; print ''; -print ''; +print ''; print ''; // Numbering module From 31ba277da708f99d33b3476c8997a74398b206f0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 26 Apr 2020 23:18:09 +0200 Subject: [PATCH 107/115] Fix phpcs --- .../compta/paiement/class/cpaiement.class.php | 2 +- htdocs/core/class/smtps.class.php | 19 +++++-------------- htdocs/core/db/sqlite3.class.php | 2 +- htdocs/expensereport/card.php | 4 ++-- test/phpunit/AdherentTest.php | 10 +++++----- test/phpunit/FilesLibTest.php | 2 +- 6 files changed, 15 insertions(+), 24 deletions(-) diff --git a/htdocs/compta/paiement/class/cpaiement.class.php b/htdocs/compta/paiement/class/cpaiement.class.php index 5b66dbec15e..d1cd1f0015b 100644 --- a/htdocs/compta/paiement/class/cpaiement.class.php +++ b/htdocs/compta/paiement/class/cpaiement.class.php @@ -185,7 +185,7 @@ class Cpaiement $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t'; if (null !== $ref) { $sql .= ' WHERE t.entity IN ('.getEntity('c_paiement').')'; - $sql .= ' AND t.code = '.'\''.$ref.'\''; + $sql .= " AND t.code = '".$this->db->escape($ref)."'"; } else { $sql .= ' WHERE t.id = '.$id; } diff --git a/htdocs/core/class/smtps.class.php b/htdocs/core/class/smtps.class.php index f6bc31c2f53..51e375c5279 100644 --- a/htdocs/core/class/smtps.class.php +++ b/htdocs/core/class/smtps.class.php @@ -1534,34 +1534,25 @@ class SMTPs $content .= "--".$this->_getBoundary('alternative')."\r\n"; } - $content .= 'Content-Type: '.$_content['mimeType'].'; ' - // . 'charset="' . $this->getCharSet() . '"'; - . 'charset='.$this->getCharSet().''; + $content .= 'Content-Type: '.$_content['mimeType'].'; charset='.$this->getCharSet(); - // $content .= ( $type == 'html') ? '; name="HTML Part"' : ''; $content .= "\r\n"; - // $content .= 'Content-Transfer-Encoding: '; - // $content .= ($type == 'html') ? 'quoted-printable' : $this->getTransEncodeType(); - // $content .= "\r\n" - // . 'Content-Disposition: inline' . "\r\n" - // . 'Content-Description: ' . $type . ' message' . "\r\n"; - if ($this->getMD5flag()) - $content .= 'Content-MD5: '.$_content['md5']."\r\n"; + if ($this->getMD5flag()) { + $content .= 'Content-MD5: '.$_content['md5']."\r\n"; + } $content .= "\r\n".$_content['data']."\r\n"; if (!key_exists('image', $this->_msgContent) && $_content['dataText'] && !empty($conf->global->MAIN_MAIL_USE_MULTI_PART)) // Add plain text message part after html part { - $content .= "--".$this->_getBoundary('alternative')."--"."\r\n"; + $content .= "--".$this->_getBoundary('alternative')."--\r\n"; } $content .= "\r\n"; } } - // Close message boundries - // $content .= "\r\n--" . $this->_getBoundary() . '--' . "\r\n" ; $content .= "--".$this->_getBoundary('mixed').'--'."\r\n"; } diff --git a/htdocs/core/db/sqlite3.class.php b/htdocs/core/db/sqlite3.class.php index ba8f8eff3e9..2d24c232797 100644 --- a/htdocs/core/db/sqlite3.class.php +++ b/htdocs/core/db/sqlite3.class.php @@ -1325,7 +1325,7 @@ class DoliDBSqlite3 extends DoliDB if ($this->db) { $newname = preg_replace('/_/', '', $name); - $localname = __CLASS__.'::'.'db'.$newname; + $localname = __CLASS__.'::db'.$newname; $reflectClass = new ReflectionClass(__CLASS__); $reflectFunction = $reflectClass->getMethod('db'.$newname); if ($arg_count < 0) { diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index fd582ac0a1e..2a0f804b196 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -2330,7 +2330,7 @@ else print ''; if (empty($conf->global->EXPENSEREPORT_DISABLE_ATTACHMENT_ON_LINES)) { - print '   -   '.''.$langs->trans("AttachTheNewLineToTheDocument"); + print '   -   '.$langs->trans("AttachTheNewLineToTheDocument"); print img_picto($langs->trans("AttachTheNewLineToTheDocument"), 'chevron-down', '', false, 0, 0, '', 'marginleftonly'); print ''; } @@ -2478,7 +2478,7 @@ else print ''; if (empty($conf->global->EXPENSEREPORT_DISABLE_ATTACHMENT_ON_LINES)) { - print '   -   '.''.$langs->trans("AttachTheNewLineToTheDocument"); + print '   -   '.$langs->trans("AttachTheNewLineToTheDocument"); print img_picto($langs->trans("AttachTheNewLineToTheDocument"), 'chevron-down', '', false, 0, 0, '', 'marginleftonly'); print ''; } diff --git a/test/phpunit/AdherentTest.php b/test/phpunit/AdherentTest.php index c78bc6542bb..89e78b32bd9 100644 --- a/test/phpunit/AdherentTest.php +++ b/test/phpunit/AdherentTest.php @@ -325,13 +325,13 @@ class AdherentTest extends PHPUnit\Framework\TestCase $conf->global->MAIN_FIRSTNAME_NAME_POSITION = 0; // Force setup for firstname+lastname - $template = '__CIVILITY__,__FIRSTNAME__,__LASTNAME__,__FULLNAME__,__COMPANY__,'. - '__ADDRESS__,__ZIP__,__TOWN__,__COUNTRY__,__EMAIL__,__BIRTH__,__PHOTO__,__LOGIN__'; + $template = '__CIVILITY__,__FIRSTNAME__,__LASTNAME__,__FULLNAME__,__COMPANY__,'; + $template .= '__ADDRESS__,__ZIP__,__TOWN__,__COUNTRY__,__EMAIL__,__BIRTH__,__PHOTO__,__LOGIN__'; // If option to store clear password has been set, we get 'dolibspec' into PASSWORD field. - $expected = ',New firstname,New name,New firstname New name,'. - 'New company label,New address,New zip,New town,Belgium,newemail@newemail.com,'.dol_print_date($localobject->birth, 'day').',,'. - 'newlogin'; + $expected = ',New firstname,New name,New firstname New name,'; + $expected .= 'New company label,New address,New zip,New town,Belgium,newemail@newemail.com,'.dol_print_date($localobject->birth, 'day').',,'; + $expected .= 'newlogin'; $result = $localobject->makeSubstitution($template); print __METHOD__." result=".$result."\n"; diff --git a/test/phpunit/FilesLibTest.php b/test/phpunit/FilesLibTest.php index 776e783a6b0..fb3ce8f5814 100644 --- a/test/phpunit/FilesLibTest.php +++ b/test/phpunit/FilesLibTest.php @@ -336,7 +336,7 @@ class FilesLibTest extends PHPUnit\Framework\TestCase $result=dol_copy($file, $conf->admin->dir_temp.'/file.csv', 0, 1); print __METHOD__." result=".$result."\n"; - $this->assertGreaterThanOrEqual(1, $result, 'copy file ('.$file.') into a dir that exists ('.$conf->admin->dir_temp.'/file.csv'.')'); // Should be 1 + $this->assertGreaterThanOrEqual(1, $result, 'copy file ('.$file.') into a dir that exists ('.$conf->admin->dir_temp.'/file.csv)'); // Should be 1 // Again to test with overwriting=0 $result=dol_copy($file, $conf->admin->dir_temp.'/file.csv', 0, 0); From 31157931a94ceebbdd49907d4f5198d8161a52dc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 26 Apr 2020 23:52:23 +0200 Subject: [PATCH 108/115] Fix phpcs --- htdocs/accountancy/index.php | 20 +++++++++---------- .../accountancy/journal/purchasesjournal.php | 8 ++++---- htdocs/admin/tools/dolibarr_export.php | 2 +- htdocs/bom/tpl/objectline_create.tpl.php | 2 +- htdocs/comm/mailing/advtargetemailing.php | 16 +++++++-------- .../mailing/class/advtargetemailing.class.php | 8 ++++---- htdocs/core/class/html.form.class.php | 3 +-- htdocs/core/lib/pdf.lib.php | 2 +- htdocs/fourn/facture/rapport.php | 3 ++- htdocs/install/repair.php | 12 +++++------ htdocs/mrp/mo_production.php | 2 +- htdocs/opensurvey/results.php | 4 ++-- htdocs/product/stock/replenish.php | 20 +++++++++---------- htdocs/product/stock/replenishorders.php | 10 ++++++---- htdocs/public/members/public_list.php | 2 +- htdocs/ticket/card.php | 2 +- htdocs/website/index.php | 4 ++-- 17 files changed, 61 insertions(+), 59 deletions(-) diff --git a/htdocs/accountancy/index.php b/htdocs/accountancy/index.php index 4d64c7666d8..2379c31ce53 100644 --- a/htdocs/accountancy/index.php +++ b/htdocs/accountancy/index.php @@ -101,13 +101,13 @@ if ($conf->accounting->enabled) // STEPS $step++; - print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescJournalSetup", $step, ''.''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("AccountingJournals").''.''); + print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescJournalSetup", $step, ''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("AccountingJournals").''); print "
    \n"; $step++; - print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescChartModel", $step, ''.''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("Pcg_version").''.''); + print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescChartModel", $step, ''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("Pcg_version").''); print "
    \n"; $step++; - print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescChart", $step, ''.''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("Chartofaccounts").''.''); + print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescChart", $step, ''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("Chartofaccounts").''); print "
    \n"; print "
    \n"; @@ -116,11 +116,11 @@ if ($conf->accounting->enabled) print "
    \n"; $step++; - print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescDefault", $step, ''.''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").''.''); + print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescDefault", $step, ''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuDefaultAccounts").''); print "
    \n"; $step++; - print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBank", $step, ''.''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuBankAccounts").''.'')."\n"; + print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBank", $step, ''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuBankAccounts").'')."\n"; print "
    \n"; $step++; @@ -145,7 +145,7 @@ if ($conf->accounting->enabled) if (!empty($conf->expensereport->enabled)) // TODO Move this in the default account page because this is only one accounting account per purpose, not several. { $step++; - print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescExpenseReport", $step, ''.''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuExpenseReportAccounts").''.''); + print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescExpenseReport", $step, ''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuExpenseReportAccounts").''); print "
    \n"; } /* @@ -169,7 +169,7 @@ if ($conf->accounting->enabled) }*/ $step++; - print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescProd", $step, ''.''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("ProductsBinding").''.''); + print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescProd", $step, ''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("ProductsBinding").''); print "
    \n"; @@ -186,17 +186,17 @@ if ($conf->accounting->enabled) $langs->loadLangs(array('bills', 'trips')); $step++; - print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64 + $step), $langs->transnoentitiesnoconv("BillsCustomers"), ''.''.$langs->transnoentitiesnoconv("TransferInAccounting").' - '.$langs->transnoentitiesnoconv("CustomersVentilation").''.'')."\n"; + print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64 + $step), $langs->transnoentitiesnoconv("BillsCustomers"), ''.$langs->transnoentitiesnoconv("TransferInAccounting").' - '.$langs->transnoentitiesnoconv("CustomersVentilation").'')."\n"; print "
    \n"; $step++; - print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64 + $step), $langs->transnoentitiesnoconv("BillsSuppliers"), ''.''.$langs->transnoentitiesnoconv("TransferInAccounting").' - '.$langs->transnoentitiesnoconv("SuppliersVentilation").''.'')."\n"; + print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64 + $step), $langs->transnoentitiesnoconv("BillsSuppliers"), ''.$langs->transnoentitiesnoconv("TransferInAccounting").' - '.$langs->transnoentitiesnoconv("SuppliersVentilation").'')."\n"; print "
    \n"; if (!empty($conf->expensereport->enabled) || !empty($conf->deplacement->enabled)) { $step++; - print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64 + $step), $langs->transnoentitiesnoconv("ExpenseReports"), ''.''.$langs->transnoentitiesnoconv("TransferInAccounting").' - '.$langs->transnoentitiesnoconv("ExpenseReportsVentilation").''.'')."\n"; + print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescBind", chr(64 + $step), $langs->transnoentitiesnoconv("ExpenseReports"), ''.$langs->transnoentitiesnoconv("TransferInAccounting").' - '.$langs->transnoentitiesnoconv("ExpenseReportsVentilation").'')."\n"; print "
    \n"; } diff --git a/htdocs/accountancy/journal/purchasesjournal.php b/htdocs/accountancy/journal/purchasesjournal.php index 59bfd561c6c..42bff74097f 100644 --- a/htdocs/accountancy/journal/purchasesjournal.php +++ b/htdocs/accountancy/journal/purchasesjournal.php @@ -959,15 +959,15 @@ if (empty($action) || $action == 'view') { foreach ($tabother[$key] as $k => $mt) { if ($mt) { print ''; - print ""; + print ''; print "".$date.""; print "".$invoicestatic->getNomUrl(1).""; // Account - print ""; + print ''; $accountoshow = length_accountg($k); - if (($accountoshow == "") || $accountoshow == 'NotDefined') + if ($accountoshow == '' || $accountoshow == 'NotDefined') { - print ''.$langs->trans("VATAccountNotDefined").' ('.$langs->trans("NPR counterpart").'). Set ACCOUNTING_COUNTERPART_VAT_NPR to the subvention account'.''; + print ''.$langs->trans("VATAccountNotDefined").' ('.$langs->trans("NPR counterpart").'). Set ACCOUNTING_COUNTERPART_VAT_NPR to the subvention account'; } else print $accountoshow; print ''; diff --git a/htdocs/admin/tools/dolibarr_export.php b/htdocs/admin/tools/dolibarr_export.php index 68bbd03162f..f88563ff512 100644 --- a/htdocs/admin/tools/dolibarr_export.php +++ b/htdocs/admin/tools/dolibarr_export.php @@ -303,7 +303,7 @@ if (in_array($type, array('mysql', 'mysqli'))) { print '
    '; print '
    '.$langs->trans('ExportStructure').''; - print ''; + print ''; print ''; print '
    '; print '
    '; diff --git a/htdocs/bom/tpl/objectline_create.tpl.php b/htdocs/bom/tpl/objectline_create.tpl.php index be7eb3e775f..eeffb625381 100644 --- a/htdocs/bom/tpl/objectline_create.tpl.php +++ b/htdocs/bom/tpl/objectline_create.tpl.php @@ -74,7 +74,7 @@ if ($nolinesbefore) { print ' '; print ''; } -print ''; +print ''; $coldisplay = 0; // Adds a line numbering column diff --git a/htdocs/comm/mailing/advtargetemailing.php b/htdocs/comm/mailing/advtargetemailing.php index b716790aa8f..d4db9fc6ea9 100644 --- a/htdocs/comm/mailing/advtargetemailing.php +++ b/htdocs/comm/mailing/advtargetemailing.php @@ -147,15 +147,15 @@ if ($action == 'add') { if (preg_match("/st_dt/", $key)) { $dtarr = array(); $dtarr = explode('_', $key); - if (!array_key_exists('options_'.$dtarr[1].'_st_dt'.'_cnct', $array_query)) { - $array_query['options_'.$dtarr[1].'_st_dt'.'_cnct'] = dol_mktime(0, 0, 0, GETPOST('options_'.$dtarr[1].'_st_dtmonth'.'_cnct', 'int'), GETPOST('options_'.$dtarr[1].'_st_dtday'.'_cnct', 'int'), GETPOST('options_'.$dtarr[1].'_st_dtyear'.'_cnct', 'int')); + if (!array_key_exists('options_'.$dtarr[1].'_st_dt_cnct', $array_query)) { + $array_query['options_'.$dtarr[1].'_st_dt_cnct'] = dol_mktime(0, 0, 0, GETPOST('options_'.$dtarr[1].'_st_dtmonth_cnct', 'int'), GETPOST('options_'.$dtarr[1].'_st_dtday_cnct', 'int'), GETPOST('options_'.$dtarr[1].'_st_dtyear_cnct', 'int')); } } elseif (preg_match("/end_dt/", $key)) { // Special case for end date come with 3 inputs day, month, year $dtarr = array(); $dtarr = explode('_', $key); - if (!array_key_exists('options_'.$dtarr[1].'_end_dt'.'_cnct', $array_query)) { - $array_query['options_'.$dtarr[1].'_end_dt'.'_cnct'] = dol_mktime(0, 0, 0, GETPOST('options_'.$dtarr[1].'_end_dtmonth'.'_cnct', 'int'), GETPOST('options_'.$dtarr[1].'_end_dtday'.'_cnct', 'int'), GETPOST('options_'.$dtarr[1].'_end_dtyear'.'_cnct', 'int')); + if (!array_key_exists('options_'.$dtarr[1].'_end_dt_cnct', $array_query)) { + $array_query['options_'.$dtarr[1].'_end_dt_cnct'] = dol_mktime(0, 0, 0, GETPOST('options_'.$dtarr[1].'_end_dtmonth_cnct', 'int'), GETPOST('options_'.$dtarr[1].'_end_dtday_cnct', 'int'), GETPOST('options_'.$dtarr[1].'_end_dtyear_cnct', 'int')); } } else { $array_query[$key] = GETPOST($key); @@ -299,15 +299,15 @@ if ($action == 'savefilter' || $action == 'createfilter') { if (preg_match("/st_dt/", $key)) { $dtarr = array(); $dtarr = explode('_', $key); - if (!array_key_exists('options_'.$dtarr[1].'_st_dt'.'_cnct', $array_query)) { - $array_query['options_'.$dtarr[1].'_st_dt'.'_cnct'] = dol_mktime(0, 0, 0, GETPOST('options_'.$dtarr[1].'_st_dtmonth'.'_cnct', 'int'), GETPOST('options_'.$dtarr[1].'_st_dtday'.'_cnct', 'int'), GETPOST('options_'.$dtarr[1].'_st_dtyear'.'_cnct', 'int')); + if (!array_key_exists('options_'.$dtarr[1].'_st_dt_cnct', $array_query)) { + $array_query['options_'.$dtarr[1].'_st_dt_cnct'] = dol_mktime(0, 0, 0, GETPOST('options_'.$dtarr[1].'_st_dtmonth_cnct', 'int'), GETPOST('options_'.$dtarr[1].'_st_dtday_cnct', 'int'), GETPOST('options_'.$dtarr[1].'_st_dtyear_cnct', 'int')); } } elseif (preg_match("/end_dt/", $key)) { // Special case for end date come with 3 inputs day, month, year $dtarr = array(); $dtarr = explode('_', $key); - if (!array_key_exists('options_'.$dtarr[1].'_end_dt'.'_cnct', $array_query)) { - $array_query['options_'.$dtarr[1].'_end_dt'.'_cnct'] = dol_mktime(0, 0, 0, GETPOST('options_'.$dtarr[1].'_end_dtmonth'.'_cnct', 'int'), GETPOST('options_'.$dtarr[1].'_end_dtday'.'_cnct', 'int'), GETPOST('options_'.$dtarr[1].'_end_dtyear'.'_cnct', 'int')); + if (!array_key_exists('options_'.$dtarr[1].'_end_dt_cnct', $array_query)) { + $array_query['options_'.$dtarr[1].'_end_dt_cnct'] = dol_mktime(0, 0, 0, GETPOST('options_'.$dtarr[1].'_end_dtmonth_cnct', 'int'), GETPOST('options_'.$dtarr[1].'_end_dtday_cnct', 'int'), GETPOST('options_'.$dtarr[1].'_end_dtyear_cnct', 'int')); // print $array_query['cnct_options_'.$dtarr[1].'_end_dt']; // 01/02/1013=1361228400 } diff --git a/htdocs/comm/mailing/class/advtargetemailing.class.php b/htdocs/comm/mailing/class/advtargetemailing.class.php index 83ea16641fe..7bb73a61c9f 100644 --- a/htdocs/comm/mailing/class/advtargetemailing.class.php +++ b/htdocs/comm/mailing/class/advtargetemailing.class.php @@ -724,13 +724,13 @@ class AdvanceTargetingMailing extends CommonObject } } elseif (($extrafields->attributes[$elementtype]['type'][$key] == 'int') || ($extrafields->attributes[$elementtype]['type'][$key] == 'double')) { - if (!empty($arrayquery['options_'.$key.'_max'.'_cnct'])) { - $sqlwhere[] = " (te.".$key." >= ".$arrayquery['options_'.$key.'_max'.'_cnct']." AND te.".$key." <= ".$arrayquery['options_'.$key.'_min'.'_cnct'].")"; + if (!empty($arrayquery['options_'.$key.'_max_cnct'])) { + $sqlwhere[] = " (te.".$key." >= ".$arrayquery['options_'.$key.'_max'.'_cnct']." AND te.".$key." <= ".$arrayquery['options_'.$key.'_min_cnct'].")"; } } elseif (($extrafields->attributes[$elementtype]['type'][$key] == 'date') || ($extrafields->attributes[$elementtype]['type'][$key] == 'datetime')) { - if (!empty($arrayquery['options_'.$key.'_end_dt'.'_cnct'])) { - $sqlwhere[] = " (te.".$key." >= '".$this->db->idate($arrayquery['options_'.$key.'_st_dt'.'_cnct'])."' AND te.".$key." <= '".$this->db->idate($arrayquery['options_'.$key.'_end_dt'.'_cnct'])."')"; + if (!empty($arrayquery['options_'.$key.'_end_dt_cnct'])) { + $sqlwhere[] = " (te.".$key." >= '".$this->db->idate($arrayquery['options_'.$key.'_st_dt'.'_cnct'])."' AND te.".$key." <= '".$this->db->idate($arrayquery['options_'.$key.'_end_dt_cnct'])."')"; } } elseif ($extrafields->attributes[$elementtype]['type'][$key] == 'boolean') { if ($arrayquery['options_'.$key.'_cnct'] != '') { diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 954a996b0a8..05174f176b0 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -6652,8 +6652,7 @@ class Form $out .= 'function formatSelection(record) {'."\n"; if ($elemtype == 'category') { - $out .= ' //return \' \'+record.text+\'\'; - return \' \'+record.text+\'\';'; + $out .= 'return \' \'+record.text+\'\';'; } else { diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index d31baf70b69..63789a18e62 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -914,7 +914,7 @@ function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_ // // become // - $newfreetext = preg_replace('/()/', '\1'.'file:/'.DOL_DATA_ROOT.'/medias/\2\3', $newfreetext); + $newfreetext = preg_replace('/()/', '\1file:/'.DOL_DATA_ROOT.'/medias/\2\3', $newfreetext); $line .= $outputlangs->convToOutputCharset($newfreetext); } diff --git a/htdocs/fourn/facture/rapport.php b/htdocs/fourn/facture/rapport.php index 391c44a2f03..f0bf2d85dd1 100644 --- a/htdocs/fourn/facture/rapport.php +++ b/htdocs/fourn/facture/rapport.php @@ -157,13 +157,14 @@ if ($year) { $tfile = $dir.'/'.$year.'/'.$file; $relativepath = $year.'/'.$file; - print ''.''.img_pdf().' '.$file.''; + print ''.img_pdf().' '.$file.''; print ''.dol_print_size(dol_filesize($tfile)).''; print ''.dol_print_date(dol_filemtime($tfile), "dayhour").''; } } closedir($handle); } + print ''; } } diff --git a/htdocs/install/repair.php b/htdocs/install/repair.php index 2c99c28e7e5..034741c7c7e 100644 --- a/htdocs/install/repair.php +++ b/htdocs/install/repair.php @@ -1465,9 +1465,9 @@ if ($ok && GETPOST('repair_link_dispatch_lines_supplier_order_lines')) { } $qty_for_line = min($remaining_qty, $obj_line->qty); if ($first_iteration) { - $sql_attach = 'UPDATE '.MAIN_DB_PREFIX.'commande_fournisseur_dispatch' - . ' SET fk_commandefourndet = '.$obj_line->rowid.', qty = '.$qty_for_line - . ' WHERE rowid = '.$obj_dispatch->rowid; + $sql_attach = 'UPDATE '.MAIN_DB_PREFIX.'commande_fournisseur_dispatch'; + $sql_attach .= ' SET fk_commandefourndet = '.$obj_line->rowid.', qty = '.$qty_for_line; + $sql_attach .= ' WHERE rowid = '.$obj_dispatch->rowid; $first_iteration = false; } else { $sql_attach_values = array( @@ -1487,9 +1487,9 @@ if ($ok && GETPOST('repair_link_dispatch_lines_supplier_order_lines')) { ); $sql_attach_values = join(', ', $sql_attach_values); - $sql_attach = 'INSERT INTO '.MAIN_DB_PREFIX.'commande_fournisseur_dispatch' - . ' (fk_commande, fk_product, fk_commandefourndet, qty, fk_entrepot, fk_user, datec, comment, status, tms, batch, eatby, sellby)' - . ' VALUES ('.$sql_attach_values.')'; + $sql_attach = 'INSERT INTO '.MAIN_DB_PREFIX.'commande_fournisseur_dispatch'; + $sql_attach .= ' (fk_commande, fk_product, fk_commandefourndet, qty, fk_entrepot, fk_user, datec, comment, status, tms, batch, eatby, sellby)'; + $sql_attach .= ' VALUES ('.$sql_attach_values.')'; } if ($repair_link_dispatch_lines_supplier_order_lines == 'confirmed') diff --git a/htdocs/mrp/mo_production.php b/htdocs/mrp/mo_production.php index 599cb094aac..f762ca9291c 100644 --- a/htdocs/mrp/mo_production.php +++ b/htdocs/mrp/mo_production.php @@ -667,7 +667,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print load_fiche_titre($langs->trans('Consumption'), '', '', 0, '', '', $newlinetext); print '
    '; - print ''; + print '
    '; print ''; print ''; diff --git a/htdocs/opensurvey/results.php b/htdocs/opensurvey/results.php index c7d712b4633..337ccb3e435 100644 --- a/htdocs/opensurvey/results.php +++ b/htdocs/opensurvey/results.php @@ -507,7 +507,7 @@ print ''."\n"; print ''; @@ -522,7 +522,7 @@ if (GETPOST('ajoutsujet')) print ''; print '
    '."\n"; - print "

    "."\n"; + print "

    \n"; // Add new column if ($object->format == "A") diff --git a/htdocs/product/stock/replenish.php b/htdocs/product/stock/replenish.php index ed83034bb6c..97d3871c027 100644 --- a/htdocs/product/stock/replenish.php +++ b/htdocs/product/stock/replenish.php @@ -588,16 +588,16 @@ if (!empty($conf->global->STOCK_ALLOW_ADD_LIMIT_STOCK_BY_WAREHOUSE) && $fk_entre { $stocklabel .= ' ('.$langs->trans("AllWarehouses").')'; } -print '
    '. - ''. - ''. - ''. - ''. - ''. - ''. - ''. - ''. - ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; // Fields title search print '
    '; diff --git a/htdocs/product/stock/replenishorders.php b/htdocs/product/stock/replenishorders.php index 25f3e38a81b..42469b4dd2a 100644 --- a/htdocs/product/stock/replenishorders.php +++ b/htdocs/product/stock/replenishorders.php @@ -268,7 +268,9 @@ if ($resql) if ($showline) { $href = DOL_URL_ROOT.'/fourn/commande/card.php?id='.$obj->rowid; + print ''; + // Ref print ''; + print ''; // Author $userstatic->id = $obj->fk_user_author; @@ -290,6 +289,7 @@ if ($resql) $txt = ' '; } print ''; + // Amount print ''; @@ -300,8 +300,10 @@ if ($resql) $date = '-'; } print ''; + // Statut print ''; + print ''; } $i++; diff --git a/htdocs/public/members/public_list.php b/htdocs/public/members/public_list.php index 0514c5ad565..459926707b8 100644 --- a/htdocs/public/members/public_list.php +++ b/htdocs/public/members/public_list.php @@ -101,7 +101,7 @@ $form = new Form($db); $morehead = ''; if (!empty($conf->global->MEMBER_PUBLIC_CSS)) $morehead = ''; -else $morehead = ''; +else $morehead = ''; llxHeaderVierge($langs->trans("ListOfValidatedPublicMembers"), $morehead); diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php index dbdb15bfedc..7f4601eb177 100644 --- a/htdocs/ticket/card.php +++ b/htdocs/ticket/card.php @@ -856,7 +856,7 @@ if (empty($action) || $action == 'view' || $action == 'addlink' || $action == 'd // Creation date print ''; // Read date diff --git a/htdocs/website/index.php b/htdocs/website/index.php index 0f684ca5232..32fa5d4eefb 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -1232,7 +1232,7 @@ if ($action == 'updatecss') $csscontent .= ""."\n"; + $csscontent .= "// END PHP ?>\n"; dol_syslog("Save css content into ".$filecss); From c0821a8ed680f3e4df6a6cbff1d1c5bec2e88157 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 27 Apr 2020 00:02:31 +0200 Subject: [PATCH 109/115] Fix phpcs --- .../accountancy/class/bookkeeping.class.php | 2 +- htdocs/admin/menus/index.php | 32 +++++++++++-------- htdocs/admin/notification.php | 2 +- htdocs/core/tpl/advtarget.tpl.php | 4 +-- htdocs/expedition/card.php | 14 ++++---- htdocs/website/index.php | 8 ++--- 6 files changed, 33 insertions(+), 29 deletions(-) diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index 43762c2d36a..0162a98394e 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -704,7 +704,7 @@ class BookKeeping extends CommonObject $sql .= ' WHERE 1 = 1'; $sql .= " AND entity IN (".getEntity('accountancy').")"; if (null !== $ref) { - $sql .= ' AND t.ref = '.'\''.$ref.'\''; + $sql .= " AND t.ref = '".$this->db->escape($ref)."'"; } else { $sql .= ' AND t.rowid = '.$id; } diff --git a/htdocs/admin/menus/index.php b/htdocs/admin/menus/index.php index cc83e019833..56251e48f7b 100644 --- a/htdocs/admin/menus/index.php +++ b/htdocs/admin/menus/index.php @@ -325,6 +325,22 @@ if ($conf->use_javascript_ajax) if (!empty($menu['langs'])) $langs->load($menu['langs']); $titre = $langs->trans($menu['titre']); + $entry = '
    '.$langs->trans("Product").'
    '; print ''.img_object($langs->trans('ShowOrder'), 'order').' '.$obj->ref.''; @@ -276,10 +278,7 @@ if ($resql) // Company $href = DOL_URL_ROOT.'/fourn/card.php?socid='.$obj->socid; - print ''. - ''. - img_object($langs->trans('ShowCompany'), 'company').' '. - $obj->name.''.img_object($langs->trans('ShowCompany'), 'company').' '.$obj->name.''.$txt.''.price($obj->total_ttc).''.$date.''.$commandestatic->LibStatut($obj->fk_statut, 5).'
    '.$langs->trans("DateCreation").''; print dol_print_date($object->datec, 'dayhour'); - print ' - '.$langs->trans("TimeElapsedSince").': '.''.convertSecondToTime(roundUpToNextMultiple($now - $object->datec, 60)).''; + print ' - '.$langs->trans("TimeElapsedSince").': '.convertSecondToTime(roundUpToNextMultiple($now - $object->datec, 60)).''; print '
    '; + $entry .= '   '.$titre.''; + $entry .= ''; + $entry .= ''.img_edit('default', 0, 'class="menuEdit" id="edit'.$menu['rowid'].'"').' '; + $entry .= ''.img_edit_add('default').' '; + $entry .= ''.img_delete('default').' '; + $entry .= '     '; + $entry .= ''.img_picto("Up", "1uparrow").''.img_picto("Down", "1downarrow").''; + $entry .= '
    '; + + $buttons = ''.img_edit('default', 0, 'class="menuEdit" id="edit'.$menu['rowid'].'"').' '; + $buttons .= ''.img_edit_add('default').' '; + $buttons .= ''.img_delete('default').' '; + $buttons .= '     '; + $buttons .= ''.img_picto("Up", "1uparrow").''.img_picto("Down", "1downarrow").''; + $data[] = array( 'rowid'=>$menu['rowid'], 'module'=>$menu['module'], @@ -335,20 +351,8 @@ if ($conf->use_javascript_ajax) 'fk_mainmenu'=>$menu['fk_mainmenu'], 'fk_leftmenu'=>$menu['fk_leftmenu'], 'position'=>$menu['position'], - 'entry'=>'
    '. - '   '.$titre.''. - ''. - ''.img_edit('default', 0, 'class="menuEdit" id="edit'.$menu['rowid'].'"').' '. - ''.img_edit_add('default').' '. - ''.img_delete('default').' '. - '     '. - ''.img_picto("Up", "1uparrow").''.img_picto("Down", "1downarrow").''. - '
    ', - 'buttons'=>''.img_edit('default', 0, 'class="menuEdit" id="edit'.$menu['rowid'].'"').' '. - ''.img_edit_add('default').' '. - ''.img_delete('default').' '. - '     '. - ''.img_picto("Up", "1uparrow").''.img_picto("Down", "1downarrow").'' + 'entry'=>$entry, + 'buttons'=>$buttons ); $i++; } diff --git a/htdocs/admin/notification.php b/htdocs/admin/notification.php index 0455fb961ae..97b09861a42 100644 --- a/htdocs/admin/notification.php +++ b/htdocs/admin/notification.php @@ -265,7 +265,7 @@ print ''.$langs->trans("Code").''; print ''.$langs->trans("Label").''; print ''.$langs->trans("FixedEmailTarget").''; print ''.$langs->trans("Threshold").''; -print ''.''; +print ''; print "\n"; foreach ($listofnotifiedevents as $notifiedevent) diff --git a/htdocs/core/tpl/advtarget.tpl.php b/htdocs/core/tpl/advtarget.tpl.php index f433366f112..23727e4ad97 100644 --- a/htdocs/core/tpl/advtarget.tpl.php +++ b/htdocs/core/tpl/advtarget.tpl.php @@ -486,9 +486,9 @@ if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) { } elseif (($extrafields->attributes[$elementtype]['type'][$key] == 'date') || ($extrafields->attributes[$elementtype]['type'][$key] == 'datetime')) { print ''; print '
    '.$langs->trans("AdvTgtStartDt").''; - print $form->selectDate('', 'options_'.$key.'_st_dt'.'_cnct'); + print $form->selectDate('', 'options_'.$key.'_st_dt_cnct'); print ''.$langs->trans("AdvTgtEndDt").''; - print $form->selectDate('', 'options_'.$key.'_end_dt'.'_cnct'); + print $form->selectDate('', 'options_'.$key.'_end_dt_cnct'); print '
    '; print ''."\n"; print $form->textwithpicto('', $langs->trans("AdvTgtSearchDtHelp"), 1, 'help'); diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 655ba8f060f..7fd2948480e 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -2278,7 +2278,7 @@ elseif ($id || $ref) { print ''; // Qty to ship or shipped - print ''.''.''; + print ''; // Batch number managment if ($lines[$i]->entrepot_id == 0) { @@ -2291,7 +2291,7 @@ elseif ($id || $ref) // add a 0 qty lot row to be able to add a lot print ''; // Qty to ship or shipped - print ''.''.''; + print ''; // Batch number managment print ''.$formproduct->selectLotStock('', 'batchl'.$line_id.'_0', '', 1, 0, $lines[$i]->fk_product).''; print ''; @@ -2305,7 +2305,7 @@ elseif ($id || $ref) print ''; print ''; // Qty to ship or shipped - print ''.''.''; + print ''; // Warehouse source print ''.$formproduct->selectWarehouses($lines[$i]->entrepot_id, 'entl'.$line_id, '', 1, 0, $lines[$i]->fk_product, '', 1).''; // Batch number managment @@ -2319,7 +2319,7 @@ elseif ($id || $ref) { print ''; // Qty to ship or shipped - print ''.''.''; + print ''; // Warehouse source print ''.$formproduct->selectWarehouses($detail_entrepot->entrepot_id, 'entl'.$detail_entrepot->line_id, '', 1, 0, $lines[$i]->fk_product, '', 1).''; // Batch number managment @@ -2338,11 +2338,11 @@ elseif ($id || $ref) print ''; print ''; // Qty to ship or shipped - print ''.''.''; + print ''; // Warehouse source - print ''.''; + print ''; // Batch number managment - print ''.''; + print ''; print ''; } } diff --git a/htdocs/website/index.php b/htdocs/website/index.php index 32fa5d4eefb..403473071f4 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -1263,7 +1263,7 @@ if ($action == 'updatecss') $jscontent .= ""."\n"; + $jscontent .= "// END PHP ?>\n"; $result = dolSaveJsFile($filejs, $jscontent); if (!$result) @@ -1329,7 +1329,7 @@ if ($action == 'updatecss') $manifestjsoncontent .= ""."\n"; + $manifestjsoncontent .= "// END PHP ?>\n"; $result = dolSaveManifestJson($filemanifestjson, $manifestjsoncontent); if (!$result) From 4c605283f5b515f6d9dddb0359a0fede90d574e9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 27 Apr 2020 00:09:21 +0200 Subject: [PATCH 110/115] Fix phpcs --- htdocs/accountancy/index.php | 4 ++-- htdocs/admin/dolistore/class/dolistore.class.php | 4 ++-- htdocs/comm/mailing/class/advtargetemailing.class.php | 4 ++-- htdocs/core/class/html.form.class.php | 4 ++-- htdocs/ticket/card.php | 2 +- htdocs/ticket/class/ticket.class.php | 8 ++++---- htdocs/website/index.php | 4 +++- 7 files changed, 16 insertions(+), 14 deletions(-) diff --git a/htdocs/accountancy/index.php b/htdocs/accountancy/index.php index 2379c31ce53..56cf674505b 100644 --- a/htdocs/accountancy/index.php +++ b/htdocs/accountancy/index.php @@ -124,12 +124,12 @@ if ($conf->accounting->enabled) print "
    \n"; $step++; - $textlink = ''.''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuVatAccounts").''.''; + $textlink = ''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuVatAccounts").''; print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescVat", $step, $textlink); print "
    \n"; if (!empty($conf->tax->enabled)) { - $textlink = ''.''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuTaxAccounts").''.''; + $textlink = ''.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("MenuTaxAccounts").''; $step++; print img_picto('', 'puce').' '.$langs->trans("AccountancyAreaDescContrib", $step, $textlink); print "
    \n"; diff --git a/htdocs/admin/dolistore/class/dolistore.class.php b/htdocs/admin/dolistore/class/dolistore.class.php index d250203b3d8..230c588f7e4 100644 --- a/htdocs/admin/dolistore/class/dolistore.class.php +++ b/htdocs/admin/dolistore/class/dolistore.class.php @@ -267,8 +267,8 @@ class Dolistore // add image or default ? if ($product->id_default_image != '') { $image_url = DOL_URL_ROOT.'/admin/dolistore/ajax/image.php?id_product='.$product->id.'&id_image='.$product->id_default_image; - $images = ''. - ''; + $images = ''; + $images .= ''; } else { $images = ''; } diff --git a/htdocs/comm/mailing/class/advtargetemailing.class.php b/htdocs/comm/mailing/class/advtargetemailing.class.php index 7bb73a61c9f..b398235e8d8 100644 --- a/htdocs/comm/mailing/class/advtargetemailing.class.php +++ b/htdocs/comm/mailing/class/advtargetemailing.class.php @@ -725,12 +725,12 @@ class AdvanceTargetingMailing extends CommonObject } elseif (($extrafields->attributes[$elementtype]['type'][$key] == 'int') || ($extrafields->attributes[$elementtype]['type'][$key] == 'double')) { if (!empty($arrayquery['options_'.$key.'_max_cnct'])) { - $sqlwhere[] = " (te.".$key." >= ".$arrayquery['options_'.$key.'_max'.'_cnct']." AND te.".$key." <= ".$arrayquery['options_'.$key.'_min_cnct'].")"; + $sqlwhere[] = " (te.".$key." >= ".$arrayquery['options_'.$key.'_max_cnct']." AND te.".$key." <= ".$arrayquery['options_'.$key.'_min_cnct'].")"; } } elseif (($extrafields->attributes[$elementtype]['type'][$key] == 'date') || ($extrafields->attributes[$elementtype]['type'][$key] == 'datetime')) { if (!empty($arrayquery['options_'.$key.'_end_dt_cnct'])) { - $sqlwhere[] = " (te.".$key." >= '".$this->db->idate($arrayquery['options_'.$key.'_st_dt'.'_cnct'])."' AND te.".$key." <= '".$this->db->idate($arrayquery['options_'.$key.'_end_dt_cnct'])."')"; + $sqlwhere[] = " (te.".$key." >= '".$this->db->idate($arrayquery['options_'.$key.'_st_dt_cnct'])."' AND te.".$key." <= '".$this->db->idate($arrayquery['options_'.$key.'_end_dt_cnct'])."')"; } } elseif ($extrafields->attributes[$elementtype]['type'][$key] == 'boolean') { if ($arrayquery['options_'.$key.'_cnct'] != '') { diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 05174f176b0..25ed9f86625 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -6642,7 +6642,7 @@ class Form $out .= 'function formatResult(record) {'."\n"; if ($elemtype == 'category') { - $out .= 'return \' \'+record.text+\'\';'; + $out .= 'return \' \'+record.text+\'\';'; } else { @@ -6652,7 +6652,7 @@ class Form $out .= 'function formatSelection(record) {'."\n"; if ($elemtype == 'category') { - $out .= 'return \' \'+record.text+\'\';'; + $out .= 'return \' \'+record.text+\'\';'; } else { diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php index 7f4601eb177..b9459a0e161 100644 --- a/htdocs/ticket/card.php +++ b/htdocs/ticket/card.php @@ -864,7 +864,7 @@ if (empty($action) || $action == 'view' || $action == 'addlink' || $action == 'd if (!empty($object->date_read)) { print dol_print_date($object->date_read, 'dayhour'); print ' - '.$langs->trans("TicketTimeToRead").': '.convertSecondToTime(roundUpToNextMultiple($object->date_read - $object->datec, 60)).''; - print ' - '.$langs->trans("TimeElapsedSince").': '.''.convertSecondToTime(roundUpToNextMultiple($now - $object->date_read, 60)).''; + print ' - '.$langs->trans("TimeElapsedSince").': '.convertSecondToTime(roundUpToNextMultiple($now - $object->date_read, 60)).''; } print ''; diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index 85c900eaf55..f94599153f0 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -1441,10 +1441,10 @@ class Ticket extends CommonObject if ($info_sendto['source'] == 'internal') { $url_internal_ticket = dol_buildpath('/ticket/card.php', 2).'?track_id='.$this->track_id; - $message .= "\n".$langs->transnoentities('TicketNotificationEmailBodyInfosTrackUrlinternal').' : '.''.$this->track_id.''."\n"; + $message .= "\n".$langs->transnoentities('TicketNotificationEmailBodyInfosTrackUrlinternal').' : '.$this->track_id.''."\n"; } else { $url_public_ticket = ($conf->global->TICKET_URL_PUBLIC_INTERFACE ? $conf->global->TICKET_URL_PUBLIC_INTERFACE.'/' : dol_buildpath('/public/ticket/view.php', 2)).'?track_id='.$this->track_id; - $message .= "\n".$langs->transnoentities('TicketNewEmailBodyInfosTrackUrlCustomer').' : '.''.$this->track_id.''."\n"; + $message .= "\n".$langs->transnoentities('TicketNewEmailBodyInfosTrackUrlCustomer').' : '.$this->track_id.''."\n"; } $message .= "\n"; @@ -2510,7 +2510,7 @@ class Ticket extends CommonObject $url_internal_ticket = dol_buildpath('/ticket/card.php', 2).'?track_id='.$object->track_id; // altairis: make html link on url - $message .= "\n".$langs->trans('TicketNotificationEmailBodyInfosTrackUrlinternal').' : '.''.$object->track_id.''."\n"; + $message .= "\n".$langs->trans('TicketNotificationEmailBodyInfosTrackUrlinternal').' : '.$object->track_id.''."\n"; // Add global email address recipient if ($conf->global->TICKET_NOTIFICATION_ALSO_MAIN_ADDRESS && !in_array($conf->global->TICKET_NOTIFICATION_EMAIL_TO, $sendto)) { @@ -2572,7 +2572,7 @@ class Ticket extends CommonObject // If public interface is not enable, use link to internal page into mail $url_public_ticket = (!empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE) ? (!empty($conf->global->TICKET_URL_PUBLIC_INTERFACE) ? $conf->global->TICKET_URL_PUBLIC_INTERFACE.'/view.php' : dol_buildpath('/public/ticket/view.php', 2)) : dol_buildpath('/ticket/card.php', 2)).'?track_id='.$object->track_id; - $message .= "\n".$langs->trans('TicketNewEmailBodyInfosTrackUrlCustomer').' : '.''.$object->track_id.''."\n"; + $message .= "\n".$langs->trans('TicketNewEmailBodyInfosTrackUrlCustomer').' : '.$object->track_id.''."\n"; // Build final message $message = $message_intro.$message; diff --git a/htdocs/website/index.php b/htdocs/website/index.php index 403473071f4..a617d9ae018 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -2719,7 +2719,9 @@ if ($action == 'editcss') { $csscontent = GETPOST('WEBSITE_CSS_INLINE', 'none'); } - if (!trim($csscontent)) $csscontent = '/* CSS content (all pages) */'."\n"."body.bodywebsite { margin: 0; font-family: 'Open Sans', sans-serif; }\n.bodywebsite h1 { margin-top: 0; margin-bottom: 0; padding: 10px;}"; + if (!trim($csscontent)) { + $csscontent = '/* CSS content (all pages) */'."\nbody.bodywebsite { margin: 0; font-family: 'Open Sans', sans-serif; }\n.bodywebsite h1 { margin-top: 0; margin-bottom: 0; padding: 10px;}"; + } if (!GETPOSTISSET('WEBSITE_JS_INLINE')) { From 3c1d989c301314cda384debea133295a6a4668d3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 27 Apr 2020 11:41:35 +0200 Subject: [PATCH 111/115] FIX #13751 --- htdocs/modulebuilder/template/.editorconfig | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/modulebuilder/template/.editorconfig b/htdocs/modulebuilder/template/.editorconfig index 3c4bd7d679d..d25f38c8b44 100644 --- a/htdocs/modulebuilder/template/.editorconfig +++ b/htdocs/modulebuilder/template/.editorconfig @@ -2,6 +2,7 @@ # top-most EditorConfig file root = true + # Unix-style newlines with a newline ending every file [*] charset = utf-8 @@ -11,9 +12,10 @@ insert_final_newline = true # PHP PSR-2 Coding Standards # http://www.php-fig.org/psr/psr-2/ [*.php] -indent_style = space +indent_style = tab indent_size = 4 trim_trailing_whitespace = true +insert_final_newline = true [*.js] indent_style = tab [*.css] From fdc0543b4d396287b4f35fe3c1f90cec9b54a221 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Mon, 27 Apr 2020 12:16:24 +0000 Subject: [PATCH 112/115] 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 ''; From 50d9f466d453c1e71bee17b8466340dd514d79ea Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 27 Apr 2020 14:38:45 +0200 Subject: [PATCH 113/115] FIX #13749 --- htdocs/api/class/api.class.php | 9 +++++++++ htdocs/product/class/api_products.class.php | 18 +++++++++++------- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/htdocs/api/class/api.class.php b/htdocs/api/class/api.class.php index 6b106efc450..5e051420748 100644 --- a/htdocs/api/class/api.class.php +++ b/htdocs/api/class/api.class.php @@ -137,6 +137,15 @@ class DolibarrApi unset($object->labelStatus); unset($object->labelStatusShort); + unset($object->stats_propale); + unset($object->stats_commande); + unset($object->stats_contrat); + unset($object->stats_facture); + unset($object->stats_commande_fournisseur); + unset($object->stats_reception); + unset($object->stats_mrptoconsume); + unset($object->stats_mrptoproduce); + unset($object->element); unset($object->fk_element); unset($object->table_element); diff --git a/htdocs/product/class/api_products.class.php b/htdocs/product/class/api_products.class.php index 315936d41eb..91162d727c3 100644 --- a/htdocs/product/class/api_products.class.php +++ b/htdocs/product/class/api_products.class.php @@ -734,8 +734,6 @@ class Products extends DolibarrApi } /** - * List purchase prices - * * Get a list of all purchase prices of products * * @param string $sortfield Sort field @@ -767,11 +765,11 @@ class Products extends DolibarrApi if ($supplier > 0) { $sql .= " AND s.fk_soc = ".$db->escape($supplier); } - $sql .= " AND s.fk_product = t.rowid "; + $sql .= " AND s.fk_product = t.rowid"; // Select products of given category if ($category > 0) { $sql .= " AND c.fk_categorie = ".$db->escape($category); - $sql .= " AND c.fk_product = t.rowid "; + $sql .= " AND c.fk_product = t.rowid"; } if ($mode == 1) { // Show only products @@ -804,10 +802,15 @@ class Products extends DolibarrApi while ($i < $min) { $obj = $db->fetch_object($result); - $product_static = new Product($db); - if ($product_static->fetch($obj->rowid)) { - $obj_ret[] = $this->_cleanObjectDatas($product_static); + + $product_fourn = new ProductFournisseur($this->db); + $product_fourn_list = $product_fourn->list_product_fournisseur_price($obj->rowid, '', '', 0, 0); + foreach($product_fourn_list as $tmpobj) { + $this->_cleanObjectDatas($tmpobj); } + //var_dump($product_fourn_list->db);exit; + $obj_ret[$obj->rowid] = $product_fourn_list; + $i++; } } @@ -1587,6 +1590,7 @@ class Products extends DolibarrApi unset($object->prices_by_qty_id); unset($object->libelle); unset($object->product_id_already_linked); + unset($object->reputations); unset($object->name); unset($object->firstname); From 581d4dbcd9ca421c64cedcb750298552b4d6f8ed Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 27 Apr 2020 14:39:38 +0200 Subject: [PATCH 114/115] Look and feel v12 --- htdocs/expedition/card.php | 3 ++- htdocs/langs/es_AR/main.lang | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 7fd2948480e..605cc8316c9 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -960,8 +960,9 @@ if ($action == 'create') $langs->load("projects"); print ''; print ''.$langs->trans("Project").''; + print img_picto('', 'project'); $numprojet = $formproject->select_projects($soc->id, $projectid, 'projectid', 0); - print '   id).'">'.$langs->trans("AddProject").''; + print ' id).'">'; print ''; print ''; } diff --git a/htdocs/langs/es_AR/main.lang b/htdocs/langs/es_AR/main.lang index 1451ea1c508..a48f7399746 100644 --- a/htdocs/langs/es_AR/main.lang +++ b/htdocs/langs/es_AR/main.lang @@ -1,6 +1,6 @@ # Dolibarr language file - Source file is en_US - main DIRECTION=ltr -FONTFORPDF=helvética +FONTFORPDF=helvetica FONTSIZEFORPDF=10 SeparatorDecimal=. SeparatorThousand=, From 6b1a1e5e587c1bd2e7b2d4a8130d10952b3d8a3f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 27 Apr 2020 15:09:27 +0200 Subject: [PATCH 115/115] FIX #13743 --- 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 289bbea2c7e..ab0abb3d151 100644 --- a/htdocs/commande/class/api_orders.class.php +++ b/htdocs/commande/class/api_orders.class.php @@ -33,7 +33,8 @@ class Orders extends DolibarrApi * @var array $FIELDS Mandatory fields, checked when create and update object */ static $FIELDS = array( - 'socid' + 'socid', + 'date' ); /** @@ -233,7 +234,9 @@ class Orders extends DolibarrApi } /** - * Create order object + * Create a sale order + * + * Exemple: { "socid": 2, "date": 1595196000, "type": 0, "lines": [{ "fk_product": 2, "qty": 1 }] } * * @param array $request_data Request data * @return int ID of order