Works on product canvas and templates
!! WARNING : not stable !!
This commit is contained in:
parent
7236e28289
commit
230a414a2c
@ -32,6 +32,8 @@ class ProductDefault extends Product
|
||||
//! Numero d'erreur Plage 1280-1535
|
||||
var $errno = 0;
|
||||
|
||||
var $tpl = array();
|
||||
|
||||
/**
|
||||
* \brief Constructeur de la classe
|
||||
* \param DB Handler acces base de donnees
|
||||
@ -70,6 +72,100 @@ class ProductDefault extends Product
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Assigne les valeurs pour les templates
|
||||
* \param object object
|
||||
*/
|
||||
function assign_values($action='')
|
||||
{
|
||||
global $conf,$html;
|
||||
|
||||
if ($action == 'view')
|
||||
{
|
||||
$this->tpl['showrefnav'] = $html->showrefnav($this,'ref','',1,'ref');
|
||||
|
||||
$this->tpl['nblignes'] = 4;
|
||||
if ($this->is_photo_available($conf->produit->dir_output))
|
||||
{
|
||||
$this->tpl['photos'] = $this->show_photos($conf->produit->dir_output,1,1,0,0,0,80);
|
||||
}
|
||||
|
||||
// Accountancy buy code
|
||||
$this->tpl['accountancyBuyCodeKey'] = $html->editfieldkey("ProductAccountancyBuyCode",'productaccountancycodesell',$this->accountancy_code_sell,'id',$this->id,$user->rights->produit->creer);
|
||||
$this->tpl['accountancyBuyCodeVal'] = $html->editfieldval("ProductAccountancyBuyCode",'productaccountancycodesell',$this->accountancy_code_sell,'id',$this->id,$user->rights->produit->creer);
|
||||
|
||||
// Accountancy sell code
|
||||
$this->tpl['accountancySellCodeKey'] = $html->editfieldkey("ProductAccountancySellCode",'productaccountancycodebuy',$this->accountancy_code_buy,'id',$this->id,$user->rights->produit->creer);
|
||||
$this->tpl['accountancySellCodeVal'] = $html->editfieldval("ProductAccountancySellCode",'productaccountancycodebuy',$this->accountancy_code_buy,'id',$this->id,$user->rights->produit->creer);
|
||||
|
||||
// Statut
|
||||
$this->tpl['status'] = $this->getLibStatut(2);
|
||||
|
||||
// Description
|
||||
$this->tpl['description'] = nl2br($this->description);
|
||||
|
||||
// Nature
|
||||
if($this->type!=1)
|
||||
{
|
||||
$this->tpl['finishedLabel'] = $this->getLibFinished();
|
||||
}
|
||||
|
||||
if ($this->isservice())
|
||||
{
|
||||
// Duration
|
||||
if ($this->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)
|
||||
{
|
||||
$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'] = $langs->trans($dur[$this->duration_unit]);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Weight
|
||||
if ($this->weight != '')
|
||||
{
|
||||
$this->tpl['weight'] = $this->weight." ".measuring_units_string($this->weight_units,"weight");
|
||||
}
|
||||
|
||||
// Length
|
||||
if ($this->length != '')
|
||||
{
|
||||
$this->tpl['length'] = $this->length." ".measuring_units_string($this->length_units,"size");
|
||||
}
|
||||
|
||||
// Surface
|
||||
if ($this->surface != '')
|
||||
{
|
||||
$this->tpl['surface'] = $this->surface." ".measuring_units_string($this->surface_units,"surface");
|
||||
}
|
||||
|
||||
// Volume
|
||||
if ($this->volume != '')
|
||||
{
|
||||
$this->tpl['volume'] = $this->volume." ".measuring_units_string($this->volume_units,"volume");
|
||||
}
|
||||
}
|
||||
|
||||
// Hidden
|
||||
if ((! $this->isservice() && $user->rights->produit->hidden)
|
||||
|| ($this->isservice() && $user->rights->service->hidden))
|
||||
{
|
||||
$this->tpl['hidden'] = yn($this->hidden);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->tpl['hidden'] = yn("No");
|
||||
}
|
||||
|
||||
// Note
|
||||
$this->tpl['note'] = nl2br($this->note);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Fetch datas list
|
||||
*/
|
||||
|
||||
101
htdocs/product/canvas/default/tpl/view.tpl.php
Normal file
101
htdocs/product/canvas/default/tpl/view.tpl.php
Normal file
@ -0,0 +1,101 @@
|
||||
<?php
|
||||
/* Copyright (C) 2010 Regis Houssin <regis@dolibarr.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
?>
|
||||
|
||||
<!-- BEGIN PHP TEMPLATE -->
|
||||
|
||||
<table class="border" width="100%">
|
||||
|
||||
<tr>
|
||||
<td width="15%"><?php echo $langs->trans("Ref"); ?></td>
|
||||
<td colspan="2"><?php echo $product->tpl['showrefnav']; ?></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><?php echo $langs->trans("Label") ?></td>
|
||||
<td><?php echo $product->libelle; ?></td>
|
||||
|
||||
<?php if ($product->tpl['photos']) { ?>
|
||||
<td valign="middle" align="center" width="30%" rowspan="<?php echo $product->tpl['nblignes']; ?>">
|
||||
<?php echo $product->tpl['photos']; ?>
|
||||
</td>
|
||||
<?php } ?>
|
||||
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><?php echo $product->tpl['accountancyBuyCodeKey']; ?></td>
|
||||
<td><?php echo $product->tpl['accountancyBuyCodeVal']; ?></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><?php echo $product->tpl['accountancySellCodeKey']; ?></td>
|
||||
<td><?php echo $product->tpl['accountancySellCodeVal']; ?></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><?php echo $langs->trans("Status"); ?></td>
|
||||
<td><?php echo $product->tpl['status']; ?></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td valign="top"><?php echo $langs->trans("Description"); ?></td>
|
||||
<td colspan="2"><?php echo $product->tpl['description']; ?></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><?php echo $langs->trans("Nature"); ?></td>
|
||||
<td colspan="2"><?php echo $product->tpl['finishedLabel']; ?></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><?php echo $langs->trans("Weight"); ?></td>
|
||||
<td colspan="2"><?php echo $product->tpl['weight']; ?></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><?php echo $langs->trans("Length"); ?></td>
|
||||
<td colspan="2"><?php echo $product->tpl['length']; ?></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><?php echo $langs->trans("Surface"); ?></td>
|
||||
<td colspan="2"><?php echo $product->tpl['surface']; ?></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><?php echo $langs->trans("Volume"); ?></td>
|
||||
<td colspan="2"><?php echo $product->tpl['volume']; ?></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><?php echo $langs->trans("Hidden"); ?></td>
|
||||
<td colspan="2"><?php echo $product->tpl['hidden']; ?></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td valign="top"><?php echo $langs->trans("Note"); ?></td>
|
||||
<td colspan="2"><?php echo $product->tpl['note']; ?></td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<!-- END PHP TEMPLATE -->
|
||||
@ -127,6 +127,8 @@ class Product extends CommonObject
|
||||
|
||||
//! Product ID already linked to a reference supplier
|
||||
var $product_id_already_linked;
|
||||
|
||||
var $nbphoto;
|
||||
|
||||
/**
|
||||
* \brief Constructeur de la classe
|
||||
@ -140,6 +142,7 @@ class Product extends CommonObject
|
||||
$this->db = $DB;
|
||||
$this->id = $id ;
|
||||
$this->status = 0;
|
||||
$this->nbphoto = 0;
|
||||
$this->stock_reel = 0;
|
||||
$this->seuil_stock_alerte = 0;
|
||||
$this->canvas = '';
|
||||
@ -2502,6 +2505,7 @@ class Product extends CommonObject
|
||||
$dirthumb = $dir.'thumbs/';
|
||||
$pdirthumb = $pdir.'thumbs/';
|
||||
|
||||
$return='';
|
||||
$nbphoto=0;
|
||||
|
||||
$dir_osencoded=dol_osencode($dir);
|
||||
@ -2531,69 +2535,69 @@ class Product extends CommonObject
|
||||
// Get filesize of original file
|
||||
$imgarray=dol_getImageSize($dir.$photo);
|
||||
|
||||
if ($nbbyrow && $nbphoto == 1) print '<table width="100%" valign="top" align="center" border="0" cellpadding="2" cellspacing="2">';
|
||||
if ($nbbyrow && $nbphoto == 1) $return.= '<table width="100%" valign="top" align="center" border="0" cellpadding="2" cellspacing="2">';
|
||||
|
||||
if ($nbbyrow && ($nbphoto % $nbbyrow == 1)) print '<tr align=center valign=middle border=1>';
|
||||
if ($nbbyrow) print '<td width="'.ceil(100/$nbbyrow).'%" class="photo">';
|
||||
if ($nbbyrow && ($nbphoto % $nbbyrow == 1)) $return.= '<tr align=center valign=middle border=1>';
|
||||
if ($nbbyrow) $return.= '<td width="'.ceil(100/$nbbyrow).'%" class="photo">';
|
||||
|
||||
print "\n";
|
||||
print '<a href="'.DOL_URL_ROOT.'/viewimage.php?modulepart=product&file='.urlencode($pdir.$photo).'" target="_blank">';
|
||||
$return.= "\n";
|
||||
$return.= '<a href="'.DOL_URL_ROOT.'/viewimage.php?modulepart=product&file='.urlencode($pdir.$photo).'" target="_blank">';
|
||||
|
||||
// Show image (width height=$maxheight)
|
||||
// Si fichier vignette disponible et image source trop grande, on utilise la vignette, sinon on utilise photo origine
|
||||
$alt=$langs->transnoentitiesnoconv('File').': '.$pdir.$photo;
|
||||
$alt.=' - '.$langs->transnoentitiesnoconv('Size').': '.$imgarray['width'].'x'.$imgarray['height'];
|
||||
if ($photo_vignette && $imgarray['height'] > $maxheight) {
|
||||
print '<!-- Show thumb -->';
|
||||
print '<img class="photo" border="0" height="'.$maxheight.'" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=product&file='.urlencode($pdirthumb.$photo_vignette).'" title="'.dol_escape_htmltag($alt).'">';
|
||||
$return.= '<!-- Show thumb -->';
|
||||
$return.= '<img class="photo" border="0" height="'.$maxheight.'" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=product&file='.urlencode($pdirthumb.$photo_vignette).'" title="'.dol_escape_htmltag($alt).'">';
|
||||
}
|
||||
else {
|
||||
print '<!-- Show original file -->';
|
||||
print '<img class="photo" border="0" height="'.$maxheight.'" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=product&file='.urlencode($pdir.$photo).'" title="'.dol_escape_htmltag($alt).'">';
|
||||
$return.= '<!-- Show original file -->';
|
||||
$return.= '<img class="photo" border="0" height="'.$maxheight.'" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=product&file='.urlencode($pdir.$photo).'" title="'.dol_escape_htmltag($alt).'">';
|
||||
}
|
||||
|
||||
print '</a>';
|
||||
$return.= '</a>';
|
||||
|
||||
if ($showfilename) print '<br>'.$viewfilename;
|
||||
if ($showfilename) $return.= '<br>'.$viewfilename;
|
||||
if ($showaction)
|
||||
{
|
||||
print '<br>';
|
||||
$return.= '<br>';
|
||||
// On propose la generation de la vignette si elle n'existe pas et si la taille est superieure aux limites
|
||||
if ($photo_vignette && preg_match('/(\.bmp|\.gif|\.jpg|\.jpeg|\.png)$/i',$photo) && ($product->imgWidth > $maxWidth || $product->imgHeight > $maxHeight))
|
||||
{
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$_GET["id"].'&action=addthumb&file='.urlencode($pdir.$viewfilename).'">'.img_refresh($langs->trans('GenerateThumb')).' </a>';
|
||||
$return.= '<a href="'.$_SERVER["PHP_SELF"].'?id='.$_GET["id"].'&action=addthumb&file='.urlencode($pdir.$viewfilename).'">'.img_refresh($langs->trans('GenerateThumb')).' </a>';
|
||||
}
|
||||
if ($user->rights->produit->creer || $user->rights->service->creer)
|
||||
{
|
||||
// Link to resize
|
||||
print '<a href="'.DOL_URL_ROOT.'/core/photos_resize.php?id='.$_GET["id"].'&file='.urlencode($pdir.$viewfilename).'" title="'.dol_escape_htmltag($langs->trans("Resize")).'">'.img_picto($langs->trans("Resize"),DOL_URL_ROOT.'/theme/common/transform-crop-and-resize','',1).'</a> ';
|
||||
$return.= '<a href="'.DOL_URL_ROOT.'/core/photos_resize.php?id='.$_GET["id"].'&file='.urlencode($pdir.$viewfilename).'" title="'.dol_escape_htmltag($langs->trans("Resize")).'">'.img_picto($langs->trans("Resize"),DOL_URL_ROOT.'/theme/common/transform-crop-and-resize','',1).'</a> ';
|
||||
|
||||
// Link to delete
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$_GET["id"].'&action=delete&file='.urlencode($pdir.$viewfilename).'">';
|
||||
print img_delete().'</a>';
|
||||
$return.= '<a href="'.$_SERVER["PHP_SELF"].'?id='.$_GET["id"].'&action=delete&file='.urlencode($pdir.$viewfilename).'">';
|
||||
$return.= img_delete().'</a>';
|
||||
}
|
||||
}
|
||||
print "\n";
|
||||
$return.= "\n";
|
||||
|
||||
if ($nbbyrow) print '</td>';
|
||||
if ($nbbyrow && ($nbphoto % $nbbyrow == 0)) print '</tr>';
|
||||
if ($nbbyrow) $return.= '</td>';
|
||||
if ($nbbyrow && ($nbphoto % $nbbyrow == 0)) $return.= '</tr>';
|
||||
|
||||
}
|
||||
|
||||
if ($size == 0) { // Format origine
|
||||
print '<img class="photo" border="0" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=product&file='.urlencode($pdir.$photo).'">';
|
||||
$return.= '<img class="photo" border="0" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=product&file='.urlencode($pdir.$photo).'">';
|
||||
|
||||
if ($showfilename) print '<br>'.$viewfilename;
|
||||
if ($showfilename) $return.= '<br>'.$viewfilename;
|
||||
if ($showaction)
|
||||
{
|
||||
if ($user->rights->produit->creer || $user->rights->service->creer)
|
||||
{
|
||||
// Link to resize
|
||||
print '<a href="'.DOL_URL_ROOT.'/core/photos_resize.php?id='.$_GET["id"].'&file='.urlencode($pdir.$viewfilename).'" title="'.dol_escape_htmltag($langs->trans("Resize")).'">'.img_picto($langs->trans("Resize"),DOL_URL_ROOT.'/theme/common/transform-crop-and-resize','',1).'</a> ';
|
||||
$return.= '<a href="'.DOL_URL_ROOT.'/core/photos_resize.php?id='.$_GET["id"].'&file='.urlencode($pdir.$viewfilename).'" title="'.dol_escape_htmltag($langs->trans("Resize")).'">'.img_picto($langs->trans("Resize"),DOL_URL_ROOT.'/theme/common/transform-crop-and-resize','',1).'</a> ';
|
||||
|
||||
// Link to delete
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$_GET["id"].'&action=delete&file='.urlencode($pdir.$viewfilename).'">';
|
||||
print img_delete().'</a>';
|
||||
$return.= '<a href="'.$_SERVER["PHP_SELF"].'?id='.$_GET["id"].'&action=delete&file='.urlencode($pdir.$viewfilename).'">';
|
||||
$return.= img_delete().'</a>';
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2608,17 +2612,19 @@ class Product extends CommonObject
|
||||
// Ferme tableau
|
||||
while ($nbphoto % $nbbyrow)
|
||||
{
|
||||
print '<td width="'.ceil(100/$nbbyrow).'%"> </td>';
|
||||
$return.= '<td width="'.ceil(100/$nbbyrow).'%"> </td>';
|
||||
$nbphoto++;
|
||||
}
|
||||
|
||||
if ($nbphoto) print '</table>';
|
||||
if ($nbphoto) $return.= '</table>';
|
||||
}
|
||||
|
||||
closedir($handle);
|
||||
}
|
||||
|
||||
return $nbphoto;
|
||||
|
||||
$this->nbphoto = $nbphoto;
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -857,17 +857,15 @@ if ($_GET["id"] || $_GET["ref"])
|
||||
}
|
||||
|
||||
// Gestion des produits specifiques
|
||||
if ($product->canvas <> '' && file_exists('canvas/'.$product->canvas.'/product.'.$product->canvas.'.class.php') )
|
||||
if (!empty($product->canvas) && file_exists(DOL_DOCUMENT_ROOT.'/product/canvas/'.$product->canvas.'/product.'.$product->canvas.'.class.php') )
|
||||
{
|
||||
$classname = 'Product'.ucfirst($product->canvas);
|
||||
include_once('canvas/'.$product->canvas.'/product.'.$product->canvas.'.class.php');
|
||||
include_once(DOL_DOCUMENT_ROOT.'/product/canvas/'.$product->canvas.'/product.'.$product->canvas.'.class.php');
|
||||
$product = new $classname($db);
|
||||
|
||||
$result = $product->fetchCanvas($_GET["id"],'',$_GET["action"]);
|
||||
|
||||
$smarty->template_dir = DOL_DOCUMENT_ROOT.'/product/canvas/'.$product->canvas.'/tpl/';
|
||||
|
||||
$product->assign_smarty_values($smarty,$_GET["action"]);
|
||||
$template_dir = DOL_DOCUMENT_ROOT.'/product/canvas/'.$product->canvas.'/tpl/';
|
||||
}
|
||||
|
||||
|
||||
@ -890,159 +888,10 @@ if ($_GET["id"] || $_GET["ref"])
|
||||
}
|
||||
|
||||
print($mesg);
|
||||
}
|
||||
if ($_GET["action"] <> 'edit' && $product->canvas <> '')
|
||||
{
|
||||
/*
|
||||
* Smarty en mode visu
|
||||
*/
|
||||
$smarty->assign('fiche_cursor_prev',$previous_ref);
|
||||
$smarty->assign('fiche_cursor_next',$next_ref);
|
||||
|
||||
// Photo
|
||||
//$nbphoto=$product->show_photos($conf->produit->dir_output,1,1,0);
|
||||
|
||||
$smarty->display($product->canvas.'-view.tpl');
|
||||
|
||||
print "</div>\n<!-- CUT HERE -->\n";
|
||||
}
|
||||
|
||||
if ($_GET["action"] <> 'edit' && $product->canvas == '')
|
||||
{
|
||||
// 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.'">';
|
||||
$nbphoto=$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";
|
||||
print "</div>\n<!-- CUT HERE -->\n";
|
||||
$product->assign_values('view');
|
||||
|
||||
include($template_dir.'view.tpl.php');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -177,9 +177,9 @@ if ($_GET["id"] || $_GET["ref"])
|
||||
$maxWidth = 160;
|
||||
$maxHeight = 120;
|
||||
|
||||
$nbphoto=$product->show_photos($dir,1,1000,$nbbyrow,1,1);
|
||||
print $product->show_photos($dir,1,1000,$nbbyrow,1,1);
|
||||
|
||||
if ($nbphoto < 1)
|
||||
if ($product->nbphoto < 1)
|
||||
{
|
||||
print '<br>';
|
||||
print '<table width="100%" valign="top" align="center" border="0" cellpadding="2" cellspacing="2">'; print '<tr align=center valign=middle border=1><td class="photo">';
|
||||
|
||||
@ -141,7 +141,7 @@ if ($product->is_photo_available($conf->produit->dir_output))
|
||||
{
|
||||
// Photo
|
||||
print '<td valign="middle" align="center" width="30%" rowspan="'.$nblignes.'">';
|
||||
$nbphoto=$product->show_photos($conf->produit->dir_output,1,1,0,0,0,80);
|
||||
print $product->show_photos($conf->produit->dir_output,1,1,0,0,0,80);
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user