mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
Qual: Uniformize code for canvas of product/service with code of canvas for company and contact.
This commit is contained in:
parent
7723d9ee81
commit
8b3ec4e284
106
htdocs/product/canvas/default/product.default.class.php → htdocs/product/canvas/product/actions_card_product.class.php
Normal file → Executable file
106
htdocs/product/canvas/default/product.default.class.php → htdocs/product/canvas/product/actions_card_product.class.php
Normal file → Executable file
|
|
@ -16,21 +16,24 @@
|
|||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/product/canvas/default/product.default.class.php
|
||||
* \file htdocs/product/canvas/product/actions_card_product.class.php
|
||||
* \ingroup produit
|
||||
* \brief Fichier de la classe des produits par defaut
|
||||
*/
|
||||
include_once(DOL_DOCUMENT_ROOT.'/product/class/product.class.php');
|
||||
|
||||
/**
|
||||
* \class ProductDefault
|
||||
* \brief Classe permettant la gestion produits par defaut, cette classe surcharge la classe produit
|
||||
* \class ActionsCardProduct
|
||||
* \brief Class with controller methods for product canvas
|
||||
*/
|
||||
class ProductDefault extends Product
|
||||
class ActionsCardProduct
|
||||
{
|
||||
//! Numero d'erreur Plage 1280-1535
|
||||
var $errno = 0;
|
||||
//! Template container
|
||||
var $db;
|
||||
var $targetmodule;
|
||||
var $canvas;
|
||||
var $card;
|
||||
|
||||
//! Template container
|
||||
var $tpl = array();
|
||||
|
||||
/**
|
||||
|
|
@ -38,7 +41,7 @@ class ProductDefault extends Product
|
|||
* \param DB Handler acces base de donnees
|
||||
* \param id Id produit (0 par defaut)
|
||||
*/
|
||||
function ProductDefault($DB=0, $id=0, $user=0)
|
||||
function ActionsCardProduct($DB=0, $id=0, $user=0)
|
||||
{
|
||||
$this->db = $DB;
|
||||
$this->id = $id ;
|
||||
|
|
@ -71,89 +74,110 @@ class ProductDefault extends Product
|
|||
}
|
||||
|
||||
/**
|
||||
* \brief Assigne les valeurs pour les templates
|
||||
* \param object object
|
||||
* Assign custom values for canvas (for example into this->tpl to be used by templates)
|
||||
*
|
||||
* @param action Type of action
|
||||
*/
|
||||
function assign_values($action='')
|
||||
{
|
||||
global $conf,$langs;
|
||||
global $html;
|
||||
global $formproduct;
|
||||
global $conf,$langs,$user;
|
||||
global $html, $formproduct;
|
||||
|
||||
parent::assign_values($action);
|
||||
|
||||
// Stock alert
|
||||
$this->tpl['seuil_stock_alerte'] = $this->seuil_stock_alerte;
|
||||
$this->tpl['finished'] = $this->object->finished;
|
||||
$this->tpl['ref'] = $this->object->ref;
|
||||
$this->tpl['label'] = $this->object->label;
|
||||
$this->tpl['id'] = $this->object->id;
|
||||
$this->tpl['type'] = $this->object->type;
|
||||
$this->tpl['note'] = $this->object->note;
|
||||
$this->tpl['seuil_stock_alerte'] = $this->object->seuil_stock_alerte;
|
||||
|
||||
if ($action == 'create')
|
||||
{
|
||||
// Title
|
||||
$this->tpl['title'] = load_fiche_titre($langs->trans("NewProduct"));
|
||||
$this->tpl['title'] = $langs->trans("NewProduct");
|
||||
}
|
||||
|
||||
if ($action == 'edit')
|
||||
{
|
||||
$this->tpl['title'] = load_fiche_titre($langs->trans('Modify').' '.$langs->trans('Product').' : '.$this->ref, "");
|
||||
$this->tpl['title'] = $langs->trans('Modify').' '.$langs->trans('Product').' : '.$this->object->ref;
|
||||
}
|
||||
|
||||
if ($action == 'create' || $action == 'edit')
|
||||
{
|
||||
// Finished
|
||||
// Status
|
||||
$statutarray=array('1' => $langs->trans("OnSell"), '0' => $langs->trans("NotOnSell"));
|
||||
$this->tpl['status'] = $html->selectarray('statut',$statutarray,$_POST["statut"]);
|
||||
|
||||
$statutarray=array('1' => $langs->trans("ProductStatusOnBuy"), '0' => $langs->trans("ProductStatusNotOnBuy"));
|
||||
$this->tpl['status_buy'] = $html->selectarray('statut_buy',$statutarray,$_POST["statut_buy"]);
|
||||
|
||||
// Finished
|
||||
$statutarray=array('1' => $langs->trans("Finished"), '0' => $langs->trans("RowMaterial"));
|
||||
$this->tpl['finished'] = $html->selectarray('finished',$statutarray,$this->finished);
|
||||
$this->tpl['finished'] = $html->selectarray('finished',$statutarray,$this->object->finished);
|
||||
|
||||
// Weight
|
||||
$this->tpl['weight'] = $this->weight;
|
||||
$this->tpl['weight_units'] = $formproduct->load_measuring_units("weight_units","weight",$this->weight_units);
|
||||
$this->tpl['weight'] = $this->object->weight;
|
||||
$this->tpl['weight_units'] = $formproduct->load_measuring_units("weight_units","weight",$this->object->weight_units);
|
||||
|
||||
// Length
|
||||
$this->tpl['length'] = $this->length;
|
||||
$this->tpl['length_units'] = $formproduct->load_measuring_units("length_units","size",$this->length_units);
|
||||
$this->tpl['length'] = $this->object->length;
|
||||
$this->tpl['length_units'] = $formproduct->load_measuring_units("length_units","size",$this->object->length_units);
|
||||
|
||||
// Surface
|
||||
$this->tpl['surface'] = $this->surface;
|
||||
$this->tpl['surface_units'] = $formproduct->load_measuring_units("surface_units","surface",$this->surface_units);
|
||||
$this->tpl['surface'] = $this->object->surface;
|
||||
$this->tpl['surface_units'] = $formproduct->load_measuring_units("surface_units","surface",$this->object->surface_units);
|
||||
|
||||
// Volume
|
||||
$this->tpl['volume'] = $this->volume;
|
||||
$this->tpl['volume_units'] = $formproduct->load_measuring_units("volume_units","volume",$this->volume_units);
|
||||
$this->tpl['volume'] = $this->object->volume;
|
||||
$this->tpl['volume_units'] = $formproduct->load_measuring_units("volume_units","volume",$this->object->volume_units);
|
||||
}
|
||||
|
||||
if ($action == 'view')
|
||||
{
|
||||
// Photo
|
||||
$head=product_prepare_head($this->object, $user);
|
||||
$titre=$langs->trans("CardProduct".$this->object->type);
|
||||
$picto=($this->object->type==1?'service':'product');
|
||||
$this->tpl['fiche_head']=dol_get_fiche_head($head, 'card', $titre, 0, $picto);
|
||||
|
||||
// Status
|
||||
$this->tpl['status'] = $this->object->getLibStatut(2,0);
|
||||
$this->tpl['status_buy'] = $this->object->getLibStatut(2,1);
|
||||
|
||||
// Photo
|
||||
$this->tpl['nblignes'] = 4;
|
||||
if ($this->is_photo_available($conf->product->dir_output))
|
||||
if ($this->object->is_photo_available($conf->product->dir_output))
|
||||
{
|
||||
$this->tpl['photos'] = $this->show_photos($conf->product->dir_output,1,1,0,0,0,80);
|
||||
$this->tpl['photos'] = $this->object->show_photos($conf->product->dir_output,1,1,0,0,0,80);
|
||||
}
|
||||
|
||||
// Nature
|
||||
$this->tpl['finished'] = $this->getLibFinished();
|
||||
$this->tpl['finished'] = $this->object->getLibFinished();
|
||||
|
||||
// Weight
|
||||
if ($this->weight != '')
|
||||
if ($this->object->weight != '')
|
||||
{
|
||||
$this->tpl['weight'] = $this->weight." ".measuring_units_string($this->weight_units,"weight");
|
||||
$this->tpl['weight'] = $this->object->weight." ".measuring_units_string($this->object->weight_units,"weight");
|
||||
}
|
||||
|
||||
// Length
|
||||
if ($this->length != '')
|
||||
if ($this->object->length != '')
|
||||
{
|
||||
$this->tpl['length'] = $this->length." ".measuring_units_string($this->length_units,"size");
|
||||
$this->tpl['length'] = $this->object->length." ".measuring_units_string($this->object->length_units,"size");
|
||||
}
|
||||
|
||||
// Surface
|
||||
if ($this->surface != '')
|
||||
if ($this->object->surface != '')
|
||||
{
|
||||
$this->tpl['surface'] = $this->surface." ".measuring_units_string($this->surface_units,"surface");
|
||||
$this->tpl['surface'] = $this->object->surface." ".measuring_units_string($this->object->surface_units,"surface");
|
||||
}
|
||||
|
||||
// Volume
|
||||
if ($this->volume != '')
|
||||
if ($this->object->volume != '')
|
||||
{
|
||||
$this->tpl['volume'] = $this->volume." ".measuring_units_string($this->volume_units,"volume");
|
||||
$this->tpl['volume'] = $this->object->volume." ".measuring_units_string($this->object->volume_units,"volume");
|
||||
}
|
||||
|
||||
$this->tpl['fiche_end']=dol_get_fiche_end();
|
||||
}
|
||||
}
|
||||
|
||||
0
htdocs/product/canvas/default/index.php → htdocs/product/canvas/product/index.php
Normal file → Executable file
0
htdocs/product/canvas/default/index.php → htdocs/product/canvas/product/index.php
Normal file → Executable file
63
htdocs/product/canvas/default/tpl/create.tpl.php → htdocs/product/canvas/product/tpl/card_create.tpl.php
Normal file → Executable file
63
htdocs/product/canvas/default/tpl/create.tpl.php → htdocs/product/canvas/product/tpl/card_create.tpl.php
Normal file → Executable file
|
|
@ -19,85 +19,80 @@
|
|||
|
||||
<!-- BEGIN PHP TEMPLATE -->
|
||||
|
||||
<?php echo $this->object->tpl['title']; ?>
|
||||
<?php print_fiche_titre($this->control->tpl['title']); ?>
|
||||
|
||||
<?php if ($mesg) { ?>
|
||||
<br><div class="error"><?php echo $mesg; ?></div><br>
|
||||
<?php } ?>
|
||||
<?php dol_htmloutput_errors($this->control->tpl['error'],$this->control->tpl['errors']); ?>
|
||||
|
||||
<form action="<?php echo $_SERVER["PHP_SELF"]; ?>" method="post">
|
||||
<input type="hidden" name="token" value="<?php echo $_SESSION['newtoken']; ?>">
|
||||
<input type="hidden" name="action" value="add">
|
||||
<input type="hidden" name="type" value="0">
|
||||
<input type="hidden" name="canvas" value="<?php echo $_GET['canvas']; ?>">
|
||||
<input type="hidden" name="canvas" value="<?php echo $canvas; ?>">
|
||||
|
||||
<table class="border" width="100%">
|
||||
|
||||
<tr>
|
||||
<td class="fieldrequired" width="20%"><?php echo $langs->trans("Ref"); ?></td>
|
||||
<td><input name="ref" size="40" maxlength="32" value="<?php echo $this->object->tpl['ref']; ?>">
|
||||
<td><input name="ref" size="40" maxlength="32" value="<?php echo $this->control->tpl['ref']; ?>">
|
||||
<?php if ($_error == 1) echo $langs->trans("RefAlreadyExists"); ?>
|
||||
</td></tr>
|
||||
|
||||
<tr>
|
||||
<td class="fieldrequired"><?php echo $langs->trans("Label"); ?></td>
|
||||
<td><input name="libelle" size="40" value="<?php echo $this->object->tpl['label']; ?>"></td>
|
||||
<td><input name="libelle" size="40" value="<?php echo $this->control->tpl['label']; ?>"></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="fieldrequired"><?php echo $langs->trans("Status"); ?></td>
|
||||
<td><?php echo $this->object->tpl['status']; ?></td>
|
||||
<td class="fieldrequired"><?php echo $langs->trans("Status").' ('.$langs->trans("Sell").')'; ?></td>
|
||||
<td><?php echo $this->control->tpl['status']; ?></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="fieldrequired"><?php echo $langs->trans("Status").' ('.$langs->trans("Buy").')'; ?></td>
|
||||
<td><?php echo $this->control->tpl['status_buy']; ?></td>
|
||||
</tr>
|
||||
|
||||
<?php if ($conf->stock->enabled) { ?>
|
||||
<tr><td><?php echo $langs->trans("StockLimit"); ?></td><td>
|
||||
<input name="seuil_stock_alerte" size="4" value="<?php echo $this->object->tpl['seuil_stock_alerte']; ?>">
|
||||
<input name="seuil_stock_alerte" size="4" value="<?php echo $this->control->tpl['seuil_stock_alerte']; ?>">
|
||||
</td></tr>
|
||||
<?php } else { ?>
|
||||
<input name="seuil_stock_alerte" type="hidden" value="0">
|
||||
<?php } ?>
|
||||
|
||||
<tr><td valign="top"><?php echo $langs->trans("Description"); ?></td><td>
|
||||
<?php if (! $this->object->tpl['textarea_description']) {
|
||||
$this->object->tpl['doleditor_description']->Create();
|
||||
}else{
|
||||
echo $this->object->tpl['textarea_description'];
|
||||
}?>
|
||||
<?php echo $this->control->tpl['textarea_description']; ?>
|
||||
</td></tr>
|
||||
|
||||
<tr><td><?php echo $langs->trans("Nature"); ?></td><td>
|
||||
<?php echo $this->object->tpl['finished']; ?>
|
||||
<?php echo $this->control->tpl['finished']; ?>
|
||||
</td></tr>
|
||||
|
||||
<tr><td><?php echo $langs->trans("Weight"); ?></td><td>
|
||||
<input name="weight" size="4" value="<?php echo $this->object->tpl['weight']; ?>">
|
||||
<?php echo $this->object->tpl['weight_units']; ?>
|
||||
<input name="weight" size="4" value="<?php echo $this->control->tpl['weight']; ?>">
|
||||
<?php echo $this->control->tpl['weight_units']; ?>
|
||||
</td></tr>
|
||||
|
||||
<tr><td><?php echo $langs->trans("Length"); ?></td><td>
|
||||
<input name="size" size="4" value="<?php echo $this->object->tpl['length']; ?>">
|
||||
<?php echo $this->object->tpl['length_units']; ?>
|
||||
<input name="size" size="4" value="<?php echo $this->control->tpl['length']; ?>">
|
||||
<?php echo $this->control->tpl['length_units']; ?>
|
||||
</td></tr>
|
||||
|
||||
<tr><td><?php echo $langs->trans("Surface"); ?></td><td>
|
||||
<input name="surface" size="4" value="<?php echo $this->object->tpl['surface']; ?>">
|
||||
<?php echo $this->object->tpl['surface_units']; ?>
|
||||
<input name="surface" size="4" value="<?php echo $this->control->tpl['surface']; ?>">
|
||||
<?php echo $this->control->tpl['surface_units']; ?>
|
||||
</td></tr>
|
||||
|
||||
<tr><td><?php echo $langs->trans("Volume"); ?></td><td>
|
||||
<input name="volume" size="4" value="<?php echo $this->object->tpl['volume']; ?>">
|
||||
<?php echo $this->object->tpl['volume_units']; ?>
|
||||
<input name="volume" size="4" value="<?php echo $this->control->tpl['volume']; ?>">
|
||||
<?php echo $this->control->tpl['volume_units']; ?>
|
||||
</td></tr>
|
||||
|
||||
<tr><td><?php echo $langs->trans("Hidden"); ?></td>
|
||||
<td><?php echo $this->object->tpl['hidden']; ?></td></tr>
|
||||
<td><?php echo $this->control->tpl['hidden']; ?></td></tr>
|
||||
|
||||
<tr><td valign="top"><?php echo $langs->trans("NoteNotVisibleOnBill"); ?></td><td>
|
||||
<?php if (! $this->object->tpl['textarea_note']) {
|
||||
$this->object->tpl['doleditor_note']->Create();
|
||||
}else{
|
||||
echo $this->object->tpl['textarea_note'];
|
||||
}?>
|
||||
<?php echo $this->control->tpl['textarea_note']; ?>
|
||||
</td></tr>
|
||||
</table>
|
||||
|
||||
|
|
@ -108,16 +103,16 @@ echo $this->object->tpl['textarea_note'];
|
|||
<table class="border" width="100%">
|
||||
|
||||
<tr><td><?php echo $langs->trans("SellingPrice"); ?></td>
|
||||
<td><input name="price" size="10" value="<?php echo $this->object->tpl['price']; ?>">
|
||||
<?php echo $this->object->tpl['price_base_type']; ?>
|
||||
<td><input name="price" size="10" value="<?php echo $this->control->tpl['price']; ?>">
|
||||
<?php echo $this->control->tpl['price_base_type']; ?>
|
||||
</td></tr>
|
||||
|
||||
<tr><td><?php echo $langs->trans("MinPrice"); ?></td>
|
||||
<td><input name="price_min" size="10" value="<?php echo $this->object->tpl['price_min']; ?>">
|
||||
<td><input name="price_min" size="10" value="<?php echo $this->control->tpl['price_min']; ?>">
|
||||
</td></tr>
|
||||
|
||||
<tr><td width="20%"><?php echo $langs->trans("VATRate"); ?></td><td>
|
||||
<?php echo $this->object->tpl['tva_tx']; ?>
|
||||
<?php echo $this->control->tpl['tva_tx']; ?>
|
||||
</td></tr>
|
||||
|
||||
</table>
|
||||
53
htdocs/product/canvas/default/tpl/edit.tpl.php → htdocs/product/canvas/product/tpl/card_edit.tpl.php
Normal file → Executable file
53
htdocs/product/canvas/default/tpl/edit.tpl.php → htdocs/product/canvas/product/tpl/card_edit.tpl.php
Normal file → Executable file
|
|
@ -19,85 +19,74 @@
|
|||
|
||||
<!-- BEGIN PHP TEMPLATE -->
|
||||
|
||||
<?php echo $this->object->tpl['title']; ?>
|
||||
<?php
|
||||
print_fiche_titre($this->control->tpl['title']);
|
||||
|
||||
<?php if ($mesg) { ?>
|
||||
<br><div class="error"><?php echo $mesg; ?></div><br>
|
||||
<?php } ?>
|
||||
dol_htmloutput_errors($this->control->tpl['error'],$this->control->tpl['errors']);
|
||||
?>
|
||||
|
||||
<form action="<?php echo $_SERVER["PHP_SELF"]; ?>" method="post">
|
||||
<input type="hidden" name="token" value="<?php echo $_SESSION['newtoken']; ?>">
|
||||
<input type="hidden" name="action" value="update">
|
||||
<input type="hidden" name="id" value="<?php echo $this->object->tpl['id']; ?>">
|
||||
<input type="hidden" name="canvas" value="<?php echo $this->object->tpl['canvas']; ?>">
|
||||
<input type="hidden" name="id" value="<?php echo $this->control->tpl['id']; ?>">
|
||||
<input type="hidden" name="canvas" value="<?php echo $this->control->tpl['canvas']; ?>">
|
||||
|
||||
|
||||
<table class="border" width="100%">
|
||||
|
||||
<tr>
|
||||
<td class="fieldrequired" width="20%"><?php echo $langs->trans("Ref"); ?></td>
|
||||
<td><input name="ref" size="40" maxlength="32" value="<?php echo $this->object->tpl['ref']; ?>">
|
||||
<td><input name="ref" size="40" maxlength="32" value="<?php echo $this->control->tpl['ref']; ?>">
|
||||
</td></tr>
|
||||
|
||||
<tr>
|
||||
<td class="fieldrequired"><?php echo $langs->trans("Label"); ?></td>
|
||||
<td><input name="libelle" size="40" value="<?php echo $this->object->tpl['label']; ?>"></td>
|
||||
<td><input name="libelle" size="40" value="<?php echo $this->control->tpl['label']; ?>"></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="fieldrequired"><?php echo $langs->trans("Status"); ?></td>
|
||||
<td><?php echo $this->object->tpl['status']; ?></td>
|
||||
<td><?php echo $this->control->tpl['status']; ?></td>
|
||||
</tr>
|
||||
|
||||
<?php if ($conf->stock->enabled) { ?>
|
||||
<tr><td><?php echo $langs->trans("StockLimit"); ?></td><td>
|
||||
<input name="seuil_stock_alerte" size="4" value="<?php echo $this->object->tpl['seuil_stock_alerte']; ?>">
|
||||
<input name="seuil_stock_alerte" size="4" value="<?php echo $this->control->tpl['seuil_stock_alerte']; ?>">
|
||||
</td></tr>
|
||||
<?php } else { ?>
|
||||
<input name="seuil_stock_alerte" type="hidden" value="0">
|
||||
<?php } ?>
|
||||
|
||||
<tr><td valign="top"><?php echo $langs->trans("Description"); ?></td><td>
|
||||
<?php if (! $this->object->tpl['textarea_description']) {
|
||||
$this->object->tpl['doleditor_description']->Create();
|
||||
}else{
|
||||
echo $this->object->tpl['textarea_description'];
|
||||
}?>
|
||||
<?php echo $this->control->tpl['textarea_description']; ?>
|
||||
</td></tr>
|
||||
|
||||
<tr><td><?php echo $langs->trans("Nature"); ?></td><td>
|
||||
<?php echo $this->object->tpl['finished']; ?>
|
||||
<?php echo $this->control->tpl['finished']; ?>
|
||||
</td></tr>
|
||||
|
||||
<tr><td><?php echo $langs->trans("Weight"); ?></td><td>
|
||||
<input name="weight" size="4" value="<?php echo $this->object->tpl['weight']; ?>">
|
||||
<?php echo $this->object->tpl['weight_units']; ?>
|
||||
<input name="weight" size="4" value="<?php echo $this->control->tpl['weight']; ?>">
|
||||
<?php echo $this->control->tpl['weight_units']; ?>
|
||||
</td></tr>
|
||||
|
||||
<tr><td><?php echo $langs->trans("Length"); ?></td><td>
|
||||
<input name="size" size="4" value="<?php echo $this->object->tpl['length']; ?>">
|
||||
<?php echo $this->object->tpl['length_units']; ?>
|
||||
<input name="size" size="4" value="<?php echo $this->control->tpl['length']; ?>">
|
||||
<?php echo $this->control->tpl['length_units']; ?>
|
||||
</td></tr>
|
||||
|
||||
<tr><td><?php echo $langs->trans("Surface"); ?></td><td>
|
||||
<input name="surface" size="4" value="<?php echo $this->object->tpl['surface']; ?>">
|
||||
<?php echo $this->object->tpl['surface_units']; ?>
|
||||
<input name="surface" size="4" value="<?php echo $this->control->tpl['surface']; ?>">
|
||||
<?php echo $this->control->tpl['surface_units']; ?>
|
||||
</td></tr>
|
||||
|
||||
<tr><td><?php echo $langs->trans("Volume"); ?></td><td>
|
||||
<input name="volume" size="4" value="<?php echo $this->object->tpl['volume']; ?>">
|
||||
<?php echo $this->object->tpl['volume_units']; ?>
|
||||
<input name="volume" size="4" value="<?php echo $this->control->tpl['volume']; ?>">
|
||||
<?php echo $this->control->tpl['volume_units']; ?>
|
||||
</td></tr>
|
||||
|
||||
<tr><td><?php echo $langs->trans("Hidden"); ?></td>
|
||||
<td><?php echo $this->object->tpl['hidden']; ?></td></tr>
|
||||
|
||||
<tr><td valign="top"><?php echo $langs->trans("NoteNotVisibleOnBill"); ?></td><td>
|
||||
<?php if (! $this->object->tpl['textarea_note']) {
|
||||
$this->object->tpl['doleditor_note']->Create();
|
||||
}else{
|
||||
echo $this->object->tpl['textarea_note'];
|
||||
}?>
|
||||
<?php echo $this->control->tpl['textarea_note']; ?>
|
||||
</td></tr>
|
||||
</table>
|
||||
|
||||
47
htdocs/product/canvas/default/tpl/view.tpl.php → htdocs/product/canvas/product/tpl/card_view.tpl.php
Normal file → Executable file
47
htdocs/product/canvas/default/tpl/view.tpl.php → htdocs/product/canvas/product/tpl/card_view.tpl.php
Normal file → Executable file
|
|
@ -18,81 +18,76 @@
|
|||
?>
|
||||
|
||||
<!-- BEGIN PHP TEMPLATE -->
|
||||
<?php echo $this->control->tpl['fiche_head']; ?>
|
||||
|
||||
<?php dol_htmloutput_errors($this->control->tpl['error'],$this->control->tpl['errors']); ?>
|
||||
|
||||
<table class="border" width="100%">
|
||||
|
||||
<tr>
|
||||
<td width="15%"><?php echo $langs->trans("Ref"); ?></td>
|
||||
<td colspan="2"><?php echo $this->object->tpl['ref']; ?></td>
|
||||
<td colspan="2"><?php echo $this->control->tpl['ref']; ?></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><?php echo $langs->trans("Label") ?></td>
|
||||
<td><?php echo $this->object->tpl['label']; ?></td>
|
||||
<td><?php echo $this->control->tpl['label']; ?></td>
|
||||
|
||||
<?php if ($this->object->tpl['photos']) { ?>
|
||||
<td valign="middle" align="center" width="30%" rowspan="<?php echo $this->object->tpl['nblignes']; ?>">
|
||||
<?php echo $this->object->tpl['photos']; ?>
|
||||
<?php if ($this->control->tpl['photos']) { ?>
|
||||
<td valign="middle" align="center" width="30%" rowspan="<?php echo $this->control->tpl['nblignes']; ?>">
|
||||
<?php echo $this->control->tpl['photos']; ?>
|
||||
</td>
|
||||
<?php } ?>
|
||||
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><?php echo $this->object->tpl['accountancyBuyCodeKey']; ?></td>
|
||||
<td><?php echo $this->object->tpl['accountancyBuyCodeVal']; ?></td>
|
||||
<td><?php echo $langs->trans("Status").' ('.$langs->trans("Sell").')'; ?></td>
|
||||
<td><?php echo $this->control->tpl['status']; ?></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><?php echo $this->object->tpl['accountancySellCodeKey']; ?></td>
|
||||
<td><?php echo $this->object->tpl['accountancySellCodeVal']; ?></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><?php echo $langs->trans("Status"); ?></td>
|
||||
<td><?php echo $this->object->tpl['status']; ?></td>
|
||||
<td><?php echo $langs->trans("Status").' ('.$langs->trans("Buy").')'; ?></td>
|
||||
<td><?php echo $this->control->tpl['status_buy']; ?></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td valign="top"><?php echo $langs->trans("Description"); ?></td>
|
||||
<td colspan="2"><?php echo $this->object->tpl['description']; ?></td>
|
||||
<td colspan="2"><?php echo $this->control->tpl['description']; ?></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><?php echo $langs->trans("Nature"); ?></td>
|
||||
<td colspan="2"><?php echo $this->object->tpl['finished']; ?></td>
|
||||
<td colspan="2"><?php echo $this->control->tpl['finished']; ?></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><?php echo $langs->trans("Weight"); ?></td>
|
||||
<td colspan="2"><?php echo $this->object->tpl['weight']; ?></td>
|
||||
<td colspan="2"><?php echo $this->control->tpl['weight']; ?></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><?php echo $langs->trans("Length"); ?></td>
|
||||
<td colspan="2"><?php echo $this->object->tpl['length']; ?></td>
|
||||
<td colspan="2"><?php echo $this->control->tpl['length']; ?></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><?php echo $langs->trans("Surface"); ?></td>
|
||||
<td colspan="2"><?php echo $this->object->tpl['surface']; ?></td>
|
||||
<td colspan="2"><?php echo $this->control->tpl['surface']; ?></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><?php echo $langs->trans("Volume"); ?></td>
|
||||
<td colspan="2"><?php echo $this->object->tpl['volume']; ?></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><?php echo $langs->trans("Hidden"); ?></td>
|
||||
<td colspan="2"><?php echo $this->object->tpl['hidden']; ?></td>
|
||||
<td colspan="2"><?php echo $this->control->tpl['volume']; ?></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td valign="top"><?php echo $langs->trans("Note"); ?></td>
|
||||
<td colspan="2"><?php echo $this->object->tpl['note']; ?></td>
|
||||
<td colspan="2"><?php echo $this->control->tpl['note']; ?></td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
<?php echo $this->control->tpl['fiche_end']; ?>
|
||||
|
||||
<!-- END PHP TEMPLATE -->
|
||||
0
htdocs/product/canvas/default/tpl/index.php → htdocs/product/canvas/product/tpl/index.php
Normal file → Executable file
0
htdocs/product/canvas/default/tpl/index.php → htdocs/product/canvas/product/tpl/index.php
Normal file → Executable file
0
htdocs/product/canvas/default/tpl/list.tpl.php → htdocs/product/canvas/product/tpl/list.tpl.php
Normal file → Executable file
0
htdocs/product/canvas/default/tpl/list.tpl.php → htdocs/product/canvas/product/tpl/list.tpl.php
Normal file → Executable file
72
htdocs/product/canvas/service/product.service.class.php → htdocs/product/canvas/service/actions_card_service.class.php
Normal file → Executable file
72
htdocs/product/canvas/service/product.service.class.php → htdocs/product/canvas/service/actions_card_service.class.php
Normal file → Executable file
|
|
@ -23,13 +23,16 @@
|
|||
|
||||
/**
|
||||
* \class ProductService
|
||||
* \brief Classe permettant la gestion services par defaut, cette classe surcharge la classe produit
|
||||
* \brief Class with controller methods for product canvas
|
||||
*/
|
||||
class ProductService extends Product
|
||||
class ActionsCardService
|
||||
{
|
||||
//! Numero d'erreur Plage 1280-1535
|
||||
var $errno = 0;
|
||||
var $db;
|
||||
var $targetmodule;
|
||||
var $canvas;
|
||||
var $card;
|
||||
|
||||
//! Template container
|
||||
var $tpl = array();
|
||||
|
||||
/**
|
||||
|
|
@ -37,7 +40,7 @@ class ProductService extends Product
|
|||
* \param DB Handler acces base de donnees
|
||||
* \param id Id service (0 par defaut)
|
||||
*/
|
||||
function ProductService($DB=0, $id=0, $user=0)
|
||||
function ActionsCardService($DB=0, $id=0, $user=0)
|
||||
{
|
||||
$this->db = $DB;
|
||||
$this->id = $id ;
|
||||
|
|
@ -73,59 +76,84 @@ class ProductService extends Product
|
|||
*/
|
||||
function assign_values($action='')
|
||||
{
|
||||
global $conf,$langs;
|
||||
global $conf,$langs,$user;
|
||||
global $html, $formproduct;
|
||||
|
||||
parent::assign_values($action);
|
||||
$this->tpl['finished'] = $this->object->finished;
|
||||
$this->tpl['ref'] = $this->object->ref;
|
||||
$this->tpl['label'] = $this->object->label;
|
||||
$this->tpl['id'] = $this->object->id;
|
||||
$this->tpl['type'] = $this->object->type;
|
||||
$this->tpl['note'] = $this->object->note;
|
||||
$this->tpl['seuil_stock_alerte'] = $this->object->seuil_stock_alerte;
|
||||
|
||||
// Duration
|
||||
$this->tpl['duration_value'] = $this->duration_value;
|
||||
$this->tpl['duration_value'] = $this->object->duration_value;
|
||||
|
||||
if ($action == 'create')
|
||||
{
|
||||
// Title
|
||||
$this->tpl['title'] = load_fiche_titre($langs->trans("NewService"));
|
||||
$this->tpl['title'] = $langs->trans("NewService");
|
||||
}
|
||||
|
||||
if ($action == 'edit')
|
||||
{
|
||||
$this->tpl['title'] = load_fiche_titre($langs->trans('Modify').' '.$langs->trans('Service').' : '.$this->ref, "");
|
||||
$this->tpl['title'] = $langs->trans('Modify').' '.$langs->trans('Service').' : '.$this->object->ref;
|
||||
}
|
||||
|
||||
if ($action == 'create' || $action == 'edit')
|
||||
{
|
||||
// Duration unit
|
||||
// Status
|
||||
$statutarray=array('1' => $langs->trans("OnSell"), '0' => $langs->trans("NotOnSell"));
|
||||
$this->tpl['status'] = $html->selectarray('statut',$statutarray,$_POST["statut"]);
|
||||
|
||||
$statutarray=array('1' => $langs->trans("ProductStatusOnBuy"), '0' => $langs->trans("ProductStatusNotOnBuy"));
|
||||
$this->tpl['status_buy'] = $html->selectarray('statut_buy',$statutarray,$_POST["statut_buy"]);
|
||||
|
||||
// Duration unit
|
||||
// TODO creer fonction
|
||||
$duration_unit = '<input name="duration_unit" type="radio" value="h"'.($this->duration_unit=='h'?' checked':'').'>'.$langs->trans("Hour");
|
||||
$duration_unit = '<input name="duration_unit" type="radio" value="h"'.($this->object->duration_unit=='h'?' checked':'').'>'.$langs->trans("Hour");
|
||||
$duration_unit.= ' ';
|
||||
$duration_unit.= '<input name="duration_unit" type="radio" value="d"'.($this->duration_unit=='d'?' checked':'').'>'.$langs->trans("Day");
|
||||
$duration_unit.= '<input name="duration_unit" type="radio" value="d"'.($this->object->duration_unit=='d'?' checked':'').'>'.$langs->trans("Day");
|
||||
$duration_unit.= ' ';
|
||||
$duration_unit.= '<input name="duration_unit" type="radio" value="w"'.($this->duration_unit=='w'?' checked':'').'>'.$langs->trans("Week");
|
||||
$duration_unit.= '<input name="duration_unit" type="radio" value="w"'.($this->object->duration_unit=='w'?' checked':'').'>'.$langs->trans("Week");
|
||||
$duration_unit.= ' ';
|
||||
$duration_unit.= '<input name="duration_unit" type="radio" value="m"'.($this->duration_unit=='m'?' checked':'').'>'.$langs->trans("Month");
|
||||
$duration_unit.= '<input name="duration_unit" type="radio" value="m"'.($this->object->duration_unit=='m'?' checked':'').'>'.$langs->trans("Month");
|
||||
$duration_unit.= ' ';
|
||||
$duration_unit.= '<input name="duration_unit" type="radio" value="y"'.($this->duration_unit=='y'?' checked':'').'>'.$langs->trans("Year");
|
||||
$duration_unit.= '<input name="duration_unit" type="radio" value="y"'.($this->object->duration_unit=='y'?' checked':'').'>'.$langs->trans("Year");
|
||||
$this->tpl['duration_unit'] = $duration_unit;
|
||||
}
|
||||
|
||||
if ($action == 'view')
|
||||
{
|
||||
// Photo
|
||||
$head=product_prepare_head($this->object, $user);
|
||||
$titre=$langs->trans("CardProduct".$this->object->type);
|
||||
$picto=($this->object->type==1?'service':'product');
|
||||
$this->tpl['fiche_head']=dol_get_fiche_head($head, 'card', $titre, 0, $picto);
|
||||
|
||||
// Status
|
||||
$this->tpl['status'] = $this->object->getLibStatut(2,0);
|
||||
$this->tpl['status_buy'] = $this->object->getLibStatut(2,1);
|
||||
|
||||
// Photo
|
||||
$this->tpl['nblignes'] = 4;
|
||||
if ($this->is_photo_available($conf->service->dir_output))
|
||||
if ($this->object->is_photo_available($conf->service->dir_output))
|
||||
{
|
||||
$this->tpl['photos'] = $this->show_photos($conf->service->dir_output,1,1,0,0,0,80);
|
||||
$this->tpl['photos'] = $this->object->show_photos($conf->service->dir_output,1,1,0,0,0,80);
|
||||
}
|
||||
|
||||
// Duration
|
||||
if ($this->duration_value > 1)
|
||||
if ($this->object->duration_value > 1)
|
||||
{
|
||||
$dur=array("h"=>$langs->trans("Hours"),"d"=>$langs->trans("Days"),"w"=>$langs->trans("Weeks"),"m"=>$langs->trans("Months"),"y"=>$langs->trans("Years"));
|
||||
}
|
||||
else if ($this->duration_value > 0)
|
||||
else if ($this->object->duration_value > 0)
|
||||
{
|
||||
$dur=array("h"=>$langs->trans("Hour"),"d"=>$langs->trans("Day"),"w"=>$langs->trans("Week"),"m"=>$langs->trans("Month"),"y"=>$langs->trans("Year"));
|
||||
}
|
||||
$this->tpl['duration_unit'] = $langs->trans($dur[$this->duration_unit]);
|
||||
$this->tpl['duration_unit'] = $langs->trans($dur[$this->object->duration_unit]);
|
||||
|
||||
$this->tpl['fiche_end']=dol_get_fiche_end();
|
||||
}
|
||||
}
|
||||
|
||||
29
htdocs/product/canvas/service/tpl/create.tpl.php → htdocs/product/canvas/service/tpl/card_create.tpl.php
Normal file → Executable file
29
htdocs/product/canvas/service/tpl/create.tpl.php → htdocs/product/canvas/service/tpl/card_create.tpl.php
Normal file → Executable file
|
|
@ -19,17 +19,15 @@
|
|||
|
||||
<!-- BEGIN PHP TEMPLATE -->
|
||||
|
||||
<?php echo $this->object->tpl['title']; ?>
|
||||
<?php print_fiche_titre($this->control->tpl['title']); ?>
|
||||
|
||||
<?php if ($mesg) { ?>
|
||||
<br><div class="error"><?php echo $mesg; ?></div><br>
|
||||
<?php } ?>
|
||||
<?php dol_htmloutput_errors($this->control->tpl['error'],$this->control->tpl['errors']); ?>
|
||||
|
||||
<form action="<?php echo $_SERVER["PHP_SELF"]; ?>" method="post">
|
||||
<input type="hidden" name="token" value="<?php echo $_SESSION['newtoken']; ?>">
|
||||
<input type="hidden" name="action" value="add">
|
||||
<input type="hidden" name="type" value="1">
|
||||
<input type="hidden" name="canvas" value="<?php echo $_GET['canvas']; ?>">
|
||||
<input type="hidden" name="canvas" value="<?php echo $canvas; ?>">
|
||||
|
||||
<table class="border" width="100%">
|
||||
|
||||
|
|
@ -45,16 +43,17 @@
|
|||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="fieldrequired"><?php echo $langs->trans("Status"); ?></td>
|
||||
<td><?php echo $this->object->tpl['status']; ?></td>
|
||||
<td class="fieldrequired"><?php echo $langs->trans("Status").' ('.$langs->trans("Sell").')'; ?></td>
|
||||
<td><?php echo $this->control->tpl['status']; ?></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="fieldrequired"><?php echo $langs->trans("Status").' ('.$langs->trans("Buy").')'; ?></td>
|
||||
<td><?php echo $this->control->tpl['status_buy']; ?></td>
|
||||
</tr>
|
||||
|
||||
<tr><td valign="top"><?php echo $langs->trans("Description"); ?></td><td>
|
||||
<?php if (! $this->object->tpl['textarea_description']) {
|
||||
$this->object->tpl['doleditor_description']->Create();
|
||||
}else{
|
||||
echo $this->object->tpl['textarea_description'];
|
||||
}?>
|
||||
<?php echo $this->object->tpl['textarea_description']; ?>
|
||||
</td></tr>
|
||||
|
||||
<tr><td><?php echo $langs->trans("Duration"); ?></td>
|
||||
|
|
@ -66,11 +65,7 @@ echo $this->object->tpl['textarea_description'];
|
|||
<td><?php echo $this->object->tpl['hidden']; ?></td></tr>
|
||||
|
||||
<tr><td valign="top"><?php echo $langs->trans("NoteNotVisibleOnBill"); ?></td><td>
|
||||
<?php if (! $this->object->tpl['textarea_note']) {
|
||||
$this->object->tpl['doleditor_note']->Create();
|
||||
}else{
|
||||
echo $this->object->tpl['textarea_note'];
|
||||
}?>
|
||||
<?php echo $this->object->tpl['textarea_note']; ?>
|
||||
</td></tr>
|
||||
</table>
|
||||
|
||||
11
htdocs/product/canvas/service/tpl/edit.tpl.php → htdocs/product/canvas/service/tpl/card_edit.tpl.php
Normal file → Executable file
11
htdocs/product/canvas/service/tpl/edit.tpl.php → htdocs/product/canvas/service/tpl/card_edit.tpl.php
Normal file → Executable file
|
|
@ -50,7 +50,7 @@
|
|||
</tr>
|
||||
|
||||
<tr><td valign="top"><?php echo $langs->trans("Description"); ?></td><td>
|
||||
<?php if (! $this->object->tpl['textarea_description']) {
|
||||
<?php if (! $this->object->tpl['textarea_description']) {
|
||||
$this->object->tpl['doleditor_description']->Create();
|
||||
}else{
|
||||
echo $this->object->tpl['textarea_description'];
|
||||
|
|
@ -62,15 +62,8 @@ echo $this->object->tpl['textarea_description'];
|
|||
<?php echo $this->object->tpl['duration_unit']; ?>
|
||||
</td></tr>
|
||||
|
||||
<tr><td><?php echo $langs->trans("Hidden"); ?></td>
|
||||
<td><?php echo $this->object->tpl['hidden']; ?></td></tr>
|
||||
|
||||
<tr><td valign="top"><?php echo $langs->trans("NoteNotVisibleOnBill"); ?></td><td>
|
||||
<?php if (! $this->object->tpl['textarea_note']) {
|
||||
$this->object->tpl['doleditor_note']->Create();
|
||||
}else{
|
||||
echo $this->object->tpl['textarea_note'];
|
||||
}?>
|
||||
<?php echo $this->object->tpl['textarea_note']; ?>
|
||||
</td></tr>
|
||||
</table>
|
||||
|
||||
37
htdocs/product/canvas/service/tpl/view.tpl.php → htdocs/product/canvas/service/tpl/card_view.tpl.php
Normal file → Executable file
37
htdocs/product/canvas/service/tpl/view.tpl.php → htdocs/product/canvas/service/tpl/card_view.tpl.php
Normal file → Executable file
|
|
@ -18,61 +18,60 @@
|
|||
?>
|
||||
|
||||
<!-- BEGIN PHP TEMPLATE -->
|
||||
<?php echo $this->control->tpl['fiche_head']; ?>
|
||||
|
||||
<?php dol_htmloutput_errors($this->control->tpl['error'],$this->control->tpl['errors']); ?>
|
||||
|
||||
<table class="border" width="100%">
|
||||
|
||||
<tr>
|
||||
<td width="15%"><?php echo $langs->trans("Ref"); ?></td>
|
||||
<td colspan="2"><?php echo $this->object->tpl['ref']; ?></td>
|
||||
<td colspan="2"><?php echo $this->control->tpl['ref']; ?></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><?php echo $langs->trans("Label") ?></td>
|
||||
<td><?php echo $this->object->tpl['label']; ?></td>
|
||||
<td><?php echo $this->control->tpl['label']; ?></td>
|
||||
|
||||
<?php if ($this->object->tpl['photos']) { ?>
|
||||
<td valign="middle" align="center" width="30%" rowspan="<?php echo $this->object->tpl['nblignes']; ?>">
|
||||
<?php echo $this->object->tpl['photos']; ?>
|
||||
<?php if ($this->control->tpl['photos']) { ?>
|
||||
<td valign="middle" align="center" width="30%" rowspan="<?php echo $this->control->tpl['nblignes']; ?>">
|
||||
<?php echo $this->control->tpl['photos']; ?>
|
||||
</td>
|
||||
<?php } ?>
|
||||
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><?php echo $this->object->tpl['accountancyBuyCodeKey']; ?></td>
|
||||
<td><?php echo $this->object->tpl['accountancyBuyCodeVal']; ?></td>
|
||||
<td><?php echo $langs->trans("Status").' ('.$langs->trans("Sell").')'; ?></td>
|
||||
<td><?php echo $this->control->tpl['status']; ?></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><?php echo $this->object->tpl['accountancySellCodeKey']; ?></td>
|
||||
<td><?php echo $this->object->tpl['accountancySellCodeVal']; ?></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><?php echo $langs->trans("Status"); ?></td>
|
||||
<td><?php echo $this->object->tpl['status']; ?></td>
|
||||
<td><?php echo $langs->trans("Status").' ('.$langs->trans("Buy").')'; ?></td>
|
||||
<td><?php echo $this->control->tpl['status_buy']; ?></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td valign="top"><?php echo $langs->trans("Description"); ?></td>
|
||||
<td colspan="2"><?php echo $this->object->tpl['description']; ?></td>
|
||||
<td colspan="2"><?php echo $this->control->tpl['description']; ?></td>
|
||||
</tr>
|
||||
|
||||
<tr><td><?php echo $langs->trans("Duration"); ?></td>
|
||||
<td><?php echo $this->object->tpl['duration_value']; ?>
|
||||
<?php echo $this->object->tpl['duration_unit']; ?>
|
||||
<td><?php echo $this->control->tpl['duration_value']; ?>
|
||||
<?php echo $this->control->tpl['duration_unit']; ?>
|
||||
</td></tr>
|
||||
|
||||
<tr>
|
||||
<td><?php echo $langs->trans("Hidden"); ?></td>
|
||||
<td colspan="2"><?php echo $this->object->tpl['hidden']; ?></td>
|
||||
<td colspan="2"><?php echo $this->control->tpl['hidden']; ?></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td valign="top"><?php echo $langs->trans("Note"); ?></td>
|
||||
<td colspan="2"><?php echo $this->object->tpl['note']; ?></td>
|
||||
<td colspan="2"><?php echo $this->control->tpl['note']; ?></td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
<?php echo $this->control->tpl['fiche_end']; ?>
|
||||
<!-- END PHP TEMPLATE -->
|
||||
|
|
@ -149,12 +149,6 @@ if (empty($reshook))
|
|||
|
||||
$product=new Product($db);
|
||||
|
||||
if (! empty($canvas)) // Overwrite product here
|
||||
{
|
||||
$objcanvas = new Canvas($db,$user);
|
||||
$product = $objcanvas->load_canvas('product',$canvas);
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
$product->ref = $ref;
|
||||
|
|
@ -220,7 +214,6 @@ if (empty($reshook))
|
|||
{
|
||||
$mesg='<div class="error">'.$langs->trans($product->error).'</div>';
|
||||
$action = "create";
|
||||
$_GET["canvas"] = $product->canvas;
|
||||
$_GET["type"] = $_POST["type"];
|
||||
}
|
||||
}
|
||||
|
|
@ -236,13 +229,6 @@ if (empty($reshook))
|
|||
else
|
||||
{
|
||||
$product=new Product($db);
|
||||
|
||||
if (! empty($canvas)) // Overwrite product here
|
||||
{
|
||||
$objcanvas = new Canvas($db,$user);
|
||||
$product = $objcanvas->load_canvas('product',$_POST["canvas"]);
|
||||
}
|
||||
|
||||
if ($product->fetch($id))
|
||||
{
|
||||
$product->ref = $ref;
|
||||
|
|
@ -637,9 +623,19 @@ if (GETPOST("cancel") == $langs->trans("Cancel"))
|
|||
* View
|
||||
*/
|
||||
|
||||
// fetch optionals attributes and labels
|
||||
$extralabels=$extrafields->fetch_name_optionals_label('product');
|
||||
|
||||
$helpurl='';
|
||||
if (GETPOST("type") == '0') $helpurl='EN:Module_Products|FR:Module_Produits|ES:Módulo_Productos';
|
||||
if (GETPOST("type") == '1') $helpurl='EN:Module_Services_En|FR:Module_Services|ES:Módulo_Servicios';
|
||||
|
||||
llxHeader('',$langs->trans("CardProduct".$_GET["type"]),$helpurl);
|
||||
|
||||
$html = new Form($db);
|
||||
$formproduct = new FormProduct($db);
|
||||
|
||||
|
||||
// TODO Mutualize this part of code (same than societe/soc.php and contact/fiche.php)
|
||||
if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
|
||||
{
|
||||
|
|
@ -657,8 +653,8 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
|
|||
$objcanvas->control->object=$objcanvas->getObject($socid); // TODO: Getting and storing object should be done into assign_values (for template with no code) or into tpl
|
||||
if (empty($objcanvas->control->object))
|
||||
{
|
||||
$object = new Societe($db);
|
||||
$object->fetch($socid);
|
||||
$object = new Product($db);
|
||||
$object->fetch($id);
|
||||
$objcanvas->control->object=$object;
|
||||
}
|
||||
$objcanvas->assign_post(); // TODO: Put code of assign_post into assign_values to keep only assign_values
|
||||
|
|
@ -670,8 +666,8 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action))
|
|||
$objcanvas->control->object=$objcanvas->getObject($socid); // TODO: Getting and storing object should be done into assign_values (for template with no code) or into tpl
|
||||
if (empty($objcanvas->control->object))
|
||||
{
|
||||
$object = new Societe($db);
|
||||
$object->fetch($socid);
|
||||
$object = new Product($db);
|
||||
$object->fetch($id);
|
||||
$objcanvas->control->object=$object;
|
||||
}
|
||||
$objcanvas->assign_values('view');
|
||||
|
|
@ -685,12 +681,6 @@ else
|
|||
// -----------------------------------------
|
||||
if ($action == 'create' && ($user->rights->produit->creer || $user->rights->service->creer))
|
||||
{
|
||||
$helpurl='';
|
||||
if (isset($_GET["type"]) && $_GET["type"] == 0) $helpurl='EN:Module_Products|FR:Module_Produits|ES:Módulo_Productos';
|
||||
if (isset($_GET["type"]) && $_GET["type"] == 1) $helpurl='EN:Module_Services_En|FR:Module_Services|ES:Módulo_Servicios';
|
||||
|
||||
llxHeader('',$langs->trans("CardProduct".$_GET["type"]),$helpurl);
|
||||
|
||||
print '<form action="fiche.php" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="add">';
|
||||
|
|
@ -853,10 +843,8 @@ else
|
|||
|
||||
if ($id || $ref)
|
||||
{
|
||||
$product=new Product($db);
|
||||
$product->fetch($id,$ref);
|
||||
|
||||
llxHeader('',$langs->trans("CardProduct".$product->type));
|
||||
$object=new Product($db);
|
||||
$object->fetch($id,$ref);
|
||||
|
||||
/*
|
||||
* Fiche en mode edition
|
||||
|
|
@ -864,8 +852,8 @@ else
|
|||
if ($action == 'edit' && ($user->rights->produit->creer || $user->rights->service->creer))
|
||||
{
|
||||
$type = $langs->trans('Product');
|
||||
if ($product->isservice()) $type = $langs->trans('Service');
|
||||
print_fiche_titre($langs->trans('Modify').' '.$type.' : '.$product->ref, "");
|
||||
if ($object->isservice()) $type = $langs->trans('Service');
|
||||
print_fiche_titre($langs->trans('Modify').' '.$type.' : '.$object->ref, "");
|
||||
|
||||
dol_htmloutput_errors($mesg);
|
||||
|
||||
|
|
@ -873,20 +861,20 @@ else
|
|||
print '<form action="fiche.php" method="POST">'."\n";
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="update">';
|
||||
print '<input type="hidden" name="id" value="'.$product->id.'">';
|
||||
print '<input type="hidden" name="canvas" value="'.$product->canvas.'">';
|
||||
print '<input type="hidden" name="id" value="'.$object->id.'">';
|
||||
print '<input type="hidden" name="canvas" value="'.$object->canvas.'">';
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Ref
|
||||
print '<tr><td width="15%">'.$langs->trans("Ref").'</td><td colspan="2"><input name="ref" size="40" maxlength="32" value="'.$product->ref.'"></td></tr>';
|
||||
print '<tr><td width="15%">'.$langs->trans("Ref").'</td><td colspan="2"><input name="ref" size="40" maxlength="32" value="'.$object->ref.'"></td></tr>';
|
||||
|
||||
// Label
|
||||
print '<tr><td>'.$langs->trans("Label").'</td><td colspan="2"><input name="libelle" size="40" value="'.$product->libelle.'"></td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Label").'</td><td colspan="2"><input name="libelle" size="40" value="'.$object->libelle.'"></td></tr>';
|
||||
|
||||
// Status
|
||||
print '<tr><td>'.$langs->trans("Status").' ('.$langs->trans("Sell").')'.'</td><td colspan="2">';
|
||||
print '<select class="flat" name="statut">';
|
||||
if ($product->status)
|
||||
if ($object->status)
|
||||
{
|
||||
print '<option value="1" selected="selected">'.$langs->trans("OnSell").'</option>';
|
||||
print '<option value="0">'.$langs->trans("NotOnSell").'</option>';
|
||||
|
|
@ -902,7 +890,7 @@ else
|
|||
// To Buy
|
||||
print '<tr><td>'.$langs->trans("Status").' ('.$langs->trans("Buy").')'.'</td><td colspan="2">';
|
||||
print '<select class="flat" name="statut_buy">';
|
||||
if ($product->status_buy)
|
||||
if ($object->status_buy)
|
||||
{
|
||||
print '<option value="1" selected="selected">'.$langs->trans("ProductStatusOnBuy").'</option>';
|
||||
print '<option value="0">'.$langs->trans("ProductStatusNotOnBuy").'</option>';
|
||||
|
|
@ -918,45 +906,45 @@ else
|
|||
// Description (used in invoice, propal...)
|
||||
print '<tr><td valign="top">'.$langs->trans("Description").'</td><td colspan="2">';
|
||||
require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php");
|
||||
$doleditor=new DolEditor('desc',$product->description,'',160,'dolibarr_notes','',false,true,$conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC,4,90);
|
||||
$doleditor=new DolEditor('desc',$object->description,'',160,'dolibarr_notes','',false,true,$conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC,4,90);
|
||||
$doleditor->Create();
|
||||
print "</td></tr>";
|
||||
print "\n";
|
||||
|
||||
// Nature
|
||||
if($product->type!=1)
|
||||
if($object->type!=1)
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("Nature").'</td><td colspan="2">';
|
||||
$statutarray=array('-1'=>' ', '1' => $langs->trans("Finished"), '0' => $langs->trans("RowMaterial"));
|
||||
print $html->selectarray('finished',$statutarray,$product->finished);
|
||||
print $html->selectarray('finished',$statutarray,$object->finished);
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
if ($product->isproduct() && $conf->stock->enabled)
|
||||
if ($object->isproduct() && $conf->stock->enabled)
|
||||
{
|
||||
print "<tr>".'<td>'.$langs->trans("StockLimit").'</td><td colspan="2">';
|
||||
print '<input name="seuil_stock_alerte" size="4" value="'.$product->seuil_stock_alerte.'">';
|
||||
print '<input name="seuil_stock_alerte" size="4" value="'.$object->seuil_stock_alerte.'">';
|
||||
print '</td></tr>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<input name="seuil_stock_alerte" type="hidden" value="'.$product->seuil_stock_alerte.'">';
|
||||
print '<input name="seuil_stock_alerte" type="hidden" value="'.$object->seuil_stock_alerte.'">';
|
||||
}
|
||||
|
||||
if ($product->isservice())
|
||||
if ($object->isservice())
|
||||
{
|
||||
// Duration
|
||||
print '<tr><td>'.$langs->trans("Duration").'</td><td colspan="2"><input name="duration_value" size="3" maxlength="5" value="'.$product->duration_value.'">';
|
||||
print '<tr><td>'.$langs->trans("Duration").'</td><td colspan="2"><input name="duration_value" size="3" maxlength="5" value="'.$object->duration_value.'">';
|
||||
print ' ';
|
||||
print '<input name="duration_unit" type="radio" value="h"'.($product->duration_unit=='h'?' checked':'').'>'.$langs->trans("Hour");
|
||||
print '<input name="duration_unit" type="radio" value="h"'.($object->duration_unit=='h'?' checked':'').'>'.$langs->trans("Hour");
|
||||
print ' ';
|
||||
print '<input name="duration_unit" type="radio" value="d"'.($product->duration_unit=='d'?' checked':'').'>'.$langs->trans("Day");
|
||||
print '<input name="duration_unit" type="radio" value="d"'.($object->duration_unit=='d'?' checked':'').'>'.$langs->trans("Day");
|
||||
print ' ';
|
||||
print '<input name="duration_unit" type="radio" value="w"'.($product->duration_unit=='w'?' checked':'').'>'.$langs->trans("Week");
|
||||
print '<input name="duration_unit" type="radio" value="w"'.($object->duration_unit=='w'?' checked':'').'>'.$langs->trans("Week");
|
||||
print ' ';
|
||||
print '<input name="duration_unit" type="radio" value="m"'.($product->duration_unit=='m'?' checked':'').'>'.$langs->trans("Month");
|
||||
print '<input name="duration_unit" type="radio" value="m"'.($object->duration_unit=='m'?' checked':'').'>'.$langs->trans("Month");
|
||||
print ' ';
|
||||
print '<input name="duration_unit" type="radio" value="y"'.($product->duration_unit=='y'?' checked':'').'>'.$langs->trans("Year");
|
||||
print '<input name="duration_unit" type="radio" value="y"'.($object->duration_unit=='y'?' checked':'').'>'.$langs->trans("Year");
|
||||
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
|
@ -964,39 +952,39 @@ else
|
|||
{
|
||||
// Weight
|
||||
print '<tr><td>'.$langs->trans("Weight").'</td><td colspan="2">';
|
||||
print '<input name="weight" size="5" value="'.$product->weight.'"> ';
|
||||
print $formproduct->select_measuring_units("weight_units", "weight", $product->weight_units);
|
||||
print '<input name="weight" size="5" value="'.$object->weight.'"> ';
|
||||
print $formproduct->select_measuring_units("weight_units", "weight", $object->weight_units);
|
||||
print '</td></tr>';
|
||||
// Length
|
||||
print '<tr><td>'.$langs->trans("Length").'</td><td colspan="2">';
|
||||
print '<input name="size" size="5" value="'.$product->length.'"> ';
|
||||
print $formproduct->select_measuring_units("size_units", "size", $product->length_units);
|
||||
print '<input name="size" size="5" value="'.$object->length.'"> ';
|
||||
print $formproduct->select_measuring_units("size_units", "size", $object->length_units);
|
||||
print '</td></tr>';
|
||||
// Surface
|
||||
print '<tr><td>'.$langs->trans("Surface").'</td><td colspan="2">';
|
||||
print '<input name="surface" size="5" value="'.$product->surface.'"> ';
|
||||
print $formproduct->select_measuring_units("surface_units", "surface", $product->surface_units);
|
||||
print '<input name="surface" size="5" value="'.$object->surface.'"> ';
|
||||
print $formproduct->select_measuring_units("surface_units", "surface", $object->surface_units);
|
||||
print '</td></tr>';
|
||||
// Volume
|
||||
print '<tr><td>'.$langs->trans("Volume").'</td><td colspan="2">';
|
||||
print '<input name="volume" size="5" value="'.$product->volume.'"> ';
|
||||
print $formproduct->select_measuring_units("volume_units", "volume", $product->volume_units);
|
||||
print '<input name="volume" size="5" value="'.$object->volume.'"> ';
|
||||
print $formproduct->select_measuring_units("volume_units", "volume", $object->volume_units);
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Custom code
|
||||
print '<tr><td>'.$langs->trans("CustomCode").'</td><td colspan="2"><input name="customcode" size="10" value="'.$product->customcode.'"></td></tr>';
|
||||
print '<tr><td>'.$langs->trans("CustomCode").'</td><td colspan="2"><input name="customcode" size="10" value="'.$object->customcode.'"></td></tr>';
|
||||
|
||||
// Origin country
|
||||
print '<tr><td>'.$langs->trans("CountryOrigin").'</td><td colspan="2">';
|
||||
$html->select_pays($product->country_id,'country_id');
|
||||
$html->select_pays($object->country_id,'country_id');
|
||||
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1);
|
||||
print '</td></tr>';
|
||||
|
||||
// Note
|
||||
print '<tr><td valign="top">'.$langs->trans("NoteNotVisibleOnBill").'</td><td colspan="2">';
|
||||
require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php");
|
||||
$doleditor=new DolEditor('note',$product->note,'',200,'dolibarr_notes','',false,true,$conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC,8,70);
|
||||
$doleditor=new DolEditor('note',$object->note,'',200,'dolibarr_notes','',false,true,$conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC,8,70);
|
||||
$doleditor->Create();
|
||||
print "</td></tr>";
|
||||
print '</table>';
|
||||
|
|
@ -1013,92 +1001,92 @@ else
|
|||
*/
|
||||
else
|
||||
{
|
||||
$head=product_prepare_head($product, $user);
|
||||
$titre=$langs->trans("CardProduct".$product->type);
|
||||
$picto=($product->type==1?'service':'product');
|
||||
$head=product_prepare_head($object, $user);
|
||||
$titre=$langs->trans("CardProduct".$object->type);
|
||||
$picto=($object->type==1?'service':'product');
|
||||
dol_fiche_head($head, 'card', $titre, 0, $picto);
|
||||
|
||||
// Confirm delete product
|
||||
if ($action == 'delete' || $conf->use_javascript_ajax)
|
||||
{
|
||||
$ret=$html->form_confirm("fiche.php?id=".$product->id,$langs->trans("DeleteProduct"),$langs->trans("ConfirmDeleteProduct"),"confirm_delete",'',0,"action-delete");
|
||||
$ret=$html->form_confirm("fiche.php?id=".$object->id,$langs->trans("DeleteProduct"),$langs->trans("ConfirmDeleteProduct"),"confirm_delete",'',0,"action-delete");
|
||||
if ($ret == 'html') print '<br>';
|
||||
}
|
||||
|
||||
$isphoto=$product->is_photo_available($conf->product->dir_output);
|
||||
$isphoto=$object->is_photo_available($conf->product->dir_output);
|
||||
|
||||
// En mode visu
|
||||
print '<table class="border" width="100%"><tr>';
|
||||
|
||||
// Ref
|
||||
print '<td width="15%">'.$langs->trans("Ref").'</td><td colspan="'.(2+($isphoto?1:0)).'">';
|
||||
print $html->showrefnav($product,'ref','',1,'ref');
|
||||
print $html->showrefnav($object,'ref','',1,'ref');
|
||||
print '</td>';
|
||||
|
||||
print '</tr>';
|
||||
|
||||
// Label
|
||||
print '<tr><td>'.$langs->trans("Label").'</td><td colspan="2">'.$product->libelle.'</td>';
|
||||
print '<tr><td>'.$langs->trans("Label").'</td><td colspan="2">'.$object->libelle.'</td>';
|
||||
|
||||
$nblignes=9;
|
||||
if ($product->type!=1) $nblignes++;
|
||||
if ($product->isservice()) $nblignes++;
|
||||
if ($object->type!=1) $nblignes++;
|
||||
if ($object->isservice()) $nblignes++;
|
||||
else $nblignes+=4;
|
||||
|
||||
if ($isphoto)
|
||||
{
|
||||
// Photo
|
||||
print '<td valign="middle" align="center" width="25%" rowspan="'.$nblignes.'">';
|
||||
print $product->show_photos($conf->product->dir_output,1,1,0,0,0,80);
|
||||
print $object->show_photos($conf->product->dir_output,1,1,0,0,0,80);
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
print '</tr>';
|
||||
|
||||
// Accountancy sell code
|
||||
print '<tr><td>'.$html->editfieldkey("ProductAccountancySellCode",'productaccountancycodesell',$product->accountancy_code_sell,'id',$product->id,$user->rights->produit->creer).'</td><td colspan="2">';
|
||||
print $html->editfieldval("ProductAccountancySellCode",'productaccountancycodesell',$product->accountancy_code_sell,'id',$product->id,$user->rights->produit->creer);
|
||||
print '<tr><td>'.$html->editfieldkey("ProductAccountancySellCode",'productaccountancycodesell',$object->accountancy_code_sell,'id',$object->id,$user->rights->produit->creer).'</td><td colspan="2">';
|
||||
print $html->editfieldval("ProductAccountancySellCode",'productaccountancycodesell',$object->accountancy_code_sell,'id',$object->id,$user->rights->produit->creer);
|
||||
print '</td></tr>';
|
||||
|
||||
// Accountancy buy code
|
||||
print '<tr><td>'.$html->editfieldkey("ProductAccountancyBuyCode",'productaccountancycodebuy',$product->accountancy_code_buy,'id',$product->id,$user->rights->produit->creer).'</td><td colspan="2">';
|
||||
print $html->editfieldval("ProductAccountancyBuyCode",'productaccountancycodebuy',$product->accountancy_code_buy,'id',$product->id,$user->rights->produit->creer);
|
||||
print '<tr><td>'.$html->editfieldkey("ProductAccountancyBuyCode",'productaccountancycodebuy',$object->accountancy_code_buy,'id',$object->id,$user->rights->produit->creer).'</td><td colspan="2">';
|
||||
print $html->editfieldval("ProductAccountancyBuyCode",'productaccountancycodebuy',$object->accountancy_code_buy,'id',$object->id,$user->rights->produit->creer);
|
||||
print '</td></tr>';
|
||||
|
||||
// Status (to sell)
|
||||
print '<tr><td>'.$langs->trans("Status").' ('.$langs->trans("Sell").')'.'</td><td colspan="2">';
|
||||
print $product->getLibStatut(2,0);
|
||||
print $object->getLibStatut(2,0);
|
||||
print '</td></tr>';
|
||||
|
||||
// Status (to buy)
|
||||
print '<tr><td>'.$langs->trans("Status").' ('.$langs->trans("Buy").')'.'</td><td colspan="2">';
|
||||
print $product->getLibStatut(2,1);
|
||||
print $object->getLibStatut(2,1);
|
||||
print '</td></tr>';
|
||||
|
||||
// Description
|
||||
print '<tr><td valign="top">'.$langs->trans("Description").'</td><td colspan="2">'.(dol_textishtml($product->description)?$product->description:dol_nl2br($product->description,1,true)).'</td></tr>';
|
||||
print '<tr><td valign="top">'.$langs->trans("Description").'</td><td colspan="2">'.(dol_textishtml($object->description)?$object->description:dol_nl2br($object->description,1,true)).'</td></tr>';
|
||||
|
||||
// Nature
|
||||
if($product->type!=1)
|
||||
if($object->type!=1)
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("Nature").'</td><td colspan="2">';
|
||||
print $product->getLibFinished();
|
||||
print $object->getLibFinished();
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
if ($product->isservice())
|
||||
if ($object->isservice())
|
||||
{
|
||||
// Duration
|
||||
print '<tr><td>'.$langs->trans("Duration").'</td><td colspan="2">'.$product->duration_value.' ';
|
||||
if ($product->duration_value > 1)
|
||||
print '<tr><td>'.$langs->trans("Duration").'</td><td colspan="2">'.$object->duration_value.' ';
|
||||
if ($object->duration_value > 1)
|
||||
{
|
||||
$dur=array("h"=>$langs->trans("Hours"),"d"=>$langs->trans("Days"),"w"=>$langs->trans("Weeks"),"m"=>$langs->trans("Months"),"y"=>$langs->trans("Years"));
|
||||
}
|
||||
else if ($product->duration_value > 0)
|
||||
else if ($object->duration_value > 0)
|
||||
{
|
||||
$dur=array("h"=>$langs->trans("Hour"),"d"=>$langs->trans("Day"),"w"=>$langs->trans("Week"),"m"=>$langs->trans("Month"),"y"=>$langs->trans("Year"));
|
||||
}
|
||||
print $langs->trans($dur[$product->duration_unit])." ";
|
||||
print $langs->trans($dur[$object->duration_unit])." ";
|
||||
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
|
@ -1106,9 +1094,9 @@ else
|
|||
{
|
||||
// Weight
|
||||
print '<tr><td>'.$langs->trans("Weight").'</td><td colspan="2">';
|
||||
if ($product->weight != '')
|
||||
if ($object->weight != '')
|
||||
{
|
||||
print $product->weight." ".measuring_units_string($product->weight_units,"weight");
|
||||
print $object->weight." ".measuring_units_string($object->weight_units,"weight");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -1117,9 +1105,9 @@ else
|
|||
print "</td></tr>\n";
|
||||
// Length
|
||||
print '<tr><td>'.$langs->trans("Length").'</td><td colspan="2">';
|
||||
if ($product->length != '')
|
||||
if ($object->length != '')
|
||||
{
|
||||
print $product->length." ".measuring_units_string($product->length_units,"size");
|
||||
print $object->length." ".measuring_units_string($object->length_units,"size");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -1128,9 +1116,9 @@ else
|
|||
print "</td></tr>\n";
|
||||
// Surface
|
||||
print '<tr><td>'.$langs->trans("Surface").'</td><td colspan="2">';
|
||||
if ($product->surface != '')
|
||||
if ($object->surface != '')
|
||||
{
|
||||
print $product->surface." ".measuring_units_string($product->surface_units,"surface");
|
||||
print $object->surface." ".measuring_units_string($object->surface_units,"surface");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -1139,9 +1127,9 @@ else
|
|||
print "</td></tr>\n";
|
||||
// Volume
|
||||
print '<tr><td>'.$langs->trans("Volume").'</td><td colspan="2">';
|
||||
if ($product->volume != '')
|
||||
if ($object->volume != '')
|
||||
{
|
||||
print $product->volume." ".measuring_units_string($product->volume_units,"volume");
|
||||
print $object->volume." ".measuring_units_string($object->volume_units,"volume");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -1151,14 +1139,14 @@ else
|
|||
}
|
||||
|
||||
// Custom code
|
||||
print '<tr><td>'.$langs->trans("CustomCode").'</td><td colspan="2">'.$product->customcode.'</td>';
|
||||
print '<tr><td>'.$langs->trans("CustomCode").'</td><td colspan="2">'.$object->customcode.'</td>';
|
||||
|
||||
// Origin country code
|
||||
print '<tr><td>'.$langs->trans("CountryOrigin").'</td><td colspan="2">'.getCountry($product->country_id,0,$db).'</td>';
|
||||
print '<tr><td>'.$langs->trans("CountryOrigin").'</td><td colspan="2">'.getCountry($object->country_id,0,$db).'</td>';
|
||||
|
||||
|
||||
// Note
|
||||
print '<tr><td valign="top">'.$langs->trans("Note").'</td><td colspan="2">'.(dol_textishtml($product->note)?$product->note:dol_nl2br($product->note,1,true)).'</td></tr>';
|
||||
print '<tr><td valign="top">'.$langs->trans("Note").'</td><td colspan="2">'.(dol_textishtml($object->note)?$object->note:dol_nl2br($object->note,1,true)).'</td></tr>';
|
||||
|
||||
print "</table>\n";
|
||||
|
||||
|
|
@ -1180,12 +1168,12 @@ if ($action == 'clone' || $conf->use_javascript_ajax)
|
|||
// Create an array for form
|
||||
$formquestion=array(
|
||||
'text' => $langs->trans("ConfirmClone"),
|
||||
array('type' => 'text', 'name' => 'clone_ref','label' => $langs->trans("NewRefForClone"), 'value' => $langs->trans("CopyOf").' '.$product->ref, 'size'=>24),
|
||||
array('type' => 'text', 'name' => 'clone_ref','label' => $langs->trans("NewRefForClone"), 'value' => $langs->trans("CopyOf").' '.$object->ref, 'size'=>24),
|
||||
array('type' => 'checkbox', 'name' => 'clone_content','label' => $langs->trans("CloneContentProduct"), 'value' => 1),
|
||||
array('type' => 'checkbox', 'name' => 'clone_prices', 'label' => $langs->trans("ClonePricesProduct").' ('.$langs->trans("FeatureNotYetAvailable").')', 'value' => 0, 'disabled' => true)
|
||||
);
|
||||
// Paiement incomplet. On demande si motif = escompte ou autre
|
||||
$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$product->id,$langs->trans('CloneProduct'),$langs->trans('ConfirmCloneProduct',$product->ref),'confirm_clone',$formquestion,'yes','action-clone',230,600);
|
||||
$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$object->id,$langs->trans('CloneProduct'),$langs->trans('ConfirmCloneProduct',$object->ref),'confirm_clone',$formquestion,'yes','action-clone',230,600);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1201,23 +1189,23 @@ if ($action == '')
|
|||
{
|
||||
if ($user->rights->produit->creer || $user->rights->service->creer)
|
||||
{
|
||||
if ($product->no_button_edit <> 1)
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&id='.$product->id.'">'.$langs->trans("Modify").'</a>';
|
||||
if ($object->no_button_edit <> 1)
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&id='.$object->id.'">'.$langs->trans("Modify").'</a>';
|
||||
|
||||
if ($product->no_button_copy <> 1) {
|
||||
if ($object->no_button_copy <> 1) {
|
||||
if ($conf->use_javascript_ajax) {
|
||||
print '<span id="action-clone" class="butAction">'.$langs->trans('ToClone').'</span>'."\n";
|
||||
} else {
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=clone&id='.$product->id.'">'.$langs->trans("ToClone").'</a>';
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=clone&id='.$object->id.'">'.$langs->trans("ToClone").'</a>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$product_is_used = $product->isObjectUsed($product->id);
|
||||
if (($product->type == 0 && $user->rights->produit->supprimer)
|
||||
|| ($product->type == 1 && $user->rights->service->supprimer))
|
||||
$object_is_used = $object->isObjectUsed($object->id);
|
||||
if (($object->type == 0 && $user->rights->produit->supprimer)
|
||||
|| ($object->type == 1 && $user->rights->service->supprimer))
|
||||
{
|
||||
if (! $product_is_used && $product->no_button_delete <> 1)
|
||||
if (! $object_is_used && $object->no_button_delete <> 1)
|
||||
{
|
||||
if ($conf->use_javascript_ajax)
|
||||
{
|
||||
|
|
@ -1225,7 +1213,7 @@ if ($action == '')
|
|||
}
|
||||
else
|
||||
{
|
||||
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?action=delete&id='.$product->id.'">'.$langs->trans("Delete").'</a>';
|
||||
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?action=delete&id='.$object->id.'">'.$langs->trans("Delete").'</a>';
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -1246,7 +1234,7 @@ print "\n</div><br>\n";
|
|||
* All the "Add to" areas
|
||||
*/
|
||||
|
||||
if ($product->id && $action == '' && $product->status)
|
||||
if ($object->id && $action == '' && $object->status)
|
||||
{
|
||||
print '<table width="100%" class="noborder">';
|
||||
|
||||
|
|
@ -1296,7 +1284,7 @@ if ($product->id && $action == '' && $product->status)
|
|||
{
|
||||
$objp = $db->fetch_object($result);
|
||||
$var=!$var;
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'?id='.$product->id.'">';
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="addinpropal">';
|
||||
print "<tr ".$bc[$var].">";
|
||||
|
|
@ -1307,7 +1295,7 @@ if ($product->id && $action == '' && $product->status)
|
|||
print '<td><input type="hidden" name="propalid" value="'.$objp->propalid.'">';
|
||||
print '<input type="text" class="flat" name="qty" size="1" value="1"></td><td nowrap>'.$langs->trans("ReductionShort");
|
||||
print '<input type="text" class="flat" name="remise_percent" size="1" value="0">%';
|
||||
print " ".$product->stock_proposition;
|
||||
print " ".$object->stock_proposition;
|
||||
print '</td><td align="right">';
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Add").'">';
|
||||
print '</td>';
|
||||
|
|
@ -1334,7 +1322,7 @@ if ($product->id && $action == '' && $product->status)
|
|||
|
||||
$var=true;
|
||||
$otherprop = $propal->liste_array(1,1,1);
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'?id='.$product->id.'">';
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<table class="nobordernopadding" width="100%">';
|
||||
if (is_array($otherprop) && sizeof($otherprop))
|
||||
|
|
@ -1413,7 +1401,7 @@ if ($product->id && $action == '' && $product->status)
|
|||
{
|
||||
$objc = $db->fetch_object($result);
|
||||
$var=!$var;
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'?id='.$product->id.'">';
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="addincommande">';
|
||||
print "<tr ".$bc[$var].">";
|
||||
|
|
@ -1424,7 +1412,7 @@ if ($product->id && $action == '' && $product->status)
|
|||
print '<td><input type="hidden" name="commandeid" value="'.$objc->commandeid.'">';
|
||||
print '<input type="text" class="flat" name="qty" size="1" value="1"></td><td nowrap>'.$langs->trans("ReductionShort");
|
||||
print '<input type="text" class="flat" name="remise_percent" size="1" value="0">%';
|
||||
print " ".$product->stock_proposition;
|
||||
print " ".$object->stock_proposition;
|
||||
print '</td><td align="right">';
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Add").'">';
|
||||
print '</td>';
|
||||
|
|
@ -1452,7 +1440,7 @@ if ($product->id && $action == '' && $product->status)
|
|||
|
||||
$var=true;
|
||||
$othercom = $commande->liste_array(1, $user);
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'?id='.$product->id.'">';
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<table class="nobordernopadding" width="100%">';
|
||||
if (is_array($othercom) && sizeof($othercom))
|
||||
|
|
@ -1527,7 +1515,7 @@ if ($product->id && $action == '' && $product->status)
|
|||
{
|
||||
$objp = $db->fetch_object($result);
|
||||
$var=!$var;
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'?id='.$product->id.'">';
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="addinfacture">';
|
||||
print "<tr $bc[$var]>";
|
||||
|
|
@ -1592,7 +1580,7 @@ if ($product->id && $action == '' && $product->status)
|
|||
$objp = $db->fetch_object($result);
|
||||
|
||||
$var=!$var;
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'?id='.$product->id.'">';
|
||||
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="addinfacture">';
|
||||
print "<tr ".$bc[$var].">";
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ include_once(DOL_DOCUMENT_ROOT.'/societe/canvas/actions_card_common.class.php');
|
|||
|
||||
/**
|
||||
* \class ActionsCardDefault
|
||||
* \brief Classe permettant la gestion des tiers par defaut
|
||||
* \brief Class with controller methods for thirdparty canvas
|
||||
*/
|
||||
class ActionsCardDefault extends ActionsCardCommon
|
||||
{
|
||||
|
|
@ -86,7 +86,8 @@ class ActionsCardDefault extends ActionsCardCommon
|
|||
}
|
||||
|
||||
/**
|
||||
* Assign custom values for canvas
|
||||
* Assign custom values for canvas (for example into this->tpl to be used by templates)
|
||||
*
|
||||
* @param action Type of action
|
||||
*/
|
||||
function assign_values($action='')
|
||||
|
|
|
|||
|
|
@ -19,11 +19,9 @@
|
|||
|
||||
<!-- BEGIN PHP TEMPLATE -->
|
||||
|
||||
<?php
|
||||
print_fiche_titre($this->control->tpl['title']);
|
||||
<?php print_fiche_titre($this->control->tpl['title']); ?>
|
||||
|
||||
dol_htmloutput_errors($this->control->tpl['error'],$this->control->tpl['errors']);
|
||||
?>
|
||||
<?php dol_htmloutput_errors($this->control->tpl['error'],$this->control->tpl['errors']); ?>
|
||||
|
||||
<?php if ($conf->use_javascript_ajax) { ?>
|
||||
<?php echo $this->control->tpl['ajax_selecttype']; ?>
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ include_once(DOL_DOCUMENT_ROOT.'/societe/canvas/actions_card_common.class.php');
|
|||
|
||||
/**
|
||||
* \class ActionsCardIndividual
|
||||
* \brief Classe permettant la gestion des particuliers
|
||||
* \brief Class with controller methods for individual canvas
|
||||
*/
|
||||
class ActionsCardIndividual extends ActionsCardCommon
|
||||
{
|
||||
|
|
@ -86,7 +86,8 @@ class ActionsCardIndividual extends ActionsCardCommon
|
|||
}
|
||||
|
||||
/**
|
||||
* Assign custom values for canvas
|
||||
* Assign custom values for canvas (for example into this->tpl to be used by templates)
|
||||
*
|
||||
* @param action Type of action
|
||||
*/
|
||||
function assign_values($action='')
|
||||
|
|
@ -98,7 +99,7 @@ class ActionsCardIndividual extends ActionsCardCommon
|
|||
|
||||
if ($action == 'create' || $action == 'edit')
|
||||
{
|
||||
$this->tpl['select_civility'] = $formcompany->select_civility($contact->civilite_id);
|
||||
$this->tpl['select_civility'] = $formcompany->select_civility(GETPOST('civilite_id'));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user