diff --git a/htdocs/html.form.class.php b/htdocs/html.form.class.php
index 84d6d9ccab3..0656714ea61 100644
--- a/htdocs/html.form.class.php
+++ b/htdocs/html.form.class.php
@@ -1513,16 +1513,29 @@ class Form
print '';
if ($user->admin && ! $noadmininfo) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1);
}
-
+
/**
* \brief Selection HT ou TTC
* \param selected Id pre-selectionne
* \param htmlname Nom de la zone select
*/
function select_PriceBaseType($selected='',$htmlname='price_base_type')
+ {
+ print $this->load_PriceBaseType($selected,$htmlname);
+ }
+
+ /**
+ * \brief Selection HT ou TTC
+ * \param selected Id pre-selectionne
+ * \param htmlname Nom de la zone select
+ */
+ function load_PriceBaseType($selected='',$htmlname='price_base_type')
{
global $langs;
- print '';
+
+ return $return;
}
/**
@@ -2191,8 +2206,7 @@ class Form
return 1;
}
}
-
-
+
/**
* \brief Output an HTML select vat rate
* \param name Nom champ html
@@ -2208,8 +2222,30 @@ class Form
* Sinon la TVA proposee par defaut=0. Fin de regle.
*/
function select_tva($name='tauxtva', $selectedrate='', $societe_vendeuse='', $societe_acheteuse='', $taux_produit='', $info_bits=0)
+ {
+ print $this->load_tva($name, $selectedrate, $societe_vendeuse, $societe_acheteuse, $taux_produit, $info_bits);
+ }
+
+
+ /**
+ * \brief Output an HTML select vat rate
+ * \param name Nom champ html
+ * \param selectedrate Forcage du taux tva pre-selectionne. Mettre '' pour aucun forcage.
+ * \param societe_vendeuse Objet societe vendeuse
+ * \param societe_acheteuse Objet societe acheteuse
+ * \param taux_produit Taux par defaut du produit vendu
+ * \param info_bits Miscellanous information on line
+ * \remarks Si vendeur non assujeti a TVA, TVA par defaut=0. Fin de regle.
+ * Si le (pays vendeur = pays acheteur) alors la TVA par defaut=TVA du produit vendu. Fin de regle.
+ * Si (vendeur et acheteur dans Communaute europeenne) et bien vendu = moyen de transports neuf (auto, bateau, avion), TVA par defaut=0 (La TVA doit etre paye par l'acheteur au centre d'impots de son pays et non au vendeur). Fin de regle.
+ * Si (vendeur et acheteur dans Communaute europeenne) et bien vendu autre que transport neuf alors la TVA par defaut=TVA du produit vendu. Fin de regle.
+ * Sinon la TVA proposee par defaut=0. Fin de regle.
+ */
+ function load_tva($name='tauxtva', $selectedrate='', $societe_vendeuse='', $societe_acheteuse='', $taux_produit='', $info_bits=0)
{
global $langs,$conf,$mysoc;
+
+ $return='';
$txtva=array();
$libtva=array();
@@ -2225,13 +2261,13 @@ class Form
{
if ($societe_vendeuse->id == $mysoc->id)
{
- print ''.$langs->trans("ErrorYourCountryIsNotDefined").'';
+ $return.= ''.$langs->trans("ErrorYourCountryIsNotDefined").'';
}
else
{
- print ''.$langs->trans("ErrorSupplierCountryIsNotDefined").'';
+ $return.= ''.$langs->trans("ErrorSupplierCountryIsNotDefined").'';
}
- return;
+ return $return;
}
if (is_object($societe_vendeuse))
@@ -2274,12 +2310,12 @@ class Form
}
else
{
- print ''.$langs->trans("ErrorNoVATRateDefinedForSellerCountry",$code_pays).'';
+ $return.= ''.$langs->trans("ErrorNoVATRateDefinedForSellerCountry",$code_pays).'';
}
}
else
{
- print ''.$this->db->error().'';
+ $return.= ''.$this->db->error().'';
}
// Definition du taux a pre-selectionner (si defaulttx non force et donc vaut -1 ou '')
@@ -2299,28 +2335,30 @@ class Form
if (sizeof($txtva))
{
- print '';
+ $return.= '';
for ($i = 0 ; $i < $nbdetaux ; $i++)
{
//print "xxxxx".$txtva[$i]."-".$nprtva[$i];
- print '';
+ $return.= '>'.vatrate($libtva[$i]);
+ $return.= $nprtva[$i] ? ' *': '';
+ $return.= '';
$this->tva_taux_value[$i] = $txtva[$i];
$this->tva_taux_libelle[$i] = $libtva[$i];
$this->tva_taux_npr[$i] = $nprtva[$i];
}
- print '';
+ $return.= '';
}
+
+ return $return;
}
diff --git a/htdocs/lib/functions.lib.php b/htdocs/lib/functions.lib.php
index 54062ea18e8..cab274a586a 100644
--- a/htdocs/lib/functions.lib.php
+++ b/htdocs/lib/functions.lib.php
@@ -2028,6 +2028,19 @@ function print_titre($titre)
print '
'.$titre.'
';
}
+/**
+ * \brief Show a title with picto
+ * \param titre Title to show
+ * \param mesg Added message to show on right
+ * \param picto Icon to use before title (should be a 32x32 transparent png file)
+ * \param pictoisfullpath 1=Icon name is a full absolute url of image
+ * \param id To force an id on html objects
+ */
+function print_fiche_titre($titre, $mesg='', $picto='title.png', $pictoisfullpath=0, $id='')
+{
+ print load_fiche_titre($titre, $mesg, $picto, $pictoisfullpath, $id);
+}
+
/**
* \brief Load a title with picto
* \param titre Title to show
@@ -2060,19 +2073,6 @@ function load_fiche_titre($titre, $mesg='', $picto='title.png', $pictoisfullpath
return $return;
}
-/**
- * \brief Show a title with picto
- * \param titre Title to show
- * \param mesg Added message to show on right
- * \param picto Icon to use before title (should be a 32x32 transparent png file)
- * \param pictoisfullpath 1=Icon name is a full absolute url of image
- * \param id To force an id on html objects
- */
-function print_fiche_titre($titre, $mesg='', $picto='title.png', $pictoisfullpath=0, $id='')
-{
- print load_fiche_titre($titre, $mesg, $picto, $pictoisfullpath, $id);
-}
-
/**
* \brief Print a title with navigation controls for pagination
* \param titre Title to show (required)
diff --git a/htdocs/product/canvas/default/product.default.class.php b/htdocs/product/canvas/default/product.default.class.php
index 0e326ad94aa..9fc10c127e6 100644
--- a/htdocs/product/canvas/default/product.default.class.php
+++ b/htdocs/product/canvas/default/product.default.class.php
@@ -47,7 +47,7 @@ class ProductDefault extends Product
$this->module = "produit";
$this->canvas = "default";
$this->name = "default";
- $this->description = "Canvas des produits (défaut)";
+ $this->definition = "Canvas des produits (défaut)";
$this->fieldListName = "product_default";
$this->next_prev_filter = "canvas='default'";
@@ -77,7 +77,9 @@ class ProductDefault extends Product
*/
function assign_values($action='')
{
- global $conf,$langs,$html;
+ global $conf,$langs;
+ global $html;
+ global $formproduct;
// Ref
$this->tpl['ref'] = $this->ref;
@@ -95,7 +97,7 @@ class ProductDefault extends Product
$this->tpl['note'] = nl2br($this->note);
// Hidden
- if ($user->rights->produit->hidden)
+ if ($this->user->rights->produit->hidden)
{
$this->tpl['hidden'] = yn($this->hidden);
}
@@ -112,6 +114,17 @@ class ProductDefault extends Product
// Title
$this->tpl['title'] = load_fiche_titre($langs->trans("NewProduct"));
+ // Price
+ $this->tpl['price'] = $this->price;
+ $this->tpl['price_min'] = $this->price_min;
+ $this->tpl['price_base_type'] = $html->load_PriceBaseType($this->price_base_type, "price_base_type");
+
+ // VAT
+ $this->tpl['tva_tx'] = $html->load_tva("tva_tx",$conf->defaulttx,$mysoc,'');
+ }
+
+ if ($action == 'create' || $action == 'edit')
+ {
// Status
$statutarray=array('1' => $langs->trans("OnSell"), '0' => $langs->trans("NotOnSell"));
$this->tpl['status'] = $html->selectarray('statut',$statutarray,$this->status);
@@ -119,24 +132,51 @@ class ProductDefault extends Product
// Finished
$statutarray=array('1' => $langs->trans("Finished"), '0' => $langs->trans("RowMaterial"));
$this->tpl['finished'] = $html->selectarray('finished',$statutarray,$this->finished);
- }
-
- if ($action == 'create' || $action == 'edit')
- {
+
+ // Weight
+ $this->tpl['weight'] = $this->weight;
+ $this->tpl['weight_units'] = $formproduct->load_measuring_units("weight_units","weight",$this->weight_units);
+
+ // Length
+ $this->tpl['length'] = $this->length;
+ $this->tpl['length_units'] = $formproduct->load_measuring_units("length_units","size",$this->length_units);
+
+ // Surface
+ $this->tpl['surface'] = $this->surface;
+ $this->tpl['surface_units'] = $formproduct->load_measuring_units("surface_units","surface",$this->surface_units);
+
+ // Volume
+ $this->tpl['volume'] = $this->volume;
+ $this->tpl['volume_units'] = $formproduct->load_measuring_units("volume_units","volume",$this->volume_units);
+
+ // Hidden
+ if ($this->user->rights->produit->hidden)
+ {
+ $this->tpl['hidden'] = $html->selectyesno('hidden',$this->hidden);
+ }
+
// TODO creer fonction
if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC)
{
require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php");
- $doleditor=new DolEditor('desc',$product->description,160,'dolibarr_notes','',false);
- $this->tpl['doleditor'] = $doleditor;
+
+ $doleditor=new DolEditor('desc',$this->description,160,'dolibarr_notes','',false);
+ $this->tpl['doleditor_description'] = $doleditor;
+
+ $doleditor=new DolEditor('note',$this->note,180,'dolibarr_notes','',false);
+ $this->tpl['doleditor_note'] = $doleditor;
}
else
{
$textarea = '';
+ $this->tpl['textarea_description'] = $textarea;
- $this->tpl['textarea'] = $textarea;
+ $textarea = '';
+ $this->tpl['textarea_note'] = $textarea;
}
}
diff --git a/htdocs/product/canvas/default/tpl/create.tpl.php b/htdocs/product/canvas/default/tpl/create.tpl.php
index 252f894b16f..5b27644da5b 100644
--- a/htdocs/product/canvas/default/tpl/create.tpl.php
+++ b/htdocs/product/canvas/default/tpl/create.tpl.php
@@ -55,10 +55,10 @@
- if ($conf->global->PRODUIT_MULTIPRICES)
- {
- // We do no show price array on create when multiprices enabled.
- // We must set them on prices tab.
- }
- else
- {
- print '
';
+global->PRODUIT_MULTIPRICES) { ?>
- // PRIX
- print '
diff --git a/htdocs/product/class/html.formproduct.class.php b/htdocs/product/class/html.formproduct.class.php
index 0856c21e4c8..2a3a6db5759 100644
--- a/htdocs/product/class/html.formproduct.class.php
+++ b/htdocs/product/class/html.formproduct.class.php
@@ -117,8 +117,7 @@ class FormProduct
}
print '';
}
-
-
+
/**
* \brief Selection des unites de mesure
* \param name Nom champ html
@@ -127,9 +126,23 @@ class FormProduct
* \remarks pour l'instant on ne definit pas les unites dans la base
*/
function select_measuring_units($name='measuring_units', $measuring_style='', $default='0', $adddefault=0)
+ {
+ print $this->load_measuring_units($name, $measuring_style, $default, $adddefault);
+ }
+
+ /**
+ * \brief Selection des unites de mesure
+ * \param name Nom champ html
+ * \param measuring_style Le style de mesure : weight, volume,...
+ * \param default Forcage de l'unite
+ * \remarks pour l'instant on ne definit pas les unites dans la base
+ */
+ function load_measuring_units($name='measuring_units', $measuring_style='', $default='0', $adddefault=0)
{
global $langs,$conf,$mysoc;
$langs->load("other");
+
+ $return='';
if ($measuring_style == 'weight')
{
@@ -160,19 +173,21 @@ class FormProduct
$measuring_units[-9] = $langs->trans("VolumeUnitmm3");
}
- print '';
- if ($adddefault) print '';
+ $return.= '';
+ if ($adddefault) $return.= '';
foreach ($measuring_units as $key => $value)
{
- print '';
+ $return.= '>'.$value.'';
}
- print '';
+ $return.= '';
+
+ return $return;
}
}