Le poids est rendu optionnel
This commit is contained in:
parent
22aacbef4e
commit
2716626296
@ -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>';
|
||||||
|
|||||||
@ -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
|
||||||
|
|||||||
@ -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
|
||||||
|
|||||||
@ -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';
|
||||||
|
|||||||
@ -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) ."'";
|
||||||
|
|||||||
@ -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");
|
||||||
@ -47,8 +47,8 @@ $types[0] = $langs->trans("Product");
|
|||||||
$types[1] = $langs->trans("Service");
|
$types[1] = $langs->trans("Service");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
if ($_GET["action"] == 'fastappro')
|
if ($_GET["action"] == 'fastappro')
|
||||||
{
|
{
|
||||||
$product = new Product($db);
|
$product = new Product($db);
|
||||||
@ -121,8 +121,8 @@ if ($_POST["action"] == 'add' && $user->rights->produit->creer)
|
|||||||
|
|
||||||
// Action mise a jour d'un produit ou service
|
// Action mise a jour d'un produit ou service
|
||||||
if ($_POST["action"] == 'update' &&
|
if ($_POST["action"] == 'update' &&
|
||||||
$_POST["cancel"] <> $langs->trans("Cancel") &&
|
$_POST["cancel"] <> $langs->trans("Cancel") &&
|
||||||
$user->rights->produit->creer)
|
$user->rights->produit->creer)
|
||||||
{
|
{
|
||||||
$product = new Product($db);
|
$product = new Product($db);
|
||||||
if ($product->fetch($_POST["id"]))
|
if ($product->fetch($_POST["id"]))
|
||||||
@ -230,8 +230,8 @@ 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)
|
||||||
{
|
{
|
||||||
$product = new Product($db);
|
$product = new Product($db);
|
||||||
@ -254,8 +254,8 @@ if ($_POST["action"] == 'confirm_delete' && $_POST["confirm"] == 'yes' && $user-
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Ajout du produit dans une propal
|
* Ajout du produit dans une propal
|
||||||
*/
|
*/
|
||||||
if ($_POST["action"] == 'addinpropal')
|
if ($_POST["action"] == 'addinpropal')
|
||||||
{
|
{
|
||||||
$propal = New Propal($db);
|
$propal = New Propal($db);
|
||||||
@ -307,8 +307,8 @@ if ($_POST["action"] == 'addinpropal')
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Ajout du produit dans une commande
|
* Ajout du produit dans une commande
|
||||||
*/
|
*/
|
||||||
if ($_POST["action"] == 'addincommande')
|
if ($_POST["action"] == 'addincommande')
|
||||||
{
|
{
|
||||||
$product = new Product($db);
|
$product = new Product($db);
|
||||||
@ -345,8 +345,8 @@ if ($_POST["action"] == 'addincommande')
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Ajout du produit dans une facture
|
* Ajout du produit dans une facture
|
||||||
*/
|
*/
|
||||||
if ($_POST["action"] == 'addinfacture' && $user->rights->facture->creer)
|
if ($_POST["action"] == 'addinfacture' && $user->rights->facture->creer)
|
||||||
{
|
{
|
||||||
$product = new Product($db);
|
$product = new Product($db);
|
||||||
@ -392,8 +392,8 @@ if ($_POST["cancel"] == $langs->trans("Cancel"))
|
|||||||
$html = new Form($db);
|
$html = new Form($db);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Action création du produit
|
* Action création du produit
|
||||||
*/
|
*/
|
||||||
if ($_GET["action"] == 'create' && $user->rights->produit->creer)
|
if ($_GET["action"] == 'create' && $user->rights->produit->creer)
|
||||||
{
|
{
|
||||||
$product = new Product($db);
|
$product = new Product($db);
|
||||||
@ -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>';
|
||||||
}
|
}
|
||||||
@ -529,10 +529,10 @@ if ($_GET["action"] == 'create' && $user->rights->produit->creer)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Fiche produit
|
* Fiche produit
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
if ($_GET["id"] || $_GET["ref"])
|
if ($_GET["id"] || $_GET["ref"])
|
||||||
{
|
{
|
||||||
$product = new Product($db);
|
$product = new Product($db);
|
||||||
@ -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 ' ';
|
||||||
|
}
|
||||||
print "</td></tr>\n";
|
print "</td></tr>\n";
|
||||||
}
|
}
|
||||||
// Note
|
// Note
|
||||||
@ -856,7 +862,7 @@ if ($_GET["action"] == '')
|
|||||||
print '<a class="tabAction" href="fiche.php?action=clone&id='.$product->id.'">'.$langs->trans("CreateCopy").'</a>';
|
print '<a class="tabAction" href="fiche.php?action=clone&id='.$product->id.'">'.$langs->trans("CreateCopy").'</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
if ($product->type == 0 && $user->rights->commande->creer)
|
if ($product->type == 0 && $user->rights->commande->creer)
|
||||||
{
|
{
|
||||||
$langs->load('orders');
|
$langs->load('orders');
|
||||||
@ -870,7 +876,7 @@ if ($_GET["action"] == '')
|
|||||||
print '<a class="tabAction" href="fiche.php?action=fastappro&id='.$product->id.'">';
|
print '<a class="tabAction" href="fiche.php?action=fastappro&id='.$product->id.'">';
|
||||||
print $langs->trans("CreateSupplierOrder").'</a>';
|
print $langs->trans("CreateSupplierOrder").'</a>';
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$product_is_used = $product->verif_prod_use($product->id);
|
$product_is_used = $product->verif_prod_use($product->id);
|
||||||
if ($user->rights->produit->supprimer && ! $product_is_used)
|
if ($user->rights->produit->supprimer && ! $product_is_used)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user