';
- // Filter on categories
- $moreforfilter='';
- if ($conf->categorie->enabled)
- {
- $moreforfilter.=$langs->trans('Categories'). ': ';
- $moreforfilter.=$htmlother->select_categories(0,$search_categ,'search_categ');
- $moreforfilter.=' ';
- }
- if ($moreforfilter)
- {
- print '';
- print '| ';
- print $moreforfilter;
- print ' |
';
- }
+ // Filter on categories
+ $moreforfilter='';
+ if ($conf->categorie->enabled)
+ {
+ $moreforfilter.=$langs->trans('Categories'). ': ';
+ $moreforfilter.=$htmlother->select_categories(0,$search_categ,'search_categ');
+ $moreforfilter.=' ';
+ }
+ if ($moreforfilter)
+ {
+ print '';
+ print '| ';
+ print $moreforfilter;
+ print ' |
';
+ }
- // Lignes des titres
- print "";
- print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"], "p.ref",$param,"","",$sortfield,$sortorder);
- print_liste_field_titre($langs->trans("Label"), $_SERVER["PHP_SELF"], "p.label",$param,"","",$sortfield,$sortorder);
- if ($conf->barcode->enabled) print_liste_field_titre($langs->trans("BarCode"), $_SERVER["PHP_SELF"], "p.barcode",$param,"","",$sortfield,$sortorder);
- print_liste_field_titre($langs->trans("DateModification"), $_SERVER["PHP_SELF"], "p.tms",$param,"",'align="center"',$sortfield,$sortorder);
- if ($conf->service->enabled && $type != 0) print_liste_field_titre($langs->trans("Duration"), $_SERVER["PHP_SELF"], "p.duration",$param,"",'align="center"',$sortfield,$sortorder);
- if (empty($conf->global->PRODUIT_MULTIPRICES)) print_liste_field_titre($langs->trans("SellingPrice"), $_SERVER["PHP_SELF"], "p.price",$param,"",'align="right"',$sortfield,$sortorder);
- print '| '.$langs->trans("BuyingPriceMinShort").' | ';
- if ($conf->stock->enabled && $user->rights->stock->lire && $type != 1) print ''.$langs->trans("PhysicalStock").' | ';
- print_liste_field_titre($langs->trans("Sell"), $_SERVER["PHP_SELF"], "p.tosell",$param,"",'align="right"',$sortfield,$sortorder);
- print_liste_field_titre($langs->trans("Buy"), $_SERVER["PHP_SELF"], "p.tobuy",$param,"",'align="right"',$sortfield,$sortorder);
- print "
\n";
+ // Lignes des titres
+ print "";
+ print_liste_field_titre($langs->trans("Ref"), $_SERVER["PHP_SELF"], "p.ref",$param,"","",$sortfield,$sortorder);
+ print_liste_field_titre($langs->trans("Label"), $_SERVER["PHP_SELF"], "p.label",$param,"","",$sortfield,$sortorder);
+ if ($conf->barcode->enabled) print_liste_field_titre($langs->trans("BarCode"), $_SERVER["PHP_SELF"], "p.barcode",$param,"","",$sortfield,$sortorder);
+ print_liste_field_titre($langs->trans("DateModification"), $_SERVER["PHP_SELF"], "p.tms",$param,"",'align="center"',$sortfield,$sortorder);
+ if ($conf->service->enabled && $type != 0) print_liste_field_titre($langs->trans("Duration"), $_SERVER["PHP_SELF"], "p.duration",$param,"",'align="center"',$sortfield,$sortorder);
+ if (empty($conf->global->PRODUIT_MULTIPRICES)) print_liste_field_titre($langs->trans("SellingPrice"), $_SERVER["PHP_SELF"], "p.price",$param,"",'align="right"',$sortfield,$sortorder);
+ print '| '.$langs->trans("BuyingPriceMinShort").' | ';
+ if ($conf->stock->enabled && $user->rights->stock->lire && $type != 1) print ''.$langs->trans("PhysicalStock").' | ';
+ print_liste_field_titre($langs->trans("Sell"), $_SERVER["PHP_SELF"], "p.tosell",$param,"",'align="right"',$sortfield,$sortorder);
+ print_liste_field_titre($langs->trans("Buy"), $_SERVER["PHP_SELF"], "p.tobuy",$param,"",'align="right"',$sortfield,$sortorder);
+ print "
\n";
- // Lignes des champs de filtre
- print '';
- print '| ';
- print '';
- print ' | ';
- print '';
- print '';
- print ' | ';
- if ($conf->barcode->enabled)
- {
- print '';
- print '';
- print ' | ';
- }
+ // Lignes des champs de filtre
+ print '
';
+ print '| ';
+ print '';
+ print ' | ';
+ print '';
+ print '';
+ print ' | ';
+ if ($conf->barcode->enabled)
+ {
+ print '';
+ print '';
+ print ' | ';
+ }
+ print '';
+ print ' ';
+ print ' | ';
+
+ // Duration
+ if ($conf->service->enabled && $type != 0)
+ {
+ print '';
+ print ' ';
+ print ' | ';
+ }
+
+ // Sell price
+ if (empty($conf->global->PRODUIT_MULTIPRICES))
+ {
print '';
print ' ';
print ' | ';
+ }
- // Duration
- if ($conf->service->enabled && $type != 0)
- {
- print '';
- print ' ';
+ // Minimum buying Price
+ print ' | ';
+ print ' ';
+ print ' | ';
+
+ // Stock
+ if ($conf->stock->enabled && $user->rights->stock->lire && $type != 1)
+ {
+ print '';
+ print ' ';
+ print ' | ';
+ }
+
+ print '';
+ print ' ';
+ print ' | ';
+
+ print '';
+ print '';
+ print '';
+ print ' | ';
+ print '
';
+
+
+ $product_static=new Product($db);
+ $product_fourn =new ProductFournisseur($db);
+
+ $var=true;
+ while ($i < min($num,$limit))
+ {
+ $objp = $db->fetch_object($resql);
+
+ // Multilangs
+ if ($conf->global->MAIN_MULTILANGS) // si l'option est active
+ {
+ $sql = "SELECT label";
+ $sql.= " FROM ".MAIN_DB_PREFIX."product_lang";
+ $sql.= " WHERE fk_product=".$objp->rowid;
+ $sql.= " AND lang='". $langs->getDefaultLang() ."'";
+ $sql.= " LIMIT 1";
+
+ $result = $db->query($sql);
+ if ($result)
+ {
+ $objtp = $db->fetch_object($result);
+ if ($objtp->label != '') $objp->label = $objtp->label;
+ }
+ }
+
+ $var=!$var;
+ print '';
+
+ // Ref
+ print '| ';
+ $product_static->id = $objp->rowid;
+ $product_static->ref = $objp->ref;
+ $product_static->type = $objp->fk_product_type;
+ print $product_static->getNomUrl(1,'',24);
+ print " | \n";
+
+ // Label
+ print ''.dol_trunc($objp->label,40).' | ';
+
+ // Barcode
+ if ($conf->barcode->enabled)
+ {
+ print ''.$objp->barcode.' | ';
+ }
+
+ // Date
+ print ''.dol_print_date($db->jdate($objp->datem),'day')." | \n";
+
+ // Duration
+ if ($conf->service->enabled && $type != 0)
+ {
+ print '';
+ if (preg_match('/([0-9]+)y/i',$objp->duration,$regs)) print $regs[1].' '.$langs->trans("DurationYear");
+ elseif (preg_match('/([0-9]+)m/i',$objp->duration,$regs)) print $regs[1].' '.$langs->trans("DurationMonth");
+ elseif (preg_match('/([0-9]+)w/i',$objp->duration,$regs)) print $regs[1].' '.$langs->trans("DurationWeek");
+ elseif (preg_match('/([0-9]+)d/i',$objp->duration,$regs)) print $regs[1].' '.$langs->trans("DurationDay");
+ else print $objp->duration;
+ print ' | ';
+ }
+
+ // Sell price
+ if (empty($conf->global->PRODUIT_MULTIPRICES))
+ {
+ print '';
+ if ($objp->price_base_type == 'TTC') print price($objp->price_ttc).' '.$langs->trans("TTC");
+ else print price($objp->price).' '.$langs->trans("HT");
print ' | ';
- }
+ }
- // Sell price
- if (empty($conf->global->PRODUIT_MULTIPRICES))
+ // Better buy price
+ print '';
+ if ($objp->minsellprice != '')
{
- print ' | ';
- print ' ';
- print ' | ';
+ //print price($objp->minsellprice).' '.$langs->trans("HT");
+ if ($product_fourn->find_min_price_product_fournisseur($objp->rowid) > 0)
+ {
+ if ($product_fourn->product_fourn_price_id > 0)
+ {
+ $htmltext=$product_fourn->display_price_product_fournisseur();
+ if ($conf->fournisseur->enabled && $user->rights->fournisseur->lire) print $html->textwithpicto(price($product_fourn->fourn_unitprice).' '.$langs->trans("HT"),$htmltext);
+ else print price($product_fourn->fourn_unitprice).' '.$langs->trans("HT");
+ }
+ }
}
-
- // Minimum buying Price
- print '';
- print ' ';
- print ' | ';
-
- // Stock
- if ($conf->stock->enabled && $user->rights->stock->lire && $type != 1)
- {
- print '';
- print ' ';
- print ' | ';
- }
-
- print '';
- print ' ';
print ' | ';
- print '';
- print '';
- print '';
- print ' | ';
- print '
';
+ // Show stock
+ if ($conf->stock->enabled && $user->rights->stock->lire && $type != 1)
+ {
+ if ($objp->fk_product_type != 1)
+ {
+ $product_static->id = $objp->rowid;
+ $product_static->load_stock();
+ print '';
+ if ($product_static->stock_reel < $objp->seuil_stock_alerte) print img_warning($langs->trans("StockTooLow")).' ';
+ print $product_static->stock_reel;
+ print ' | ';
+ }
+ else
+ {
+ print ' | ';
+ }
+ }
+ // Status (to buy)
+ print ''.$product_static->LibStatut($objp->tosell,5,0).' | ';
- $product_static=new Product($db);
- $product_fourn =new ProductFournisseur($db);
+ // Status (to sell)
+ print ''.$product_static->LibStatut($objp->tobuy,5,1).' | ';
- $var=true;
- while ($i < min($num,$limit))
- {
- $objp = $db->fetch_object($resql);
+ print "\n";
+ $i++;
+ }
- // Multilangs
- if ($conf->global->MAIN_MULTILANGS) // si l'option est active
- {
- $sql = "SELECT label";
- $sql.= " FROM ".MAIN_DB_PREFIX."product_lang";
- $sql.= " WHERE fk_product=".$objp->rowid;
- $sql.= " AND lang='". $langs->getDefaultLang() ."'";
- $sql.= " LIMIT 1";
+ if ($num > $conf->liste_limit)
+ {
+ if ($sref || $snom || $sall || $sbarcode || $_POST["search"])
+ {
+ print_barre_liste('', $page, "liste.php", "&sref=".$sref."&snom=".$snom."&sall=".$sall."&tosell=".$tosell."&tobuy=".$tobuy, $sortfield, $sortorder,'',$num);
+ }
+ else
+ {
+ print_barre_liste('', $page, "liste.php", "&sref=$sref&snom=$snom&fourn_id=$fourn_id".(isset($type)?"&type=$type":"")."&tosell=".$tosell."&tobuy=".$tobuy, $sortfield, $sortorder,'',$num);
+ }
+ }
- $result = $db->query($sql);
- if ($result)
- {
- $objtp = $db->fetch_object($result);
- if ($objtp->label != '') $objp->label = $objtp->label;
- }
- }
+ $db->free($resql);
- $var=!$var;
- print '';
-
- // Ref
- print '| ';
- $product_static->id = $objp->rowid;
- $product_static->ref = $objp->ref;
- $product_static->type = $objp->fk_product_type;
- print $product_static->getNomUrl(1,'',24);
- print " | \n";
-
- // Label
- print ''.dol_trunc($objp->label,40).' | ';
-
- // Barcode
- if ($conf->barcode->enabled)
- {
- print ''.$objp->barcode.' | ';
- }
-
- // Date
- print ''.dol_print_date($db->jdate($objp->datem),'day')." | \n";
-
- // Duration
- if ($conf->service->enabled && $type != 0)
- {
- print '';
- if (preg_match('/([0-9]+)y/i',$objp->duration,$regs)) print $regs[1].' '.$langs->trans("DurationYear");
- elseif (preg_match('/([0-9]+)m/i',$objp->duration,$regs)) print $regs[1].' '.$langs->trans("DurationMonth");
- elseif (preg_match('/([0-9]+)w/i',$objp->duration,$regs)) print $regs[1].' '.$langs->trans("DurationWeek");
- elseif (preg_match('/([0-9]+)d/i',$objp->duration,$regs)) print $regs[1].' '.$langs->trans("DurationDay");
- else print $objp->duration;
- print ' | ';
- }
-
- // Sell price
- if (empty($conf->global->PRODUIT_MULTIPRICES))
- {
- print '';
- if ($objp->price_base_type == 'TTC') print price($objp->price_ttc).' '.$langs->trans("TTC");
- else print price($objp->price).' '.$langs->trans("HT");
- print ' | ';
- }
-
- // Better buy price
- print '';
- if ($objp->minsellprice != '')
- {
- //print price($objp->minsellprice).' '.$langs->trans("HT");
- if ($product_fourn->find_min_price_product_fournisseur($objp->rowid) > 0)
- {
- if ($product_fourn->product_fourn_price_id > 0)
- {
- $htmltext=$product_fourn->display_price_product_fournisseur();
- if ($conf->fournisseur->enabled && $user->rights->fournisseur->lire) print $html->textwithpicto(price($product_fourn->fourn_unitprice).' '.$langs->trans("HT"),$htmltext);
- else print price($product_fourn->fourn_unitprice).' '.$langs->trans("HT");
- }
- }
- }
- print ' | ';
-
- // Show stock
- if ($conf->stock->enabled && $user->rights->stock->lire && $type != 1)
- {
- if ($objp->fk_product_type != 1)
- {
- $product_static->id = $objp->rowid;
- $product_static->load_stock();
- print '';
- if ($product_static->stock_reel < $objp->seuil_stock_alerte) print img_warning($langs->trans("StockTooLow")).' ';
- print $product_static->stock_reel;
- print ' | ';
- }
- else
- {
- print ' | ';
- }
- }
-
- // Status (to buy)
- print ''.$product_static->LibStatut($objp->tosell,5,0).' | ';
-
- // Status (to sell)
- print ''.$product_static->LibStatut($objp->tobuy,5,1).' | ';
-
- print "
\n";
- $i++;
- }
-
- if ($num > $conf->liste_limit)
- {
- if ($sref || $snom || $sall || $sbarcode || $_POST["search"])
- {
- print_barre_liste('', $page, "liste.php", "&sref=".$sref."&snom=".$snom."&sall=".$sall."&tosell=".$tosell."&tobuy=".$tobuy, $sortfield, $sortorder,'',$num);
- }
- else
- {
- print_barre_liste('', $page, "liste.php", "&sref=$sref&snom=$snom&fourn_id=$fourn_id".(isset($type)?"&type=$type":"")."&tosell=".$tosell."&tobuy=".$tobuy, $sortfield, $sortorder,'',$num);
- }
- }
-
- $db->free($resql);
-
- print "
";
- print '';
- }
- }
- else
- {
- dol_print_error($db);
- }
+ print "