Qual: Simplify and fix multiprice management

This commit is contained in:
Laurent Destailleur 2009-01-10 00:44:38 +00:00
parent aa23471000
commit d724ee4427
6 changed files with 201 additions and 206 deletions

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -15,17 +15,13 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
* $Source$
*
*/ */
/** /**
\file htdocs/expedition/stats/index.php \file htdocs/expedition/stats/index.php
\ingroup expedition \ingroup expedition
\brief Page des stats expeditions \brief Page des stats expeditions
\version $Revision$ \version $Id$
*/ */
require("./pre.inc.php"); require("./pre.inc.php");
@ -59,7 +55,7 @@ if ($db->query($sql))
} }
$db->free(); $db->free();
print '</table><br><i>Statistiques effectuées sur les expéditions validées uniquement</i>'; print '</table><br><i>Statistiques effectuees sur les expeditions validees uniquement</i>';
$db->close(); $db->close();

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -63,7 +63,7 @@ if (! $mesg)
} }
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
print '<tr><td align="center">Nombre d\'expédition par mois</td>'; print '<tr><td align="center">Nombre d expedition par mois</td>';
print '<td align="center">'; print '<td align="center">';
print '<img src="'.$fileurl.'">'; print '<img src="'.$fileurl.'">';
print '</td></tr>'; print '</td></tr>';
@ -71,5 +71,5 @@ print '</table>';
$db->close(); $db->close();
llxFooter("<em>Derni&egrave;re modification $Date$ r&eacute;vision $Revision$</em>"); llxFooter('$Date$ - $Revision$');
?> ?>

View File

@ -844,22 +844,9 @@ if ($_GET["id"] || $_GET["ref"])
print '<tr><td>'.$langs->trans("Label").'</td><td>'.$product->libelle.'</td></tr>'; print '<tr><td>'.$langs->trans("Label").'</td><td>'.$product->libelle.'</td></tr>';
// MultiPrix // MultiPrix
if($conf->global->PRODUIT_MULTIPRICES == 1) if($conf->global->PRODUIT_MULTIPRICES)
{ {
print '<tr><td>'.$langs->trans("SellingPrice").' 1</td>'; for ($i=1; $i<=$conf->global->PRODUIT_MULTIPRICES_LIMIT; $i++)
if ($product->price_base_type == 'TTC')
{
print '<td>'.price($product->price_ttc);
}
else
{
print '<td>'.price($product->price);
}
print ' '.$langs->trans($product->price_base_type);
print '</td></tr>';
for($i=2;$i<=$conf->global->PRODUIT_MULTIPRICES_LIMIT;$i++)
{ {
print '<tr><td>'.$langs->trans("SellingPrice").' '.$i.'</td>'; print '<tr><td>'.$langs->trans("SellingPrice").' '.$i.'</td>';
@ -880,13 +867,24 @@ if ($_GET["id"] || $_GET["ref"])
{ {
print ' '.$langs->trans($product->price_base_type); print ' '.$langs->trans($product->price_base_type);
} }
print '</td></tr>';
// Prix mini
print '<tr><td>'.$langs->trans("MinPrice").' '.$i.'</td><td>';
if ($product->multiprices_base_type["$i"] == 'TTC')
{
print price($product->multiprices_min_ttc["$i"]).' '.$langs->trans($product->multiprices_base_type["$i"]);
}
else
{
print price($product->multiprices_min["$i"]).' '.$langs->trans($product->multiprices_base_type["$i"]);
}
print '</td></tr>'; print '</td></tr>';
} }
} }
// Prix
else else
{ {
// Prix
print '<tr><td>'.$langs->trans("SellingPrice").'</td><td>'; print '<tr><td>'.$langs->trans("SellingPrice").'</td><td>';
if ($product->price_base_type == 'TTC') if ($product->price_base_type == 'TTC')
{ {
@ -897,19 +895,19 @@ if ($_GET["id"] || $_GET["ref"])
print price($product->price).' '.$langs->trans($product->price_base_type); print price($product->price).' '.$langs->trans($product->price_base_type);
} }
print '</td></tr>'; print '</td></tr>';
}
// Prix mini // Prix mini
print '<tr><td>'.$langs->trans("MinPrice").'</td><td>'; print '<tr><td>'.$langs->trans("MinPrice").'</td><td>';
if ($product->price_base_type == 'TTC') if ($product->price_base_type == 'TTC')
{ {
print price($product->price_min_ttc).' '.$langs->trans($product->price_base_type); print price($product->price_min_ttc).' '.$langs->trans($product->price_base_type);
}
else
{
print price($product->price_min).' '.$langs->trans($product->price_base_type);
}
print '</td></tr>';
} }
else
{
print price($product->price_min).' '.$langs->trans($product->price_base_type);
}
print '</td></tr>';
// TVA // TVA
print '<tr><td>'.$langs->trans("VATRate").'</td><td>'.vatrate($product->tva_tx,true).'</td></tr>'; print '<tr><td>'.$langs->trans("VATRate").'</td><td>'.vatrate($product->tva_tx,true).'</td></tr>';

View File

@ -156,7 +156,7 @@ if ($conf->global->PRODUIT_MULTIPRICES)
print '</td></tr>'; print '</td></tr>';
// Prix minimum // Prix minimum
print '<tr><td>'.$langs->trans("MinPrice").'</td><td>'; print '<tr><td>'.$langs->trans("MinPrice").' '.$i.'</td><td>';
if ($product->multiprices_base_type["$i"] == 'TTC') if ($product->multiprices_base_type["$i"] == 'TTC')
{ {
print price($product->multiprices_min_ttc["$i"]).' '.$langs->trans($product->multiprices_base_type["$i"]); print price($product->multiprices_min_ttc["$i"]).' '.$langs->trans($product->multiprices_base_type["$i"]);
@ -314,7 +314,7 @@ if ($_GET["action"] == 'edit_price' && $user->rights->produit->creer)
print '</td></tr>'; print '</td></tr>';
print '<tr><td>'; print '<tr><td>';
$text=$langs->trans('MinPrice') ; $text=$langs->trans('MinPrice').' '.$i;
print $html->textwithhelp($text,$langs->trans("PrecisionUnitIsLimitedToXDecimals",$conf->global->MAIN_MAX_DECIMALS_UNIT),$direction=1,$usehelpcursor=1); print $html->textwithhelp($text,$langs->trans("PrecisionUnitIsLimitedToXDecimals",$conf->global->MAIN_MAX_DECIMALS_UNIT),$direction=1,$usehelpcursor=1);
if ($product->multiprices_base_type["$i"] == 'TTC') if ($product->multiprices_base_type["$i"] == 'TTC')
{ {

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2001-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2001-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2006 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2005-2006 Regis Houssin <regis@dolibarr.fr>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -19,11 +19,11 @@
*/ */
/** /**
\file htdocs/product/reassort.php * \file htdocs/product/reassort.php
\ingroup produit * \ingroup produit
\brief Page liste des produits ou services * \brief Page liste des produits ou services
\version $Id$ * \version $Id$
*/ */
require("./pre.inc.php"); require("./pre.inc.php");
require_once(DOL_DOCUMENT_ROOT.'/product.class.php'); require_once(DOL_DOCUMENT_ROOT.'/product.class.php');
@ -33,7 +33,7 @@ $langs->load("products");
$langs->load("stocks"); $langs->load("stocks");
if (!$user->rights->produit->lire) if (!$user->rights->produit->lire)
accessforbidden(); accessforbidden();
$sref=isset($_GET["sref"])?$_GET["sref"]:$_POST["sref"]; $sref=isset($_GET["sref"])?$_GET["sref"]:$_POST["sref"];
@ -55,13 +55,13 @@ $offset = $limit * $page ;
if (isset($_POST["button_removefilter_x"])) if (isset($_POST["button_removefilter_x"]))
{ {
$sref=""; $sref="";
$snom=""; $snom="";
} }
if (isset($_REQUEST['catid'])) if (isset($_REQUEST['catid']))
{ {
$catid = $_REQUEST['catid']; $catid = $_REQUEST['catid'];
} }
@ -81,51 +81,51 @@ $sql.= ' FROM '.MAIN_DB_PREFIX.'product_stock as s,';
$sql.= ' '.MAIN_DB_PREFIX.'product as p'; $sql.= ' '.MAIN_DB_PREFIX.'product as p';
if ($catid || ($conf->categorie->enabled && ! $user->rights->categorie->voir)) if ($catid || ($conf->categorie->enabled && ! $user->rights->categorie->voir))
{ {
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."categorie_product as cp ON cp.fk_product = p.rowid"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."categorie_product as cp ON cp.fk_product = p.rowid";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."categorie as c ON cp.fk_categorie = c.rowid"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."categorie as c ON cp.fk_categorie = c.rowid";
} }
if ($_GET["fourn_id"] > 0) if ($_GET["fourn_id"] > 0)
{ {
$fourn_id = $_GET["fourn_id"]; $fourn_id = $_GET["fourn_id"];
$sql .= ", ".MAIN_DB_PREFIX."product_fournisseur as pf"; $sql .= ", ".MAIN_DB_PREFIX."product_fournisseur as pf";
} }
$sql .= " WHERE p.rowid = s.fk_product"; $sql .= " WHERE p.rowid = s.fk_product";
if ($sall) if ($sall)
{ {
$sql .= " AND (p.ref like '%".addslashes($sall)."%' OR p.label like '%".addslashes($sall)."%' OR p.description like '%".addslashes($sall)."%' OR p.note like '%".addslashes($sall)."%')"; $sql .= " AND (p.ref like '%".addslashes($sall)."%' OR p.label like '%".addslashes($sall)."%' OR p.description like '%".addslashes($sall)."%' OR p.note like '%".addslashes($sall)."%')";
} }
if ($type==1) if ($type==1)
{ {
$sql .= " AND p.fk_product_type = '1'"; $sql .= " AND p.fk_product_type = '1'";
} }
else else
{ {
$sql .= " AND p.fk_product_type <> '1'"; $sql .= " AND p.fk_product_type <> '1'";
} }
if ($sref) if ($sref)
{ {
$sql .= " AND p.ref like '%".$sref."%'"; $sql .= " AND p.ref like '%".$sref."%'";
} }
if ($snom) if ($snom)
{ {
$sql .= " AND p.label like '%".addslashes($snom)."%'"; $sql .= " AND p.label like '%".addslashes($snom)."%'";
} }
if (isset($_GET["envente"]) && strlen($_GET["envente"]) > 0) if (isset($_GET["envente"]) && strlen($_GET["envente"]) > 0)
{ {
$sql .= " AND p.envente = ".$_GET["envente"]; $sql .= " AND p.envente = ".$_GET["envente"];
} }
if($catid) if($catid)
{ {
$sql .= " AND cp.fk_categorie = ".$catid; $sql .= " AND cp.fk_categorie = ".$catid;
} }
if ($conf->categorie->enabled && !$user->rights->categorie->voir) if ($conf->categorie->enabled && !$user->rights->categorie->voir)
{ {
$sql.= ' AND IFNULL(c.visible,1)=1'; $sql.= ' AND IFNULL(c.visible,1)=1';
} }
if ($fourn_id > 0) if ($fourn_id > 0)
{ {
$sql .= " AND p.rowid = pf.fk_product AND pf.fk_soc = ".$fourn_id; $sql .= " AND p.rowid = pf.fk_product AND pf.fk_soc = ".$fourn_id;
} }
$sql .= " GROUP BY p.rowid"; $sql .= " GROUP BY p.rowid";
$sql .= " ORDER BY $sortfield $sortorder "; $sql .= " ORDER BY $sortfield $sortorder ";
@ -134,161 +134,161 @@ $resql = $db->query($sql) ;
if ($resql) if ($resql)
{ {
$num = $db->num_rows($resql); $num = $db->num_rows($resql);
$i = 0; $i = 0;
if ($num == 1 && ($sall or $snom or $sref)) if ($num == 1 && ($sall or $snom or $sref))
{ {
$objp = $db->fetch_object($resql); $objp = $db->fetch_object($resql);
Header("Location: fiche.php?id=$objp->rowid"); Header("Location: fiche.php?id=$objp->rowid");
exit; exit;
} }
if (isset($_GET["envente"]) || isset($_POST["envente"])) if (isset($_GET["envente"]) || isset($_POST["envente"]))
{ {
$envente = (isset($_GET["envente"])?$_GET["envente"]:$_POST["envente"]); $envente = (isset($_GET["envente"])?$_GET["envente"]:$_POST["envente"]);
} }
if (isset($_GET["type"]) || isset($_POST["type"])) if (isset($_GET["type"]) || isset($_POST["type"]))
{ {
if ($type==1) { $texte = $langs->trans("Services"); } if ($type==1) { $texte = $langs->trans("Services"); }
else { $texte = $langs->trans("Products"); } else { $texte = $langs->trans("Products"); }
} else { } else {
$texte = $langs->trans("ProductsAndServices"); $texte = $langs->trans("ProductsAndServices");
} }
llxHeader("","",$texte); llxHeader("","",$texte);
if ($sref || $snom || $sall || $_POST["search"]) if ($sref || $snom || $sall || $_POST["search"])
{ {
print_barre_liste($texte, $page, "reassort.php", "&sref=".$sref."&snom=".$snom."&amp;sall=".$sall."&amp;envente=".$_POST["envente"], $sortfield, $sortorder,'',$num); print_barre_liste($texte, $page, "reassort.php", "&sref=".$sref."&snom=".$snom."&amp;sall=".$sall."&amp;envente=".$_POST["envente"], $sortfield, $sortorder,'',$num);
} }
else else
{ {
print_barre_liste($texte, $page, "reassort.php", "&sref=$sref&snom=$snom&fourn_id=$fourn_id".(isset($type)?"&amp;type=$type":""), $sortfield, $sortorder,'',$num); print_barre_liste($texte, $page, "reassort.php", "&sref=$sref&snom=$snom&fourn_id=$fourn_id".(isset($type)?"&amp;type=$type":""), $sortfield, $sortorder,'',$num);
} }
if (isset($catid)) if (isset($catid))
{ {
print "<div id='ways'>"; print "<div id='ways'>";
$c = new Categorie ($db, $catid); $c = new Categorie ($db, $catid);
$ways = $c->print_all_ways(' &gt; ','product/reassort.php'); $ways = $c->print_all_ways(' &gt; ','product/reassort.php');
print " &gt; ".$ways[0]."<br />\n"; print " &gt; ".$ways[0]."<br />\n";
print "</div><br />"; print "</div><br />";
} }
print '<form action="reassort.php" method="post" name="formulaire">'; print '<form action="reassort.php" method="post" name="formulaire">';
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">'; print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">'; print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="type" value="'.$type.'">'; print '<input type="hidden" name="type" value="'.$type.'">';
print '<table class="liste" width="100%">'; print '<table class="liste" width="100%">';
// Lignes des titres // Lignes des titres
print "<tr class=\"liste_titre\">"; print "<tr class=\"liste_titre\">";
print_liste_field_titre($langs->trans("Ref"),"reassort.php", "p.ref","&amp;envente=$envente".(isset($type)?"&amp;type=$type":"")."&fourn_id=$fourn_id&amp;snom=$snom&amp;sref=$sref","","",$sortfield,$sortorder); print_liste_field_titre($langs->trans("Ref"),"reassort.php", "p.ref","&amp;envente=$envente".(isset($type)?"&amp;type=$type":"")."&fourn_id=$fourn_id&amp;snom=$snom&amp;sref=$sref","","",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Label"),"reassort.php", "p.label","&envente=$envente&".(isset($type)?"&amp;type=$type":"")."&fourn_id=$fourn_id&amp;snom=$snom&amp;sref=$sref","","",$sortfield,$sortorder); print_liste_field_titre($langs->trans("Label"),"reassort.php", "p.label","&envente=$envente&".(isset($type)?"&amp;type=$type":"")."&fourn_id=$fourn_id&amp;snom=$snom&amp;sref=$sref","","",$sortfield,$sortorder);
//print_liste_field_titre($langs->trans("TheoreticalStock"),"reassort.php", "stock_theorique","&envente=$envente&".(isset($type)?"&amp;type=$type":"")."&fourn_id=$fourn_id&amp;snom=$snom&amp;sref=$sref","",'align="right"',$sortfield,$sortorder); //print_liste_field_titre($langs->trans("TheoreticalStock"),"reassort.php", "stock_theorique","&envente=$envente&".(isset($type)?"&amp;type=$type":"")."&fourn_id=$fourn_id&amp;snom=$snom&amp;sref=$sref","",'align="right"',$sortfield,$sortorder);
if ($conf->service->enabled && $type == 1) print_liste_field_titre($langs->trans("Duration"),"reassort.php", "p.duration","&envente=$envente&".(isset($type)?"&amp;type=$type":"")."&fourn_id=$fourn_id&amp;snom=$snom&amp;sref=$sref","",'align="center"',$sortfield,$sortorder); if ($conf->service->enabled && $type == 1) print_liste_field_titre($langs->trans("Duration"),"reassort.php", "p.duration","&envente=$envente&".(isset($type)?"&amp;type=$type":"")."&fourn_id=$fourn_id&amp;snom=$snom&amp;sref=$sref","",'align="center"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("PhysicalStock"),"reassort.php", "stock_physique","&envente=$envente&".(isset($type)?"&amp;type=$type":"")."&fourn_id=$fourn_id&amp;snom=$snom&amp;sref=$sref","",'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("PhysicalStock"),"reassort.php", "stock_physique","&envente=$envente&".(isset($type)?"&amp;type=$type":"")."&fourn_id=$fourn_id&amp;snom=$snom&amp;sref=$sref","",'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("MininumStock"),"reassort.php", "p.seuil_stock_alerte","&envente=$envente&".(isset($type)?"&amp;type=$type":"")."&fourn_id=$fourn_id&amp;snom=$snom&amp;sref=$sref","",'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("MininumStock"),"reassort.php", "p.seuil_stock_alerte","&envente=$envente&".(isset($type)?"&amp;type=$type":"")."&fourn_id=$fourn_id&amp;snom=$snom&amp;sref=$sref","",'align="right"',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Status"),"reassort.php", "p.envente","&envente=$envente&".(isset($type)?"&amp;type=$type":"")."&fourn_id=$fourn_id&amp;snom=$snom&amp;sref=$sref","",'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Status"),"reassort.php", "p.envente","&envente=$envente&".(isset($type)?"&amp;type=$type":"")."&fourn_id=$fourn_id&amp;snom=$snom&amp;sref=$sref","",'align="right"',$sortfield,$sortorder);
print "</tr>\n"; print "</tr>\n";
// Lignes des champs de filtre // Lignes des champs de filtre
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td class="liste_titre">'; print '<td class="liste_titre">';
print '<input class="flat" type="text" name="sref" value="'.$sref.'">'; print '<input class="flat" type="text" name="sref" value="'.$sref.'">';
print '</td>'; print '</td>';
print '<td class="liste_titre">'; print '<td class="liste_titre">';
print '<input class="flat" type="text" name="snom" value="'.$snom.'">'; print '<input class="flat" type="text" name="snom" value="'.$snom.'">';
print '</td>'; print '</td>';
if ($conf->service->enabled && $type == 1) if ($conf->service->enabled && $type == 1)
{ {
print '<td class="liste_titre">'; print '<td class="liste_titre">';
print '&nbsp;'; print '&nbsp;';
print '</td>'; print '</td>';
} }
print '<td class="liste_titre" colspan="2">'; print '<td class="liste_titre" colspan="2">';
print '&nbsp;'; print '&nbsp;';
print '</td>'; print '</td>';
print '<td class="liste_titre" align="right">'; print '<td class="liste_titre" align="right">';
print '<input type="image" class="liste_titre" name="button_search" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/search.png" alt="'.$langs->trans("Search").'">'; print '<input type="image" class="liste_titre" name="button_search" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/search.png" alt="'.$langs->trans("Search").'">';
print '<input type="image" class="liste_titre" name="button_removefilter" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/searchclear.png" alt="'.$langs->trans("RemoveFilter").'">'; print '<input type="image" class="liste_titre" name="button_removefilter" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/searchclear.png" alt="'.$langs->trans("RemoveFilter").'">';
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
$product_static=new Product($db); $product_static=new Product($db);
$var=True; $var=True;
while ($i < min($num,$limit)) while ($i < min($num,$limit))
{ {
$objp = $db->fetch_object($resql); $objp = $db->fetch_object($resql);
// Multilangs // Multilangs
if ($conf->global->MAIN_MULTILANGS) // si l'option est active if ($conf->global->MAIN_MULTILANGS) // si l'option est active
{ {
$sql = "SELECT label FROM ".MAIN_DB_PREFIX."product_det"; $sql = "SELECT label FROM ".MAIN_DB_PREFIX."product_det";
$sql.= " WHERE fk_product=".$objp->rowid." AND lang='". $langs->getDefaultLang() ."'"; $sql.= " WHERE fk_product=".$objp->rowid." AND lang='". $langs->getDefaultLang() ."'";
$sql.= " LIMIT 1"; $sql.= " LIMIT 1";
$result = $db->query($sql); $result = $db->query($sql);
if ($result) if ($result)
{ {
$objtp = $db->fetch_object($result); $objtp = $db->fetch_object($result);
if ($objtp->label != '') $objp->label = $objtp->label; if ($objtp->label != '') $objp->label = $objtp->label;
} }
} }
$var=!$var; $var=!$var;
print '<tr '.$bc[$var].'><td nowrap="nowrap">'; print '<tr '.$bc[$var].'><td nowrap="nowrap">';
$product_static->ref=$objp->ref; $product_static->ref=$objp->ref;
$product_static->id=$objp->rowid; $product_static->id=$objp->rowid;
$product_static->type=$objp->fk_product_type; $product_static->type=$objp->fk_product_type;
print $product_static->getNomUrl(1,'',16); print $product_static->getNomUrl(1,'',16);
//if ($objp->stock_theorique < $objp->seuil_stock_alerte) print ' '.img_warning($langs->trans("StockTooLow")); //if ($objp->stock_theorique < $objp->seuil_stock_alerte) print ' '.img_warning($langs->trans("StockTooLow"));
print '</td>'; print '</td>';
print '<td>'.$objp->label.'</td>'; print '<td>'.$objp->label.'</td>';
if ($conf->service->enabled && $type == 1) if ($conf->service->enabled && $type == 1)
{ {
print '<td align="center">'; print '<td align="center">';
if (eregi('([0-9]+)y',$objp->duration,$regs)) print $regs[1].' '.$langs->trans("DurationYear"); if (eregi('([0-9]+)y',$objp->duration,$regs)) print $regs[1].' '.$langs->trans("DurationYear");
elseif (eregi('([0-9]+)m',$objp->duration,$regs)) print $regs[1].' '.$langs->trans("DurationMonth"); elseif (eregi('([0-9]+)m',$objp->duration,$regs)) print $regs[1].' '.$langs->trans("DurationMonth");
elseif (eregi('([0-9]+)d',$objp->duration,$regs)) print $regs[1].' '.$langs->trans("DurationDay"); elseif (eregi('([0-9]+)d',$objp->duration,$regs)) print $regs[1].' '.$langs->trans("DurationDay");
else print $objp->duration; else print $objp->duration;
print '</td>'; print '</td>';
} }
//print '<td align="right">'.$objp->stock_theorique.'</td>'; //print '<td align="right">'.$objp->stock_theorique.'</td>';
print '<td align="right">'.$objp->stock_physique.'</td>'; print '<td align="right">'.$objp->stock_physique.'</td>';
print '<td align="right">'.$objp->seuil_stock_alerte.'</td>'; print '<td align="right">'.$objp->seuil_stock_alerte.'</td>';
print '<td align="right" nowrap="nowrap">'.$product_static->LibStatut($objp->statut,5).'</td>'; print '<td align="right" nowrap="nowrap">'.$product_static->LibStatut($objp->statut,5).'</td>';
print "</tr>\n"; print "</tr>\n";
$i++; $i++;
}
print "</table>";
print '</form>';
if ($num > $conf->liste_limit)
{
if ($sref || $snom || $sall || $_POST["search"])
{
print_barre_liste($texte, $page, "reassort.php", "&sref=".$sref."&snom=".$snom."&amp;sall=".$sall."&amp;envente=".$_POST["envente"], $sortfield, $sortorder,'',$num);
} }
else
{
print_barre_liste($texte, $page, "reassort.php", "&sref=$sref&snom=$snom&fourn_id=$fourn_id".(isset($type)?"&amp;type=$type":""), $sortfield, $sortorder,'',$num);
}
}
$db->free($resql); print "</table>";
print '</form>';
if ($num > $conf->liste_limit)
{
if ($sref || $snom || $sall || $_POST["search"])
{
print_barre_liste('', $page, "reassort.php", "&sref=".$sref."&snom=".$snom."&amp;sall=".$sall."&amp;envente=".$_POST["envente"], $sortfield, $sortorder,'',$num, 0, '');
}
else
{
print_barre_liste('', $page, "reassort.php", "&sref=$sref&snom=$snom&fourn_id=$fourn_id".(isset($type)?"&amp;type=$type":""), $sortfield, $sortorder,'',$num, 0, '');
}
}
$db->free($resql);
} }
else else
{ {
dolibarr_print_error($db); dolibarr_print_error($db);
} }

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2003-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2003-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005 Simon Tosser <simon@kornog-computing.com> * Copyright (C) 2005 Simon Tosser <simon@kornog-computing.com>
* Copyright (C) 2005-2006 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2005-2006 Regis Houssin <regis@dolibarr.fr>
* *
@ -130,10 +130,11 @@ llxHeader("","",$langs->trans("WarehouseCard"));
if ($_GET["action"] == 'create') if ($_GET["action"] == 'create')
{ {
print_fiche_titre($langs->trans("NewWarehouse"));
print "<form action=\"fiche.php\" method=\"post\">\n"; print "<form action=\"fiche.php\" method=\"post\">\n";
print '<input type="hidden" name="action" value="add">'; print '<input type="hidden" name="action" value="add">';
print '<input type="hidden" name="type" value="'.$type.'">'."\n"; print '<input type="hidden" name="type" value="'.$type.'">'."\n";
print_titre($langs->trans("NewWarehouse"));
if ($mesg) if ($mesg)
{ {