| '.$langs->trans("SellingPrice").' | '.price($product->price).' | ';
$nblignefour=2;
- if ($product->type == 0 && $conf->stock->enabled) $nblignefour++;
- if ($product->type == 1) $nblignefour++;
+ if ($product->isproduct() && $conf->stock->enabled) $nblignefour++;
+ if ($product->isservice()) $nblignefour++;
print '';
$product->show_photos($conf->produit->dir_output,1,1,0);
@@ -379,7 +376,7 @@ else
print ' |
| '.$langs->trans("Duration").' | '.$product->duration_value.' ';
@@ -512,7 +509,11 @@ else
if (($_GET["action"] == 'edit' || $_GET["action"] == 're-edit') && $user->rights->produit->creer)
{
- print_fiche_titre('Edition de la fiche '.$types[$product->type].' : '.$product->ref, "");
+ if ($product->isservice()) {
+ print_fiche_titre($langs->trans('Edit').' '.$langs->trans('Service').' : '.$product->ref, "");
+ } else {
+ print_fiche_titre($langs->trans('Edit').' '.$langs->trans('Product').' : '.$product->ref, "");
+ }
if ($mesg) {
print '
'.$mesg.' ';
@@ -526,7 +527,7 @@ else
print ' | '.$langs->trans("Label").' | |
';
- if ($product->type == 0 && $conf->stock->enabled)
+ if ($product->isproduct() && $conf->stock->enabled)
{
print "| '.$langs->trans("Duration").' | ';
print ' ';
@@ -580,14 +581,14 @@ else
print ''.$langs->trans("Edit").'';
}
- if ($product->type == 0 && $conf->stock->enabled)
+ if ($product->isproduct() && $conf->stock->enabled)
{
print ''.$langs->trans("CorrectStock").'';
}
print ''.$langs->trans("AddSupplier").'';
- if ($product->type == 0 && $user->rights->commande->creer)
+ if ($product->isproduct() && $user->rights->commande->creer)
{
$langs->load('orders');
print '';
diff --git a/htdocs/fourn/product/index.php b/htdocs/fourn/product/index.php
index 28d831024b7..397c042cf29 100644
--- a/htdocs/fourn/product/index.php
+++ b/htdocs/fourn/product/index.php
@@ -96,11 +96,11 @@ print ' | ';
/*
- * Derniers produits/services en vente
+ * Derniers produits en vente
*/
-$sql = "SELECT p.rowid, p.label, p.price, p.ref, p.fk_product_type";
+$sql = "SELECT p.rowid, p.label, p.price, p.ref, p.type";
$sql .= " FROM ".MAIN_DB_PREFIX."product as p ";
-$sql .= " WHERE p.fk_product_type=0";
+$sql .= " WHERE p.fk_product_type <> 1";
$sql .= " ORDER BY p.datec DESC ";
$sql .= $db->plimit(15 ,0);
@@ -112,9 +112,6 @@ if ($resql)
$i = 0;
- $typeprodser[0]=$langs->trans("Product");
- $typeprodser[1]=$langs->trans("Service");
-
if ($num > 0)
{
print '';
@@ -132,8 +129,10 @@ if ($resql)
else print img_object($langs->trans("ShowProduct"),"product");
print " rowid\">$objp->ref\n";
print "| $objp->label | ";
- print "".$typeprodser[$objp->fk_product_type]." | ";
- print "\n";
+ print "";
+ if ($objp->fk_product_type==1) print $langs->trans('ShowService');
+ else print $langs->trans('ShowProduct');
+ print " | \n";
$i++;
}
$db->free($resql);
diff --git a/htdocs/fourn/product/photos.php b/htdocs/fourn/product/photos.php
index 20e237f8a1e..b878e7aa5c3 100644
--- a/htdocs/fourn/product/photos.php
+++ b/htdocs/fourn/product/photos.php
@@ -35,9 +35,6 @@ require_once(DOL_DOCUMENT_ROOT."/product.class.php");
if (!$user->rights->produit->lire) accessforbidden();
-$types[0] = $langs->trans("Product");
-$types[1] = $langs->trans("Service");
-
/*
*
*/
@@ -118,7 +115,7 @@ if ($_GET["id"])
* Ajouter une photo
*
*/
- if ($_GET["action"] == 'ajout_photo' && $user->rights->produit->creer && $product->isproduct && $conf->upload)
+ if ($_GET["action"] == 'ajout_photo' && $user->rights->produit->creer && $product->isproduct() && $conf->upload)
{
print_titre($langs->trans("AddPhoto"));
@@ -202,7 +199,7 @@ if ($_GET["id"])
if ($_GET["action"] == '')
{
- if ( $user->rights->produit->creer && $product->isproduct && $conf->upload)
+ if ( $user->rights->produit->creer && $product->isproduct() && $conf->upload)
{
print '';
print $langs->trans("AddPhoto").'';
diff --git a/htdocs/html.form.class.php b/htdocs/html.form.class.php
index 3b6d914d68e..c90c2f2c280 100644
--- a/htdocs/html.form.class.php
+++ b/htdocs/html.form.class.php
@@ -2014,81 +2014,81 @@ class Form
* Sinon la TVA proposée par défaut=0. Fin de règle.
*/
function select_tva($name='tauxtva', $defaulttx='', $societe_vendeuse='', $societe_acheteuse='', $taux_produit='')
- {
- global $langs,$conf,$mysoc;
+ {
+ global $langs,$conf,$mysoc;
- //print $societe_vendeuse."-".$societe_acheteuse;
- if (is_object($societe_vendeuse) && ! $societe_vendeuse->pays_code)
- {
- if ($societe_vendeuse->id == $mysoc->id)
- {
- print ''.$langs->trans("ErrorYourCountryIsNotDefined").'';
- }
- else
- {
- print ''.$langs->trans("ErrorSupplierCountryIsNotDefined").'';
- }
- return;
- }
-
- if (is_object($societe_vendeuse->pays_code))
- {
- $code_pays=$societe_vendeuse->pays_code;
+ //print $societe_vendeuse."-".$societe_acheteuse;
+ if (is_object($societe_vendeuse) && ! $societe_vendeuse->pays_code)
+ {
+ if ($societe_vendeuse->id == $mysoc->id)
+ {
+ print ''.$langs->trans("ErrorYourCountryIsNotDefined").'';
+ }
+ else
+ {
+ print ''.$langs->trans("ErrorSupplierCountryIsNotDefined").'';
+ }
+ return;
+ }
+
+ if (is_object($societe_vendeuse))
+ {
+ $code_pays=$societe_vendeuse->pays_code;
+ }
+ else
+ {
+ $code_pays=$mysoc->pays_code; // Pour compatibilite ascendente
+ }
+
+ // Recherche liste des codes TVA du pays vendeur
+ $sql = "SELECT t.taux,t.recuperableonly";
+ $sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_pays as p";
+ $sql .= " WHERE t.fk_pays = p.rowid AND p.code = '".$code_pays."'";
+ $sql .= " AND t.active = 1";
+ $sql .= " ORDER BY t.taux ASC, t.recuperableonly ASC";
+
+ $resql=$this->db->query($sql);
+ if ($resql)
+ {
+ $num = $this->db->num_rows($resql);
+ for ($i = 0; $i < $num; $i++)
+ {
+ $obj = $this->db->fetch_object($resql);
+ $txtva[ $i ] = $obj->taux;
+ $libtva[ $i ] = $obj->taux.'%'.($obj->recuperableonly ? ' *':'');
+ }
+ }
+ else
+ {
+ print ''.$langs->trans("ErrorNoVATRateDefinedForSellerCountry").'';
+ }
+
+ // Définition du taux à présélectionner
+ if ($defaulttx == '') $defaulttx=get_default_tva($societe_vendeuse,$societe_acheteuse,$taux_produit);
+ // Si taux par defaut n'a pu etre trouvé, on prend dernier.
+ // Comme ils sont triés par ordre croissant, dernier = plus élevé = taux courant
+ if ($defaulttx == '') $defaulttx = $txtva[sizeof($txtva)-1];
+
+ $nbdetaux = sizeof($txtva);
+
+ print '';
}
- else
- {
- $code_pays=$mysoc->pays_code; // Pour compatibilite ascendente
- }
-
- // Recherche liste des codes TVA du pays vendeur
- $sql = "SELECT t.taux,t.recuperableonly";
- $sql .= " FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_pays as p";
- $sql .= " WHERE t.fk_pays = p.rowid AND p.code = '".$code_pays."'";
- $sql .= " AND t.active = 1";
- $sql .= " ORDER BY t.taux ASC, t.recuperableonly ASC";
-
- $resql=$this->db->query($sql);
- if ($resql)
- {
- $num = $this->db->num_rows($resql);
- for ($i = 0; $i < $num; $i++)
- {
- $obj = $this->db->fetch_object($resql);
- $txtva[ $i ] = $obj->taux;
- $libtva[ $i ] = $obj->taux.'%'.($obj->recuperableonly ? ' *':'');
- }
- }
- else
- {
- print ''.$langs->trans("ErrorNoVATRateDefinedForSellerCountry").'';
- }
-
- // Définition du taux à présélectionner
- if ($defaulttx == '') $defaulttx=get_default_tva($societe_vendeuse,$societe_acheteuse,$taux_produit);
- // Si taux par defaut n'a pu etre trouvé, on prend dernier.
- // Comme ils sont triés par ordre croissant, dernier = plus élevé = taux courant
- if ($defaulttx == '') $defaulttx = $txtva[sizeof($txtva)-1];
-
- $nbdetaux = sizeof($txtva);
-
- print '';
- }
|