From 7cfa710d4894b03cf51a744293ae9510ea94caef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 23 Oct 2020 21:53:18 +0200 Subject: [PATCH] replace & by && --- htdocs/product/stats/card.php | 84 ++++++++++++----------------------- 1 file changed, 28 insertions(+), 56 deletions(-) diff --git a/htdocs/product/stats/card.php b/htdocs/product/stats/card.php index 0cae0f1b5f6..92c252db3e3 100644 --- a/htdocs/product/stats/card.php +++ b/htdocs/product/stats/card.php @@ -78,20 +78,17 @@ $form = new Form($db); $htmlother = new FormOther($db); $object = new Product($db); -if (!$id && empty($ref)) -{ +if (!$id && empty($ref)) { llxHeader("", $langs->trans("ProductStatistics")); $type = GETPOST('type', 'int'); $helpurl = ''; - if ($type == '0') - { + if ($type == '0') { $helpurl = 'EN:Module_Products|FR:Module_Produits|ES:Módulo_Productos'; //$title=$langs->trans("StatisticsOfProducts"); $title = $langs->trans("Statistics"); - } elseif ($type == '1') - { + } elseif ($type == '1') { $helpurl = 'EN:Module_Services_En|FR:Module_Services|ES:Módulo_Servicios'; //$title=$langs->trans("StatisticsOfServices"); $title = $langs->trans("Statistics"); @@ -111,13 +108,11 @@ if (!$id && empty($ref)) $title = $langs->trans('ProductServiceCard'); $helpurl = ''; $shortlabel = dol_trunc($object->label, 16); - if (GETPOST("type") == '0' || ($object->type == Product::TYPE_PRODUCT)) - { + if (GETPOST("type") == '0' || ($object->type == Product::TYPE_PRODUCT)) { $title = $langs->trans('Product')." ".$shortlabel." - ".$langs->trans('Statistics'); $helpurl = 'EN:Module_Products|FR:Module_Produits|ES:Módulo_Productos'; } - if (GETPOST("type") == '1' || ($object->type == Product::TYPE_SERVICE)) - { + if (GETPOST("type") == '1' || ($object->type == Product::TYPE_SERVICE)) { $title = $langs->trans('Service')." ".$shortlabel." - ".$langs->trans('Statistics'); $helpurl = 'EN:Module_Services_En|FR:Module_Services|ES:Módulo_Servicios'; } @@ -126,8 +121,7 @@ if (!$id && empty($ref)) } -if ($result && (!empty($id) || !empty($ref))) -{ +if ($result && (!empty($id) || !empty($ref))) { $head = product_prepare_head($object); $titre = $langs->trans("CardProduct".$object->type); $picto = ($object->type == Product::TYPE_SERVICE ? 'service' : 'product'); @@ -140,8 +134,7 @@ if ($result && (!empty($id) || !empty($ref))) dol_fiche_end(); } -if (empty($id) & empty($ref)) -{ +if (empty($id) && empty($ref)) { $h = 0; $head = array(); @@ -167,16 +160,14 @@ if (empty($id) & empty($ref)) } -if ($result || empty($id)) -{ +if ($result || empty($id)) { print '
'; print ''; print ''; print ''; - if (empty($id)) - { + if (empty($id)) { // Type print ''; // Tag - if ($conf->categorie->enabled) - { + if ($conf->categorie->enabled) { print ''; print '
'.$langs->trans("Filter").'
'.$langs->trans("ProductsAndServices").''; $array = array('-1'=>' ', '0'=>$langs->trans('Product'), '1'=>$langs->trans('Service')); @@ -184,8 +175,7 @@ if ($result || empty($id)) print '
'.$langs->trans("Categories").''; //$moreforfilter.='
'; $moreforfilter .= $htmlother->select_categories(Categorie::TYPE_PRODUCT, $search_categ, 'search_categ', 1); @@ -198,8 +188,7 @@ if ($result || empty($id)) // Year print '
'.$langs->trans("Year").''; $arrayyears = array(); - for ($year = $currentyear - 10; $year < $currentyear + 10; $year++) - { + for ($year = $currentyear - 10; $year < $currentyear + 10; $year++) { $arrayyears[$year] = $year; } if (!in_array($year, $arrayyears)) $arrayyears[$year] = $year; @@ -240,12 +229,9 @@ if ($result || empty($id)) // Generation des graphs $dir = (!empty($conf->product->multidir_temp[$object->entity]) ? $conf->product->multidir_temp[$object->entity] : $conf->service->multidir_temp[$object->entity]); - if ($object->id > 0) // We are on statistics for a dedicated product - { - if (!file_exists($dir.'/'.$object->id)) - { - if (dol_mkdir($dir.'/'.$object->id) < 0) - { + if ($object->id > 0) { // We are on statistics for a dedicated product + if (!file_exists($dir.'/'.$object->id)) { + if (dol_mkdir($dir.'/'.$object->id) < 0) { $mesg = $langs->trans("ErrorCanNotCreateDir", $dir); $error++; } @@ -302,31 +288,25 @@ if ($result || empty($id)) $px = new DolGraph(); - if (!$error && count($graphfiles) > 0) - { + if (!$error && count($graphfiles) > 0) { $mesg = $px->isGraphKo(); - if (!$mesg) - { - foreach ($graphfiles as $key => $val) - { + if (!$mesg) { + foreach ($graphfiles as $key => $val) { if (!$graphfiles[$key]['file']) continue; $graph_data = array(); - if (dol_is_file($dir.'/'.$graphfiles[$key]['file'])) - { + if (dol_is_file($dir.'/'.$graphfiles[$key]['file'])) { // TODO Load cachefile $graphfiles[$key]['file'] } else { $morefilters = ''; - if ($search_categ > 0) - { + if ($search_categ > 0) { $categ = new Categorie($db); $categ->fetch($search_categ); $listofprodids = $categ->getObjectsInCateg('product', 1); $morefilters = ' AND d.fk_product IN ('.((is_array($listofprodids) && count($listofprodids)) ? join(',', $listofprodids) : '0').')'; } - if ($search_categ == -2) - { + if ($search_categ == -2) { $morefilters = ' AND d.fk_product NOT IN (SELECT cp.fk_product from '.MAIN_DB_PREFIX.'categorie_product as cp)'; } @@ -342,8 +322,7 @@ if ($result || empty($id)) // TODO Save cachefile $graphfiles[$key]['file'] } - if (is_array($graph_data)) - { + if (is_array($graph_data)) { $px->SetData($graph_data); $px->SetYLabel($graphfiles[$key]['label']); $px->SetMaxValue($px->GetCeilMaxValue() < 0 ? 0 : $px->GetCeilMaxValue()); @@ -371,10 +350,8 @@ if ($result || empty($id)) // Show graphs $i = 0; - if (count($graphfiles) > 0) - { - foreach ($graphfiles as $key => $val) - { + if (count($graphfiles) > 0) { + foreach ($graphfiles as $key => $val) { if (!$graphfiles[$key]['file']) continue; if ($graphfiles == 'propal' && !$user->rights->propale->lire) continue; @@ -386,16 +363,14 @@ if ($result || empty($id)) if ($graphfiles == 'mrp' && empty($user->rights->mrp->mo->read)) continue; - if ($i % 2 == 0) - { + if ($i % 2 == 0) { print "\n".'
'."\n"; } else { print "\n".'
'."\n"; } // Date generation - if ($graphfiles[$key]['output'] && !$px->isGraphKo()) - { + if ($graphfiles[$key]['output'] && !$px->isGraphKo()) { if (file_exists($dir."/".$graphfiles[$key]['file']) && filemtime($dir."/".$graphfiles[$key]['file'])) $dategenerated = $langs->trans("GeneratedOn", dol_print_date(filemtime($dir."/".$graphfiles[$key]['file']), "dayhour")); else $dategenerated = $langs->trans("GeneratedOn", dol_print_date(dol_now(), "dayhour")); } else { @@ -417,8 +392,7 @@ if ($result || empty($id)) print '
'; - if ($i % 2 == 0) - { + if ($i % 2 == 0) { print "\n".''."\n"; } else { print "\n".''; @@ -429,16 +403,14 @@ if ($result || empty($id)) } } // div not closed - if ($i % 2 == 1) - { + if ($i % 2 == 1) { print "\n".'
'."\n"; print "\n".'
'; print '

'."\n"; } } -if (!$id) -{ +if (!$id) { dol_fiche_end(); }