From 0104f00a7a6cc347f2e9c2d8e8198c29e8b97efa Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 9 Jun 2022 11:12:45 +0200 Subject: [PATCH] Debug v16 --- htdocs/fourn/product/list.php | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/htdocs/fourn/product/list.php b/htdocs/fourn/product/list.php index 2665f987a10..a89b25c2201 100644 --- a/htdocs/fourn/product/list.php +++ b/htdocs/fourn/product/list.php @@ -33,10 +33,6 @@ require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php'; $langs->loadLangs(array("products", "suppliers")); -if (!$user->rights->produit->lire && !$user->rights->service->lire) { - accessforbidden(); -} - $sref = GETPOST('sref', 'alphanohtml'); $sRefSupplier = GETPOST('srefsupplier'); $snom = GETPOST('snom', 'alphanohtml'); @@ -72,13 +68,15 @@ $catid = GETPOST('catid', 'intcomma'); $hookmanager->initHooks(array('supplierpricelist')); $extrafields = new ExtraFields($db); +if (empty($user->rights->produit->lire) && empty($user->rights->service->lire)) { + accessforbidden(); +} +$permissiontoadd = ($user->hasRight('produit', 'lire') || $user->hasRight('service', 'lire')); /* - * ACTIONS - * - * Put here all code to do according to value of "action" parameter + * Actions */ if (GETPOST('cancel', 'alpha')) { @@ -228,7 +226,11 @@ if ($resql) { if ($optioncss != '') { $param .= '&optioncss='.$optioncss; } - print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords); + + $newcardbutton = ''; + $newcardbutton .= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/product/list.php?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']), '', $permissiontoadd); + + print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'generic', 0, $newcardbutton); if (!empty($catid)) { print "
"; @@ -358,6 +360,12 @@ if ($resql) { } $db->free($resql); + // If no record found + if ($num == 0) { + $colspan = 8; + print ''.$langs->trans("NoRecordFound").''; + } + print "
"; print '';