Le poids est rendu optionnel

This commit is contained in:
Laurent Destailleur 2006-12-12 22:31:27 +00:00
parent 22aacbef4e
commit 2716626296
6 changed files with 798 additions and 783 deletions

View File

@ -2071,10 +2071,11 @@ class Form
function select_weight_units($name='weight_units', $default='0', $adddefault=0) function select_weight_units($name='weight_units', $default='0', $adddefault=0)
{ {
global $langs,$conf,$mysoc; global $langs,$conf,$mysoc;
$langs->load("other");
$units[3] = "Tonne"; $units[3] = $langs->trans("WeightUnitmg");
$units[0] = "kg"; $units[0] = $langs->trans("WeightUnitkg");
$units[-3] = "g"; $units[-3] = $langs->trans("WeightUnitg");
print '<select class="flat" name="'.$name.'">'; print '<select class="flat" name="'.$name.'">';
if ($adddefault) print '<option value="0">'.$langs->trans("Default").'</option>'; if ($adddefault) print '<option value="0">'.$langs->trans("Default").'</option>';

View File

@ -59,6 +59,10 @@ FeatureNotYetAvailable=Feature not yet available in this version
FeaturesSupported=Features supported FeaturesSupported=Features supported
Width=Width Width=Width
Height=Height Height=Height
Weight=Weight
WeightUnitmg=tonnes
WeightUnitkg=kg
WeightUnitg=g
##### Webcal ##### ##### Webcal #####
LoginWebcal=Login for Webcalendar LoginWebcal=Login for Webcalendar
AddCalendarEntry=Add entry in calendar AddCalendarEntry=Add entry in calendar

View File

@ -59,6 +59,10 @@ FeatureNotYetAvailable=Fonctionnalit
FeaturesSupported=Fonctionnalités supportées FeaturesSupported=Fonctionnalités supportées
Width=Largeur Width=Largeur
Height=Hauteur Height=Hauteur
Weight=Poids
WeightUnitmg=tonnes
WeightUnitkg=kg
WeightUnitg=g
##### Webcal ##### ##### Webcal #####
LoginWebcal=Login Webcalendar LoginWebcal=Login Webcalendar
AddCalendarEntry=Ajouter entrée dans le calendrier AddCalendarEntry=Ajouter entrée dans le calendrier

View File

@ -44,6 +44,11 @@ function product_prepare_head($product)
$head[$h][2] = 'price'; $head[$h][2] = 'price';
$h++; $h++;
$head[$h][0] = DOL_URL_ROOT."/product/photos.php?id=".$product->id;
$head[$h][1] = $langs->trans("Photos");
$head[$h][2] = 'photos';
$h++;
//affichage onglet catégorie //affichage onglet catégorie
if ($conf->categorie->enabled) if ($conf->categorie->enabled)
{ {
@ -77,6 +82,15 @@ function product_prepare_head($product)
$h++; $h++;
} }
// sousproduits
if($conf->global->PRODUIT_SOUSPRODUITS == 1)
{
$head[$h][0] = DOL_URL_ROOT."/product/sousproduits/fiche.php?id=".$product->id;
$head[$h][1] = $langs->trans('AssociatedProducts');
$head[$h][2] = 'subproduct';
$h++;
}
if ($conf->fournisseur->enabled) if ($conf->fournisseur->enabled)
{ {
$head[$h][0] = DOL_URL_ROOT."/product/fournisseurs.php?id=".$product->id; $head[$h][0] = DOL_URL_ROOT."/product/fournisseurs.php?id=".$product->id;
@ -90,26 +104,11 @@ function product_prepare_head($product)
$head[$h][2] = 'stats'; $head[$h][2] = 'stats';
$h++; $h++;
// sousproduits
if($conf->global->PRODUIT_SOUSPRODUITS == 1)
{
$head[$h][0] = DOL_URL_ROOT."/product/sousproduits/fiche.php?id=".$product->id;
$head[$h][1] = $langs->trans('AssociatedProducts');
$head[$h][2] = 'subproduct';
$h++;
}
$head[$h][0] = DOL_URL_ROOT."/product/stats/facture.php?id=".$product->id; $head[$h][0] = DOL_URL_ROOT."/product/stats/facture.php?id=".$product->id;
$head[$h][1] = $langs->trans('Referers'); $head[$h][1] = $langs->trans('Referers');
$head[$h][2] = 'referers'; $head[$h][2] = 'referers';
$h++; $h++;
$head[$h][0] = DOL_URL_ROOT."/product/photos.php?id=".$product->id;
$head[$h][1] = $langs->trans("Photos");
$head[$h][2] = 'photos';
$h++;
$head[$h][0] = DOL_URL_ROOT.'/product/document.php?id='.$product->id; $head[$h][0] = DOL_URL_ROOT.'/product/document.php?id='.$product->id;
$head[$h][1] = $langs->trans('Documents'); $head[$h][1] = $langs->trans('Documents');
$head[$h][2] = 'documents'; $head[$h][2] = 'documents';

View File

@ -201,6 +201,7 @@ class Product
$this->db->rollback(); $this->db->rollback();
return -1; return -1;
} }
/** /**
* \brief Mise à jour du produit en base * \brief Mise à jour du produit en base
* \param id id du produit * \param id id du produit
@ -219,7 +220,7 @@ class Product
$this->libelle = trim($this->libelle); $this->libelle = trim($this->libelle);
$this->description = trim($this->description); $this->description = trim($this->description);
$this->note = trim($this->note); $this->note = trim($this->note);
$this->new_weight = trim(ereg_replace(",",".",$this->new_weight)); $this->new_weight = price2num($this->new_weight);
$this->new_weight_units = trim($this->new_weight_units); $this->new_weight_units = trim($this->new_weight_units);
$sql = "UPDATE ".MAIN_DB_PREFIX."product "; $sql = "UPDATE ".MAIN_DB_PREFIX."product ";
@ -227,7 +228,7 @@ class Product
if ($this->ref) $sql .= ",ref = '" . $this->ref ."'"; if ($this->ref) $sql .= ",ref = '" . $this->ref ."'";
$sql .= ",tva_tx = '" . $this->tva_tx."'"; $sql .= ",tva_tx = '" . $this->tva_tx."'";
$sql .= ",envente = " . $this->status; $sql .= ",envente = " . $this->status;
$sql .= ",weight = '" . $this->new_weight."'"; $sql .= ",weight = " . ($this->new_weight!='' ? "'".$this->new_weight."'" : 'null');
$sql .= ",weight_units = '" . $this->new_weight_units."'"; $sql .= ",weight_units = '" . $this->new_weight_units."'";
$sql .= ",seuil_stock_alerte = '" . $this->seuil_stock_alerte."'"; $sql .= ",seuil_stock_alerte = '" . $this->seuil_stock_alerte."'";
$sql .= ",description = '" . addslashes($this->description) ."'"; $sql .= ",description = '" . addslashes($this->description) ."'";

View File

@ -24,10 +24,10 @@
*/ */
/** /**
\file htdocs/product/fiche.php * \file htdocs/product/fiche.php
\ingroup product * \ingroup product
\brief Page de la fiche produit * \brief Page de la fiche produit
\version $Revision$ * \version $Revision$
*/ */
require("./pre.inc.php"); require("./pre.inc.php");
@ -230,7 +230,7 @@ if ($_GET["action"] == 'clone' && $user->rights->produit->creer)
} }
/* /*
* Suppression d'un produit/service pas encore affecté * Suppression d'un produit/service pas encore affect
*/ */
if ($_POST["action"] == 'confirm_delete' && $_POST["confirm"] == 'yes' && $user->rights->produit->supprimer) if ($_POST["action"] == 'confirm_delete' && $_POST["confirm"] == 'yes' && $user->rights->produit->supprimer)
{ {
@ -493,7 +493,7 @@ if ($_GET["action"] == 'create' && $user->rights->produit->creer)
{ {
// Le poids ne concerne que les produits et pas les services // Le poids ne concerne que les produits et pas les services
print '<tr><td>'.$langs->trans("Weight").'</td><td>'; print '<tr><td>'.$langs->trans("Weight").'</td><td>';
print '<input name="weight" size="4" value="0">'; print '<input name="weight" size="4" value="">';
print $html->select_weight_units("weight_units"); print $html->select_weight_units("weight_units");
print '</td></tr>'; print '</td></tr>';
} }
@ -705,8 +705,14 @@ if ($_GET["id"] || $_GET["ref"])
else else
{ {
print '<tr><td>'.$langs->trans("Weight").'</td><td>'; print '<tr><td>'.$langs->trans("Weight").'</td><td>';
print $product->weight." "; if ($product->weight != '')
print weight_units_string($product->weight_units); {
print $product->weight." ".weight_units_string($product->weight_units);
}
else
{
print '&nbsp;';
}
print "</td></tr>\n"; print "</td></tr>\n";
} }
// Note // Note