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) 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>';
foreach ($units as $key => $value) foreach ($units as $key => $value)
{ {
print '<option value="'.$key.'"'; print '<option value="'.$key.'"';
if ($key == $default) if ($key == $default)
{ {
print ' selected="true"'; print ' selected="true"';
} }
print '>'.$value.'</option>'; print '>'.$value.'</option>';
} }
print '</select>'; print '</select>';
} }
function load_tva($name='tauxtva', $defaulttx='', $societe_vendeuse='', $societe_acheteuse='', $taux_produit='') 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 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,12 +228,12 @@ 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) ."'";
$sql .= ",stock_loc = '" . addslashes($this->stock_loc) ."'"; $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 .= ",duration = '" . $this->duration_value . $this->duration_unit ."'";
$sql .= " WHERE rowid = " . $id; $sql .= " WHERE rowid = " . $id;

File diff suppressed because it is too large Load Diff