From c18a8bef1b349d6db558d229b001f07045e27316 Mon Sep 17 00:00:00 2001 From: wdammak <26695620+wdammak@users.noreply.github.com> Date: Tue, 29 Jan 2019 19:44:59 +0100 Subject: [PATCH 01/35] Update eldy.lib.php Simplifying horizontal menu writing, it would simplify menu updates in the future. The menu table can be further simplified, it's in a 2nd step if @eldy confirms this restructuring. Already tested and it works. --- htdocs/core/menus/standard/eldy.lib.php | 584 +++++++++++++++--------- 1 file changed, 361 insertions(+), 223 deletions(-) diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 1de907face7..ef1ce0c8d85 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -65,246 +65,384 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = $menu->add('#', '', 0, $showmode, $atarget, "xxx", '', 0, $id, $idsel, $classname); } - // Home - $showmode=1; - $classname=""; - if ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "home") { $classname='class="tmenusel"'; $_SESSION['idmenu']=''; } - else $classname = 'class="tmenu"'; - $idsel='home'; - - $titlehome = $langs->trans("Home"); - if (! empty($conf->global->THEME_TOPMENU_DISABLE_IMAGE)) $titlehome = '   '; - $menu->add('/index.php?mainmenu=home&leftmenu=home', $titlehome, 0, $showmode, $atarget, "home", '', 10, $id, $idsel, $classname); + // Home + $menu_arr[] = array( + 'name' => 'Home', + 'link' => '/index.php?mainmenu=home&leftmenu=home', + 'title' => (! empty($conf->global->THEME_TOPMENU_DISABLE_IMAGE)? '   ' : "Home") , + 'level' => 0, + 'enabled' => $showmode = 1, + 'target' => $atarget, + 'mainmenu' => "home", + 'leftmenu' => '', + 'position' => 10, + 'id' => $id, + 'idsel' => 'home', + 'classname' => $classname = ( $_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "home" ) ? 'class="tmenusel"' : 'class="tmenu"', + 'prefix' => '', + 'session' => ( ( $_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "home" ) ? 0 : 1 ), + 'loadLangs' => array(), + 'submenus' => array(), + ); // Members - $tmpentry = array( - 'enabled'=>(! empty($conf->adherent->enabled)), - 'perms'=>(! empty($user->rights->adherent->lire)), - 'module'=>'adherent', - ); - $showmode=isVisibleToUserType($type_user, $tmpentry, $listofmodulesforexternal); - if ($showmode) - { - $classname=""; - if ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "members") { $classname='class="tmenusel"'; $_SESSION['idmenu']=''; } - else $classname = 'class="tmenu"'; - $idsel='members'; + $menu_arr[] = array( + 'name' => 'Members', + 'link' => '/adherents/index.php?mainmenu=members&leftmenu=', + 'title' => "MenuMembers", + 'level' => 0, + 'enabled' => $showmode = isVisibleToUserType + ( + $type_user, + $tmpentry = array( + 'enabled' => (! empty($conf->adherent->enabled) ) , + 'perms' => (! empty($user->rights->adherent->lire) ), + 'module' => 'adherent', + ), + $listofmodulesforexternal + ), + 'target' => $atarget, + 'mainmenu' => "members", + 'leftmenu' => '', + 'position' => 18, + 'id' => $id, + 'idsel' => 'members', + 'classname' => $classname = ( $_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "members" ) ? 'class="tmenusel"' : 'class="tmenu"', + 'prefix' => '', + 'session' => ( ( $_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "members" ) ? 0 : 1 ), + 'loadLangs' => array(), + 'submenus' => array(), + ); - $menu->add('/adherents/index.php?mainmenu=members&leftmenu=', $langs->trans("MenuMembers"), 0, $showmode, $atarget, "members", '', 18, $id, $idsel, $classname); - } + // Third parties + $menu_arr[] = array( + 'name' => 'Companies', + 'link' => '/societe/index.php?mainmenu=companies&leftmenu=', + 'title' => "ThirdParties", + 'level' => 0, + 'enabled' => $showmode = isVisibleToUserType + ( + $type_user, + $tmpentry = array( + 'enabled'=> ( ( ! empty($conf->societe->enabled) && + ( empty($conf->global->SOCIETE_DISABLE_PROSPECTS) || empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) ) + ) + || ! empty($conf->fournisseur->enabled) + ), + 'perms'=> (! empty($user->rights->societe->lire) || ! empty($user->rights->fournisseur->lire)), + 'module'=>'societe|fournisseur', + ), + $listofmodulesforexternal + ), + 'target' => $atarget, + 'mainmenu' => "companies", + 'leftmenu' => '', + 'position' => 20, + 'id' => $id, + 'idsel' => 'companies', + 'classname' => $classname = ( $_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "companies" ) ? 'class="tmenusel"' : 'class="tmenu"', + 'prefix' => '', + 'session' => ( ( $_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "companies" ) ? 0 : 1 ), + 'loadLangs' => array("companies","suppliers"), + 'submenus' => array(), + ); - // Third parties - $tmpentry = array( - 'enabled'=>(( ! empty($conf->societe->enabled) && (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) || empty($conf->global->SOCIETE_DISABLE_CUSTOMERS))) || ! empty($conf->fournisseur->enabled)), - 'perms'=>(! empty($user->rights->societe->lire) || ! empty($user->rights->fournisseur->lire)), - 'module'=>'societe|fournisseur', - ); - $showmode=isVisibleToUserType($type_user, $tmpentry, $listofmodulesforexternal); - if ($showmode) - { - // Load translation files required by the page - $langs->loadLangs(array("companies","suppliers")); + // Products-Services + $menu_arr[] = array( + 'name' => 'Products', + 'link' => '/product/index.php?mainmenu=products&leftmenu=', + 'title' => (! empty($conf->product->enabled) && ! empty($conf->service->enabled)) + ? ( array("TMenuProducts" , " | " ,"TMenuServices") ) + : (! empty($conf->product->enabled)? "TMenuProducts" : "TMenuServices" ), + 'level' => 0, + 'enabled' => $showmode = isVisibleToUserType + ( + $type_user, + $tmpentry = array( + 'enabled'=> ( ( ! empty($conf->societe->enabled) && + ( empty($conf->global->SOCIETE_DISABLE_PROSPECTS) || empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) ) + ) + || ! empty($conf->fournisseur->enabled) + ), + 'perms'=> (! empty($user->rights->societe->lire) || ! empty($user->rights->fournisseur->lire)), + 'module'=>'product|service', + ), + $listofmodulesforexternal + ), + 'target' => $atarget, + 'mainmenu' => "products", + 'leftmenu' => '', + 'position' => 30, + 'id' => $id, + 'idsel' => 'products', + 'classname' => $classname = ( $_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "products" ) ? 'class="tmenusel"' : 'class="tmenu"', + 'prefix' => '', + 'session' => ( ( $_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "products" ) ? 0 : 1 ), + 'loadLangs' => array("products"), + 'submenus' => array(), + ); - $classname=""; - if ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "companies") { $classname='class="tmenusel"'; $_SESSION['idmenu']=''; } - else $classname = 'class="tmenu"'; - $idsel='companies'; - - $menu->add('/societe/index.php?mainmenu=companies&leftmenu=', $langs->trans("ThirdParties"), 0, $showmode, $atarget, "companies", '', 20, $id, $idsel, $classname); - } - - // Products-Services - $tmpentry = array( - 'enabled'=>(! empty($conf->product->enabled) || ! empty($conf->service->enabled)), - 'perms'=>(! empty($user->rights->produit->lire) || ! empty($user->rights->service->lire)), - 'module'=>'product|service', - ); - $showmode=isVisibleToUserType($type_user, $tmpentry, $listofmodulesforexternal); - if ($showmode) - { - $langs->load("products"); - - $classname=""; - if ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "products") { $classname='class="tmenusel"'; $_SESSION['idmenu']=''; } - else $classname = 'class="tmenu"'; - $idsel='products'; - - $chaine=""; - if (! empty($conf->product->enabled)) { - $chaine.=$langs->trans("TMenuProducts"); - } - if (! empty($conf->product->enabled) && ! empty($conf->service->enabled)) { - $chaine.=" | "; - } - if (! empty($conf->service->enabled)) { - $chaine.=$langs->trans("TMenuServices"); - } - - $menu->add('/product/index.php?mainmenu=products&leftmenu=', $chaine, 0, $showmode, $atarget, "products", '', 30, $id, $idsel, $classname); - } - - // Projects - $tmpentry=array('enabled'=>(! empty($conf->projet->enabled)), - 'perms'=>(! empty($user->rights->projet->lire)), - 'module'=>'projet'); - $showmode=isVisibleToUserType($type_user, $tmpentry, $listofmodulesforexternal); - if ($showmode) - { - $langs->load("projects"); - - $classname=""; - if ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "project") { $classname='class="tmenusel"'; $_SESSION['idmenu']=''; } - else $classname = 'class="tmenu"'; - $idsel='project'; - - $title = $langs->trans("LeadsOrProjects"); // Leads and opportunities by default - $showmodel = $showmodep = $showmode; - if (empty($conf->global->PROJECT_USE_OPPORTUNITIES)) - { - $title = $langs->trans("Projects"); - $showmodel = 0; - } - if ($conf->global->PROJECT_USE_OPPORTUNITIES == 2) { - $title = $langs->trans("Leads"); - $showmodep = 0; - } - - $menu->add('/projet/index.php?mainmenu=project&leftmenu=', $title, 0, $showmode, $atarget, "project", '', 35, $id, $idsel, $classname); - //$menu->add('/projet/index.php?mainmenu=project&leftmenu=&search_opp_status=openedopp', $langs->trans("ListLeads"), 0, $showmodel & $conf->global->PROJECT_USE_OPPORTUNITIES, $atarget, "project", '', 70, $id, $idsel, $classname); - //$menu->add('/projet/index.php?mainmenu=project&leftmenu=&search_opp_status=notopenedopp', $langs->trans("ListProjects"), 0, $showmodep, $atarget, "project", '', 70, $id, $idsel, $classname); - } + // Projects + $menu_arr[] = array( + 'name' => 'Projet', + 'link' => '/projet/index.php?mainmenu=project&leftmenu=', + 'title' => (empty($conf->global->PROJECT_USE_OPPORTUNITIES) || $conf->global->PROJECT_USE_OPPORTUNITIES == 2 ) + ? (($conf->global->PROJECT_USE_OPPORTUNITIES == 2)?"Leads":"Projects") + : "LeadsOrProjects", + 'level' => 0, + 'enabled' => $showmode = isVisibleToUserType + ( + $type_user, + $tmpentry = array( + 'enabled'=> ( ! empty($conf->projet->enabled) ? 1 : 0), + 'perms'=> (! empty($user->rights->projet->lire) ? 1 : 0), + 'module'=>'projet', + ), + $listofmodulesforexternal + ), + 'target' => $atarget, + 'mainmenu' => "project", + 'leftmenu' => '', + 'position' => 35, + 'id' => $id, + 'idsel' => 'project', + 'classname' => $classname = ( $_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "project" ) ? 'class="tmenusel"' : 'class="tmenu"', + 'prefix' => '', + 'session' => ( ( $_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "project" ) ? 0 : 1 ), + 'loadLangs' => array("projects"), + 'submenus' => array(), + ); // Commercial - $menuqualified=0; - if (! empty($conf->propal->enabled)) $menuqualified++; - if (! empty($conf->commande->enabled)) $menuqualified++; - if (! empty($conf->supplier_order->enabled)) $menuqualified++; - if (! empty($conf->supplier_proposal->enabled)) $menuqualified++; - if (! empty($conf->contrat->enabled)) $menuqualified++; - if (! empty($conf->ficheinter->enabled)) $menuqualified++; - $tmpentry = array( - 'enabled'=>$menuqualified, - 'perms'=>(! empty($user->rights->societe->lire) || ! empty($user->rights->societe->contact->lire)), - 'module'=>'propal|commande|supplier_order|contrat|ficheinter', - ); - $showmode=isVisibleToUserType($type_user, $tmpentry, $listofmodulesforexternal); - if ($showmode) - { - $langs->load("commercial"); + $menu_arr[] = array( + 'name' => 'Commercial', + 'link' => '/comm/index.php?mainmenu=commercial&leftmenu=', + 'title' => "Commercial", + 'level' => 0, + 'enabled' => $showmode = isVisibleToUserType + ( + $type_user, + $tmpentry = array( + 'enabled'=>(! empty($conf->propal->enabled) || + ! empty($conf->commande->enabled) || + ! empty($conf->supplier_order->enabled) || + ! empty($conf->supplier_proposal->enabled) || + ! empty($conf->contrat->enabled) || + ! empty($conf->ficheinter->enabled) + )?1:0, + 'perms'=>(! empty($user->rights->societe->lire) || ! empty($user->rights->societe->contact->lire)), + 'module'=>'propal|commande|supplier_order|contrat|ficheinter', + ), + $listofmodulesforexternal + ), + 'target' => $atarget, + 'mainmenu' => "commercial", + 'leftmenu' => '', + 'position' => 40, + 'id' => $id, + 'idsel' => 'commercial', + 'classname' => $classname = ( $_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "commercial" ) ? 'class="tmenusel"' : 'class="tmenu"', + 'prefix' => '', + 'session' => ( ( $_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "commercial" ) ? 0 : 1 ), + 'loadLangs' => array("commercial"), + 'submenus' => array(), + ); - $classname=""; - if ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "commercial") { $classname='class="tmenusel"'; $_SESSION['idmenu']=''; } - else $classname = 'class="tmenu"'; - $idsel='commercial'; - - $menu->add('/comm/index.php?mainmenu=commercial&leftmenu=', $langs->trans("Commercial"), 0, $showmode, $atarget, "commercial", "", 40, $id, $idsel, $classname); - } - - // Billing - Financial - $menuqualified=0; - if (! empty($conf->facture->enabled)) $menuqualified++; - if (! empty($conf->don->enabled)) $menuqualified++; - if (! empty($conf->tax->enabled)) $menuqualified++; - if (! empty($conf->salaries->enabled)) $menuqualified++; - if (! empty($conf->supplier_invoice->enabled)) $menuqualified++; - if (! empty($conf->loan->enabled)) $menuqualified++; - $tmpentry = array( - 'enabled'=>$menuqualified, - 'perms'=>(! empty($user->rights->facture->lire) || ! empty($user->rights->don->lire) || ! empty($user->rights->tax->charges->lire) || ! empty($user->rights->salaries->read) || ! empty($user->rights->fournisseur->facture->lire) || ! empty($user->rights->loan->read)), - 'module'=>'facture|supplier_invoice|don|tax|salaries|loan', - ); - $showmode=isVisibleToUserType($type_user, $tmpentry, $listofmodulesforexternal); - if ($showmode) - { - $langs->load("compta"); - - $classname=""; - if ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "billing") { $classname='class="tmenusel"'; $_SESSION['idmenu']=''; } - else $classname = 'class="tmenu"'; - $idsel='billing'; - - $menu->add('/compta/index.php?mainmenu=billing&leftmenu=', $langs->trans("MenuFinancial"), 0, $showmode, $atarget, "billing", '', 50, $id, $idsel, $classname); - } + // Billing - Financial + $menu_arr[] = array( + 'name' => 'Compta', + 'link' => '/compta/index.php?mainmenu=billing&leftmenu=', + 'title' => "MenuFinancial", + 'level' => 0, + 'enabled' => $showmode = isVisibleToUserType + ( + $type_user, + $tmpentry = array( + 'enabled'=>(! empty($conf->facture->enabled) || + ! empty($conf->don->enabled) || + ! empty($conf->tax->enabled) || + ! empty($conf->salaries->enabled) || + ! empty($conf->supplier_invoice->enabled) || + ! empty($conf->loan->enabled) + )?1:0, + 'perms'=>(! empty($user->rights->facture->lire) || ! empty($user->rights->don->contact->lire) + || ! empty($user->rights->tax->charges->lire) || ! empty($user->rights->salaries->read) + || ! empty($user->rights->fournisseur->facture->lire) || ! empty($user->rights->loan->read)), + 'module'=>'facture|supplier_invoice|don|tax|salaries|loan', + ), + $listofmodulesforexternal + ), + 'target' => $atarget, + 'mainmenu' => "billing", + 'leftmenu' => '', + 'position' => 50, + 'id' => $id, + 'idsel' => 'billing', + 'classname' => $classname = ( $_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "billing" ) ? 'class="tmenusel"' : 'class="tmenu"', + 'prefix' => '', + 'session' => ( ( $_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "billing" ) ? 0 : 1 ), + 'loadLangs' => array("compta"), + 'submenus' => array(), + ); // Bank - $tmpentry = array( - 'enabled'=>(! empty($conf->banque->enabled) || ! empty($conf->prelevement->enabled)), - 'perms'=>(! empty($user->rights->banque->lire) || ! empty($user->rights->prelevement->lire)), - 'module'=>'banque|prelevement', - ); - $showmode=isVisibleToUserType($type_user, $tmpentry, $listofmodulesforexternal); - if ($showmode) - { - // Load translation files required by the page - $langs->loadLangs(array("compta","banks")); - - $classname=""; - if ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "bank") { $classname='class="tmenusel"'; $_SESSION['idmenu']=''; } - else $classname = 'class="tmenu"'; - $idsel='bank'; - - $menu->add('/compta/bank/list.php?mainmenu=bank&leftmenu=', $langs->trans("MenuBankCash"), 0, $showmode, $atarget, "bank", '', 52, $id, $idsel, $classname); - } + $menu_arr[] = array( + 'name' => 'Bank', + 'link' => '/compta/bank/list.php?mainmenu=bank&leftmenu=', + 'title' => "MenuBankCash", + 'level' => 0, + 'enabled' => $showmode = isVisibleToUserType + ( + $type_user, + $tmpentry = array( + 'enabled'=>(! empty($conf->banque->enabled) || ! empty($conf->prelevement->enabled)), + 'perms'=>(! empty($user->rights->banque->lire) || ! empty($user->rights->prelevement->lire)), + 'module'=>'banque|prelevement', + ), + $listofmodulesforexternal + ), + 'target' => $atarget, + 'mainmenu' => "bank", + 'leftmenu' => '', + 'position' => 52, + 'id' => $id, + 'idsel' => 'bank', + 'classname' => $classname = ( $_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "bank" ) ? 'class="tmenusel"' : 'class="tmenu"', + 'prefix' => '', + + 'session' => ( ( $_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "bank" ) ? 0 : 1 ), + + 'loadLangs' => array("compta","banks"), + 'submenus' => array(), + ); // Accounting - $menuqualified=0; - if (! empty($conf->comptabilite->enabled)) $menuqualified++; - if (! empty($conf->accounting->enabled)) $menuqualified++; - if (! empty($conf->asset->enabled)) $menuqualified++; - $tmpentry = array( - 'enabled'=>$menuqualified, - 'perms'=>(! empty($user->rights->compta->resultat->lire) || ! empty($user->rights->accounting->mouvements->lire) || ! empty($user->rights->asset->read)), - 'module'=>'comptabilite|accounting', - ); - $showmode=isVisibleToUserType($type_user, $tmpentry, $listofmodulesforexternal); - if ($showmode) - { - $langs->load("compta"); - - $classname=""; - if ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "accountancy") { $classname='class="tmenusel"'; $_SESSION['idmenu']=''; } - else $classname = 'class="tmenu"'; - $idsel='accountancy'; - - $menu->add('/accountancy/index.php?mainmenu=accountancy&leftmenu=', $langs->trans("MenuAccountancy"), 0, $showmode, $atarget, "accountancy", '', 54, $id, $idsel, $classname); - } + $menu_arr[] = array( + 'name' => 'Accounting', + 'link' => '/accountancy/index.php?mainmenu=accountancy&leftmenu=', + 'title' => "MenuAccountancy", + 'level' => 0, + 'enabled' => $showmode = isVisibleToUserType + ( + $type_user, + $tmpentry = array( + 'enabled'=>(! empty($conf->comptabilite->enabled) || ! empty($conf->accounting->enabled) || ! empty($conf->asset->enabled)), + 'perms'=>(! empty($user->rights->compta->resultat->lire) || ! empty($user->rights->accounting->mouvements->lire) || ! empty($user->rights->asset->read)), + 'comptabilite|accounting', + ), + $listofmodulesforexternal + ), + 'target' => $atarget, + 'mainmenu' => "accountancy", + 'leftmenu' => '', + 'position' => 54, + 'id' => $id, + 'idsel' => 'accountancy', + 'classname' => $classname = ( $_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "accountancy" ) ? 'class="tmenusel"' : 'class="tmenu"', + 'prefix' => '', + + 'session' => ( ( $_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "accountancy" ) ? 0 : 1 ), + + 'loadLangs' => array("compta"), + 'submenus' => array(), + ); // HRM - $tmpentry = array( - 'enabled'=>(! empty($conf->hrm->enabled) || ! empty($conf->holiday->enabled) || ! empty($conf->deplacement->enabled) || ! empty($conf->expensereport->enabled)), - 'perms'=>(! empty($user->rights->hrm->employee->read) || ! empty($user->rights->holiday->write) || ! empty($user->rights->deplacement->lire) || ! empty($user->rights->expensereport->lire)), - 'module'=>'hrm|holiday|deplacement|expensereport', - ); - $showmode=isVisibleToUserType($type_user, $tmpentry, $listofmodulesforexternal); - if ($showmode) - { - $langs->load("holiday"); - - $classname=""; - if ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "hrm") { $classname='class="tmenusel"'; $_SESSION['idmenu']=''; } - else $classname = 'class="tmenu"'; - $idsel='hrm'; - - $menu->add('/hrm/index.php?mainmenu=hrm&leftmenu=', $langs->trans("HRM"), 0, $showmode, $atarget, "hrm", '', 80, $id, $idsel, $classname); - } + $menu_arr[] = array( + 'name' => 'HRM', + 'link' => '/hrm/index.php?mainmenu=hrm&leftmenu=', + 'title' => "HRM", + 'level' => 0, + 'enabled' => $showmode = isVisibleToUserType + ( + $type_user, + $tmpentry = array( + 'enabled'=>(! empty($conf->hrm->enabled) || ! empty($conf->holiday->enabled) || ! empty($conf->deplacement->enabled) || ! empty($conf->expensereport->enabled)), + 'perms'=>(! empty($user->rights->hrm->employee->read) || ! empty($user->rights->holiday->write) || ! empty($user->rights->deplacement->lire) || ! empty($user->rights->expensereport->lire)), + 'module'=>'hrm|holiday|deplacement|expensereport', + ), + $listofmodulesforexternal + ), + 'target' => $atarget, + 'mainmenu' => "hrm", + 'leftmenu' => '', + 'position' => 80, + 'id' => $id, + 'idsel' => 'hrm', + 'classname' => $classname = ( $_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "hrm" ) ? 'class="tmenusel"' : 'class="tmenu"', + 'prefix' => '', + + 'session' => ( ( $_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "hrm" ) ? 0 : 1 ), + + 'loadLangs' => array("holiday"), + 'submenus' => array(), + ); // Tools - $tmpentry = array( - 'enabled'=>1, - 'perms'=>1, - 'module'=>'', - ); - $showmode=isVisibleToUserType($type_user, $tmpentry, $listofmodulesforexternal); - if ($showmode) + $menu_arr[] = array( + 'name' => 'Tools', + 'link' => '/core/tools.php?mainmenu=tools&leftmenu=', + 'title' => "Tools", + 'level' => 0, + 'enabled' => $showmode = isVisibleToUserType + ( + $type_user, + $tmpentry = array( + 'enabled'=>1, + 'perms'=>1, + 'module'=>'', + ), + $listofmodulesforexternal + ), + 'target' => $atarget, + 'mainmenu' => "tools", + 'leftmenu' => '', + 'position' => 90, + 'id' => $id, + 'idsel' => 'tools', + 'classname' => $classname = ( $_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "tools" ) ? 'class="tmenusel"' : 'class="tmenu"', + 'prefix' => '', + + 'session' => ( ( $_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "tools" ) ? 0 : 1 ), + + 'loadLangs' => array("other"), + 'submenus' => array(), + ); + + // Add menus + foreach($menu_arr as $key => $smenu) { - $langs->load("other"); - - $classname=""; - if ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "tools") { $classname='class="tmenusel"'; $_SESSION['idmenu']=''; } - else $classname = 'class="tmenu"'; - $idsel='tools'; - - $menu->add('/core/tools.php?mainmenu=tools&leftmenu=', $langs->trans("Tools"), 0, $showmode, $atarget, "tools", '', 90, $id, $idsel, $classname); + $smenu = (object) $smenu; + + if( $smenu->enabled ) + { + if($langs->session) + { + $_SESSION['idmenu']=''; + } + + // Load Langue + if(! empty($smenu->loadLangs)) + { + $langs->loadLangs($smenu->loadLangs); + } + + // Trans title + $mtitle = ''; + if(is_array($smenu->title)) + { + foreach($smenu->title as $item) + { + $mtitle .= $langs->trans($item); + } + } + else + { + $mtitle = $langs->trans($smenu->title); + } + // Add item + $menu->add($smenu->link, $mtitle , $smenu->level, $smenu->enabled, $smenu->target, $smenu->mainmenu, $smenu->leftmenu, $smenu->position, $smenu->id, $smenu->idsel, $smenu->classname, $smenu->prefix); + } } // Show personalized menus From f3c725f40f0980ae588ce02bbd5afbeece10865e Mon Sep 17 00:00:00 2001 From: wdammak <26695620+wdammak@users.noreply.github.com> Date: Tue, 29 Jan 2019 21:36:52 +0100 Subject: [PATCH 02/35] Update eldy.lib.php fix travis --- htdocs/core/menus/standard/eldy.lib.php | 72 ++++++++++++------------- 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index ef1ce0c8d85..5226fb7d6cc 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -65,7 +65,7 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = $menu->add('#', '', 0, $showmode, $atarget, "xxx", '', 0, $id, $idsel, $classname); } - // Home + // Home $menu_arr[] = array( 'name' => 'Home', 'link' => '/index.php?mainmenu=home&leftmenu=home', @@ -94,7 +94,7 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = 'enabled' => $showmode = isVisibleToUserType ( $type_user, - $tmpentry = array( + $tmpentry = array( 'enabled' => (! empty($conf->adherent->enabled) ) , 'perms' => (! empty($user->rights->adherent->lire) ), 'module' => 'adherent', @@ -108,13 +108,13 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = 'id' => $id, 'idsel' => 'members', 'classname' => $classname = ( $_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "members" ) ? 'class="tmenusel"' : 'class="tmenu"', - 'prefix' => '', + 'prefix' => '', 'session' => ( ( $_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "members" ) ? 0 : 1 ), 'loadLangs' => array(), 'submenus' => array(), ); - // Third parties + // Third parties $menu_arr[] = array( 'name' => 'Companies', 'link' => '/societe/index.php?mainmenu=companies&leftmenu=', @@ -123,10 +123,10 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = 'enabled' => $showmode = isVisibleToUserType ( $type_user, - $tmpentry = array( - 'enabled'=> ( ( ! empty($conf->societe->enabled) && + $tmpentry = array( + 'enabled'=> ( ( ! empty($conf->societe->enabled) && ( empty($conf->global->SOCIETE_DISABLE_PROSPECTS) || empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) ) - ) + ) || ! empty($conf->fournisseur->enabled) ), 'perms'=> (! empty($user->rights->societe->lire) || ! empty($user->rights->fournisseur->lire)), @@ -147,21 +147,21 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = 'submenus' => array(), ); - // Products-Services + // Products-Services $menu_arr[] = array( 'name' => 'Products', 'link' => '/product/index.php?mainmenu=products&leftmenu=', - 'title' => (! empty($conf->product->enabled) && ! empty($conf->service->enabled)) + 'title' => (! empty($conf->product->enabled) && ! empty($conf->service->enabled)) ? ( array("TMenuProducts" , " | " ,"TMenuServices") ) : (! empty($conf->product->enabled)? "TMenuProducts" : "TMenuServices" ), 'level' => 0, 'enabled' => $showmode = isVisibleToUserType ( $type_user, - $tmpentry = array( - 'enabled'=> ( ( ! empty($conf->societe->enabled) && + $tmpentry = array( + 'enabled'=> ( ( ! empty($conf->societe->enabled) && ( empty($conf->global->SOCIETE_DISABLE_PROSPECTS) || empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) ) - ) + ) || ! empty($conf->fournisseur->enabled) ), 'perms'=> (! empty($user->rights->societe->lire) || ! empty($user->rights->fournisseur->lire)), @@ -182,18 +182,18 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = 'submenus' => array(), ); - // Projects + // Projects $menu_arr[] = array( 'name' => 'Projet', 'link' => '/projet/index.php?mainmenu=project&leftmenu=', - 'title' => (empty($conf->global->PROJECT_USE_OPPORTUNITIES) || $conf->global->PROJECT_USE_OPPORTUNITIES == 2 ) + 'title' => (empty($conf->global->PROJECT_USE_OPPORTUNITIES) || $conf->global->PROJECT_USE_OPPORTUNITIES == 2 ) ? (($conf->global->PROJECT_USE_OPPORTUNITIES == 2)?"Leads":"Projects") : "LeadsOrProjects", 'level' => 0, 'enabled' => $showmode = isVisibleToUserType ( $type_user, - $tmpentry = array( + $tmpentry = array( 'enabled'=> ( ! empty($conf->projet->enabled) ? 1 : 0), 'perms'=> (! empty($user->rights->projet->lire) ? 1 : 0), 'module'=>'projet', @@ -222,13 +222,13 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = 'enabled' => $showmode = isVisibleToUserType ( $type_user, - $tmpentry = array( - 'enabled'=>(! empty($conf->propal->enabled) || - ! empty($conf->commande->enabled) || - ! empty($conf->supplier_order->enabled) || - ! empty($conf->supplier_proposal->enabled) || - ! empty($conf->contrat->enabled) || - ! empty($conf->ficheinter->enabled) + $tmpentry = array( + 'enabled'=>(! empty($conf->propal->enabled) || + ! empty($conf->commande->enabled) || + ! empty($conf->supplier_order->enabled) || + ! empty($conf->supplier_proposal->enabled) || + ! empty($conf->contrat->enabled) || + ! empty($conf->ficheinter->enabled) )?1:0, 'perms'=>(! empty($user->rights->societe->lire) || ! empty($user->rights->societe->contact->lire)), 'module'=>'propal|commande|supplier_order|contrat|ficheinter', @@ -248,7 +248,7 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = 'submenus' => array(), ); - // Billing - Financial + // Billing - Financial $menu_arr[] = array( 'name' => 'Compta', 'link' => '/compta/index.php?mainmenu=billing&leftmenu=', @@ -257,16 +257,16 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = 'enabled' => $showmode = isVisibleToUserType ( $type_user, - $tmpentry = array( - 'enabled'=>(! empty($conf->facture->enabled) || - ! empty($conf->don->enabled) || - ! empty($conf->tax->enabled) || - ! empty($conf->salaries->enabled) || - ! empty($conf->supplier_invoice->enabled) || - ! empty($conf->loan->enabled) + $tmpentry = array( + 'enabled'=>(! empty($conf->facture->enabled) || + ! empty($conf->don->enabled) || + ! empty($conf->tax->enabled) || + ! empty($conf->salaries->enabled) || + ! empty($conf->supplier_invoice->enabled) || + ! empty($conf->loan->enabled) )?1:0, - 'perms'=>(! empty($user->rights->facture->lire) || ! empty($user->rights->don->contact->lire) - || ! empty($user->rights->tax->charges->lire) || ! empty($user->rights->salaries->read) + 'perms'=>(! empty($user->rights->facture->lire) || ! empty($user->rights->don->contact->lire) + || ! empty($user->rights->tax->charges->lire) || ! empty($user->rights->salaries->read) || ! empty($user->rights->fournisseur->facture->lire) || ! empty($user->rights->loan->read)), 'module'=>'facture|supplier_invoice|don|tax|salaries|loan', ), @@ -294,7 +294,7 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = 'enabled' => $showmode = isVisibleToUserType ( $type_user, - $tmpentry = array( + $tmpentry = array( 'enabled'=>(! empty($conf->banque->enabled) || ! empty($conf->prelevement->enabled)), 'perms'=>(! empty($user->rights->banque->lire) || ! empty($user->rights->prelevement->lire)), 'module'=>'banque|prelevement', @@ -325,7 +325,7 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = 'enabled' => $showmode = isVisibleToUserType ( $type_user, - $tmpentry = array( + $tmpentry = array( 'enabled'=>(! empty($conf->comptabilite->enabled) || ! empty($conf->accounting->enabled) || ! empty($conf->asset->enabled)), 'perms'=>(! empty($user->rights->compta->resultat->lire) || ! empty($user->rights->accounting->mouvements->lire) || ! empty($user->rights->asset->read)), 'comptabilite|accounting', @@ -356,7 +356,7 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = 'enabled' => $showmode = isVisibleToUserType ( $type_user, - $tmpentry = array( + $tmpentry = array( 'enabled'=>(! empty($conf->hrm->enabled) || ! empty($conf->holiday->enabled) || ! empty($conf->deplacement->enabled) || ! empty($conf->expensereport->enabled)), 'perms'=>(! empty($user->rights->hrm->employee->read) || ! empty($user->rights->holiday->write) || ! empty($user->rights->deplacement->lire) || ! empty($user->rights->expensereport->lire)), 'module'=>'hrm|holiday|deplacement|expensereport', @@ -387,7 +387,7 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = 'enabled' => $showmode = isVisibleToUserType ( $type_user, - $tmpentry = array( + $tmpentry = array( 'enabled'=>1, 'perms'=>1, 'module'=>'', From 84d2bcce4faa6bb07672f8649c08b1c0059d0bce Mon Sep 17 00:00:00 2001 From: wdammak <26695620+wdammak@users.noreply.github.com> Date: Tue, 29 Jan 2019 22:08:18 +0100 Subject: [PATCH 03/35] Update eldy.lib.php Fix Travis --- htdocs/core/menus/standard/eldy.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 5226fb7d6cc..1da90af83e2 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -441,7 +441,7 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = $mtitle = $langs->trans($smenu->title); } // Add item - $menu->add($smenu->link, $mtitle , $smenu->level, $smenu->enabled, $smenu->target, $smenu->mainmenu, $smenu->leftmenu, $smenu->position, $smenu->id, $smenu->idsel, $smenu->classname, $smenu->prefix); + $menu->add($smenu->link, $mtitle, $smenu->level, $smenu->enabled, $smenu->target, $smenu->mainmenu, $smenu->leftmenu, $smenu->position, $smenu->id, $smenu->idsel, $smenu->classname, $smenu->prefix); } } From 12d7d3a6cbfed4dc13be0bdf0bb5a6bed6d17820 Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Sat, 2 Mar 2019 09:54:32 +0100 Subject: [PATCH 04/35] retrieve latest branch --- htdocs/.gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/.gitignore b/htdocs/.gitignore index ac35d8fab2f..aa007a70ae5 100644 --- a/htdocs/.gitignore +++ b/htdocs/.gitignore @@ -28,3 +28,4 @@ /nomenclature* /of/ /workstation/ +/theme/dolipro* \ No newline at end of file From 3037e4a15730bd5f632f9902df631786123e64bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sat, 2 Mar 2019 20:49:53 +0100 Subject: [PATCH 05/35] Update DolibarrModules.class.php --- htdocs/core/modules/DolibarrModules.class.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/htdocs/core/modules/DolibarrModules.class.php b/htdocs/core/modules/DolibarrModules.class.php index 0140f850e34..9b9ed4f7a60 100644 --- a/htdocs/core/modules/DolibarrModules.class.php +++ b/htdocs/core/modules/DolibarrModules.class.php @@ -895,6 +895,8 @@ class DolibarrModules // Can not be abstract, because we need to insta { global $conf; + $err = 0; + $sql = "SELECT tms FROM ".MAIN_DB_PREFIX."const"; $sql.= " WHERE ".$this->db->decrypt('name')." = '".$this->db->escape($this->const_name)."'"; $sql.= " AND entity IN (0, ".$conf->entity.")"; @@ -921,6 +923,8 @@ class DolibarrModules // Can not be abstract, because we need to insta { global $conf; + $err = 0; + $sql = "SELECT tms, note FROM ".MAIN_DB_PREFIX."const"; $sql.= " WHERE ".$this->db->decrypt('name')." = '".$this->db->escape($this->const_name)."'"; $sql.= " AND entity IN (0, ".$conf->entity.")"; From 8feca792f14479dfec6163e702966dbb78528e67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 4 Mar 2019 18:07:37 +0100 Subject: [PATCH 06/35] Update mouvementstock.class.php --- htdocs/product/stock/class/mouvementstock.class.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/product/stock/class/mouvementstock.class.php b/htdocs/product/stock/class/mouvementstock.class.php index 39a9bb94bed..1135c0aa3fc 100644 --- a/htdocs/product/stock/class/mouvementstock.class.php +++ b/htdocs/product/stock/class/mouvementstock.class.php @@ -89,7 +89,8 @@ class MouvementStock extends CommonObject } - /** + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore + /** * Add a movement of stock (in one direction only) * * @param User $user User object @@ -111,8 +112,9 @@ class MouvementStock extends CommonObject * @param int $id_product_batch Id product_batch (when skip_batch is false and we already know which record of product_batch to use) * @return int <0 if KO, 0 if fk_product is null, >0 if OK */ - private function _create($user, $fk_product, $entrepot_id, $qty, $type, $price = 0, $label = '', $inventorycode = '', $datem = '', $eatby = '', $sellby = '', $batch = '', $skip_batch = false, $id_product_batch = 0) + protected function _create($user, $fk_product, $entrepot_id, $qty, $type, $price = 0, $label = '', $inventorycode = '', $datem = '', $eatby = '', $sellby = '', $batch = '', $skip_batch = false, $id_product_batch = 0) { + // phpcs:enable global $conf, $langs; require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; From 7bcc4e877553ea42f67a64fe0467befb77c8b7ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 4 Mar 2019 18:21:48 +0100 Subject: [PATCH 07/35] Update mouvementstock.class.php --- htdocs/product/stock/class/mouvementstock.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/stock/class/mouvementstock.class.php b/htdocs/product/stock/class/mouvementstock.class.php index 1135c0aa3fc..99008aa9277 100644 --- a/htdocs/product/stock/class/mouvementstock.class.php +++ b/htdocs/product/stock/class/mouvementstock.class.php @@ -112,7 +112,7 @@ class MouvementStock extends CommonObject * @param int $id_product_batch Id product_batch (when skip_batch is false and we already know which record of product_batch to use) * @return int <0 if KO, 0 if fk_product is null, >0 if OK */ - protected function _create($user, $fk_product, $entrepot_id, $qty, $type, $price = 0, $label = '', $inventorycode = '', $datem = '', $eatby = '', $sellby = '', $batch = '', $skip_batch = false, $id_product_batch = 0) + public function _create($user, $fk_product, $entrepot_id, $qty, $type, $price = 0, $label = '', $inventorycode = '', $datem = '', $eatby = '', $sellby = '', $batch = '', $skip_batch = false, $id_product_batch = 0) { // phpcs:enable global $conf, $langs; From 5dc3cbcdfc9988de4c47c6b37bee56b6f17793fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 4 Mar 2019 18:22:59 +0100 Subject: [PATCH 08/35] remove warning --- htdocs/theme/eldy/style.css.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index db4b494179d..30870438475 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -1839,7 +1839,7 @@ a.tmenuimage { $found=1; break; } - else if (file_exists($dirroot."/".$val."/img/".$val.".png")) // Retro compatibilité + elseif (file_exists($dirroot."/".$val."/img/".$val.".png")) // Retro compatibilité { $url=dol_buildpath('/'.$val.'/img/'.$val.'.png', 1); $found=1; From bdba88a6d56949ac1660ce00586f1a1d6ff0ca8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 4 Mar 2019 18:23:52 +0100 Subject: [PATCH 09/35] remove warning --- htdocs/theme/md/style.css.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 85918a43245..781b72200b4 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -1819,7 +1819,7 @@ foreach($mainmenuusedarray as $val) $found=1; break; } - else if (file_exists($dirroot."/".$val."/img/".$val.".png")) // Retro compatibilité + elseif (file_exists($dirroot."/".$val."/img/".$val.".png")) // Retro compatibilité { $url=dol_buildpath('/'.$val.'/img/'.$val.'.png', 1); $found=1; From f283782445093a5fc46a7d6dd18847673dd7003a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 4 Mar 2019 19:57:46 +0100 Subject: [PATCH 10/35] change visibility --- htdocs/adherents/class/api_members.class.php | 5 +++-- .../adherents/class/api_memberstypes.class.php | 5 +++-- htdocs/api/class/api_documents.class.php | 17 +++++++++-------- htdocs/api/class/api_setup.class.php | 4 +++- htdocs/bom/class/api_bom.class.php | 4 +++- .../categories/class/api_categories.class.php | 5 +++-- .../action/class/api_agendaevents.class.php | 5 +++-- .../comm/propal/class/api_proposals.class.php | 5 +++-- htdocs/commande/class/api_orders.class.php | 5 +++-- .../bank/class/api_bankaccounts.class.php | 4 +++- .../compta/facture/class/api_invoices.class.php | 5 +++-- htdocs/contrat/class/api_contracts.class.php | 5 +++-- htdocs/don/class/api_donations.class.php | 5 +++-- htdocs/expedition/class/api_shipments.class.php | 5 +++-- .../class/api_expensereports.class.php | 5 +++-- .../fichinter/class/api_interventions.class.php | 5 +++-- .../fourn/class/api_supplier_invoices.class.php | 5 +++-- .../fourn/class/api_supplier_orders.class.php | 5 +++-- .../template/class/api_mymodule.class.php | 4 +++- htdocs/product/class/api_products.class.php | 5 +++-- .../stock/class/api_stockmovements.class.php | 5 +++-- .../stock/class/api_warehouses.class.php | 5 +++-- htdocs/projet/class/api_projects.class.php | 5 +++-- htdocs/projet/class/api_tasks.class.php | 5 +++-- htdocs/societe/class/api_contacts.class.php | 5 +++-- htdocs/societe/class/api_thirdparties.class.php | 4 +++- .../class/api_supplier_proposals.class.php | 5 +++-- htdocs/ticket/class/api_tickets.class.php | 6 +++--- htdocs/user/class/api_users.class.php | 4 +++- 29 files changed, 93 insertions(+), 59 deletions(-) diff --git a/htdocs/adherents/class/api_members.class.php b/htdocs/adherents/class/api_members.class.php index 6025f2a2985..6948bce1e25 100644 --- a/htdocs/adherents/class/api_members.class.php +++ b/htdocs/adherents/class/api_members.class.php @@ -288,15 +288,16 @@ class Members extends DolibarrApi return $member; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore /** * Clean sensible object datas * * @param object $object Object to clean * @return array Array of cleaned object properties */ - private function _cleanObjectDatas($object) + protected function _cleanObjectDatas($object) { - + // phpcs:enable $object = parent::_cleanObjectDatas($object); // Remove the subscriptions because they are handled as a subresource. diff --git a/htdocs/adherents/class/api_memberstypes.class.php b/htdocs/adherents/class/api_memberstypes.class.php index 43fd2635fb4..abfaf84993d 100644 --- a/htdocs/adherents/class/api_memberstypes.class.php +++ b/htdocs/adherents/class/api_memberstypes.class.php @@ -266,15 +266,16 @@ class MembersTypes extends DolibarrApi return $membertype; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore /** * Clean sensible object datas * * @param object $object Object to clean * @return array Array of cleaned object properties */ - private function _cleanObjectDatas($object) + protected function _cleanObjectDatas($object) { - + // phpcs:enable $object = parent::_cleanObjectDatas($object); unset($object->array_options); diff --git a/htdocs/api/class/api_documents.class.php b/htdocs/api/class/api_documents.class.php index 19bd61c641b..f4a7084b336 100644 --- a/htdocs/api/class/api_documents.class.php +++ b/htdocs/api/class/api_documents.class.php @@ -274,7 +274,7 @@ class Documents extends DolibarrApi $upload_dir = $conf->societe->multidir_output[$object->entity] . "/" . $object->id; } - else if ($modulepart == 'adherent' || $modulepart == 'member') + elseif ($modulepart == 'adherent' || $modulepart == 'member') { require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; @@ -290,7 +290,7 @@ class Documents extends DolibarrApi $upload_dir = $conf->adherent->dir_output . "/" . get_exdir(0, 0, 0, 1, $object, 'member'); } - else if ($modulepart == 'propal' || $modulepart == 'proposal') + elseif ($modulepart == 'propal' || $modulepart == 'proposal') { require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; @@ -306,7 +306,7 @@ class Documents extends DolibarrApi $upload_dir = $conf->propal->multidir_output[$object->entity] . "/" . get_exdir(0, 0, 0, 1, $object, 'propal'); } - else if ($modulepart == 'commande' || $modulepart == 'order') + elseif ($modulepart == 'commande' || $modulepart == 'order') { require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; @@ -322,7 +322,7 @@ class Documents extends DolibarrApi $upload_dir = $conf->commande->dir_output . "/" . get_exdir(0, 0, 0, 1, $object, 'commande'); } - else if ($modulepart == 'shipment' || $modulepart == 'expedition') + elseif ($modulepart == 'shipment' || $modulepart == 'expedition') { require_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php'; @@ -338,7 +338,7 @@ class Documents extends DolibarrApi $upload_dir = $conf->expedition->dir_output . "/sending/" . get_exdir(0, 0, 0, 1, $object, 'shipment'); } - else if ($modulepart == 'facture' || $modulepart == 'invoice') + elseif ($modulepart == 'facture' || $modulepart == 'invoice') { require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; @@ -354,7 +354,7 @@ class Documents extends DolibarrApi $upload_dir = $conf->facture->dir_output . "/" . get_exdir(0, 0, 0, 1, $object, 'invoice'); } - else if ($modulepart == 'produit' || $modulepart == 'product') + elseif ($modulepart == 'produit' || $modulepart == 'product') { require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; @@ -370,7 +370,7 @@ class Documents extends DolibarrApi $upload_dir = $conf->product->dir_output . "/" . get_exdir(0, 0, 0, 1, $object, 'product'); } - else if ($modulepart == 'agenda' || $modulepart == 'action' || $modulepart == 'event') + elseif ($modulepart == 'agenda' || $modulepart == 'action' || $modulepart == 'event') { require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; @@ -600,7 +600,8 @@ class Documents extends DolibarrApi * @return array * @throws RestException */ - private function _validate_file($data) { + private function _validate_file($data) + { // phpcs:enable $result = array(); foreach (Documents::$DOCUMENT_FIELDS as $field) { diff --git a/htdocs/api/class/api_setup.class.php b/htdocs/api/class/api_setup.class.php index 766cf79f7be..783ec6540e3 100644 --- a/htdocs/api/class/api_setup.class.php +++ b/htdocs/api/class/api_setup.class.php @@ -273,14 +273,16 @@ class Setup extends DolibarrApi return $list; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore /** * Clean sensible object datas * * @param object $object Object to clean * @return array Array of cleaned object properties */ - private function _cleanObjectDatas($object) + protected function _cleanObjectDatas($object) { + // phpcs:enable $object = parent::_cleanObjectDatas($object); unset($object->error); diff --git a/htdocs/bom/class/api_bom.class.php b/htdocs/bom/class/api_bom.class.php index 4bb4f1a96ab..4d13475be1a 100644 --- a/htdocs/bom/class/api_bom.class.php +++ b/htdocs/bom/class/api_bom.class.php @@ -283,14 +283,16 @@ class BillOfMaterialsApi extends DolibarrApi } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore /** * Clean sensible object datas * * @param object $object Object to clean * @return array Array of cleaned object properties */ - private function _cleanObjectDatas($object) + protected function _cleanObjectDatas($object) { + // phpcs:enable $object = parent::_cleanObjectDatas($object); /*unset($object->note); diff --git a/htdocs/categories/class/api_categories.class.php b/htdocs/categories/class/api_categories.class.php index 434b7ba1d24..c975236f930 100644 --- a/htdocs/categories/class/api_categories.class.php +++ b/htdocs/categories/class/api_categories.class.php @@ -261,15 +261,16 @@ class Categories extends DolibarrApi } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore /** * Clean sensible object datas * * @param Categorie $object Object to clean * @return array Array of cleaned object properties */ - private function _cleanObjectDatas($object) + protected function _cleanObjectDatas($object) { - + // phpcs:enable $object = parent::_cleanObjectDatas($object); // Remove fields not relevent to categories diff --git a/htdocs/comm/action/class/api_agendaevents.class.php b/htdocs/comm/action/class/api_agendaevents.class.php index b6df9ec7d96..ec899d72ae1 100644 --- a/htdocs/comm/action/class/api_agendaevents.class.php +++ b/htdocs/comm/action/class/api_agendaevents.class.php @@ -313,15 +313,16 @@ class AgendaEvents extends DolibarrApi return $event; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore /** * Clean sensible object datas * * @param object $object Object to clean * @return array Array of cleaned object properties */ - private function _cleanObjectDatas($object) + protected function _cleanObjectDatas($object) { - + // phpcs:enable $object = parent::_cleanObjectDatas($object); unset($object->usermod); diff --git a/htdocs/comm/propal/class/api_proposals.class.php b/htdocs/comm/propal/class/api_proposals.class.php index 33122986187..9145b8eb151 100644 --- a/htdocs/comm/propal/class/api_proposals.class.php +++ b/htdocs/comm/propal/class/api_proposals.class.php @@ -782,15 +782,16 @@ class Proposals extends DolibarrApi } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore /** * Clean sensible object datas * * @param object $object Object to clean * @return array Array of cleaned object properties */ - private function _cleanObjectDatas($object) + protected function _cleanObjectDatas($object) { - + // phpcs:enable $object = parent::_cleanObjectDatas($object); unset($object->note); diff --git a/htdocs/commande/class/api_orders.class.php b/htdocs/commande/class/api_orders.class.php index 2bd942a3c34..24508d6fb11 100644 --- a/htdocs/commande/class/api_orders.class.php +++ b/htdocs/commande/class/api_orders.class.php @@ -838,15 +838,16 @@ class Orders extends DolibarrApi } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore /** * Clean sensible object datas * * @param object $object Object to clean * @return array Array of cleaned object properties */ - private function _cleanObjectDatas($object) + protected function _cleanObjectDatas($object) { - + // phpcs:enable $object = parent::_cleanObjectDatas($object); unset($object->note); diff --git a/htdocs/compta/bank/class/api_bankaccounts.class.php b/htdocs/compta/bank/class/api_bankaccounts.class.php index 04692fb4e44..72ba4c82db1 100644 --- a/htdocs/compta/bank/class/api_bankaccounts.class.php +++ b/htdocs/compta/bank/class/api_bankaccounts.class.php @@ -248,14 +248,16 @@ class BankAccounts extends DolibarrApi return $account; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore /** * Clean sensible object datas * * @param object $object Object to clean * @return array Array of cleaned object properties */ - private function _cleanObjectDatas($object) + protected function _cleanObjectDatas($object) { + // phpcs:enable $object = parent::_cleanObjectDatas($object); unset($object->rowid); diff --git a/htdocs/compta/facture/class/api_invoices.class.php b/htdocs/compta/facture/class/api_invoices.class.php index 6c4c94fc2ce..d68c3d40338 100644 --- a/htdocs/compta/facture/class/api_invoices.class.php +++ b/htdocs/compta/facture/class/api_invoices.class.php @@ -1417,15 +1417,16 @@ class Invoices extends DolibarrApi return $paiement_id; } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore /** * Clean sensible object datas * * @param object $object Object to clean * @return array Array of cleaned object properties */ - private function _cleanObjectDatas($object) + protected function _cleanObjectDatas($object) { - + // phpcs:enable $object = parent::_cleanObjectDatas($object); unset($object->note); diff --git a/htdocs/contrat/class/api_contracts.class.php b/htdocs/contrat/class/api_contracts.class.php index 6f4a2041670..00d168a0db4 100644 --- a/htdocs/contrat/class/api_contracts.class.php +++ b/htdocs/contrat/class/api_contracts.class.php @@ -633,15 +633,16 @@ class Contracts extends DolibarrApi + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore /** * Clean sensible object datas * * @param object $object Object to clean * @return array Array of cleaned object properties */ - private function _cleanObjectDatas($object) + protected function _cleanObjectDatas($object) { - + // phpcs:enable $object = parent::_cleanObjectDatas($object); unset($object->address); diff --git a/htdocs/don/class/api_donations.class.php b/htdocs/don/class/api_donations.class.php index 06ddd5616c0..8762f763da7 100644 --- a/htdocs/don/class/api_donations.class.php +++ b/htdocs/don/class/api_donations.class.php @@ -326,15 +326,16 @@ class Donations extends DolibarrApi return $this->_cleanObjectDatas($this->don); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore /** * Clean sensible object datas * * @param object $object Object to clean * @return array Array of cleaned object properties */ - private function _cleanObjectDatas($object) + protected function _cleanObjectDatas($object) { - + // phpcs:enable $object = parent::_cleanObjectDatas($object); unset($object->note); diff --git a/htdocs/expedition/class/api_shipments.class.php b/htdocs/expedition/class/api_shipments.class.php index 73923105c7d..0c8f8717aea 100644 --- a/htdocs/expedition/class/api_shipments.class.php +++ b/htdocs/expedition/class/api_shipments.class.php @@ -610,15 +610,16 @@ class Shipments extends DolibarrApi } */ + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore /** * Clean sensible object datas * * @param object $object Object to clean * @return array Array of cleaned object properties */ - private function _cleanObjectDatas($object) + protected function _cleanObjectDatas($object) { - + // phpcs:enable $object = parent::_cleanObjectDatas($object); unset($object->thirdparty); // id already returned diff --git a/htdocs/expensereport/class/api_expensereports.class.php b/htdocs/expensereport/class/api_expensereports.class.php index 35ce9f9a4a2..cb5a438bc21 100644 --- a/htdocs/expensereport/class/api_expensereports.class.php +++ b/htdocs/expensereport/class/api_expensereports.class.php @@ -489,15 +489,16 @@ class ExpenseReports extends DolibarrApi ); }*/ + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore /** * Clean sensible object datas * * @param object $object Object to clean * @return array Array of cleaned object properties */ - private function _cleanObjectDatas($object) + protected function _cleanObjectDatas($object) { - + // phpcs:enable $object = parent::_cleanObjectDatas($object); unset($object->barcode_type); diff --git a/htdocs/fichinter/class/api_interventions.class.php b/htdocs/fichinter/class/api_interventions.class.php index d49f58ed52e..2702ad6c55e 100644 --- a/htdocs/fichinter/class/api_interventions.class.php +++ b/htdocs/fichinter/class/api_interventions.class.php @@ -417,15 +417,16 @@ class Interventions extends DolibarrApi } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore /** * Clean sensible object datas * * @param object $object Object to clean * @return array Array of cleaned object properties */ - private function _cleanObjectDatas($object) + protected function _cleanObjectDatas($object) { - + // phpcs:enable $object = parent::_cleanObjectDatas($object); unset($object->statuts_short); diff --git a/htdocs/fourn/class/api_supplier_invoices.class.php b/htdocs/fourn/class/api_supplier_invoices.class.php index 3f94401bc9d..416f7e11e94 100644 --- a/htdocs/fourn/class/api_supplier_invoices.class.php +++ b/htdocs/fourn/class/api_supplier_invoices.class.php @@ -333,15 +333,16 @@ class SupplierInvoices extends DolibarrApi ); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore /** * Clean sensible object datas * * @param Object $object Object to clean * @return array Array of cleaned object properties */ - private function _cleanObjectDatas($object) + protected function _cleanObjectDatas($object) { - + // phpcs:enable $object = parent::_cleanObjectDatas($object); unset($object->rowid); diff --git a/htdocs/fourn/class/api_supplier_orders.class.php b/htdocs/fourn/class/api_supplier_orders.class.php index 9a898fae3a7..42f7eccf608 100644 --- a/htdocs/fourn/class/api_supplier_orders.class.php +++ b/htdocs/fourn/class/api_supplier_orders.class.php @@ -330,15 +330,16 @@ class SupplierOrders extends DolibarrApi ); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore /** * Clean sensible object datas * * @param Object $object Object to clean * @return array Array of cleaned object properties */ - private function _cleanObjectDatas($object) + protected function _cleanObjectDatas($object) { - + // phpcs:enable $object = parent::_cleanObjectDatas($object); unset($object->rowid); diff --git a/htdocs/modulebuilder/template/class/api_mymodule.class.php b/htdocs/modulebuilder/template/class/api_mymodule.class.php index cdb5a4b74f4..566fe56affb 100644 --- a/htdocs/modulebuilder/template/class/api_mymodule.class.php +++ b/htdocs/modulebuilder/template/class/api_mymodule.class.php @@ -280,14 +280,16 @@ class MyModuleApi extends DolibarrApi } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore /** * Clean sensible object datas * * @param object $object Object to clean * @return array Array of cleaned object properties */ - private function _cleanObjectDatas($object) + protected function _cleanObjectDatas($object) { + // phpcs:enable $object = parent::_cleanObjectDatas($object); /*unset($object->note); diff --git a/htdocs/product/class/api_products.class.php b/htdocs/product/class/api_products.class.php index c95bcdcb8f4..756bbde5b29 100644 --- a/htdocs/product/class/api_products.class.php +++ b/htdocs/product/class/api_products.class.php @@ -468,15 +468,16 @@ class Products extends DolibarrApi } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore /** * Clean sensible object datas * * @param object $object Object to clean * @return array Array of cleaned object properties */ - private function _cleanObjectDatas($object) + protected function _cleanObjectDatas($object) { - + // phpcs:enable $object = parent::_cleanObjectDatas($object); unset($object->regeximgext); diff --git a/htdocs/product/stock/class/api_stockmovements.class.php b/htdocs/product/stock/class/api_stockmovements.class.php index 4c5971b8cc4..12cf15110fe 100644 --- a/htdocs/product/stock/class/api_stockmovements.class.php +++ b/htdocs/product/stock/class/api_stockmovements.class.php @@ -274,15 +274,16 @@ class StockMovements extends DolibarrApi + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore /** * Clean sensible object datas * * @param MouvementStock $object Object to clean * @return array Array of cleaned object properties */ - private function _cleanObjectDatas($object) + protected function _cleanObjectDatas($object) { - + // phpcs:enable $object = parent::_cleanObjectDatas($object); // Remove useless data diff --git a/htdocs/product/stock/class/api_warehouses.class.php b/htdocs/product/stock/class/api_warehouses.class.php index 18286cea931..e0a05af4226 100644 --- a/htdocs/product/stock/class/api_warehouses.class.php +++ b/htdocs/product/stock/class/api_warehouses.class.php @@ -243,15 +243,16 @@ class Warehouses extends DolibarrApi } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore /** * Clean sensible object datas * * @param Entrepot $object Object to clean * @return array Array of cleaned object properties */ - private function _cleanObjectDatas($object) + protected function _cleanObjectDatas($object) { - + // phpcs:enable $object = parent::_cleanObjectDatas($object); // Remove the subscriptions because they are handled as a subresource. diff --git a/htdocs/projet/class/api_projects.class.php b/htdocs/projet/class/api_projects.class.php index 532f46ccfe4..9680cd66591 100644 --- a/htdocs/projet/class/api_projects.class.php +++ b/htdocs/projet/class/api_projects.class.php @@ -534,15 +534,16 @@ class Projects extends DolibarrApi } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore /** * Clean sensible object datas * * @param object $object Object to clean * @return array Array of cleaned object properties */ - private function _cleanObjectDatas($object) + protected function _cleanObjectDatas($object) { - + // phpcs:enable $object = parent::_cleanObjectDatas($object); unset($object->titre); diff --git a/htdocs/projet/class/api_tasks.class.php b/htdocs/projet/class/api_tasks.class.php index 40c3e78f7e6..9fafcb98343 100644 --- a/htdocs/projet/class/api_tasks.class.php +++ b/htdocs/projet/class/api_tasks.class.php @@ -547,15 +547,16 @@ class Tasks extends DolibarrApi } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore /** * Clean sensible object datas * * @param object $object Object to clean * @return array Array of cleaned object properties */ - private function _cleanObjectDatas($object) + protected function _cleanObjectDatas($object) { - + // phpcs:enable $object = parent::_cleanObjectDatas($object); unset($object->barcode_type); diff --git a/htdocs/societe/class/api_contacts.class.php b/htdocs/societe/class/api_contacts.class.php index 97fc83a3545..772d8d3fe10 100644 --- a/htdocs/societe/class/api_contacts.class.php +++ b/htdocs/societe/class/api_contacts.class.php @@ -379,15 +379,16 @@ class Contacts extends DolibarrApi } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore /** * Clean sensible object datas * * @param Object $object Object to clean * @return array Array of cleaned object properties */ - private function _cleanObjectDatas($object) + protected function _cleanObjectDatas($object) { - + // phpcs:enable $object = parent::_cleanObjectDatas($object); unset($object->total_ht); diff --git a/htdocs/societe/class/api_thirdparties.class.php b/htdocs/societe/class/api_thirdparties.class.php index 3cc1dd51b1a..954535d1c87 100644 --- a/htdocs/societe/class/api_thirdparties.class.php +++ b/htdocs/societe/class/api_thirdparties.class.php @@ -1626,14 +1626,16 @@ $reshook = $hookmanager->executeHooks('replaceThirdparty', array( } } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore /** * Clean sensible object datas * * @param object $object Object to clean * @return array Array of cleaned object properties */ - private function _cleanObjectDatas($object) + protected function _cleanObjectDatas($object) { + // phpcs:enable $object = parent::_cleanObjectDatas($object); unset($object->nom); // ->name already defined and nom deprecated diff --git a/htdocs/supplier_proposal/class/api_supplier_proposals.class.php b/htdocs/supplier_proposal/class/api_supplier_proposals.class.php index 15f4278bf49..5ac77fe85bb 100644 --- a/htdocs/supplier_proposal/class/api_supplier_proposals.class.php +++ b/htdocs/supplier_proposal/class/api_supplier_proposals.class.php @@ -190,15 +190,16 @@ class Supplierproposals extends DolibarrApi } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore /** * Clean sensible object datas * * @param object $object Object to clean * @return array Array of cleaned object properties */ - private function _cleanObjectDatas($object) + protected function _cleanObjectDatas($object) { - + // phpcs:enable $object = parent::_cleanObjectDatas($object); unset($object->name); diff --git a/htdocs/ticket/class/api_tickets.class.php b/htdocs/ticket/class/api_tickets.class.php index 005d8084f31..fedadd2c96e 100644 --- a/htdocs/ticket/class/api_tickets.class.php +++ b/htdocs/ticket/class/api_tickets.class.php @@ -513,7 +513,7 @@ class Tickets extends DolibarrApi return $ticket; } - + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore /** * Clean sensible object datas * @@ -523,9 +523,9 @@ class Tickets extends DolibarrApi * @todo use an array for properties to clean * */ - private function _cleanObjectDatas($object) + protected function _cleanObjectDatas($object) { - + // phpcs:enable $object = parent::_cleanObjectDatas($object); // Other attributes to clean diff --git a/htdocs/user/class/api_users.class.php b/htdocs/user/class/api_users.class.php index 625fd913f5e..17e22a314ef 100644 --- a/htdocs/user/class/api_users.class.php +++ b/htdocs/user/class/api_users.class.php @@ -354,14 +354,16 @@ class Users extends DolibarrApi return $this->useraccount->delete(DolibarrApiAccess::$user); } + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore /** * Clean sensible object datas * * @param object $object Object to clean * @return array Array of cleaned object properties */ - private function _cleanObjectDatas($object) + protected function _cleanObjectDatas($object) { + // phpcs:enable global $conf; $object = parent::_cleanObjectDatas($object); From 16c73af0cb131d3860f6945a61619a15c2a99f4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 4 Mar 2019 20:16:18 +0100 Subject: [PATCH 11/35] remove test ticketlog --- test/phpunit/TicketTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/phpunit/TicketTest.php b/test/phpunit/TicketTest.php index 175ced68bda..b5bfd9212e9 100644 --- a/test/phpunit/TicketTest.php +++ b/test/phpunit/TicketTest.php @@ -341,7 +341,7 @@ class TicketTest extends PHPUnit_Framework_TestCase * @depends testTicketFetch * The depends says test is run only if previous is ok */ - public function testTicketcreateTicketLog($localobject) + /*public function testTicketcreateTicketLog($localobject) { global $conf,$user,$langs,$db; $conf=$this->savconf; @@ -357,7 +357,7 @@ class TicketTest extends PHPUnit_Framework_TestCase $this->assertGreaterThan(0, $result); return $localobject; - } + }*/ /** * testTicketclose From 2f3c3aeb05e2cc649884cda8cb5c2d6eb4ff5c91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 4 Mar 2019 21:24:48 +0100 Subject: [PATCH 12/35] test --- test/phpunit/MouvementStockTest.php | 32 ++++++++++++++--------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/test/phpunit/MouvementStockTest.php b/test/phpunit/MouvementStockTest.php index 597f4b88de6..b6acdfd11b1 100644 --- a/test/phpunit/MouvementStockTest.php +++ b/test/phpunit/MouvementStockTest.php @@ -162,27 +162,27 @@ class MouvementStockTest extends PHPUnit_Framework_TestCase // Do a list of movement into warehouse 1 - // Create an input movement (type = 3) of price 9.9 -> shoul dupdate PMP to 9.9 - $result=$localobject->reception($user, $product1id, $warehouse1id, 10, 9.9, 'Movement for unit test 1', 'Inventory Code Test'); + // Create an input movement (type = 3) of price 9.9 -> should update PMP to 9.9 + $result=$localobject->reception($user, $product1id, $warehouse1id, 10, 9.9, 'Movement for unit test 1'); print __METHOD__." result=".$result."\n"; $this->assertLessThan($result, 0); - // Create an input movement (type = 3) of price 9.7 -> shoul dupdate PMP to 9.9/9.7 = 9.8 - $result=$localobject->reception($user, $product1id, $warehouse1id, 10, 9.7, 'Movement for unit test 2', 'Inventory Code Test'); + // Create an input movement (type = 3) of price 9.7 -> should update PMP to 9.9/9.7 = 9.8 + $result=$localobject->reception($user, $product1id, $warehouse1id, 10, 9.7, 'Movement for unit test 2'); print __METHOD__." result=".$result."\n"; $this->assertLessThan($result, 0); - // Create an output movement (type = 2) of price 9.7 -> shoul dupdate PMP to 9.9/9.7 = 9.8 - $result=$localobject->livraison($user, $product1id, $warehouse1id, 5, 999, 'Movement for unit test 3', 'Inventory Code Test'); + // Create an output movement (type = 2) of price 9.7 -> should update PMP to 9.9/9.7 = 9.8 + $result=$localobject->livraison($user, $product1id, $warehouse1id, 5, 999, 'Movement for unit test 3'); print __METHOD__." result=".$result."\n"; $this->assertLessThan($result, 0); - // Create an output movement (type = 1) of price 9.7 -> shoul dupdate PMP to 9.9/9.7 = 9.8 + // Create an output movement (type = 1) of price 9.7 -> should update PMP to 9.9/9.7 = 9.8 $result=$localobject->_create($user, $product1id, $warehouse1id, 1, 0, 0, 'Input from transfer', 'Transfert X'); print __METHOD__." result=".$result."\n"; $this->assertLessThan($result, 0); - // Create an output movement (type = 1) of price 9.7 -> shoul dupdate PMP to 9.9/9.7 = 9.8 + // Create an output movement (type = 1) of price 9.7 -> should update PMP to 9.9/9.7 = 9.8 $result=$localobject->_create($user, $product1id, $warehouse1id, -2, 1, 0, 'Output from transfer', 'Transfert Y'); print __METHOD__." result=".$result."\n"; $this->assertLessThan($result, 0); @@ -190,27 +190,27 @@ class MouvementStockTest extends PHPUnit_Framework_TestCase // Do same but into warehouse 2 - // Create an input movement (type = 3) of price 9.9 -> shoul dupdate PMP to 9.9 - $result=$localobject->reception($user, $product1id, $warehouse2id, 10, 9.9, 'Movement for unit test 1 wh 2', 'Inventory Code Test 2'); + // Create an input movement (type = 3) of price 9.9 -> should update PMP to 9.9 + $result=$localobject->reception($user, $product1id, $warehouse2id, 10, 9.9, 'Movement for unit test 1 wh 2'); print __METHOD__." result=".$result."\n"; $this->assertLessThan($result, 0); - // Create an input movement (type = 3) of price 9.7 -> shoul dupdate PMP to 9.9/9.7 = 9.8 - $result=$localobject->reception($user, $product1id, $warehouse2id, 10, 9.7, 'Movement for unit test 2 wh 2', 'Inventory Code Test 2'); + // Create an input movement (type = 3) of price 9.7 -> should update PMP to 9.9/9.7 = 9.8 + $result=$localobject->reception($user, $product1id, $warehouse2id, 10, 9.7, 'Movement for unit test 2 wh 2'); print __METHOD__." result=".$result."\n"; $this->assertLessThan($result, 0); - // Create an output movement (type = 2) of price 9.7 -> shoul dupdate PMP to 9.9/9.7 = 9.8 - $result=$localobject->livraison($user, $product1id, $warehouse2id, 5, 999, 'Movement for unit test 3 wh 2', 'Inventory Code Test 2'); + // Create an output movement (type = 2) of price 9.7 -> should update PMP to 9.9/9.7 = 9.8 + $result=$localobject->livraison($user, $product1id, $warehouse2id, 5, 999, 'Movement for unit test 3 wh 2'); print __METHOD__." result=".$result."\n"; $this->assertLessThan($result, 0); - // Create an output movement (type = 1) of price 9.7 -> shoul dupdate PMP to 9.9/9.7 = 9.8 + // Create an output movement (type = 1) of price 9.7 -> should update PMP to 9.9/9.7 = 9.8 $result=$localobject->_create($user, $product1id, $warehouse2id, 1, 0, 0, 'Input from transfer wh 2', 'Transfert X 2'); print __METHOD__." result=".$result."\n"; $this->assertLessThan($result, 0); - // Create an output movement (type = 1) of price 9.7 -> shoul dupdate PMP to 9.9/9.7 = 9.8 + // Create an output movement (type = 1) of price 9.7 -> should update PMP to 9.9/9.7 = 9.8 $result=$localobject->_create($user, $product1id, $warehouse2id, -2, 1, 0, 'Output from transfer wh 2', 'Transfert Y 2'); print __METHOD__." result=".$result."\n"; $this->assertLessThan($result, 0); From e8b21887e2f186659cf75f2dfd49b48a908617b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 4 Mar 2019 21:41:00 +0100 Subject: [PATCH 13/35] phpcs --- htdocs/admin/security.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/security.php b/htdocs/admin/security.php index 6c3ed1f294b..df2d2b09ee6 100644 --- a/htdocs/admin/security.php +++ b/htdocs/admin/security.php @@ -497,7 +497,7 @@ print ''; print ''; print '
'; -if (GETPOST('info','int') > 0) +if (GETPOST('info', 'int') > 0) { if (function_exists('password_hash')) { From 023992f2e14758743265bc7d1a34753a11318db6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 4 Mar 2019 23:06:23 +0100 Subject: [PATCH 14/35] Update list.php --- htdocs/ticket/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/ticket/list.php b/htdocs/ticket/list.php index 0b3a1c101e8..3a0e8fea9d6 100644 --- a/htdocs/ticket/list.php +++ b/htdocs/ticket/list.php @@ -580,7 +580,7 @@ foreach($object->fields as $key => $val) if ($key == 'fk_statut') $cssforfield.=($cssforfield?' ':'').'center'; if (! empty($arrayfields['t.'.$key]['checked'])) { - print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($cssforfield?'class="'.$cssforfield.'"':''), $sortfield, $sortorder, ($cssforfield?$cssforfield.' ':''))."\n"; + print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, '', $sortfield, $sortorder, ($cssforfield?$cssforfield.' ':''))."\n"; } } // Extra fields From 162f2614e5527d9d0aaadb728bc90e171264a8f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 4 Mar 2019 23:25:23 +0100 Subject: [PATCH 15/35] Update mymodulewidget1.php --- htdocs/modulebuilder/template/core/boxes/mymodulewidget1.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/modulebuilder/template/core/boxes/mymodulewidget1.php b/htdocs/modulebuilder/template/core/boxes/mymodulewidget1.php index 7416eb1c35e..087f102daef 100644 --- a/htdocs/modulebuilder/template/core/boxes/mymodulewidget1.php +++ b/htdocs/modulebuilder/template/core/boxes/mymodulewidget1.php @@ -186,7 +186,7 @@ class mymodulewidget1 extends ModeleBoxes 'tr' => 'class="left"', 'text' => '' ), - 0 => array( // TR + 1 => array( // TR 'tr' => 'class="left"', 'text' => '' ) From ef10a3206906707ec88bf36b3c493a593c2a0a4f Mon Sep 17 00:00:00 2001 From: Lionel VESSILLER Date: Tue, 5 Mar 2019 11:18:44 +0100 Subject: [PATCH 16/35] Fix authorize long references in Beluga PDF model (uses Landscape mode) --- .../project/doc/pdf_beluga.modules.php | 57 +++++++++++++------ 1 file changed, 39 insertions(+), 18 deletions(-) diff --git a/htdocs/core/modules/project/doc/pdf_beluga.modules.php b/htdocs/core/modules/project/doc/pdf_beluga.modules.php index f24f400f2af..95bba01ad23 100644 --- a/htdocs/core/modules/project/doc/pdf_beluga.modules.php +++ b/htdocs/core/modules/project/doc/pdf_beluga.modules.php @@ -54,6 +54,12 @@ if (! empty($conf->agenda->enabled)) require_once DOL_DOCUMENT_ROOT.'/com class pdf_beluga extends ModelePDFProjects { + /** + * Page orientation + * @var string 'P' or 'Portait' (default), 'L' or 'Landscape' + */ + private $orientation = ''; + /** * Issuer * @var Societe @@ -79,8 +85,14 @@ class pdf_beluga extends ModelePDFProjects // Dimension page pour format A4 $this->type = 'pdf'; $formatarray=pdf_getFormat(); - $this->page_largeur = $formatarray['width']; - $this->page_hauteur = $formatarray['height']; + $this->orientation = 'L'; + if ($this->orientation == 'L' || $this->orientation == 'Landscape') { + $this->page_largeur = $formatarray['height']; + $this->page_hauteur = $formatarray['width']; + } else { + $this->page_largeur = $formatarray['width']; + $this->page_hauteur = $formatarray['height']; + } $this->format = array($this->page_largeur,$this->page_hauteur); $this->marge_gauche=isset($conf->global->MAIN_PDF_MARGIN_LEFT)?$conf->global->MAIN_PDF_MARGIN_LEFT:10; $this->marge_droite=isset($conf->global->MAIN_PDF_MARGIN_RIGHT)?$conf->global->MAIN_PDF_MARGIN_RIGHT:10; @@ -95,13 +107,22 @@ class pdf_beluga extends ModelePDFProjects $this->emetteur=$mysoc; if (! $this->emetteur->country_code) $this->emetteur->country_code=substr($langs->defaultlang, -2); // By default if not defined - // Defini position des colonnes - $this->posxref=$this->marge_gauche+1; - $this->posxdate=$this->marge_gauche+25; - $this->posxsociety=$this->marge_gauche+45; - $this->posxamountht=$this->marge_gauche+110; - $this->posxamountttc=$this->marge_gauche+135; - $this->posxstatut=$this->marge_gauche+165; + // Defini position des colonnes + if ($this->orientation == 'L' || $this->orientation == 'Landscape') { + $this->posxref=$this->marge_gauche+1; + $this->posxdate=$this->marge_gauche+105; + $this->posxsociety=$this->marge_gauche+125; + $this->posxamountht=$this->marge_gauche+190; + $this->posxamountttc=$this->marge_gauche+215; + $this->posxstatut=$this->marge_gauche+245; + } else { + $this->posxref=$this->marge_gauche+1; + $this->posxdate=$this->marge_gauche+25; + $this->posxsociety=$this->marge_gauche+45; + $this->posxamountht=$this->marge_gauche+110; + $this->posxamountttc=$this->marge_gauche+135; + $this->posxstatut=$this->marge_gauche+165; + } if ($this->page_largeur < 210) // To work with US executive format { $this->posxref-=20; @@ -217,7 +238,7 @@ class pdf_beluga extends ModelePDFProjects $pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right // New page - $pdf->AddPage(); + $pdf->AddPage($this->orientation); if (! empty($tplidx)) $pdf->useTemplate($tplidx); $pagenb++; $this->_pagehead($pdf, $object, 1, $outputlangs); @@ -433,7 +454,7 @@ class pdf_beluga extends ModelePDFProjects $pdf->SetTextColor(0, 0, 0); $pdf->setTopMargin($tab_top_newpage); - $pdf->setPageOrientation('', 1, $heightforfooter+$heightforfreetext+$heightforinfotot); // The only function to edit the bottom margin of current page to set it. + $pdf->setPageOrientation($this->orientation, 1, $heightforfooter+$heightforfreetext+$heightforinfotot); // The only function to edit the bottom margin of current page to set it. $pageposbefore=$pdf->getPage(); // Description of line @@ -469,7 +490,7 @@ class pdf_beluga extends ModelePDFProjects $pdf->rollbackTransaction(true); $pageposafter=$pageposbefore; //print $pageposafter.'-'.$pageposbefore;exit; - $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. + $pdf->setPageOrientation($this->orientation, 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. // Label $pdf->SetXY($this->posxref, $curY); $posybefore=$pdf->GetY(); @@ -480,7 +501,7 @@ class pdf_beluga extends ModelePDFProjects { if ($i == ($num-1)) // No more lines, and no space left to show total, so we create a new page { - $pdf->AddPage('', '', true); + $pdf->AddPage($this->orientation, '', true); if (! empty($tplidx)) $pdf->useTemplate($tplidx); if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); $pdf->setPage($pageposafter+1); @@ -495,9 +516,9 @@ class pdf_beluga extends ModelePDFProjects { $pdf->rollbackTransaction(true); $pageposafter=$pageposbefore; - $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. + $pdf->setPageOrientation($this->orientation, 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. - $pdf->AddPage('', '', true); + $pdf->AddPage($this->orientation, '', true); if (! empty($tplidx)) $pdf->useTemplate($tplidx); if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); $pdf->setPage($pageposafter+1); @@ -505,7 +526,7 @@ class pdf_beluga extends ModelePDFProjects $pdf->MultiCell(0, 3, ''); // Set interline to 3 $pdf->SetTextColor(0, 0, 0); - $pdf->setPageOrientation('', 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. + $pdf->setPageOrientation($this->orientation, 1, $heightforfooter); // The only function to edit the bottom margin of current page to set it. $curY = $tab_top_newpage + $heightoftitleline + 1; // Label @@ -528,7 +549,7 @@ class pdf_beluga extends ModelePDFProjects $pageposafter=$pdf->getPage(); $pdf->setPage($pageposbefore); $pdf->setTopMargin($this->marge_haute); - $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. + $pdf->setPageOrientation($this->orientation, 1, 0); // The only function to edit the bottom margin of current page to set it. // We suppose that a too long description is moved completely on next page if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) { @@ -628,7 +649,7 @@ class pdf_beluga extends ModelePDFProjects $this->_pagefoot($pdf, $object, $outputlangs, 1); $pagenb++; $pdf->setPage($pagenb); - $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. + $pdf->setPageOrientation($this->orientation, 1, 0); // The only function to edit the bottom margin of current page to set it. if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) $this->_pagehead($pdf, $object, 0, $outputlangs); } } From f402966eb80f2355dd671deca1185f3bbd444940 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 5 Mar 2019 15:48:12 +0100 Subject: [PATCH 17/35] Missing translation --- htdocs/langs/en_US/website.lang | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/website.lang b/htdocs/langs/en_US/website.lang index f8250ebbc6b..99f0133f175 100644 --- a/htdocs/langs/en_US/website.lang +++ b/htdocs/langs/en_US/website.lang @@ -94,4 +94,5 @@ ShowSubcontainers=Include dynamic content InternalURLOfPage=Internal URL of page ThisPageIsTranslationOf=This page/container is translation of ThisPageHasTranslationPages=This page/container has translation -NoWebSiteCreateOneFirst=No website created yet. Create on first. \ No newline at end of file +NoWebSiteCreateOneFirst=No website created yet. Create on first. +GoTo=Go to \ No newline at end of file From 28a4217660442c94a64cf92f4c3506422f73c2fc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 5 Mar 2019 15:52:03 +0100 Subject: [PATCH 18/35] Prepare 9.0.1 --- ChangeLog | 34 ++++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 441bbb189b8..cbba717e6a8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -7,21 +7,51 @@ English Dolibarr ChangeLog FIX: #10381 FIX: #10460 compatibility with MariaDB 10.4 FIX: #10485 +FIX: #10638 +FIX: Accountancy - Adding transaction with multicompany uses all the time 1st entity +FIX: actioncomm export: ORDER BY clause is in wrong export property + event type filter does not work FIX: add fk_unit on addline action +FIX: adding css by page if url is externam +FIX: Bad link in menu manager FIX: better test on fetch +FIX: can't add lines on invoices +FIX: Check for old picture name if the new one was not found +FIX: could not create several superadmin in transversal mode +FIX: creation of menu entry with parent id not int +FIX: creation of new left menu entry FIX: Default language of company is not set +FIX: error on setup of password if pass generators have a .old file. FIX: error report not returned FIX: expedition: reset status on rollback + replace hardcoded status with const +FIX: fetch module / pos source +FIX: fk_default_warehouse missing in group by +FIX: function sendEmailsReminder isn't completely developed, then MAIN_FEATURES_LEVEL must be 2 to "use" it +FIX: if empty error message, we just see "error" displayed +FIX: label of bank account FIX: line edit template: keep fk_parent_line +FIX: Mark credit note as available for credit note in other currency +FIX: missing access security checking with multicompany +FIX: missing entity filter in function "build_filterField()" (export module) +FIX: missing $ismultientitymanaged for previous/next ref FIX: Missing province in export of invoice FIX: must fetch member in current entity +FIX: positive values creating diff on addline rounding +FIX: positive values IN supplier credit notes creating diff on addline rounding FIX: Price in combo list of service does not use the correct price level -FIX: supplier invoice payment total doesnt care about deposit or credit +FIX: project_title for display of getNomUrl() +FIX: same thing here +FIX: Show button POS Ticket only if invoice was generated by POS +FIX: supplier invoice payment total doesn't care about deposit or credit FIX: supplier invoice product stats total ht is line total not invoice total +FIX: The notes was also copied on invoice +FIX: Transaction on leave approval and decrease ko if setup not complete FIX: Translation not loaded by scheduled jobs +FIX: [URGENT] broken feature, "$usercancreate" is for Dolibarr 9 +FIX: we want to be able to reopen fourn credit note +FIX: wrong feature2 when user rights "group_advance" is used FIX: wrong merged conflict FIX: wrong tests on fetch -NEW: Add protection to avoid packaging if files non indexed exists into +NEW: Add protection to avoid packaging if files non indexed exists ***** ChangeLog for 9.0.0 compared to 8.0.0 ***** For Users: From e66447eabc8e43b952e41332189873114990e63f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 5 Mar 2019 15:53:57 +0100 Subject: [PATCH 19/35] Fix phpcs --- htdocs/admin/security.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/security.php b/htdocs/admin/security.php index 6c3ed1f294b..df2d2b09ee6 100644 --- a/htdocs/admin/security.php +++ b/htdocs/admin/security.php @@ -497,7 +497,7 @@ print ''; print ''; print '
'; -if (GETPOST('info','int') > 0) +if (GETPOST('info', 'int') > 0) { if (function_exists('password_hash')) { From bbbffae72b6ff95324c52d8000982f02ddf6e154 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 5 Mar 2019 16:27:19 +0100 Subject: [PATCH 20/35] Fix phpcs --- htdocs/core/class/html.formticket.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.formticket.class.php b/htdocs/core/class/html.formticket.class.php index c255145ee58..03ee95619da 100644 --- a/htdocs/core/class/html.formticket.class.php +++ b/htdocs/core/class/html.formticket.class.php @@ -352,7 +352,7 @@ class FormTicket { $formproject=new FormProjets($this->db); print ''; - print $formproject->select_projects(-1, GETPOST('projectid','int'), 'projectid', 0, 0, 1, 1); + print $formproject->select_projects(-1, GETPOST('projectid', 'int'), 'projectid', 0, 0, 1, 1); print ''; } From 1e95802a4197ff16fd9e488fa1e2fec6adfb9824 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 5 Mar 2019 16:29:24 +0100 Subject: [PATCH 21/35] Fix phpcs --- htdocs/ticket/class/actions_ticket.class.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/ticket/class/actions_ticket.class.php b/htdocs/ticket/class/actions_ticket.class.php index 39d51017c41..f978642311c 100644 --- a/htdocs/ticket/class/actions_ticket.class.php +++ b/htdocs/ticket/class/actions_ticket.class.php @@ -116,9 +116,9 @@ class ActionsTicket /* * Add file in email form */ - if (GETPOST('addfile')) { + if (GETPOST('addfile', 'alpha')) { // altairis : allow files from public interface - if (GETPOST('track_id')) { + if (GETPOST('track_id', 'alpha')) { $res = $object->fetch('', '', GETPOST('track_id', 'alpha')); } @@ -140,7 +140,7 @@ class ActionsTicket /* * Remove file in email form */ - if (GETPOST('removedfile')) { + if (GETPOST('removedfile', 'alpha')) { // altairis : allow files from public interface if (GETPOST('track_id')) { $res = $object->fetch('', '', GETPOST('track_id', 'alpha')); @@ -160,7 +160,7 @@ class ActionsTicket ////} } - if (GETPOST('add','alpha') && $user->rights->ticket->write) { + if (GETPOST('add', 'alpha') && $user->rights->ticket->write) { $error = 0; if (!GETPOST("subject")) { From 2ebffb2ffe2fc03c47f9379d4b7c99154d34cacd Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Tue, 5 Mar 2019 16:29:53 +0100 Subject: [PATCH 22/35] FIX: date in ticket.class.php dolibarize date --- htdocs/ticket/class/ticket.class.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index 0eb1de8f8d2..c603c0489cb 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -528,9 +528,12 @@ class Ticket extends CommonObject $this->severity_label = $label_severity; $this->datec = $this->db->jdate($obj->datec); + $this->date_creation = $this->db->jdate($obj->datec); $this->date_read = $this->db->jdate($obj->date_read); + $this->date_validation = $this->db->jdate($obj->date_read); $this->date_close = $this->db->jdate($obj->date_close); $this->tms = $this->db->jdate($obj->tms); + $this->date_modification = $this->db->jdate($obj->tms); $this->fetch_optionals(); From 756b9ca07fe974657aa2a984ae7f39f47f0b432a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 5 Mar 2019 16:51:16 +0100 Subject: [PATCH 23/35] Fix phpunit --- test/phpunit/TicketTest.php | 27 --------------------------- 1 file changed, 27 deletions(-) diff --git a/test/phpunit/TicketTest.php b/test/phpunit/TicketTest.php index 175ced68bda..4f3d06fc7cc 100644 --- a/test/phpunit/TicketTest.php +++ b/test/phpunit/TicketTest.php @@ -332,33 +332,6 @@ class TicketTest extends PHPUnit_Framework_TestCase return $localobject; } - /** - * testTicketcreateTicketLog - * - * @param Ticket $localobject Ticket - * @return int - * - * @depends testTicketFetch - * The depends says test is run only if previous is ok - */ - public function testTicketcreateTicketLog($localobject) - { - global $conf,$user,$langs,$db; - $conf=$this->savconf; - $user=$this->savuser; - $langs=$this->savlangs; - $db=$this->savdb; - - - $message = 'Test ticket log'; - $noemail = 1; - $result=$localobject->createTicketLog($user, $message, $noemail); - print __METHOD__." id=".$localobject->id." result=".$result."\n"; - - $this->assertGreaterThan(0, $result); - return $localobject; - } - /** * testTicketclose * From 4aa93181d30ba1087fd96b1ba8200fa2c1fa53a8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 5 Mar 2019 18:17:26 +0100 Subject: [PATCH 24/35] Fix phpunit --- test/phpunit/MouvementStockTest.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/test/phpunit/MouvementStockTest.php b/test/phpunit/MouvementStockTest.php index 597f4b88de6..e422d5e10ca 100644 --- a/test/phpunit/MouvementStockTest.php +++ b/test/phpunit/MouvementStockTest.php @@ -163,17 +163,17 @@ class MouvementStockTest extends PHPUnit_Framework_TestCase // Do a list of movement into warehouse 1 // Create an input movement (type = 3) of price 9.9 -> shoul dupdate PMP to 9.9 - $result=$localobject->reception($user, $product1id, $warehouse1id, 10, 9.9, 'Movement for unit test 1', 'Inventory Code Test'); + $result=$localobject->reception($user, $product1id, $warehouse1id, 10, 9.9, 'Movement for unit test 1', '', '', '', '', 0, 'Inventory Code Test'); print __METHOD__." result=".$result."\n"; $this->assertLessThan($result, 0); // Create an input movement (type = 3) of price 9.7 -> shoul dupdate PMP to 9.9/9.7 = 9.8 - $result=$localobject->reception($user, $product1id, $warehouse1id, 10, 9.7, 'Movement for unit test 2', 'Inventory Code Test'); + $result=$localobject->reception($user, $product1id, $warehouse1id, 10, 9.7, 'Movement for unit test 2', '', '', '', '', 0, 'Inventory Code Test'); print __METHOD__." result=".$result."\n"; $this->assertLessThan($result, 0); // Create an output movement (type = 2) of price 9.7 -> shoul dupdate PMP to 9.9/9.7 = 9.8 - $result=$localobject->livraison($user, $product1id, $warehouse1id, 5, 999, 'Movement for unit test 3', 'Inventory Code Test'); + $result=$localobject->livraison($user, $product1id, $warehouse1id, 5, 999, 'Movement for unit test 3', '', '', '', '', 0, 'Inventory Code Test'); print __METHOD__." result=".$result."\n"; $this->assertLessThan($result, 0); @@ -191,17 +191,17 @@ class MouvementStockTest extends PHPUnit_Framework_TestCase // Do same but into warehouse 2 // Create an input movement (type = 3) of price 9.9 -> shoul dupdate PMP to 9.9 - $result=$localobject->reception($user, $product1id, $warehouse2id, 10, 9.9, 'Movement for unit test 1 wh 2', 'Inventory Code Test 2'); + $result=$localobject->reception($user, $product1id, $warehouse2id, 10, 9.9, 'Movement for unit test 1 wh 2', '', '', '', '', 0, 'Inventory Code Test 2'); print __METHOD__." result=".$result."\n"; $this->assertLessThan($result, 0); // Create an input movement (type = 3) of price 9.7 -> shoul dupdate PMP to 9.9/9.7 = 9.8 - $result=$localobject->reception($user, $product1id, $warehouse2id, 10, 9.7, 'Movement for unit test 2 wh 2', 'Inventory Code Test 2'); + $result=$localobject->reception($user, $product1id, $warehouse2id, 10, 9.7, 'Movement for unit test 2 wh 2', '', '', '', '', 0, 'Inventory Code Test 2'); print __METHOD__." result=".$result."\n"; $this->assertLessThan($result, 0); // Create an output movement (type = 2) of price 9.7 -> shoul dupdate PMP to 9.9/9.7 = 9.8 - $result=$localobject->livraison($user, $product1id, $warehouse2id, 5, 999, 'Movement for unit test 3 wh 2', 'Inventory Code Test 2'); + $result=$localobject->livraison($user, $product1id, $warehouse2id, 5, 999, 'Movement for unit test 3 wh 2', '', '', '', '', 0, 'Inventory Code Test 2'); print __METHOD__." result=".$result."\n"; $this->assertLessThan($result, 0); From db5dd7f9aa0f4e1b53bdbdfaa3e3040049b4a814 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 5 Mar 2019 18:19:37 +0100 Subject: [PATCH 25/35] Fix phpunit --- htdocs/product/stock/class/mouvementstock.class.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/htdocs/product/stock/class/mouvementstock.class.php b/htdocs/product/stock/class/mouvementstock.class.php index bf267c9985e..130bece6372 100644 --- a/htdocs/product/stock/class/mouvementstock.class.php +++ b/htdocs/product/stock/class/mouvementstock.class.php @@ -711,15 +711,16 @@ class MouvementStock extends CommonObject * @param date $sellby sell-by date * @param string $batch batch number * @param int $id_product_batch Id product_batch + * @param string $inventorycode Inventory code * @return int <0 if KO, >0 if OK */ - public function livraison($user, $fk_product, $entrepot_id, $qty, $price = 0, $label = '', $datem = '', $eatby = '', $sellby = '', $batch = '', $id_product_batch = 0) + public function livraison($user, $fk_product, $entrepot_id, $qty, $price = 0, $label = '', $datem = '', $eatby = '', $sellby = '', $batch = '', $id_product_batch = 0, $inventorycode='') { global $conf; $skip_batch = empty($conf->productbatch->enabled); - return $this->_create($user, $fk_product, $entrepot_id, (0 - $qty), 2, $price, $label, '', $datem, $eatby, $sellby, $batch, $skip_batch, $id_product_batch); + return $this->_create($user, $fk_product, $entrepot_id, (0 - $qty), 2, $price, $label, $inventorycode, $datem, $eatby, $sellby, $batch, $skip_batch, $id_product_batch); } /** @@ -736,15 +737,16 @@ class MouvementStock extends CommonObject * @param string $batch batch number * @param string $datem Force date of movement * @param int $id_product_batch Id product_batch + * @param string $inventorycode Inventory code * @return int <0 if KO, >0 if OK */ - public function reception($user, $fk_product, $entrepot_id, $qty, $price = 0, $label = '', $eatby = '', $sellby = '', $batch = '', $datem = '', $id_product_batch = 0) + public function reception($user, $fk_product, $entrepot_id, $qty, $price = 0, $label = '', $eatby = '', $sellby = '', $batch = '', $datem = '', $id_product_batch = 0, $inventorycode='') { global $conf; $skip_batch = empty($conf->productbatch->enabled); - return $this->_create($user, $fk_product, $entrepot_id, $qty, 3, $price, $label, '', $datem, $eatby, $sellby, $batch, $skip_batch, $id_product_batch); + return $this->_create($user, $fk_product, $entrepot_id, $qty, 3, $price, $label, $inventorycode, $datem, $eatby, $sellby, $batch, $skip_batch, $id_product_batch); } From 6c6a1a02f070bbc6a7ccce272ba84732199c2a96 Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Wed, 6 Mar 2019 11:06:35 +0100 Subject: [PATCH 26/35] allow this script to be included in custom themes --- htdocs/theme/eldy/style.css.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index 1f58937d879..35f6f56c57c 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -61,7 +61,7 @@ if (defined('THEME_ONLY_CONSTANT')) return; session_cache_limiter('public'); -require_once '../../main.inc.php'; +require_once __DIR__.'/../../main.inc.php'; // __DIR__ allow this script to be included in custom themes require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; // Load user to have $user->conf loaded (not done into main because of NOLOGIN constant defined) From 1ee52131b43a2c7a0df605ef60a0fa120bccf818 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 6 Mar 2019 11:49:41 +0100 Subject: [PATCH 27/35] Fix badge for sf download --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9dfd1a8a750..ad1702fffe4 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # DOLIBARR ERP & CRM -![Downloads per day](https://img.shields.io/sourceforge/dm/dolibarr.svg) +![Downloads per day](https://img.shields.io/sourceforge/dw/dolibarr.svg) [![Reviewed by Hound](https://img.shields.io/badge/Reviewed_by-Hound-8E64B0.svg)](https://houndci.com) |6|7|8|9|develop| From 1ab3949e9c0e0a4cc92a5c8b8c0a488ea8bfb193 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 6 Mar 2019 13:01:01 +0100 Subject: [PATCH 28/35] Optimize js code --- htdocs/core/tpl/objectline_create.tpl.php | 73 ++++++++++------------- 1 file changed, 30 insertions(+), 43 deletions(-) diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index 8b577b71bcc..2cc990056da 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -596,6 +596,28 @@ if (! empty($usemargins) && $user->rights->margins->creer) /* JQuery for product free or predefined select */ jQuery(document).ready(function() { + jQuery("#price_ht").keyup(function(event) { + // console.log(event.which); // discard event tag and arrows + if (event.which != 9 && (event.which < 37 ||event.which > 40) && jQuery("#price_ht").val() != '') { + jQuery("#price_ttc").val(''); + jQuery("#multicurrency_subprice").val(''); + } + }); + jQuery("#price_ttc").keyup(function(event) { + // console.log(event.which); // discard event tag and arrows + if (event.which != 9 && (event.which < 37 || event.which > 40) && jQuery("#price_ttc").val() != '') { + jQuery("#price_ht").val(''); + jQuery("#multicurrency_subprice").val(''); + } + }); + jQuery("#multicurrency_subprice").keyup(function(event) { + // console.log(event.which); // discard event tag and arrows + if (event.which != 9 && (event.which < 37 || event.which > 40) && jQuery("#price_ttc").val() != '') { + jQuery("#price_ht").val(''); + jQuery("#price_ttc").val(''); + } + }); + $("#prod_entry_mode_free").on( "click", function() { setforfree(); }); @@ -662,10 +684,7 @@ jQuery(document).ready(function() { $.post('/fourn/ajax/getSupplierPrices.php?bestpricefirst=1', { 'idprod': $(this).val() }, function(data) { if (data && data.length > 0) { - var options = ''; - var defaultkey = ''; - var defaultprice = ''; - var bestpricefound = 0; + var options = ''; var defaultkey = ''; var defaultprice = ''; var bestpricefound = 0; var bestpriceid = 0; var bestpricevalue = 0; var pmppriceid = 0; var pmppricevalue = 0; @@ -796,61 +815,29 @@ jQuery(document).ready(function() { setforpredef(); - }); /* Function to set fields from choice */ function setforfree() { console.log("Call setforfree. We show most fields"); - jQuery("#search_idprod").val(''); - jQuery("#idprod").val(''); jQuery("#idprodfournprice").val('0'); // Set cursor on not selected product - jQuery("#search_idprodfournprice").val(''); jQuery("#prod_entry_mode_free").prop('checked',true).change(); jQuery("#prod_entry_mode_predef").prop('checked',false).change(); - jQuery("#price_ht").show(); - jQuery("#multicurrency_price_ht").show(); - jQuery("#price_ttc").show(); // May not exist - jQuery("#fourn_ref").show(); - jQuery("#tva_tx").show(); - jQuery("#buying_price").val('').show(); + jQuery("#search_idprod, #idprod, #search_idprodfournprice, #buying_price").val(''); + jQuery("#price_ht, #multicurrency_price_ht, #price_ttc, #price_ttc, #fourn_ref, #tva_tx, #buying_price, #title_vat, #title_up_ht, #title_up_ht_currency, #title_up_ttc, #title_up_ttc_currency").show(); + jQuery("#np_marginRate, #np_markRate, .np_marginRate, .np_markRate, #units, #title_units").show(); jQuery("#fournprice_predef").hide(); - jQuery("#title_vat").show(); - jQuery("#title_up_ht").show(); - jQuery("#title_up_ht_currency").show(); - jQuery("#title_up_ttc").show(); - jQuery("#title_up_ttc_currency").show(); - jQuery("#np_marginRate").show(); // May not exist - jQuery("#np_markRate").show(); // May not exist - jQuery(".np_marginRate").show(); // May not exist - jQuery(".np_markRate").show(); // May not exist - jQuery("#units, #title_units").show(); } function setforpredef() { console.log("Call setforpredef. We hide some fields and show dates"); jQuery("#select_type").val(-1); - jQuery("#prod_entry_mode_free").prop('checked',false).change(); jQuery("#prod_entry_mode_predef").prop('checked',true).change(); - jQuery("#price_ht").val('').hide(); - jQuery("#multicurrency_price_ht").hide(); - jQuery("#price_ttc").hide(); // May not exist - jQuery("#fourn_ref").hide(); - jQuery("#tva_tx").hide(); + jQuery("#price_ht").val('') + jQuery("#price_ht, #multicurrency_price_ht, #price_ttc, #fourn_ref, #tva_tx, #title_vat, #title_up_ht, #title_up_ht_currency, #title_up_ttc, #title_up_ttc_currency").hide(); + jQuery("#np_marginRate, #np_markRate, .np_marginRate, .np_markRate, #units, #title_units").hide(); jQuery("#buying_price").show(); - jQuery("#title_vat").hide(); - jQuery("#title_up_ht").hide(); - jQuery("#title_up_ht_currency").hide(); - jQuery("#title_up_ttc").hide(); - jQuery("#title_up_ttc_currency").hide(); - jQuery("#np_marginRate").hide(); // May not exist - jQuery("#np_markRate").hide(); // May not exist - jQuery(".np_marginRate").hide(); // May not exist - jQuery(".np_markRate").hide(); // May not exist - jQuery("#units, #title_units").hide(); - - jQuery('#trlinefordates').show(); - jQuery('.divlinefordates').show(); + jQuery('#trlinefordates, .divlinefordates').show(); } From d4409ffb0886e8dc34c6b6cef8cd3f9075aab36e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 6 Mar 2019 14:18:58 +0100 Subject: [PATCH 29/35] Restore menu MRP on new eldy code --- htdocs/core/menus/standard/eldy.lib.php | 66 ++++++++++++++---------- htdocs/theme/eldy/main_menu_fa_icons.css | 8 +++ htdocs/theme/md/style.css.php | 4 ++ 3 files changed, 50 insertions(+), 28 deletions(-) diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index fcc1f1aea3a..4383ae07e75 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -183,23 +183,33 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = ); // MRP - $tmpentry = array( - 'enabled'=>(! empty($conf->bom->enabled) || ! empty($conf->mrp->enabled)), - 'perms'=>(! empty($user->rights->bom->read) || ! empty($user->rights->mrp->read)), - 'module'=>'bom|mrp', + $menu_arr[] = array( + 'name' => 'TMenuMRP', + 'link' => '/bom/bom_list.php?mainmenu=mrp&leftmenu=', + 'title' => $langs->trans("TMenuMRP"), + 'level' => 0, + 'enabled' => $showmode = isVisibleToUserType + ( + $type_user, + $tmpentry = array( + 'enabled'=>(! empty($conf->bom->enabled) || ! empty($conf->mrp->enabled)), + 'perms'=>(! empty($user->rights->bom->read) || ! empty($user->rights->mrp->read)), + 'module'=>'bom|mrp', + ), + $listofmodulesforexternal + ), + 'target' => $atarget, + 'mainmenu' => "mrp", + 'leftmenu' => '', + 'position' => 30, + 'id' => $id, + 'idsel' => 'mrp', + 'classname' => $classname = ( $_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "project" ) ? 'class="tmenusel"' : 'class="tmenu"', + 'prefix' => '', + 'session' => ( ( $_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "project" ) ? 0 : 1 ), + 'loadLangs' => array("projects"), + 'submenus' => array(), ); - $showmode=isVisibleToUserType($type_user, $tmpentry, $listofmodulesforexternal); - if ($showmode) - { - $classname=""; - if ($_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "mrp") { $classname='class="tmenusel"'; $_SESSION['idmenu']=''; } - else $classname = 'class="tmenu"'; - $idsel='products'; - - $chaine=$langs->trans("TMenuMRP"); - - $menu->add('/bom/bom_list.php?mainmenu=mrp&leftmenu=', $chaine, 0, $showmode, $atarget, "bom", '', 30, $id, $idsel, $classname); - } // Projects $menu_arr[] = array( @@ -328,9 +338,9 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = 'idsel' => 'bank', 'classname' => $classname = ( $_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "bank" ) ? 'class="tmenusel"' : 'class="tmenu"', 'prefix' => '', - + 'session' => ( ( $_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "bank" ) ? 0 : 1 ), - + 'loadLangs' => array("compta","banks"), 'submenus' => array(), ); @@ -359,9 +369,9 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = 'idsel' => 'accountancy', 'classname' => $classname = ( $_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "accountancy" ) ? 'class="tmenusel"' : 'class="tmenu"', 'prefix' => '', - + 'session' => ( ( $_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "accountancy" ) ? 0 : 1 ), - + 'loadLangs' => array("compta"), 'submenus' => array(), ); @@ -390,9 +400,9 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = 'idsel' => 'hrm', 'classname' => $classname = ( $_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "hrm" ) ? 'class="tmenusel"' : 'class="tmenu"', 'prefix' => '', - + 'session' => ( ( $_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "hrm" ) ? 0 : 1 ), - + 'loadLangs' => array("holiday"), 'submenus' => array(), ); @@ -421,31 +431,31 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = 'idsel' => 'tools', 'classname' => $classname = ( $_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "tools" ) ? 'class="tmenusel"' : 'class="tmenu"', 'prefix' => '', - + 'session' => ( ( $_SESSION["mainmenu"] && $_SESSION["mainmenu"] == "tools" ) ? 0 : 1 ), - + 'loadLangs' => array("other"), 'submenus' => array(), ); - + // Add menus foreach($menu_arr as $key => $smenu) { $smenu = (object) $smenu; - + if( $smenu->enabled ) { if($langs->session) { $_SESSION['idmenu']=''; } - + // Load Langue if(! empty($smenu->loadLangs)) { $langs->loadLangs($smenu->loadLangs); } - + // Trans title $mtitle = ''; if(is_array($smenu->title)) diff --git a/htdocs/theme/eldy/main_menu_fa_icons.css b/htdocs/theme/eldy/main_menu_fa_icons.css index 58890786111..57d422b8395 100644 --- a/htdocs/theme/eldy/main_menu_fa_icons.css +++ b/htdocs/theme/eldy/main_menu_fa_icons.css @@ -118,6 +118,14 @@ div.mainmenu.products::before { font-size: 1.5em; } +div.mainmenu.mrp::before { + font-family: "Font Awesome 5 Free"; + font-weight: 900; + content: "\f468"; + color: white; + font-size: 1.5em; +} + div.mainmenu.project::before { font-family: "Font Awesome 5 Free"; font-weight: 900; diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 6748bcb215a..1f98c2d25ca 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -1764,6 +1764,10 @@ div.mainmenu.products { background-image: url(); } +div.mainmenu.mrp { + background-image: url(); +} + div.mainmenu.project { background-image: url(); } From 0c2a0c643bf50d9639d111e82afab39bdd6eb8ea Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 6 Mar 2019 14:33:05 +0100 Subject: [PATCH 30/35] NEW Performance enhancement: Replace dirname(__FILE__) with __DIR__ --- htdocs/core/lib/website.lib.php | 5 ++--- htdocs/holiday/common.inc.php | 2 +- htdocs/install/upgrade.php | 2 +- htdocs/install/upgrade2.php | 2 +- htdocs/modulebuilder/template/scripts/myobject.php | 2 +- htdocs/website/index.php | 14 +++++++------- htdocs/website/samples/wrapper.html | 2 +- 7 files changed, 14 insertions(+), 15 deletions(-) diff --git a/htdocs/core/lib/website.lib.php b/htdocs/core/lib/website.lib.php index 40c12d302c9..972a271c140 100644 --- a/htdocs/core/lib/website.lib.php +++ b/htdocs/core/lib/website.lib.php @@ -22,7 +22,6 @@ */ - /** * Convert a page content to have correct links (based on DOL_URL_ROOT) into an html content. * Used to ouput the page on the Preview from backoffice. @@ -661,7 +660,7 @@ function dolSavePageContent($filetpl, $object, $objectpage) $tplcontent =''; $tplcontent.= " Date: Wed, 6 Mar 2019 16:00:09 +0100 Subject: [PATCH 31/35] Fix tabs badges --- htdocs/theme/eldy/_badges.css.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/theme/eldy/_badges.css.php b/htdocs/theme/eldy/_badges.css.php index d10f7c00122..7384fffed5f 100644 --- a/htdocs/theme/eldy/_badges.css.php +++ b/htdocs/theme/eldy/_badges.css.php @@ -22,7 +22,7 @@ if (! defined('ISLOADEDBYSTEELSHEET')) die('Must be call by steelsheet'); ?> box-sizing: border-box; } -.badge-pill { +.badge-pill, .tabs .badge { padding-right: .6em; padding-left: .6em; border-radius: 10rem; @@ -58,7 +58,7 @@ a.badge-primary:focus, a.badge-primary:hover { } /* SECONDARY */ -.badge-secondary { +.badge-secondary, .tabs .badge { color: #fff !important; background-color: ; } From a6b759bd879701405e1db3fab52c7944fcca75c6 Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Wed, 6 Mar 2019 16:50:28 +0100 Subject: [PATCH 32/35] remove specific entry in gitignore --- htdocs/.gitignore | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/.gitignore b/htdocs/.gitignore index aa007a70ae5..ac35d8fab2f 100644 --- a/htdocs/.gitignore +++ b/htdocs/.gitignore @@ -28,4 +28,3 @@ /nomenclature* /of/ /workstation/ -/theme/dolipro* \ No newline at end of file From c2070190f2bb5ad8910d037932a8c198207bfd09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 6 Mar 2019 16:51:35 +0100 Subject: [PATCH 33/35] phpcs fix --- htdocs/core/menus/standard/eldy.lib.php | 35 +++++++++---------------- 1 file changed, 12 insertions(+), 23 deletions(-) diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 4383ae07e75..04f379b746f 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -91,8 +91,7 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = 'link' => '/adherents/index.php?mainmenu=members&leftmenu=', 'title' => "MenuMembers", 'level' => 0, - 'enabled' => $showmode = isVisibleToUserType - ( + 'enabled' => $showmode = isVisibleToUserType( $type_user, $tmpentry = array( 'enabled' => (! empty($conf->adherent->enabled) ) , @@ -120,8 +119,7 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = 'link' => '/societe/index.php?mainmenu=companies&leftmenu=', 'title' => "ThirdParties", 'level' => 0, - 'enabled' => $showmode = isVisibleToUserType - ( + 'enabled' => $showmode = isVisibleToUserType( $type_user, $tmpentry = array( 'enabled'=> ( ( ! empty($conf->societe->enabled) && @@ -155,11 +153,10 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = ? ( array("TMenuProducts" , " | " ,"TMenuServices") ) : (! empty($conf->product->enabled)? "TMenuProducts" : "TMenuServices" ), 'level' => 0, - 'enabled' => $showmode = isVisibleToUserType - ( + 'enabled' => $showmode = isVisibleToUserType( $type_user, $tmpentry = array( - 'enabled'=> ( ( ! empty($conf->societe->enabled) && + 'enabled'=> (( ! empty($conf->societe->enabled) && ( empty($conf->global->SOCIETE_DISABLE_PROSPECTS) || empty($conf->global->SOCIETE_DISABLE_CUSTOMERS) ) ) || ! empty($conf->fournisseur->enabled) @@ -188,8 +185,7 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = 'link' => '/bom/bom_list.php?mainmenu=mrp&leftmenu=', 'title' => $langs->trans("TMenuMRP"), 'level' => 0, - 'enabled' => $showmode = isVisibleToUserType - ( + 'enabled' => $showmode = isVisibleToUserType( $type_user, $tmpentry = array( 'enabled'=>(! empty($conf->bom->enabled) || ! empty($conf->mrp->enabled)), @@ -219,8 +215,7 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = ? (($conf->global->PROJECT_USE_OPPORTUNITIES == 2)?"Leads":"Projects") : "LeadsOrProjects", 'level' => 0, - 'enabled' => $showmode = isVisibleToUserType - ( + 'enabled' => $showmode = isVisibleToUserType( $type_user, $tmpentry = array( 'enabled'=> ( ! empty($conf->projet->enabled) ? 1 : 0), @@ -248,8 +243,7 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = 'link' => '/comm/index.php?mainmenu=commercial&leftmenu=', 'title' => "Commercial", 'level' => 0, - 'enabled' => $showmode = isVisibleToUserType - ( + 'enabled' => $showmode = isVisibleToUserType( $type_user, $tmpentry = array( 'enabled'=>(! empty($conf->propal->enabled) || @@ -283,8 +277,7 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = 'link' => '/compta/index.php?mainmenu=billing&leftmenu=', 'title' => "MenuFinancial", 'level' => 0, - 'enabled' => $showmode = isVisibleToUserType - ( + 'enabled' => $showmode = isVisibleToUserType( $type_user, $tmpentry = array( 'enabled'=>(! empty($conf->facture->enabled) || @@ -320,8 +313,7 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = 'link' => '/compta/bank/list.php?mainmenu=bank&leftmenu=', 'title' => "MenuBankCash", 'level' => 0, - 'enabled' => $showmode = isVisibleToUserType - ( + 'enabled' => $showmode = isVisibleToUserType( $type_user, $tmpentry = array( 'enabled'=>(! empty($conf->banque->enabled) || ! empty($conf->prelevement->enabled)), @@ -351,8 +343,7 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = 'link' => '/accountancy/index.php?mainmenu=accountancy&leftmenu=', 'title' => "MenuAccountancy", 'level' => 0, - 'enabled' => $showmode = isVisibleToUserType - ( + 'enabled' => $showmode = isVisibleToUserType( $type_user, $tmpentry = array( 'enabled'=>(! empty($conf->comptabilite->enabled) || ! empty($conf->accounting->enabled) || ! empty($conf->asset->enabled)), @@ -382,8 +373,7 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = 'link' => '/hrm/index.php?mainmenu=hrm&leftmenu=', 'title' => "HRM", 'level' => 0, - 'enabled' => $showmode = isVisibleToUserType - ( + 'enabled' => $showmode = isVisibleToUserType( $type_user, $tmpentry = array( 'enabled'=>(! empty($conf->hrm->enabled) || ! empty($conf->holiday->enabled) || ! empty($conf->deplacement->enabled) || ! empty($conf->expensereport->enabled)), @@ -413,8 +403,7 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = 'link' => '/core/tools.php?mainmenu=tools&leftmenu=', 'title' => "Tools", 'level' => 0, - 'enabled' => $showmode = isVisibleToUserType - ( + 'enabled' => $showmode = isVisibleToUserType( $type_user, $tmpentry = array( 'enabled'=>1, From 401ad659758df2cc1f236251cae5ae64ba3e2ec7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 6 Mar 2019 18:04:36 +0100 Subject: [PATCH 34/35] Fix API explorer was broken due to corrupted API --- .../{api_bom.class.php => api_boms.class.php} | 77 +++++++++---------- htdocs/commande/class/api_orders.class.php | 6 +- .../template/class/api_mymodule.class.php | 30 ++++---- 3 files changed, 55 insertions(+), 58 deletions(-) rename htdocs/bom/class/{api_bom.class.php => api_boms.class.php} (84%) diff --git a/htdocs/bom/class/api_bom.class.php b/htdocs/bom/class/api_boms.class.php similarity index 84% rename from htdocs/bom/class/api_bom.class.php rename to htdocs/bom/class/api_boms.class.php index 4d13475be1a..adda9ceb238 100644 --- a/htdocs/bom/class/api_bom.class.php +++ b/htdocs/bom/class/api_boms.class.php @@ -18,12 +18,11 @@ use Luracast\Restler\RestException; -dol_include_once('/bom/class/bom.class.php'); - +require_once DOL_DOCUMENT_ROOT.'/bom/class/bom.class.php'; /** - * \file bom/class/api_bom.class.php + * \file bom/class/api_boms.class.php * \ingroup bom * \brief File for API management of bom. */ @@ -31,36 +30,32 @@ dol_include_once('/bom/class/bom.class.php'); /** * API class for bom bom * - * @smart-auto-routing false * @access protected * @class DolibarrApiAccess {@requires user,external} */ -class BillOfMaterialsApi extends DolibarrApi +class BOMs extends DolibarrApi { /** * @var array $FIELDS Mandatory fields, checked when create and update object */ static $FIELDS = array( - 'name', + 'label' ); /** - * @var BillOfMaterials $bom {@type BillOfMaterials} + * @var BOM $bom {@type BOM} */ public $bom; /** * Constructor - * - * @url GET / - * */ public function __construct() { global $db, $conf; $this->db = $db; - $this->bom = new BillOfMaterials($this->db); + $this->bom = new BOM($this->db); } /** @@ -71,7 +66,7 @@ class BillOfMaterialsApi extends DolibarrApi * @param int $id ID of bom * @return array|mixed data without useless information * - * @url GET boms/{id} + * @url GET {id} * @throws RestException */ public function get($id) @@ -82,7 +77,7 @@ class BillOfMaterialsApi extends DolibarrApi $result = $this->bom->fetch($id); if( ! $result ) { - throw new RestException(404, 'BillOfMaterials not found'); + throw new RestException(404, 'BOM not found'); } if( ! DolibarrApi::_checkAccessToResource('bom', $this->bom->id)) { @@ -106,8 +101,6 @@ class BillOfMaterialsApi extends DolibarrApi * @return array Array of order objects * * @throws RestException - * - * @url GET /boms/ */ public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $sqlfilters = '') { @@ -134,7 +127,7 @@ class BillOfMaterialsApi extends DolibarrApi //if ($mode == 1) $sql.= " AND s.client IN (1, 3)"; //if ($mode == 2) $sql.= " AND s.client IN (2, 3)"; - $tmpobject = new BillOfMaterials($db); + $tmpobject = new BOM($db); if ($tmpobject->ismultientitymanaged) $sql.= ' AND t.entity IN ('.getEntity('bom').')'; if ($restictonsocid && (!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) $sql.= " AND t.fk_soc = sc.fk_soc"; if ($restictonsocid && $socid) $sql.= " AND t.fk_soc = ".$socid; @@ -172,7 +165,7 @@ class BillOfMaterialsApi extends DolibarrApi while ($i < $num) { $obj = $db->fetch_object($result); - $bom_static = new BillOfMaterials($db); + $bom_static = new BOM($db); if($bom_static->fetch($obj->rowid)) { $obj_ret[] = $this->_cleanObjectDatas($bom_static); } @@ -193,8 +186,6 @@ class BillOfMaterialsApi extends DolibarrApi * * @param array $request_data Request datas * @return int ID of bom - * - * @url POST boms/ */ public function post($request_data = null) { @@ -208,7 +199,7 @@ class BillOfMaterialsApi extends DolibarrApi $this->bom->$field = $value; } if( ! $this->bom->create(DolibarrApiAccess::$user)) { - throw new RestException(500); + throw new RestException(500, "Error creating BOM", array_merge(array($this->bom->error), $this->bom->errors)); } return $this->bom->id; } @@ -218,9 +209,8 @@ class BillOfMaterialsApi extends DolibarrApi * * @param int $id Id of bom to update * @param array $request_data Datas - * @return int * - * @url PUT boms/{id} + * @return int */ public function put($id, $request_data = null) { @@ -230,7 +220,7 @@ class BillOfMaterialsApi extends DolibarrApi $result = $this->bom->fetch($id); if( ! $result ) { - throw new RestException(404, 'BillOfMaterials not found'); + throw new RestException(404, 'BOM not found'); } if( ! DolibarrApi::_checkAccessToResource('bom', $this->bom->id)) { @@ -238,46 +228,49 @@ class BillOfMaterialsApi extends DolibarrApi } foreach($request_data as $field => $value) { + if ($field == 'id') continue; $this->bom->$field = $value; } - if($this->bom->update($id, DolibarrApiAccess::$user)) + if($this->bom->update($id, DolibarrApiAccess::$user) > 0) + { return $this->get($id); - - return false; + } + else + { + throw new RestException(500, $this->commande->error); + } } /** * Delete bom * - * @param int $id BillOfMaterials ID + * @param int $id BOM ID * @return array - * - * @url DELETE bom/{id} */ public function delete($id) { - if(! DolibarrApiAccess::$user->rights->bom->delete) { + if (! DolibarrApiAccess::$user->rights->bom->delete) { throw new RestException(401); } $result = $this->bom->fetch($id); - if( ! $result ) { - throw new RestException(404, 'BillOfMaterials not found'); + if (! $result) { + throw new RestException(404, 'BOM not found'); } - if( ! DolibarrApi::_checkAccessToResource('bom', $this->bom->id)) { + if (! DolibarrApi::_checkAccessToResource('bom', $this->bom->id)) { throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); } - if( !$this->bom->delete(DolibarrApiAccess::$user, 0)) + if (! $this->bom->delete(DolibarrApiAccess::$user)) { - throw new RestException(500); + throw new RestException(500, 'Error when deleting BOM : '.$this->bom->error); } return array( 'success' => array( 'code' => 200, - 'message' => 'BillOfMaterials deleted' + 'message' => 'BOM deleted' ) ); } @@ -287,8 +280,8 @@ class BillOfMaterialsApi extends DolibarrApi /** * Clean sensible object datas * - * @param object $object Object to clean - * @return array Array of cleaned object properties + * @param object $object Object to clean + * @return array Array of cleaned object properties */ protected function _cleanObjectDatas($object) { @@ -308,15 +301,15 @@ class BillOfMaterialsApi extends DolibarrApi /** * Validate fields before create or update object * - * @param array $data Data to validate - * @return array + * @param array $data Array of data to validate + * @return array * - * @throws RestException + * @throws RestException */ private function _validate($data) { $bom = array(); - foreach (BillOfMaterialsApi::$FIELDS as $field) { + foreach (BOMs::$FIELDS as $field) { if (!isset($data[$field])) throw new RestException(400, "$field field missing"); $bom[$field] = $data[$field]; diff --git a/htdocs/commande/class/api_orders.class.php b/htdocs/commande/class/api_orders.class.php index 24508d6fb11..ca7823a6ac1 100644 --- a/htdocs/commande/class/api_orders.class.php +++ b/htdocs/commande/class/api_orders.class.php @@ -16,9 +16,9 @@ * along with this program. If not, see . */ - use Luracast\Restler\RestException; +use Luracast\Restler\RestException; - require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; +require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; /** * API class for orders @@ -544,7 +544,7 @@ class Orders extends DolibarrApi } if( ! $this->commande->delete(DolibarrApiAccess::$user)) { - throw new RestException(500, 'Error when delete order : '.$this->commande->error); + throw new RestException(500, 'Error when deleting order : '.$this->commande->error); } return array( diff --git a/htdocs/modulebuilder/template/class/api_mymodule.class.php b/htdocs/modulebuilder/template/class/api_mymodule.class.php index 566fe56affb..acf7f65454d 100644 --- a/htdocs/modulebuilder/template/class/api_mymodule.class.php +++ b/htdocs/modulebuilder/template/class/api_mymodule.class.php @@ -31,7 +31,6 @@ dol_include_once('/mymodule/class/myobject.class.php'); /** * API class for mymodule myobject * - * @smart-auto-routing false * @access protected * @class DolibarrApiAccess {@requires user,external} */ @@ -205,7 +204,7 @@ class MyModuleApi extends DolibarrApi $this->myobject->$field = $value; } if( ! $this->myobject->create(DolibarrApiAccess::$user)) { - throw new RestException(500); + throw new RestException(500, "Error creating MyObject", array_merge(array($this->myobject->error), $this->myobject->errors)); } return $this->myobject->id; } @@ -235,13 +234,18 @@ class MyModuleApi extends DolibarrApi } foreach($request_data as $field => $value) { + if ($field == 'id') continue; $this->myobject->$field = $value; } - if($this->myobject->update($id, DolibarrApiAccess::$user)) + if ($this->myobject->update($id, DolibarrApiAccess::$user) > 0) + { return $this->get($id); - - return false; + } + else + { + throw new RestException(500, $this->myobject->error); + } } /** @@ -254,21 +258,21 @@ class MyModuleApi extends DolibarrApi */ public function delete($id) { - if(! DolibarrApiAccess::$user->rights->myobject->delete) { + if (! DolibarrApiAccess::$user->rights->myobject->delete) { throw new RestException(401); } $result = $this->myobject->fetch($id); - if( ! $result ) { + if (! $result) { throw new RestException(404, 'MyObject not found'); } - if( ! DolibarrApi::_checkAccessToResource('myobject', $this->myobject->id)) { + if (! DolibarrApi::_checkAccessToResource('myobject', $this->myobject->id)) { throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); } - if( !$this->myobject->delete(DolibarrApiAccess::$user, 0)) + if (! $this->myobject->delete(DolibarrApiAccess::$user)) { - throw new RestException(500); + throw new RestException(500, 'Error when deleting MyObject : '.$this->myobject->error); } return array( @@ -305,10 +309,10 @@ class MyModuleApi extends DolibarrApi /** * Validate fields before create or update object * - * @param array $data Data to validate - * @return array + * @param array $data Array of data to validate + * @return array * - * @throws RestException + * @throws RestException */ private function _validate($data) { From 1b0aec0847732d58da4a719afec45f7e99d14cf0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 6 Mar 2019 20:51:07 +0100 Subject: [PATCH 35/35] Complete fields for template invoices --- htdocs/install/mysql/migration/9.0.0-10.0.0.sql | 7 +++++++ htdocs/install/mysql/tables/llx_facturedet.sql | 8 ++++---- htdocs/install/mysql/tables/llx_facturedet_rec.sql | 7 +++++++ 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/htdocs/install/mysql/migration/9.0.0-10.0.0.sql b/htdocs/install/mysql/migration/9.0.0-10.0.0.sql index 5154d7311a9..7dd893b8dab 100644 --- a/htdocs/install/mysql/migration/9.0.0-10.0.0.sql +++ b/htdocs/install/mysql/migration/9.0.0-10.0.0.sql @@ -230,3 +230,10 @@ ALTER TABLE llx_bom_bom ADD INDEX idx_bom_bom_fk_product (fk_product); ALTER TABLE llx_bom_bomline ADD INDEX idx_bom_bomline_rowid (rowid); ALTER TABLE llx_bom_bomline ADD INDEX idx_bom_bomline_fk_product (fk_product); ALTER TABLE llx_bom_bomline ADD INDEX idx_bom_bomline_fk_bom (fk_bom); + +ALTER TABLE llx_facturedet_rec ADD COLUMN buy_price_ht double(24,8) DEFAULT 0; +ALTER TABLE llx_facturedet_rec ADD COLUMN fk_product_fournisseur_price integer DEFAULT NULL; + +ALTER TABLE llx_facturedet_rec ADD COLUMN fk_user_author integer; +ALTER TABLE llx_facturedet_rec ADD COLUMN fk_user_modif integer; + diff --git a/htdocs/install/mysql/tables/llx_facturedet.sql b/htdocs/install/mysql/tables/llx_facturedet.sql index ac7142c898d..deb52576a8a 100644 --- a/htdocs/install/mysql/tables/llx_facturedet.sql +++ b/htdocs/install/mysql/tables/llx_facturedet.sql @@ -55,16 +55,16 @@ create table llx_facturedet buy_price_ht double(24,8) DEFAULT 0, -- buying price. Note: this value is saved as an always positive value, even on credit notes (it is price we bought the product before selling it). fk_product_fournisseur_price integer DEFAULT NULL, -- reference of supplier price when line was added (may be used to update buy_price_ht current price when future invoice will be created) - fk_code_ventilation integer DEFAULT 0 NOT NULL, -- Id in table llx_accounting_bookeeping to know accounting account for product line - special_code integer DEFAULT 0, -- code for special lines (may be 1=transport, 2=ecotax, 3=option, moduleid=...) rang integer DEFAULT 0, -- position of line fk_contract_line integer NULL, -- id of contract line when invoice comes from contract lines + fk_unit integer DEFAULT NULL, -- id of the unit code import_key varchar(14), + fk_code_ventilation integer DEFAULT 0 NOT NULL, -- Id in table llx_accounting_bookeeping to know accounting account for product line + situation_percent real, -- % progression of lines invoicing - fk_prev_id integer, -- id of the line in the previous situation, - fk_unit integer DEFAULT NULL, -- id of the unit code¡ + fk_prev_id integer, -- id of the line in the previous situation fk_user_author integer, -- user making creation fk_user_modif integer, -- user making last change diff --git a/htdocs/install/mysql/tables/llx_facturedet_rec.sql b/htdocs/install/mysql/tables/llx_facturedet_rec.sql index ac79dfd891d..267abcd5053 100644 --- a/htdocs/install/mysql/tables/llx_facturedet_rec.sql +++ b/htdocs/install/mysql/tables/llx_facturedet_rec.sql @@ -48,11 +48,18 @@ create table llx_facturedet_rec date_start_fill integer DEFAULT 0, -- 1=autofill the date_start of invoice with __INVOICE_DATE_NEXT_INVOICE_BEFORE_GEN__ date_end_fill integer DEFAULT 0, -- 1=autofill the date_start of invoice with __INVOICE_PREVIOUS_DATE_NEXT_INVOICE_AFTER_GEN__ info_bits integer DEFAULT 0, -- TVA NPR ou non + + buy_price_ht double(24,8) DEFAULT 0, -- buying price. Note: this value is saved as an always positive value, even on credit notes (it is price we bought the product before selling it). + fk_product_fournisseur_price integer DEFAULT NULL, -- reference of supplier price when line was added (may be used to update buy_price_ht current price when future invoice will be created) + special_code integer UNSIGNED DEFAULT 0, -- code pour les lignes speciales rang integer DEFAULT 0, -- ordre d'affichage fk_contract_line integer NULL, -- id of contract line when template invoice comes from contract lines fk_unit integer DEFAULT NULL, import_key varchar(14), + + fk_user_author integer, -- user making creation + fk_user_modif integer, -- user making last change fk_multicurrency integer, multicurrency_code varchar(255),