mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-11 20:11:26 +01:00
Fix a lot of bugs after changes for canvas (photo hidden, edit field for accountancy disappeared, etc...). Too complicated to fix with canvas so I restore the "simple" code. Canvas feature should still works but with some bugs.
This commit is contained in:
@@ -50,18 +50,27 @@ class Canvas
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Load canvas
|
* \brief Load canvas
|
||||||
|
* \param Name of first part of canvas
|
||||||
|
* \canvas Name of second part of canvas
|
||||||
*/
|
*/
|
||||||
function load_canvas($object,$canvas)
|
function load_canvas($object,$canvas)
|
||||||
{
|
{
|
||||||
global $langs;
|
global $langs;
|
||||||
|
|
||||||
|
$part1=$object;
|
||||||
|
$part2=$canvas;
|
||||||
|
|
||||||
if (preg_match('/^([^@]+)@([^@]+)$/i',$canvas,$regs))
|
if (preg_match('/^([^@]+)@([^@]+)$/i',$canvas,$regs))
|
||||||
{
|
{
|
||||||
if (file_exists(DOL_DOCUMENT_ROOT.'/'.$regs[2].'/canvas/'.$regs[1].'/'.$object.'.'.$regs[1].'.class.php'))
|
$part1=$regs[2];
|
||||||
|
$part2=$regs[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (file_exists(DOL_DOCUMENT_ROOT.'/'.$part1.'/canvas/'.$part2.'/'.$part1.'.'.$part2.'.class.php'))
|
||||||
{
|
{
|
||||||
$filecanvas = DOL_DOCUMENT_ROOT.'/'.$regs[2].'/canvas/'.$regs[1].'/'.$object.'.'.$regs[1].'.class.php';
|
$filecanvas = DOL_DOCUMENT_ROOT.'/'.$part1.'/canvas/'.$part2.'/'.$part1.'.'.$part2.'.class.php';
|
||||||
$classname = ucfirst($object).ucfirst($regs[1]);
|
$classname = ucfirst($part1).ucfirst($part2);
|
||||||
$this->template_dir = DOL_DOCUMENT_ROOT.'/'.$regs[2].'/canvas/'.$regs[1].'/tpl/';
|
$this->template_dir = DOL_DOCUMENT_ROOT.'/'.$part1.'/canvas/'.$part2.'/tpl/';
|
||||||
|
|
||||||
include_once($filecanvas);
|
include_once($filecanvas);
|
||||||
$this->object = new $classname($this->db,0,$this->user);
|
$this->object = new $classname($this->db,0,$this->user);
|
||||||
@@ -74,13 +83,6 @@ class Canvas
|
|||||||
$this->error = $langs->trans('CanvasIsInvalid');
|
$this->error = $langs->trans('CanvasIsInvalid');
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$this->error = $langs->trans('BadCanvasName');
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -127,7 +127,7 @@ class Translate {
|
|||||||
* \brief Load translation key-value for a particular file, into a memory array.
|
* \brief Load translation key-value for a particular file, into a memory array.
|
||||||
* If data for file already loaded, do nothing.
|
* If data for file already loaded, do nothing.
|
||||||
* All data in translation array are stored in UTF-8 format.
|
* All data in translation array are stored in UTF-8 format.
|
||||||
* \param domain File name to load (.lang file). Use @ before value if domain is in a module directory.
|
* \param domain File name to load (.lang file). Use file@module if file is in a module directory.
|
||||||
* \param alt 0,1,2
|
* \param alt 0,1,2
|
||||||
* \param soptafterdirection Stop when the DIRECTION tag is found (optimize)
|
* \param soptafterdirection Stop when the DIRECTION tag is found (optimize)
|
||||||
* \param forcelangdir To force a lang directory
|
* \param forcelangdir To force a lang directory
|
||||||
|
|||||||
@@ -382,6 +382,15 @@ function dol_fiche_head($links, $active='0', $title='', $notab=0, $picto='')
|
|||||||
if (! $notab) print "\n".'<div class="tabBar">'."\n";
|
if (! $notab) print "\n".'<div class="tabBar">'."\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Show tab footer of a card
|
||||||
|
* \param notab 0=Add tab footer, 1=no tab footer
|
||||||
|
*/
|
||||||
|
function dol_fiche_end($notab=0)
|
||||||
|
{
|
||||||
|
if (! $notab) print "\n</div>\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Add a delay to a date
|
* \brief Add a delay to a date
|
||||||
|
|||||||
@@ -2493,7 +2493,7 @@ class Product extends CommonObject
|
|||||||
* \param showfilename 1=Show filename
|
* \param showfilename 1=Show filename
|
||||||
* \param showaction 1=Show icon with action links (resize, delete)
|
* \param showaction 1=Show icon with action links (resize, delete)
|
||||||
* \param maxheight Max height of image when size=1
|
* \param maxheight Max height of image when size=1
|
||||||
* \return int Number of photos shown
|
* \return string Html code to show photo. Number of photos shown is saved in this->nbphoto
|
||||||
*/
|
*/
|
||||||
function show_photos($sdir,$size=0,$nbmax=0,$nbbyrow=5,$showfilename=0,$showaction=0,$maxheight=120)
|
function show_photos($sdir,$size=0,$nbmax=0,$nbbyrow=5,$showfilename=0,$showaction=0,$maxheight=120)
|
||||||
{
|
{
|
||||||
@@ -2507,7 +2507,7 @@ class Product extends CommonObject
|
|||||||
$dirthumb = $dir.'thumbs/';
|
$dirthumb = $dir.'thumbs/';
|
||||||
$pdirthumb = $pdir.'thumbs/';
|
$pdirthumb = $pdir.'thumbs/';
|
||||||
|
|
||||||
$return='';
|
$return='<!-- Photo -->';
|
||||||
$nbphoto=0;
|
$nbphoto=0;
|
||||||
|
|
||||||
$dir_osencoded=dol_osencode($dir);
|
$dir_osencoded=dol_osencode($dir);
|
||||||
|
|||||||
@@ -127,19 +127,14 @@ if ($_POST["action"] == 'add' && ($user->rights->produit->creer || $user->rights
|
|||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($_POST["canvas"]))
|
$product=new Product($db);
|
||||||
|
|
||||||
|
$usecanvas=$_POST["canvas"];
|
||||||
|
if (! empty($usecanvas)) // Overwrite product here
|
||||||
{
|
{
|
||||||
$canvas = new Canvas($db,$user);
|
$canvas = new Canvas($db,$user);
|
||||||
$product = $canvas->load_canvas('product',$_POST["canvas"]);
|
$product = $canvas->load_canvas('product',$_POST["canvas"]);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
$mesg='<div class="error">'.$langs->trans('ErrorCanvasNotDefined').'</div>';
|
|
||||||
$_GET["action"] = "create";
|
|
||||||
$_GET["canvas"] = $_POST["canvas"];
|
|
||||||
$_GET["type"] = $_POST["type"];
|
|
||||||
$error++;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
@@ -192,8 +187,6 @@ if ($_POST["action"] == 'add' && ($user->rights->produit->creer || $user->rights
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( $value != $current_lang ) $e_product = $product;
|
|
||||||
|
|
||||||
$id = $product->create($user);
|
$id = $product->create($user);
|
||||||
|
|
||||||
if ($id > 0)
|
if ($id > 0)
|
||||||
@@ -220,7 +213,10 @@ if ($_POST["action"] == 'update' && ($user->rights->produit->creer || $user->rig
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!empty($_POST["canvas"]))
|
$product=new Product($db);
|
||||||
|
|
||||||
|
$usecanvas=$_POST["canvas"];
|
||||||
|
if (! empty($usecanvas)) // Overwrite product here
|
||||||
{
|
{
|
||||||
$canvas = new Canvas($db,$user);
|
$canvas = new Canvas($db,$user);
|
||||||
$product = $canvas->load_canvas('product',$_POST["canvas"]);
|
$product = $canvas->load_canvas('product',$_POST["canvas"]);
|
||||||
@@ -362,7 +358,7 @@ if ($_REQUEST['action'] == 'confirm_delete' && $_REQUEST['confirm'] == 'yes' &&
|
|||||||
*/
|
*/
|
||||||
if ($_POST["action"] == 'addinpropal')
|
if ($_POST["action"] == 'addinpropal')
|
||||||
{
|
{
|
||||||
$propal = New Propal($db);
|
$propal = new Propal($db);
|
||||||
$result=$propal->fetch($_POST["propalid"]);
|
$result=$propal->fetch($_POST["propalid"]);
|
||||||
if ($result <= 0)
|
if ($result <= 0)
|
||||||
{
|
{
|
||||||
@@ -622,29 +618,28 @@ $formproduct = new FormProduct($db);
|
|||||||
*/
|
*/
|
||||||
if ($_GET["action"] == 'create' && ($user->rights->produit->creer || $user->rights->service->creer))
|
if ($_GET["action"] == 'create' && ($user->rights->produit->creer || $user->rights->service->creer))
|
||||||
{
|
{
|
||||||
if (!empty($_GET["canvas"]))
|
|
||||||
{
|
|
||||||
$helpurl='';
|
$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"] == 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';
|
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);
|
llxHeader('',$langs->trans("CardProduct".$_GET["type"]),$helpurl);
|
||||||
|
|
||||||
if (! isset($product))
|
$usecanvas=$_GET["canvas"];
|
||||||
|
if (empty($usecanvas))
|
||||||
|
{
|
||||||
|
// TODO Restore simple code here
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
$canvas = new Canvas($db,$user);
|
$canvas = new Canvas($db,$user);
|
||||||
|
|
||||||
$product = $canvas->load_canvas('product',$_GET["canvas"]);
|
$product = $canvas->load_canvas('product',$_GET["canvas"]);
|
||||||
|
|
||||||
$canvas->assign_values('create');
|
$canvas->assign_values('create');
|
||||||
$canvas->display_canvas();
|
$canvas->display_canvas();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($_error == 1)
|
|
||||||
{
|
|
||||||
$product = $e_product;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -654,31 +649,196 @@ if ($_GET["action"] == 'create' && ($user->rights->produit->creer || $user->righ
|
|||||||
*/
|
*/
|
||||||
if ($_GET["id"] || $_GET["ref"])
|
if ($_GET["id"] || $_GET["ref"])
|
||||||
{
|
{
|
||||||
|
$product=new Product($db);
|
||||||
|
|
||||||
// TODO en attendant d'inclure le nom du canvas dans les liens
|
// TODO en attendant d'inclure le nom du canvas dans les liens
|
||||||
$productstatic = new Product($db);
|
$productstatic = new Product($db);
|
||||||
$result = $productstatic->getCanvas($_GET["id"],$_GET["ref"]);
|
$result = $productstatic->getCanvas($_GET["id"],$_GET["ref"]);
|
||||||
|
$usecanvas=$productstatic->canvas;
|
||||||
|
|
||||||
// Gestion des produits specifiques
|
if (empty($usecanvas))
|
||||||
if (!empty($productstatic->canvas))
|
{
|
||||||
|
$product->fetch($_GET["id"],$_GET["ref"]);
|
||||||
|
}
|
||||||
|
else // Gestion des produits specifiques
|
||||||
{
|
{
|
||||||
$canvas = new Canvas($db,$user);
|
$canvas = new Canvas($db,$user);
|
||||||
|
|
||||||
$product = $canvas->load_canvas('product',$productstatic->canvas);
|
$product = $canvas->load_canvas('product',$productstatic->canvas);
|
||||||
|
if (! $product) dol_print_error('','Faled to load canvas product-'.$productstatic->canvas);
|
||||||
|
|
||||||
$canvas->fetch($productstatic->id,'',$_GET["action"]);
|
$canvas->fetch($productstatic->id,'',$_GET["action"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
llxHeader('',$langs->trans("CardProduct".$product->type));
|
llxHeader('',$langs->trans("CardProduct".$product->type));
|
||||||
|
|
||||||
if ( $result )
|
|
||||||
{
|
|
||||||
/*
|
/*
|
||||||
* Fiche en mode edition
|
* Fiche en mode edition
|
||||||
*/
|
*/
|
||||||
if ($_GET["action"] == 'edit' && ($user->rights->produit->creer || $user->rights->service->creer))
|
if ($_GET["action"] == 'edit' && ($user->rights->produit->creer || $user->rights->service->creer))
|
||||||
|
{
|
||||||
|
if (empty($usecanvas))
|
||||||
|
{
|
||||||
|
if ($product->isservice()) {
|
||||||
|
print_fiche_titre($langs->trans('Modify').' '.$langs->trans('Service').' : '.$product->ref, "");
|
||||||
|
} else {
|
||||||
|
print_fiche_titre($langs->trans('Modify').' '.$langs->trans('Product').' : '.$product->ref, "");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($mesg) {
|
||||||
|
print '<br><div class="error">'.$mesg.'</div><br>';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Main official, simple, and not duplicated code
|
||||||
|
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 '<table class="border" width="100%">';
|
||||||
|
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>'.$langs->trans("Label").'</td><td><input name="libelle" size="40" value="'.$product->libelle.'"></td></tr>';
|
||||||
|
|
||||||
|
// Status
|
||||||
|
print '<tr><td>'.$langs->trans("Status").'</td><td colspan="2">';
|
||||||
|
print '<select class="flat" name="statut">';
|
||||||
|
if ($product->status)
|
||||||
|
{
|
||||||
|
print '<option value="1" selected="true">'.$langs->trans("OnSell").'</option>';
|
||||||
|
print '<option value="0">'.$langs->trans("NotOnSell").'</option>';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print '<option value="1">'.$langs->trans("OnSell").'</option>';
|
||||||
|
print '<option value="0" selected="true">'.$langs->trans("NotOnSell").'</option>';
|
||||||
|
}
|
||||||
|
print '</select>';
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
|
// Description (used in invoice, propal...)
|
||||||
|
print '<tr><td valign="top">'.$langs->trans("Description").'</td><td colspan="2">';
|
||||||
|
print "\n";
|
||||||
|
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);
|
||||||
|
$doleditor->Create();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print '<textarea name="desc" rows="4" cols="90">';
|
||||||
|
print dol_htmlentitiesbr_decode($product->description);
|
||||||
|
print "</textarea>";
|
||||||
|
}
|
||||||
|
print "</td></tr>";
|
||||||
|
print "\n";
|
||||||
|
|
||||||
|
// Nature
|
||||||
|
if($product->type!=1)
|
||||||
|
{
|
||||||
|
print '<tr><td>'.$langs->trans("Nature").'</td><td>';
|
||||||
|
$statutarray=array('-1'=>' ', '1' => $langs->trans("Finished"), '0' => $langs->trans("RowMaterial"));
|
||||||
|
$html->select_array('finished',$statutarray,$product->finished);
|
||||||
|
print '</td></tr>';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($product->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 '</td></tr>';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print '<input name="seuil_stock_alerte" type="hidden" value="'.$product->seuil_stock_alerte.'">';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($product->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 ' ';
|
||||||
|
print '<input name="duration_unit" type="radio" value="h"'.($product->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 ' ';
|
||||||
|
print '<input name="duration_unit" type="radio" value="w"'.($product->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 ' ';
|
||||||
|
print '<input name="duration_unit" type="radio" value="y"'.($product->duration_unit=='y'?' checked':'').'>'.$langs->trans("Year");
|
||||||
|
|
||||||
|
print '</td></tr>';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Weight
|
||||||
|
print '<tr><td>'.$langs->trans("Weight").'</td><td>';
|
||||||
|
print '<input name="weight" size="5" value="'.$product->weight.'"> ';
|
||||||
|
print $formproduct->select_measuring_units("weight_units", "weight", $product->weight_units);
|
||||||
|
print '</td></tr>';
|
||||||
|
// Length
|
||||||
|
print '<tr><td>'.$langs->trans("Length").'</td><td>';
|
||||||
|
print '<input name="size" size="5" value="'.$product->length.'"> ';
|
||||||
|
print $formproduct->select_measuring_units("size_units", "size", $product->length_units);
|
||||||
|
print '</td></tr>';
|
||||||
|
// Surface
|
||||||
|
print '<tr><td>'.$langs->trans("Surface").'</td><td>';
|
||||||
|
print '<input name="surface" size="5" value="'.$product->surface.'"> ';
|
||||||
|
print $formproduct->select_measuring_units("surface_units", "surface", $product->surface_units);
|
||||||
|
print '</td></tr>';
|
||||||
|
// Volume
|
||||||
|
print '<tr><td>'.$langs->trans("Volume").'</td><td>';
|
||||||
|
print '<input name="volume" size="5" value="'.$product->volume.'"> ';
|
||||||
|
print $formproduct->select_measuring_units("volume_units", "volume", $product->volume_units);
|
||||||
|
print '</td></tr>';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Hidden
|
||||||
|
if ((! $product->isservice() && $user->rights->produit->hidden)
|
||||||
|
|| ($product->isservice() && $user->rights->service->hidden))
|
||||||
|
{
|
||||||
|
print '<tr><td>'.$langs->trans("Hidden").'</td><td>';
|
||||||
|
print $html->selectyesno('hidden',$product->hidden);
|
||||||
|
print '</td></tr>';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print '<tr><td>'.$langs->trans("Hidden").'</td><td>';
|
||||||
|
print yn("No");
|
||||||
|
print '</td></tr>';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Note
|
||||||
|
print '<tr><td valign="top">'.$langs->trans("NoteNotVisibleOnBill").'</td><td colspan="2">';
|
||||||
|
if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC)
|
||||||
|
{
|
||||||
|
require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php");
|
||||||
|
$doleditor=new DolEditor('note',$product->note,200,'dolibarr_notes','',false);
|
||||||
|
$doleditor->Create();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print '<textarea name="note" rows="8" cols="70">';
|
||||||
|
print dol_htmlentitiesbr_decode($product->note);
|
||||||
|
print "</textarea>";
|
||||||
|
}
|
||||||
|
print "</td></tr>";
|
||||||
|
print '</table>';
|
||||||
|
|
||||||
|
print '<br>';
|
||||||
|
|
||||||
|
print '<center><input type="submit" class="button" value="'.$langs->trans("Save").'"> ';
|
||||||
|
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'"></center>';
|
||||||
|
|
||||||
|
print '</form>';
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
$canvas->assign_values('edit');
|
$canvas->assign_values('edit');
|
||||||
$canvas->display_canvas();
|
$canvas->display_canvas();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
/*
|
/*
|
||||||
* Fiche en mode visu
|
* Fiche en mode visu
|
||||||
*/
|
*/
|
||||||
@@ -696,10 +856,151 @@ if ($_GET["id"] || $_GET["ref"])
|
|||||||
if ($ret == 'html') print '<br>';
|
if ($ret == 'html') print '<br>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (empty($usecanvas))
|
||||||
|
{
|
||||||
|
// En mode visu
|
||||||
|
print '<table class="border" width="100%"><tr>';
|
||||||
|
|
||||||
|
// Ref
|
||||||
|
print '<td width="15%">'.$langs->trans("Ref").'</td><td colspan="2">';
|
||||||
|
print $html->showrefnav($product,'ref','',1,'ref');
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
|
// Label
|
||||||
|
print '<tr><td>'.$langs->trans("Label").'</td><td>'.$product->libelle.'</td>';
|
||||||
|
|
||||||
|
$nblignes=4;
|
||||||
|
if ($product->is_photo_available($conf->produit->dir_output))
|
||||||
|
{
|
||||||
|
// Photo
|
||||||
|
print '<td valign="middle" align="center" width="30%" rowspan="'.$nblignes.'">';
|
||||||
|
print $product->show_photos($conf->produit->dir_output,1,1,0,0,0,80);
|
||||||
|
print '</td>';
|
||||||
|
}
|
||||||
|
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
|
// Accountancy buy code
|
||||||
|
print '<tr><td>'.$html->editfieldkey("ProductAccountancyBuyCode",'productaccountancycodesell',$product->accountancy_code_sell,'id',$product->id,$user->rights->produit->creer).'</td><td>';
|
||||||
|
print $html->editfieldval("ProductAccountancyBuyCode",'productaccountancycodesell',$product->accountancy_code_sell,'id',$product->id,$user->rights->produit->creer);
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
|
// Accountancy sell code
|
||||||
|
print '<tr><td>'.$html->editfieldkey("ProductAccountancySellCode",'productaccountancycodebuy',$product->accountancy_code_buy,'id',$product->id,$user->rights->produit->creer).'</td><td>';
|
||||||
|
print $html->editfieldval("ProductAccountancySellCode",'productaccountancycodebuy',$product->accountancy_code_buy,'id',$product->id,$user->rights->produit->creer);
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
|
// Statut
|
||||||
|
print '<tr><td>'.$langs->trans("Status").'</td><td>';
|
||||||
|
print $product->getLibStatut(2);
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
|
// Description
|
||||||
|
print '<tr><td valign="top">'.$langs->trans("Description").'</td><td colspan="2">'.nl2br($product->description).'</td></tr>';
|
||||||
|
|
||||||
|
// Nature
|
||||||
|
if($product->type!=1)
|
||||||
|
{
|
||||||
|
print '<tr><td>'.$langs->trans("Nature").'</td><td colspan="2">';
|
||||||
|
print $product->getLibFinished();
|
||||||
|
print '</td></tr>';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($product->isservice())
|
||||||
|
{
|
||||||
|
// Duration
|
||||||
|
print '<tr><td>'.$langs->trans("Duration").'</td><td colspan="2">'.$product->duration_value.' ';
|
||||||
|
if ($product->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)
|
||||||
|
{
|
||||||
|
$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 '</td></tr>';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Weight
|
||||||
|
print '<tr><td>'.$langs->trans("Weight").'</td><td colspan="2">';
|
||||||
|
if ($product->weight != '')
|
||||||
|
{
|
||||||
|
print $product->weight." ".measuring_units_string($product->weight_units,"weight");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print ' ';
|
||||||
|
}
|
||||||
|
print "</td></tr>\n";
|
||||||
|
// Length
|
||||||
|
print '<tr><td>'.$langs->trans("Length").'</td><td colspan="2">';
|
||||||
|
if ($product->length != '')
|
||||||
|
{
|
||||||
|
print $product->length." ".measuring_units_string($product->length_units,"size");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print ' ';
|
||||||
|
}
|
||||||
|
print "</td></tr>\n";
|
||||||
|
// Surface
|
||||||
|
print '<tr><td>'.$langs->trans("Surface").'</td><td colspan="2">';
|
||||||
|
if ($product->surface != '')
|
||||||
|
{
|
||||||
|
print $product->surface." ".measuring_units_string($product->surface_units,"surface");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print ' ';
|
||||||
|
}
|
||||||
|
print "</td></tr>\n";
|
||||||
|
// Volume
|
||||||
|
print '<tr><td>'.$langs->trans("Volume").'</td><td colspan="2">';
|
||||||
|
if ($product->volume != '')
|
||||||
|
{
|
||||||
|
print $product->volume." ".measuring_units_string($product->volume_units,"volume");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print ' ';
|
||||||
|
}
|
||||||
|
print "</td></tr>\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
// Hidden
|
||||||
|
if ((! $product->isservice() && $user->rights->produit->hidden)
|
||||||
|
|| ($product->isservice() && $user->rights->service->hidden))
|
||||||
|
{
|
||||||
|
print '<tr><td>'.$langs->trans("Hidden").'</td><td colspan="2">';
|
||||||
|
print yn($product->hidden);
|
||||||
|
print "</td></tr>\n";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print '<tr><td>'.$langs->trans("Hidden").'</td><td>';
|
||||||
|
print yn("No");
|
||||||
|
print '</td></tr>';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Note
|
||||||
|
print '<tr><td valign="top">'.$langs->trans("Note").'</td><td colspan="2">'.nl2br($product->note).'</td></tr>';
|
||||||
|
|
||||||
|
print "</table>\n";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
$canvas->assign_values('view');
|
$canvas->assign_values('view');
|
||||||
$canvas->display_canvas();
|
$canvas->display_canvas();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dol_fiche_end();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (!$_GET["action"] == 'create')
|
else if (!$_GET["action"] == 'create')
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user