Works on product canvas and templates
!! WARNING : not stable !!
This commit is contained in:
parent
fa73ddf93c
commit
5cc40ab6f4
@ -80,19 +80,72 @@ class ProductDefault extends Product
|
|||||||
global $conf,$langs,$html;
|
global $conf,$langs,$html;
|
||||||
|
|
||||||
// Ref
|
// Ref
|
||||||
$this->tpl['showrefnav'] = $html->showrefnav($this,'ref','',1,'ref');
|
$this->tpl['ref'] = $this->ref;
|
||||||
|
|
||||||
// Label
|
// Label
|
||||||
$this->tpl['label'] = $this->libelle;
|
$this->tpl['label'] = $this->libelle;
|
||||||
|
|
||||||
|
// Description
|
||||||
|
$this->tpl['description'] = nl2br($this->description);
|
||||||
|
|
||||||
// Statut
|
// Statut
|
||||||
$this->tpl['status'] = $this->getLibStatut(2);
|
$this->tpl['status'] = $this->getLibStatut(2);
|
||||||
|
|
||||||
|
// Note
|
||||||
|
$this->tpl['note'] = nl2br($this->note);
|
||||||
|
|
||||||
|
// Hidden
|
||||||
|
if ($user->rights->produit->hidden)
|
||||||
|
{
|
||||||
|
$this->tpl['hidden'] = yn($this->hidden);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->tpl['hidden'] = yn("No");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Stock alert
|
||||||
|
$this->tpl['seuil_stock_alerte'] = $this->seuil_stock_alerte;
|
||||||
|
|
||||||
if ($action == 'create')
|
if ($action == 'create')
|
||||||
{
|
{
|
||||||
$this->tpl['cardTitle'] = load_fiche_titre($langs->trans("NewProduct"));
|
// Title
|
||||||
|
$this->tpl['title'] = load_fiche_titre($langs->trans("NewProduct"));
|
||||||
|
|
||||||
|
// Status
|
||||||
|
$statutarray=array('1' => $langs->trans("OnSell"), '0' => $langs->trans("NotOnSell"));
|
||||||
|
$this->tpl['status'] = $html->selectarray('statut',$statutarray,$this->status);
|
||||||
|
|
||||||
|
// 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')
|
||||||
|
{
|
||||||
|
// 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;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$textarea = '<textarea name="desc" rows="4" cols="90">';
|
||||||
|
$textarea.= $product->description;
|
||||||
|
$textarea.= '</textarea>';
|
||||||
|
|
||||||
|
$this->tpl['textarea'] = $textarea;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action == 'view')
|
if ($action == 'view')
|
||||||
{
|
{
|
||||||
|
// Ref
|
||||||
|
$this->tpl['ref'] = $html->showrefnav($this,'ref','',1,'ref');
|
||||||
|
|
||||||
|
// Photo
|
||||||
$this->tpl['nblignes'] = 4;
|
$this->tpl['nblignes'] = 4;
|
||||||
if ($this->is_photo_available($conf->produit->dir_output))
|
if ($this->is_photo_available($conf->produit->dir_output))
|
||||||
{
|
{
|
||||||
@ -107,11 +160,8 @@ class ProductDefault extends Product
|
|||||||
$this->tpl['accountancySellCodeKey'] = $html->editfieldkey("ProductAccountancySellCode",'productaccountancycodebuy',$this->accountancy_code_buy,'id',$this->id,$user->rights->produit->creer);
|
$this->tpl['accountancySellCodeKey'] = $html->editfieldkey("ProductAccountancySellCode",'productaccountancycodebuy',$this->accountancy_code_buy,'id',$this->id,$user->rights->produit->creer);
|
||||||
$this->tpl['accountancySellCodeVal'] = $html->editfieldval("ProductAccountancySellCode",'productaccountancycodebuy',$this->accountancy_code_buy,'id',$this->id,$user->rights->produit->creer);
|
$this->tpl['accountancySellCodeVal'] = $html->editfieldval("ProductAccountancySellCode",'productaccountancycodebuy',$this->accountancy_code_buy,'id',$this->id,$user->rights->produit->creer);
|
||||||
|
|
||||||
// Description
|
|
||||||
$this->tpl['description'] = nl2br($this->description);
|
|
||||||
|
|
||||||
// Nature
|
// Nature
|
||||||
$this->tpl['finishedLabel'] = $this->getLibFinished();
|
$this->tpl['finished'] = $this->getLibFinished();
|
||||||
|
|
||||||
// Weight
|
// Weight
|
||||||
if ($this->weight != '')
|
if ($this->weight != '')
|
||||||
@ -136,19 +186,6 @@ class ProductDefault extends Product
|
|||||||
{
|
{
|
||||||
$this->tpl['volume'] = $this->volume." ".measuring_units_string($this->volume_units,"volume");
|
$this->tpl['volume'] = $this->volume." ".measuring_units_string($this->volume_units,"volume");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hidden
|
|
||||||
if ($user->rights->produit->hidden)
|
|
||||||
{
|
|
||||||
$this->tpl['hidden'] = yn($this->hidden);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$this->tpl['hidden'] = yn("No");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Note
|
|
||||||
$this->tpl['note'] = nl2br($this->note);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -26,62 +26,44 @@
|
|||||||
<input type="hidden" name="action" value="add">
|
<input type="hidden" name="action" value="add">
|
||||||
<input type="hidden" name="canvas" value="<?php echo $_GET['canvas']; ?>">
|
<input type="hidden" name="canvas" value="<?php echo $_GET['canvas']; ?>">
|
||||||
|
|
||||||
<?php echo $product->tpl['cardTitle']; ?>
|
<?php echo $product->tpl['title']; ?>
|
||||||
|
|
||||||
<table class="border" width="100%">
|
<table class="border" width="100%">
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td class="fieldrequired" width="20%"><?php echo $langs->trans("Ref"); ?></td>
|
<td class="fieldrequired" width="20%"><?php echo $langs->trans("Ref"); ?></td>
|
||||||
<td><input name="ref" size="40" maxlength="32" value="<?php echo $_POST["ref"]; ?>">
|
<td><input name="ref" size="40" maxlength="32" value="<?php echo $product->tpl['ref']; ?>">
|
||||||
if ($_error == 1)
|
<?php if ($_error == 1) echo $langs->trans("RefAlreadyExists"); ?>
|
||||||
{
|
|
||||||
print $langs->trans("RefAlreadyExists");
|
|
||||||
}
|
|
||||||
</td></tr>
|
</td></tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td class="fieldrequired"><?php echo $langs->trans("Label"); ?></td>
|
<td class="fieldrequired"><?php echo $langs->trans("Label"); ?></td>
|
||||||
<td><input name="libelle" size="40" value="<?php echo $_POST["libelle"]; ?>"></td>
|
<td><input name="libelle" size="40" value="<?php echo $product->tpl['label']; ?>"></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td class="fieldrequired"><?php echo $langs->trans("Status"); ?></td><td>
|
<td class="fieldrequired"><?php echo $langs->trans("Status"); ?></td>
|
||||||
$statutarray=array('1' => $langs->trans("OnSell"), '0' => $langs->trans("NotOnSell"));
|
<td><?php echo $product->tpl['status']; ?></td>
|
||||||
$html->select_array('statut',$statutarray,$_POST["statut"]);
|
|
||||||
</td>
|
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
if ($_GET["type"] != 1 && $conf->stock->enabled)
|
<?php if ($conf->stock->enabled) { ?>
|
||||||
{
|
|
||||||
<tr><td><?php echo $langs->trans("StockLimit"); ?></td><td>
|
<tr><td><?php echo $langs->trans("StockLimit"); ?></td><td>
|
||||||
<input name="seuil_stock_alerte" size="4" value="<?php echo $_POST["seuil_stock_alerte"]; ?>">
|
<input name="seuil_stock_alerte" size="4" value="<?php echo $product->tpl['seuil_stock_alerte']; ?>">
|
||||||
</td></tr>
|
</td></tr>
|
||||||
}
|
<?php } else { ?>
|
||||||
else
|
|
||||||
{
|
|
||||||
<input name="seuil_stock_alerte" type="hidden" value="0">
|
<input name="seuil_stock_alerte" type="hidden" value="0">
|
||||||
}
|
<?php } ?>
|
||||||
|
|
||||||
<tr><td valign="top"><?php echo $langs->trans("Description"); ?></td><td>
|
<tr><td valign="top"><?php echo $langs->trans("Description"); ?></td><td>
|
||||||
|
<?php if (! $product->tpl['textarea']) {
|
||||||
if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC)
|
$product->tpl['doleditor']->Create();
|
||||||
{
|
}else{
|
||||||
require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php");
|
echo $product->tpl['textarea'];
|
||||||
$doleditor=new DolEditor('desc',$_POST["desc"],160,'dolibarr_notes','',false);
|
}?>
|
||||||
$doleditor->Create();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
print '<textarea name="desc" rows="4" cols="90">';
|
|
||||||
print $_POST["desc"];
|
|
||||||
print '</textarea>';
|
|
||||||
}
|
|
||||||
|
|
||||||
</td></tr>
|
</td></tr>
|
||||||
|
|
||||||
<tr><td><?php echo $langs->trans("Nature"); ?></td><td>
|
<tr><td><?php echo $langs->trans("Nature"); ?></td><td>
|
||||||
$statutarray=array('1' => $langs->trans("Finished"), '0' => $langs->trans("RowMaterial"));
|
<?php echo $product->tpl['finished']; ?>
|
||||||
$html->select_array('finished',$statutarray,$_POST["finished"]);
|
|
||||||
</td></tr>
|
</td></tr>
|
||||||
|
|
||||||
<tr><td><?php echo $langs->trans("Weight"); ?></td><td>
|
<tr><td><?php echo $langs->trans("Weight"); ?></td><td>
|
||||||
|
|||||||
@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td width="15%"><?php echo $langs->trans("Ref"); ?></td>
|
<td width="15%"><?php echo $langs->trans("Ref"); ?></td>
|
||||||
<td colspan="2"><?php echo $product->tpl['showrefnav']; ?></td>
|
<td colspan="2"><?php echo $product->tpl['ref']; ?></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
@ -62,7 +62,7 @@
|
|||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td><?php echo $langs->trans("Nature"); ?></td>
|
<td><?php echo $langs->trans("Nature"); ?></td>
|
||||||
<td colspan="2"><?php echo $product->tpl['finishedLabel']; ?></td>
|
<td colspan="2"><?php echo $product->tpl['finished']; ?></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user