From e6ed53fd04a539f9e920decaa34e528e201c44e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 11 Jun 2024 01:06:15 +0200 Subject: [PATCH] fix phpstan (#29978) --- htdocs/public/demo/index.php | 58 +++++++++++++++++++++--------------- 1 file changed, 34 insertions(+), 24 deletions(-) diff --git a/htdocs/public/demo/index.php b/htdocs/public/demo/index.php index 4d683d4c967..011f594a8c4 100644 --- a/htdocs/public/demo/index.php +++ b/htdocs/public/demo/index.php @@ -3,6 +3,7 @@ * Copyright (C) 2006-2013 Laurent Destailleur * Copyright (C) 2010 Regis Houssin * Copyright (C) 2015 Raphaël Doursenaud + * Copyright (C) 2024 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -76,34 +77,44 @@ $reshook = $hookmanager->executeHooks('addDemoProfile', $parameters, $object, $t $error = $hookmanager->error; $errors = $hookmanager->errors; if (empty($reshook)) { $demoprofiles = array( - array('default'=>'1', 'key'=>'profdemoservonly', 'label'=>'DemoCompanyServiceOnly', - 'disablemodules'=>'adherent,barcode,bom,cashdesk,don,expedition,externalsite,ftp,incoterm,mailmanspip,margin,mrp,prelevement,product,productbatch,stock,takepos', - //'icon'=>DOL_URL_ROOT.'/public/demo/dolibarr_screenshot8.png', - 'icon'=>DOL_URL_ROOT.'/public/demo/demo-profile-service.jpg', - 'url'=>$url + array( + 'default'=>'1', 'key'=>'profdemoservonly', 'label'=>'DemoCompanyServiceOnly', + 'disablemodules'=>'adherent,barcode,bom,cashdesk,don,expedition,externalsite,ftp,incoterm,mailmanspip,margin,mrp,prelevement,product,productbatch,stock,takepos', + //'icon'=>DOL_URL_ROOT.'/public/demo/dolibarr_screenshot8.png', + 'icon'=>DOL_URL_ROOT.'/public/demo/demo-profile-service.jpg', + 'url'=>$url, + 'lang' => '', ), - array('default'=>'0', 'key'=>'profmanufacture', 'label'=>'DemoCompanyManufacturing', + array( + 'default'=>'0', 'key'=>'profmanufacture', 'label'=>'DemoCompanyManufacturing', 'disablemodules'=>'adherent,contrat,don,externalsite,ficheinter,ftp,mailmanspip,prelevement,service', 'icon'=>DOL_URL_ROOT.'/public/demo/demo-profile-manufacturing.jpg', - 'url'=>$url + 'url'=>$url, + 'lang' => '', ), - array('default'=>'0', 'key'=>'profdemoprodstock', 'label'=>'DemoCompanyProductAndStocks', - 'disablemodules'=>'adherent,bom,contrat,don,externalsite,ficheinter,ftp,mailmanspip,mrp,prelevement,service', - //'icon'=>DOL_URL_ROOT.'/public/demo/dolibarr_screenshot2.png', - 'icon'=>DOL_URL_ROOT.'/public/demo/demo-profile-product.jpg', - 'url'=>$url + array( + 'default'=>'0', 'key'=>'profdemoprodstock', 'label'=>'DemoCompanyProductAndStocks', + 'disablemodules'=>'adherent,bom,contrat,don,externalsite,ficheinter,ftp,mailmanspip,mrp,prelevement,service', + //'icon'=>DOL_URL_ROOT.'/public/demo/dolibarr_screenshot2.png', + 'icon'=>DOL_URL_ROOT.'/public/demo/demo-profile-product.jpg', + 'url'=>$url, + 'lang' => '', ), - array('default'=>'0', 'key'=>'profdemofun2', 'label'=>'DemoFundation2', - 'disablemodules'=>'barcode,cashdesk,bom,commande,commercial,compta,comptabilite,contrat,expedition,externalsite,ficheinter,ftp,incoterm,mailmanspip,margin,mrp,prelevement,product,productbatch,projet,propal,propale,service,societe,stock,tax,takepos', - //'icon'=>DOL_URL_ROOT.'/public/demo/dolibarr_screenshot6.png', - 'icon'=>DOL_URL_ROOT.'/public/demo/demo-profile-foundation.jpg', - 'url'=>$url + array( + 'default'=>'0', 'key'=>'profdemofun2', 'label'=>'DemoFundation2', + 'disablemodules'=>'barcode,cashdesk,bom,commande,commercial,compta,comptabilite,contrat,expedition,externalsite,ficheinter,ftp,incoterm,mailmanspip,margin,mrp,prelevement,product,productbatch,projet,propal,propale,service,societe,stock,tax,takepos', + //'icon'=>DOL_URL_ROOT.'/public/demo/dolibarr_screenshot6.png', + 'icon'=>DOL_URL_ROOT.'/public/demo/demo-profile-foundation.jpg', + 'url'=>$url, + 'lang' => '', ), // All demo profile - array('default'=>'0', 'key'=>'profdemoall', 'label'=>'ChooseYourDemoProfilMore', - 'disablemodules'=>'adherent,cashdesk,don,externalsite,mailmanspip', - //'icon'=>DOL_URL_ROOT.'/public/demo/dolibarr_screenshot9.png' - 'icon'=>DOL_URL_ROOT.'/public/demo/demo-profile-all.jpg' + array( + 'default'=>'0', 'key'=>'profdemoall', 'label'=>'ChooseYourDemoProfilMore', + 'disablemodules'=>'adherent,cashdesk,don,externalsite,mailmanspip', + //'icon'=>DOL_URL_ROOT.'/public/demo/dolibarr_screenshot9.png' + 'icon'=>DOL_URL_ROOT.'/public/demo/demo-profile-all.jpg', + 'lang' => '', ) ); @@ -186,7 +197,6 @@ foreach ($modulesdir as $dir) { } asort($orders); -//var_dump($orders); /* @@ -222,7 +232,7 @@ if (GETPOST('action', 'aZ09') == 'gotodemo') { // Action run when we click o $url .= (preg_match('/\?/', $url) ? '&' : '?').'urlfrom='.urlencode(GETPOST('urlfrom', 'alpha')); } $url .= (preg_match('/\?/', $url) ? '&' : '?').'disablemodules='.$disablestring; - //var_dump($url);exit; + header("Location: ".$url); exit; } @@ -290,7 +300,7 @@ $i = 0; foreach ($demoprofiles as $profilearray) { if ($profilearray['default'] >= 0) { //print $profilearray['lang']; - if (isset($profilearray['lang']) && !empty($profilearray['lang'])) { + if (!empty($profilearray['lang'])) { $langs->load($profilearray['lang']); }