Skip to content
Snippets Groups Projects
Commit d5b1097d authored by Laurent Destailleur's avatar Laurent Destailleur
Browse files

Qual: Mutualize common code

parent c5e01667
No related branches found
No related tags found
No related merge requests found
......@@ -844,12 +844,12 @@ if ($_GET["id"] || $_GET["ref"])
// En mode visu
print '<table class="border" width="100%"><tr>';
// Reference
// Ref
print '<td width="15%">'.$langs->trans("Ref").'</td><td>';
print $html->showrefnav($product,'ref','',1,'ref');
print '</td>';
$nblignes=4;
$nblignes=3;
if (! empty($conf->global->PRODUIT_MULTIPRICES_LIMIT) && empty($socid)) $nblignes+=$conf->global->PRODUIT_MULTIPRICES_LIMIT;
else $nblignes+=3;
......@@ -862,7 +862,7 @@ if ($_GET["id"] || $_GET["ref"])
}
print '</tr>';
// Libelle
// Label
print '<tr><td>'.$langs->trans("Label").'</td><td>'.$product->libelle.'</td></tr>';
// MultiPrix
......@@ -988,7 +988,7 @@ if ($_GET["id"] || $_GET["ref"])
print '</td></tr>';
// Description
print '<tr><td valign="top">'.$langs->trans("Description").'</td><td>'.nl2br($product->description).'</td></tr>';
print '<tr><td valign="top">'.$langs->trans("Description").'</td><td colspan="2">'.nl2br($product->description).'</td></tr>';
// Nature
if($product->type!=1)
......
......@@ -189,80 +189,19 @@ if ($_GET["id"] || $_GET["ref"])
$maxWidth = 160;
$maxHeight = 120;
$pdir = get_exdir($product->id,2) . $product->id ."/photos/";
$dir = $conf->produit->dir_output . '/'. $pdir;
print '<br>';
print '<table width="100%" valign="top" align="center" border="0" cellpadding="2" cellspacing="2">';
foreach ($product->liste_photos($dir) as $key => $obj)
{
$nbphoto++;
// if ($nbbyrow && $nbphoto == 1) print '<table width="100%" valign="top" align="center" border="0" cellpadding="2" cellspacing="2">';
// Do not use show_photo because there is more information to show
if ($nbbyrow && ($nbphoto % $nbbyrow == 1)) print '<tr align=center valign=middle border=1>';
if ($nbbyrow) print '<td width="'.ceil(100/$nbbyrow).'%" class="photo">';
print '<a href="'.DOL_URL_ROOT.'/viewimage.php?modulepart=product&file='.urlencode($pdir.$obj['photo']).'" alt="'.dol_escape_htmltag($langs->trans("OriginalSize")).'" target="_blank">';
// Si fichier vignette disponible, on l'utilise, sinon on utilise photo origine
if ($obj['photo_vignette'])
{
$filename='thumbs/'.$obj['photo_vignette'];
}
else
{
$filename=$obj['photo'];
}
// Nom affiche
$viewfilename=$obj['photo'];
// Taille de l'image
$product->get_image_size($dir.$filename);
$imgWidth = ($product->imgWidth < $maxWidth) ? $product->imgWidth : $maxWidth;
$imgHeight = ($product->imgHeight < $maxHeight) ? $product->imgHeight : $maxHeight;
print '<img class="photo" border="0" width="'.$imgWidth.'" height="'.$imgHeight.'" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=product&file='.urlencode($pdir.$filename).'">';
print '</a>';
print '<br>'.$viewfilename;
print '<br>';
// On propose la generation de la vignette si elle n'existe pas et si la taille est superieure aux limites
if (!$obj['photo_vignette'] && preg_match('/(\.bmp|\.gif|\.jpg|\.jpeg|\.png)$/i',$obj['photo']) && ($product->imgWidth > $maxWidth || $product->imgHeight > $maxHeight))
{
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$_GET["id"].'&amp;action=addthumb&amp;file='.urlencode($pdir.$viewfilename).'">'.img_refresh($langs->trans('GenerateThumb')).'&nbsp;&nbsp;</a>';
}
if ($user->rights->produit->creer || $user->rights->service->creer)
{
print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$_GET["id"].'&amp;action=delete&amp;file='.urlencode($pdir.$viewfilename).'">';
print img_delete().'</a>';
}
if ($nbbyrow) print '</td>';
if ($nbbyrow && ($nbphoto % $nbbyrow == 0)) print '</tr>';
}
// Ferme tableau
while ($nbphoto % $nbbyrow)
{
print '<td width="'.ceil(100/$nbbyrow).'%">&nbsp;</td>';
$nbphoto++;
}
$nbphoto=$product->show_photos($conf->produit->dir_output,1,1000,$nbbyrow,1,1);
if ($nbphoto < 1)
{
print '<tr align=center valign=middle border=1><td class="photo">';
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">';
print "<br>".$langs->trans("NoPhotoYet")."<br><br>";
print '</td></tr>';
}
print '</table>';
}
}
}
}
else
{
print $langs->trans("ErrorUnknown");
......
......@@ -23,7 +23,7 @@
/**
* \file htdocs/product/price.php
* \ingroup product
* \brief Page de la fiche produit
* \brief Page to show product prices
* \version $Id$
*/
......@@ -126,17 +126,26 @@ dol_fiche_head($head, 'price', $titre, 0, $picto);
print '<table class="border" width="100%">';
// Reference
print '<tr>';
print '<td width="15%">'.$langs->trans("Ref").'</td><td colspan="2">';
// Ref
print '<td width="15%">'.$langs->trans("Ref").'</td><td>';
print $html->showrefnav($product,'ref','',1,'ref');
print '</td>';
print '</tr>';
// Libelle
print '<tr><td>'.$langs->trans("Label").'</td><td colspan="2">'.$product->libelle.'</td>';
$nblignes=3;
if (! empty($conf->global->PRODUIT_MULTIPRICES_LIMIT) && empty($socid)) $nblignes+=$conf->global->PRODUIT_MULTIPRICES_LIMIT;
else $nblignes+=3;
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);
print '</td>';
}
print '</tr>';
// Label
print '<tr><td>'.$langs->trans("Label").'</td><td>'.$product->libelle.'</td></tr>';
// MultiPrix
if($conf->global->PRODUIT_MULTIPRICES)
......@@ -252,12 +261,11 @@ else
print '</td></tr>';
// TVA
print '<tr><td>'.$langs->trans("VATRate").'</td><td colspan="2">'.vatrate($product->tva_tx,true).'</td></tr>';
print '<tr><td>'.$langs->trans("VATRate").'</td><td>'.vatrate($product->tva_tx,true).'</td></tr>';
}
// Statut
print '<tr><td>'.$langs->trans("Status").'</td><td colspan="2">';
print '<tr><td>'.$langs->trans("Status").'</td><td>';
print $product->getLibStatut(2);
print '</td></tr>';
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment