diff --git a/htdocs/product/popuprop.php b/htdocs/product/popuprop.php index 8ffae0bee8c..32a2cd08cc9 100644 --- a/htdocs/product/popuprop.php +++ b/htdocs/product/popuprop.php @@ -178,7 +178,7 @@ $arrayofmode = array( 'facture' => 'Facture' ); $title .= ' '.$form->selectarray('mode', $arrayofmode, $mode, 1); -$title .= ' '; +$title .= ' '; print '
'; @@ -198,7 +198,7 @@ print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sort print ''; -print ""; +print ''; print_liste_field_titre('Ref', $_SERVER["PHP_SELF"], 'p.ref', '', $param, '', $sortfield, $sortorder); print_liste_field_titre('Type', $_SERVER["PHP_SELF"], 'p.fk_product_type', '', $param, '', $sortfield, $sortorder); print_liste_field_titre('Label', $_SERVER["PHP_SELF"], 'p.label', '', $param, '', $sortfield, $sortorder); diff --git a/htdocs/product/stats/card.php b/htdocs/product/stats/card.php index 6929c70a5ff..6dc40ab7477 100644 --- a/htdocs/product/stats/card.php +++ b/htdocs/product/stats/card.php @@ -45,6 +45,7 @@ $ref = GETPOST('ref', 'alpha'); $mode = (GETPOST('mode', 'alpha') ? GETPOST('mode', 'alpha') : 'byunit'); $search_year = GETPOST('search_year', 'int'); $search_categ = GETPOST('search_categ', 'int'); +$notab = GETPOST('notab', 'int'); $error = 0; $mesg = ''; @@ -56,7 +57,7 @@ if (!empty($user->socid)) { } // Security check -$fieldvalue = (!empty($id) ? $id : $ref); +$fieldvalue = ($id > 0 ? $id : $ref); $fieldtype = (!empty($ref) ? 'ref' : 'rowid'); $tmp = dol_getdate(dol_now()); @@ -65,6 +66,11 @@ if (empty($search_year)) { $search_year = $currentyear; } +$object = new Product($db); +if ($id > 0 || !empty($ref)) { + $result = $object->fetch($id, $ref); +} + $result = restrictedArea($user, 'produit|service', $fieldvalue, 'product&product', '', '', $fieldtype); @@ -81,9 +87,10 @@ $result = restrictedArea($user, 'produit|service', $fieldvalue, 'product&product $form = new Form($db); $htmlother = new FormOther($db); -$object = new Product($db); -if (!$id && empty($ref)) { +if (!($id > 0) && empty($ref) || $notab) { + $notab = 1; + llxHeader("", $langs->trans("ProductStatistics")); $type = GETPOST('type', 'int'); @@ -128,7 +135,7 @@ if (!$id && empty($ref)) { } -if ($result && (!empty($id) || !empty($ref))) { +if ($result && ($id > 0 || !empty($ref)) && empty($notab)) { $head = product_prepare_head($object); $titre = $langs->trans("CardProduct".$object->type); $picto = ($object->type == Product::TYPE_SERVICE ? 'service' : 'product'); @@ -141,11 +148,11 @@ if ($result && (!empty($id) || !empty($ref))) { print dol_get_fiche_end(); } -if (empty($id) && empty($ref)) { +if ((!($id > 0) && empty($ref)) || $notab) { $h = 0; $head = array(); - $head[$h][0] = DOL_URL_ROOT.'/product/stats/card.php'.($type != '' ? '?type='.$type : ''); + $head[$h][0] = DOL_URL_ROOT.'/product/stats/card.php'.($type != '' ? '?type='.((int) $type) : ''); $head[$h][1] = $langs->trans("Chart"); $head[$h][2] = 'chart'; $h++; @@ -158,7 +165,7 @@ if (empty($id) && empty($ref)) { $title = $langs->trans("ListProductByPopularity"); } - $head[$h][0] = DOL_URL_ROOT.'/product/popuprop.php'.($type != '' ? '?type='.$type : ''); + $head[$h][0] = DOL_URL_ROOT.'/product/popuprop.php'.($type != '' ? '?type='.((int) $type) : ''); $head[$h][1] = $langs->trans("ProductsPerPopularity"); $head[$h][2] = 'popularity'; $h++; @@ -167,21 +174,29 @@ if (empty($id) && empty($ref)) { } -if ($result || empty($id)) { +if ($result || !($id > 0)) { print ''; print ''; - print ''; + if (empty($id) || $notab) { + print ''; + } print '
'; print ''; - if (empty($id)) { + if (!($id > 0) || $notab) { // Type - print ''; + // Product + print ''; + // Tag if ($conf->categorie->enabled) { print ''; } + } else { + print ''; } // Year @@ -220,7 +237,7 @@ if ($result || empty($id)) { } if ($mode == 'bynumber') { - print 'id).($type != '' ? '&type='.$type : '').'&mode=byunit&search_year='.$search_year.'">'; + print ''; } else { print ''; } @@ -238,7 +255,7 @@ if ($result || empty($id)) { } if ($mode == 'byunit') { - print 'id).($type != '' ? '&type='.$type : '').'&mode=bynumber&search_year='.$search_year.'">'; + print ''; } else { print ''; } @@ -256,9 +273,7 @@ if ($result || empty($id)) { } print '
'; - //print '
'.$langs->trans("Filter").'
'.$langs->trans("ProductsAndServices").''; + print '
'.$langs->trans("Type").''; $array = array('-1'=>' ', '0'=>$langs->trans('Product'), '1'=>$langs->trans('Service')); print $form->selectarray('type', $array, $type); print '
'.$langs->trans("ProductOrService").''; + print img_picto('', 'product', 'class="pictofixedwidth"'); + print $form->select_produits($id, 'id', '', 0, 0, 1, 2, '', 0, array(), 0, '1', 0, 'maxwidth500'); + print '
'.$langs->trans("Categories").''; @@ -190,6 +205,8 @@ if ($result || empty($id)) { print $moreforfilter; print '
'; - - // Generation des graphs + // Generation of 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)) { @@ -383,7 +398,7 @@ if ($result || empty($id)) { $px->SetShading(3); //print 'x '.$key.' '.$graphfiles[$key]['file']; - $url = DOL_URL_ROOT.'/viewimage.php?modulepart='.$graphfiles[$key]['modulepart'].'&entity='.$object->entity.'&file='.urlencode($graphfiles[$key]['file']); + $url = DOL_URL_ROOT.'/viewimage.php?modulepart='.$graphfiles[$key]['modulepart'].'&entity='.((int) $object->entity).'&file='.urlencode($graphfiles[$key]['file']).($notab ? '¬ab='.$notab : ''); $px->draw($dir."/".$graphfiles[$key]['file'], $url); $graphfiles[$key]['total'] = $px->total(); @@ -444,7 +459,9 @@ if ($result || empty($id)) { } else { $dategenerated = ($mesg ? ''.$mesg.'' : $langs->trans("ChartNotGenerated")); } - $linktoregenerate = 'id).((string) $type != '' ? '&type='.$type : '').'&action=recalcul&mode='.$mode.'&search_year='.$search_year.'&search_categ='.$search_categ.'">'.img_picto($langs->trans("ReCalculate").' ('.$dategenerated.')', 'refresh').''; + $linktoregenerate = ' 0 ? '&search_categ='.((int) $search_categ) : '').'">'; + $linktoregenerate .= img_picto($langs->trans("ReCalculate").' ('.$dategenerated.')', 'refresh'); + $linktoregenerate .= ''; // Show graph print '
'; @@ -478,7 +495,7 @@ if ($result || empty($id)) { } } -if (!$id) { +if (!($id > 0)) { print dol_get_fiche_end(); }