From d5b1097d135c79bd4bad84e3b5c59688a10dcfc9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 17 Feb 2010 18:57:08 +0000 Subject: [PATCH] Qual: Mutualize common code --- htdocs/product/fiche.php | 8 ++--- htdocs/product/photos.php | 69 +++------------------------------------ htdocs/product/price.php | 30 ++++++++++------- 3 files changed, 27 insertions(+), 80 deletions(-) diff --git a/htdocs/product/fiche.php b/htdocs/product/fiche.php index 46bb90f2efd..263d7678cb7 100644 --- a/htdocs/product/fiche.php +++ b/htdocs/product/fiche.php @@ -844,12 +844,12 @@ if ($_GET["id"] || $_GET["ref"]) // En mode visu print ''; - // Reference + // Ref print ''; - $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 ''; - // Libelle + // Label print ''; // MultiPrix @@ -988,7 +988,7 @@ if ($_GET["id"] || $_GET["ref"]) print ''; // Description - print ''; + print ''; // Nature if($product->type!=1) diff --git a/htdocs/product/photos.php b/htdocs/product/photos.php index f2373082425..792762c5393 100644 --- a/htdocs/product/photos.php +++ b/htdocs/product/photos.php @@ -189,77 +189,16 @@ 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 '
'; - print '
'.$langs->trans("Ref").''; print $html->showrefnav($product,'ref','',1,'ref'); print '
'.$langs->trans("Label").''.$product->libelle.'
'.$langs->trans("Description").''.nl2br($product->description).'
'.$langs->trans("Description").''.nl2br($product->description).'
'; - - foreach ($product->liste_photos($dir) as $key => $obj) - { - $nbphoto++; - - // if ($nbbyrow && $nbphoto == 1) print '
'; - - // Do not use show_photo because there is more information to show - if ($nbbyrow && ($nbphoto % $nbbyrow == 1)) print ''; - if ($nbbyrow) print ''; - if ($nbbyrow && ($nbphoto % $nbbyrow == 0)) print ''; - } - - // Ferme tableau - while ($nbphoto % $nbbyrow) - { - print ''; - $nbphoto++; - } + $nbphoto=$product->show_photos($conf->produit->dir_output,1,1000,$nbbyrow,1,1); if ($nbphoto < 1) { - print '
'; - - print ''; - - // 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 ''; - - print ''; - print '
'.$viewfilename; - print '
'; - - // 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 ''.img_refresh($langs->trans('GenerateThumb')).'  '; - } - if ($user->rights->produit->creer || $user->rights->service->creer) - { - print ''; - print img_delete().''; - } - if ($nbbyrow) print '
 
'; + print '
'; + print ''; print ''; + print '
'; print "
".$langs->trans("NoPhotoYet")."

"; print '
'; } - - print '
'; } } } diff --git a/htdocs/product/price.php b/htdocs/product/price.php index 8cb60c8f8fc..a67f4318334 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -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 ''; -// Reference -print ''; -print ''; + +$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 ''; +} print ''; -// Libelle -print ''; -print ''; - +// Label +print ''; // MultiPrix if($conf->global->PRODUIT_MULTIPRICES) @@ -252,12 +261,11 @@ else print ''; // TVA - print ''; - + print ''; } // Statut -print '';
'.$langs->trans("Ref").''; +// Ref +print ''.$langs->trans("Ref").''; print $html->showrefnav($product,'ref','',1,'ref'); print ''; + $nbphoto=$product->show_photos($conf->produit->dir_output,1,1,0); + print '
'.$langs->trans("Label").''.$product->libelle.'
'.$langs->trans("Label").''.$product->libelle.'
'.$langs->trans("VATRate").''.vatrate($product->tva_tx,true).'
'.$langs->trans("VATRate").''.vatrate($product->tva_tx,true).'
'.$langs->trans("Status").''; +print '
'.$langs->trans("Status").''; print $product->getLibStatut(2); print '