From 7be8f1a19c8b2908e262e6d1a623e2a44d4f69e8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 2 Apr 2005 13:56:33 +0000 Subject: [PATCH] =?UTF-8?q?Fix:=20L'onglet=20photo=20n'=E9tait=20pas=20tou?= =?UTF-8?q?jours=20apparent?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/product.class.php | 34 ++++++++++++++++--------------- htdocs/product/fiche.php | 35 ++++++++++++++------------------ htdocs/product/fournisseurs.php | 27 +++++++++++++----------- htdocs/product/photos.php | 6 +++--- htdocs/product/price.php | 14 +++++++------ htdocs/product/stats/fiche.php | 13 ++++++++---- htdocs/product/stock/product.php | 17 +++++++++++----- 7 files changed, 80 insertions(+), 66 deletions(-) diff --git a/htdocs/product.class.php b/htdocs/product.class.php index 71bec12d9e1..4c0fc5618db 100644 --- a/htdocs/product.class.php +++ b/htdocs/product.class.php @@ -851,30 +851,31 @@ class Product } /** - * - * + * \brief Déplace fichier uploadé sous le nom $files dans le répertoire sdir + * \param sdir Répertoire destination finale + * \param $files Nom du fichier uploadé */ function add_photo($sdir, $files) { - $dir = $sdir .'/'. get_exdir($this->id) . $this->id ."/"; - $dir .= "photos/"; - + if (! file_exists($dir)) - { - dolibarr_syslog("Product Create $dir"); - create_exdir($dir); - } + { + dolibarr_syslog("Product Create $dir"); + create_exdir($dir); + } + + if (file_exists($dir)) + { + // Crée fichier en taille vignette + // \todo A faire - if ( file_exists($dir)) - { - if (doliMoveFileUpload($files['tmp_name'], $dir . $files['name'])) - { - - } - } + // Crée fichier en taille origine + doliMoveFileUpload($files['tmp_name'], $dir . $files['name'])) + } } + /** * * @@ -903,6 +904,7 @@ class Product } } } + /** * Je sais c'est sale mais le besoin est urgent ;-) * diff --git a/htdocs/product/fiche.php b/htdocs/product/fiche.php index 16cebf37a39..9c5aa6d50cc 100644 --- a/htdocs/product/fiche.php +++ b/htdocs/product/fiche.php @@ -41,33 +41,29 @@ $mesg = ''; if (!$user->rights->produit->lire) accessforbidden(); - $types[0] = $langs->trans("Product"); $types[1] = $langs->trans("Service"); -/* - * - */ +/* + * Upload photo + */ if ( $_POST["sendit"] && defined('MAIN_UPLOAD_DOC') && MAIN_UPLOAD_DOC == 1) { - if ($_GET["id"]) + if ($_POST["id"]) { $product = new Product($db); - $result = $product->fetch($_GET["id"]); - - // if (doliMoveFileUpload($_FILES['userfile']['tmp_name'], $upload_dir . "/" . $_FILES['userfile']['name'])) - - // var_dump($_FILES); + $result = $product->fetch($_POST["id"]); $product->add_photo($conf->produit->dir_output, $_FILES['photofile']); } + + $_GET["id"]=$_POST["id"]; } + /* * */ - - if ($_GET["action"] == 'fastappro') { $product = new Product($db); @@ -369,7 +365,8 @@ else $head[$h][1] = $langs->trans("Stock"); $h++; } - + } + if ($conf->fournisseur->enabled) { $head[$h][0] = DOL_URL_ROOT."/product/fournisseurs.php?id=".$product->id; @@ -381,8 +378,6 @@ else $head[$h][1] = $langs->trans("Photos"); $h++; - } - $head[$h][0] = DOL_URL_ROOT."/product/stats/fiche.php?id=".$product->id; $head[$h][1] = $langs->trans('Statistics'); $h++; @@ -560,16 +555,16 @@ else { print_titre($langs->trans("AddPhoto")); - print '
'; - print ''; + print ''; + print ''; + print ''; print ''; - print ''; + print ''; print ''; print ''; print '
'.$langs->trans("File").''.$langs->trans("File").' ('.$langs->trans("Size").' <= '.$conf->maxfilesize.')
'; - print ' '; - + print '   '; print '
'; diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php index e55c380e1d0..71a736dd86a 100644 --- a/htdocs/product/fournisseurs.php +++ b/htdocs/product/fournisseurs.php @@ -21,11 +21,11 @@ * */ -/*! - \file htdocs/product/fiche.php - \ingroup product - \brief Page de la fiche produit - \version $Revision$ +/** + \file htdocs/product/fiche.php + \ingroup product + \brief Page de la fiche produit + \version $Revision$ */ require("./pre.inc.php"); @@ -113,17 +113,20 @@ if ($_GET["id"]) $head[$h][1] = 'Stock'; $h++; } - + } + if ($conf->fournisseur->enabled) { - $head[$h][0] = DOL_URL_ROOT."/product/fournisseurs.php?id=".$product->id; - $head[$h][1] = $langs->trans("Suppliers"); - $hselected = $h; - $h++; + $head[$h][0] = DOL_URL_ROOT."/product/fournisseurs.php?id=".$product->id; + $head[$h][1] = $langs->trans("Suppliers"); + $hselected = $h; + $h++; } - } - + $head[$h][0] = DOL_URL_ROOT."/product/photos.php?id=".$product->id; + $head[$h][1] = $langs->trans("Photos"); + $h++; + $head[$h][0] = DOL_URL_ROOT."/product/stats/fiche.php?id=".$product->id; $head[$h][1] = $langs->trans('Statistics'); $h++; diff --git a/htdocs/product/photos.php b/htdocs/product/photos.php index e582ac9737b..20125fc5f39 100644 --- a/htdocs/product/photos.php +++ b/htdocs/product/photos.php @@ -134,8 +134,8 @@ if ($_GET["id"]) print $langs->trans("NotOnSell"); } print ''; - print ''.$langs->trans("Label").''.$product->libelle.''; - print ''.$langs->trans("SellingPrice").''.price($product->price).''; + print ''.$langs->trans("Label").''.$product->libelle.''; + print ''; print ''.$langs->trans("Description").''.nl2br($product->description).''; @@ -150,7 +150,7 @@ if ($_GET["id"]) print $product->show_photos($conf->produit->dir_output); } - print "\n"; + print "
\n"; } } else diff --git a/htdocs/product/price.php b/htdocs/product/price.php index 46c0ad5b99a..a78174a7809 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -74,15 +74,17 @@ if($product->type == 0) $head[$h][1] = $langs->trans("Stock"); $h++; } +} - if ($conf->fournisseur->enabled) { - $head[$h][0] = DOL_URL_ROOT."/product/fournisseurs.php?id=".$product->id; - $head[$h][1] = $langs->trans("Suppliers"); - $h++; - } +if ($conf->fournisseur->enabled) { + $head[$h][0] = DOL_URL_ROOT."/product/fournisseurs.php?id=".$product->id; + $head[$h][1] = $langs->trans("Suppliers"); + $h++; } - +$head[$h][0] = DOL_URL_ROOT."/product/photos.php?id=".$product->id; +$head[$h][1] = $langs->trans("Photos"); +$h++; $head[$h][0] = DOL_URL_ROOT."/product/stats/fiche.php?id=".$product->id; $head[$h][1] = $langs->trans("Statistics"); diff --git a/htdocs/product/stats/fiche.php b/htdocs/product/stats/fiche.php index ec777ce6978..9c1d64ee044 100644 --- a/htdocs/product/stats/fiche.php +++ b/htdocs/product/stats/fiche.php @@ -127,13 +127,18 @@ if ($_GET["id"]) $head[$h][1] = $langs->trans('Stock'); $h++; } - - if ($conf->fournisseur->enabled) { + } + + if ($conf->fournisseur->enabled) + { $head[$h][0] = DOL_URL_ROOT."/product/fournisseurs.php?id=".$product->id; $head[$h][1] = $langs->trans("Suppliers"); $h++; - } - } + } + + $head[$h][0] = DOL_URL_ROOT."/product/photos.php?id=".$product->id; + $head[$h][1] = $langs->trans("Photos"); + $h++; $head[$h][0] = DOL_URL_ROOT."/product/stats/fiche.php?id=".$product->id; $head[$h][1] = $langs->trans("Statistics"); diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php index 7ce7d728326..f17060c020f 100644 --- a/htdocs/product/stock/product.php +++ b/htdocs/product/stock/product.php @@ -114,12 +114,15 @@ if ($_GET["id"]) $head[$h][1] = $langs->trans("Price"); $h++; - if($product->type == 0) + if ($product->type == 0) { - $head[$h][0] = DOL_URL_ROOT."/product/stock/product.php?id=".$product->id; - $head[$h][1] = $langs->trans("Stock"); - $hselected=$h; - $h++; + if ($conf->stock->enabled) + { + $head[$h][0] = DOL_URL_ROOT."/product/stock/product.php?id=".$product->id; + $head[$h][1] = $langs->trans("Stock"); + $hselected = $h; + $h++; + } } if ($conf->fournisseur->enabled) { @@ -127,6 +130,10 @@ if ($_GET["id"]) $head[$h][1] = $langs->trans("Suppliers"); $h++; } + + $head[$h][0] = DOL_URL_ROOT."/product/photos.php?id=".$product->id; + $head[$h][1] = $langs->trans("Photos"); + $h++; $head[$h][0] = DOL_URL_ROOT."/product/stats/fiche.php?id=".$product->id; $head[$h][1] = $langs->trans("Statistics");