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

@ -2070,25 +2070,26 @@ class Form
*/
function select_weight_units($name='weight_units', $default='0', $adddefault=0)
{
global $langs,$conf,$mysoc;
$units[3] = "Tonne";
$units[0] = "kg";
$units[-3] = "g";
print '<select class="flat" name="'.$name.'">';
if ($adddefault) print '<option value="0">'.$langs->trans("Default").'</option>';
foreach ($units as $key => $value)
{
print '<option value="'.$key.'"';
if ($key == $default)
{
print ' selected="true"';
}
print '>'.$value.'</option>';
}
print '</select>';
global $langs,$conf,$mysoc;
$langs->load("other");
$units[3] = $langs->trans("WeightUnitmg");
$units[0] = $langs->trans("WeightUnitkg");
$units[-3] = $langs->trans("WeightUnitg");
print '<select class="flat" name="'.$name.'">';
if ($adddefault) print '<option value="0">'.$langs->trans("Default").'</option>';
foreach ($units as $key => $value)
{
print '<option value="'.$key.'"';
if ($key == $default)
{
print ' selected="true"';
}
print '>'.$value.'</option>';
}
print '</select>';
}
function load_tva($name='tauxtva', $defaulttx='', $societe_vendeuse='', $societe_acheteuse='', $taux_produit='')

View File

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

View File

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

View File

@ -44,6 +44,11 @@ function product_prepare_head($product)
$head[$h][2] = 'price';
$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
if ($conf->categorie->enabled)
{
@ -77,6 +82,15 @@ function product_prepare_head($product)
$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)
{
$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';
$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][1] = $langs->trans('Referers');
$head[$h][2] = 'referers';
$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][1] = $langs->trans('Documents');
$head[$h][2] = 'documents';

View File

@ -201,6 +201,7 @@ class Product
$this->db->rollback();
return -1;
}
/**
* \brief Mise à jour du produit en base
* \param id id du produit
@ -219,7 +220,7 @@ class Product
$this->libelle = trim($this->libelle);
$this->description = trim($this->description);
$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);
$sql = "UPDATE ".MAIN_DB_PREFIX."product ";
@ -227,12 +228,12 @@ class Product
if ($this->ref) $sql .= ",ref = '" . $this->ref ."'";
$sql .= ",tva_tx = '" . $this->tva_tx."'";
$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 .= ",seuil_stock_alerte = '" . $this->seuil_stock_alerte."'";
$sql .= ",description = '" . addslashes($this->description) ."'";
$sql .= ",stock_loc = '" . addslashes($this->stock_loc) ."'";
$sql .= ",note = '" . addslashes($this->note) ."'";
$sql .= ",note = '" . addslashes($this->note) ."'";
$sql .= ",duration = '" . $this->duration_value . $this->duration_unit ."'";
$sql .= " WHERE rowid = " . $id;

File diff suppressed because it is too large Load Diff