From 8d0825910a017bdf33c429e721faf429e1c8a1a7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 23 Apr 2019 10:38:20 +0200 Subject: [PATCH] Fix warnings --- htdocs/core/lib/pdf.lib.php | 18 +- htdocs/core/menus/standard/eldy.lib.php | 213 ++++++++++-------------- 2 files changed, 99 insertions(+), 132 deletions(-) diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 2d6e41abe59..134cf7c8e5e 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -341,14 +341,14 @@ function pdfBuildThirdpartyName($thirdparty, Translate $outputlangs, $includeali /** * Return a string with full address formated for output on documents * - * @param Translate $outputlangs Output langs object - * @param Societe $sourcecompany Source company object - * @param Societe|string $targetcompany Target company object - * @param Contact|string $targetcontact Target contact object - * @param int $usecontact Use contact instead of company - * @param string $mode Address type ('source', 'target', 'targetwithdetails', 'targetwithdetails_xxx': target but include also phone/fax/email/url) - * @param Object $object Object we want to build document for - * @return string String with full address + * @param Translate $outputlangs Output langs object + * @param Societe $sourcecompany Source company object + * @param Societe|string|null $targetcompany Target company object + * @param Contact|string|null $targetcontact Target contact object + * @param int $usecontact Use contact instead of company + * @param string $mode Address type ('source', 'target', 'targetwithdetails', 'targetwithdetails_xxx': target but include also phone/fax/email/url) + * @param Object $object Object we want to build document for + * @return string String with full address */ function pdf_build_address($outputlangs, $sourcecompany, $targetcompany = '', $targetcontact = '', $usecontact = 0, $mode = 'source', $object = null) { @@ -364,7 +364,7 @@ function pdf_build_address($outputlangs, $sourcecompany, $targetcompany = '', $t $stringaddress = ''; if (is_object($hookmanager)) { - $parameters = array('sourcecompany'=>&$sourcecompany,'targetcompany'=>&$targetcompany,'targetcontact'=>$targetcontact,'outputlangs'=>$outputlangs,'mode'=>$mode,'usecontact'=>$usecontact); + $parameters = array('sourcecompany'=>&$sourcecompany, 'targetcompany'=>&$targetcompany, 'targetcontact'=>&$targetcontact, 'outputlangs'=>$outputlangs, 'mode'=>$mode, 'usecontact'=>$usecontact); $action=''; $reshook = $hookmanager->executeHooks('pdf_build_address', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks $stringaddress.=$hookmanager->resPrint; diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index d5e93ce5119..02727acf36c 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -87,20 +87,17 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = ); // Members + $tmpentry = array( + 'enabled' => (! empty($conf->adherent->enabled) ) , + 'perms' => (! empty($user->rights->adherent->lire) ), + 'module' => 'adherent' + ); $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 - ), + 'enabled' => $showmode = isVisibleToUserType($type_user, $tmpentry, $listofmodulesforexternal), 'target' => $atarget, 'mainmenu' => "members", 'leftmenu' => '', @@ -115,24 +112,21 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = ); // 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' + ); $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 - ), + 'enabled' => $showmode = isVisibleToUserType($type_user, $tmpentry, $listofmodulesforexternal), 'target' => $atarget, 'mainmenu' => "companies", 'leftmenu' => '', @@ -147,6 +141,15 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = ); // Products-Services + $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' + ); $menu_arr[] = array( 'name' => 'Products', 'link' => '/product/index.php?mainmenu=products&leftmenu=', @@ -154,19 +157,7 @@ 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( - $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 - ), + 'enabled' => $showmode = isVisibleToUserType($type_user, $tmpentry, $listofmodulesforexternal), 'target' => $atarget, 'mainmenu' => "products", 'leftmenu' => '', @@ -181,20 +172,17 @@ 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' => '/mrp/index.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 - ), + 'enabled' => $showmode = isVisibleToUserType($type_user, $tmpentry, $listofmodulesforexternal), 'target' => $atarget, 'mainmenu' => "mrp", 'leftmenu' => '', @@ -209,6 +197,11 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = ); // Projects + $tmpentry = array( + 'enabled'=> ( ! empty($conf->projet->enabled) ? 1 : 0), + 'perms'=> (! empty($user->rights->projet->lire) ? 1 : 0), + 'module'=>'projet' + ); $menu_arr[] = array( 'name' => 'Projet', 'link' => '/projet/index.php?mainmenu=project&leftmenu=', @@ -216,15 +209,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( - $type_user, - $tmpentry = array( - 'enabled'=> ( ! empty($conf->projet->enabled) ? 1 : 0), - 'perms'=> (! empty($user->rights->projet->lire) ? 1 : 0), - 'module'=>'projet', - ), - $listofmodulesforexternal - ), + 'enabled' => $showmode = isVisibleToUserType($type_user, $tmpentry, $listofmodulesforexternal), 'target' => $atarget, 'mainmenu' => "project", 'leftmenu' => '', @@ -239,26 +224,23 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = ); // Commercial + $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' + ); $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 - ), + 'enabled' => $showmode = isVisibleToUserType($type_user, $tmpentry, $listofmodulesforexternal), 'target' => $atarget, 'mainmenu' => "commercial", 'leftmenu' => '', @@ -273,28 +255,25 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = ); // Billing - Financial + $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' + ); $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 - ), + 'enabled' => $showmode = isVisibleToUserType($type_user, $tmpentry, $listofmodulesforexternal), 'target' => $atarget, 'mainmenu' => "billing", 'leftmenu' => '', @@ -309,20 +288,17 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = ); // 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' + ); $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 - ), + 'enabled' => $showmode = isVisibleToUserType($type_user, $tmpentry, $listofmodulesforexternal), 'target' => $atarget, 'mainmenu' => "bank", 'leftmenu' => '', @@ -339,20 +315,17 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = ); // Accounting + $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|asset' + ); $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|asset', - ), - $listofmodulesforexternal - ), + 'enabled' => $showmode = isVisibleToUserType($type_user, $tmpentry, $listofmodulesforexternal), 'target' => $atarget, 'mainmenu' => "accountancy", 'leftmenu' => '', @@ -369,20 +342,17 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = ); // 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' + ); $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 - ), + 'enabled' => $showmode = isVisibleToUserType($type_user, $tmpentry, $listofmodulesforexternal), 'target' => $atarget, 'mainmenu' => "hrm", 'leftmenu' => '', @@ -399,20 +369,17 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = ); // Tools + $tmpentry = array( + 'enabled'=>1, + 'perms'=>1, + 'module'=>'' + ); $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 - ), + 'enabled' => $showmode = isVisibleToUserType($type_user, $tmpentry, $listofmodulesforexternal), 'target' => $atarget, 'mainmenu' => "tools", 'leftmenu' => '', @@ -641,7 +608,7 @@ function print_end_menu_array() */ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabMenu, &$menu, $noout = 0, $forcemainmenu = '', $forceleftmenu = '', $moredata = null) { - global $user,$conf,$langs,$dolibarr_main_db_name,$mysoc; + global $user, $conf, $langs, $dolibarr_main_db_name, $mysoc; //var_dump($tabMenu); @@ -1638,7 +1605,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM $tmpentry = array( 'enabled'=>(! empty($conf->projet->enabled)), 'perms'=>(! empty($user->rights->projet->lire)), - 'module'=>'projet', + 'module'=>'projet' ); $showmode=isVisibleToUserType($type_user, $tmpentry, $listofmodulesforexternal);