Fix: L'onglet photo n'était pas toujours apparent

This commit is contained in:
Laurent Destailleur 2005-04-02 13:56:33 +00:00
parent 02980093ee
commit 7be8f1a19c
7 changed files with 80 additions and 66 deletions

View File

@ -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) function add_photo($sdir, $files)
{ {
$dir = $sdir .'/'. get_exdir($this->id) . $this->id ."/"; $dir = $sdir .'/'. get_exdir($this->id) . $this->id ."/";
$dir .= "photos/"; $dir .= "photos/";
if (! file_exists($dir)) if (! file_exists($dir))
{ {
dolibarr_syslog("Product Create $dir"); dolibarr_syslog("Product Create $dir");
create_exdir($dir); create_exdir($dir);
} }
if (file_exists($dir))
{
// Crée fichier en taille vignette
// \todo A faire
if ( file_exists($dir)) // Crée fichier en taille origine
{ doliMoveFileUpload($files['tmp_name'], $dir . $files['name']))
if (doliMoveFileUpload($files['tmp_name'], $dir . $files['name'])) }
{
}
}
} }
/** /**
* *
* *
@ -903,6 +904,7 @@ class Product
} }
} }
} }
/** /**
* Je sais c'est sale mais le besoin est urgent ;-) * Je sais c'est sale mais le besoin est urgent ;-)
* *

View File

@ -41,33 +41,29 @@ $mesg = '';
if (!$user->rights->produit->lire) accessforbidden(); if (!$user->rights->produit->lire) accessforbidden();
$types[0] = $langs->trans("Product"); $types[0] = $langs->trans("Product");
$types[1] = $langs->trans("Service"); $types[1] = $langs->trans("Service");
/*
*
*/
/*
* Upload photo
*/
if ( $_POST["sendit"] && defined('MAIN_UPLOAD_DOC') && MAIN_UPLOAD_DOC == 1) if ( $_POST["sendit"] && defined('MAIN_UPLOAD_DOC') && MAIN_UPLOAD_DOC == 1)
{ {
if ($_GET["id"]) if ($_POST["id"])
{ {
$product = new Product($db); $product = new Product($db);
$result = $product->fetch($_GET["id"]); $result = $product->fetch($_POST["id"]);
// if (doliMoveFileUpload($_FILES['userfile']['tmp_name'], $upload_dir . "/" . $_FILES['userfile']['name']))
// var_dump($_FILES);
$product->add_photo($conf->produit->dir_output, $_FILES['photofile']); $product->add_photo($conf->produit->dir_output, $_FILES['photofile']);
} }
$_GET["id"]=$_POST["id"];
} }
/* /*
* *
*/ */
if ($_GET["action"] == 'fastappro') if ($_GET["action"] == 'fastappro')
{ {
$product = new Product($db); $product = new Product($db);
@ -369,7 +365,8 @@ else
$head[$h][1] = $langs->trans("Stock"); $head[$h][1] = $langs->trans("Stock");
$h++; $h++;
} }
}
if ($conf->fournisseur->enabled) if ($conf->fournisseur->enabled)
{ {
$head[$h][0] = DOL_URL_ROOT."/product/fournisseurs.php?id=".$product->id; $head[$h][0] = DOL_URL_ROOT."/product/fournisseurs.php?id=".$product->id;
@ -381,8 +378,6 @@ else
$head[$h][1] = $langs->trans("Photos"); $head[$h][1] = $langs->trans("Photos");
$h++; $h++;
}
$head[$h][0] = DOL_URL_ROOT."/product/stats/fiche.php?id=".$product->id; $head[$h][0] = DOL_URL_ROOT."/product/stats/fiche.php?id=".$product->id;
$head[$h][1] = $langs->trans('Statistics'); $head[$h][1] = $langs->trans('Statistics');
$h++; $h++;
@ -560,16 +555,16 @@ else
{ {
print_titre($langs->trans("AddPhoto")); print_titre($langs->trans("AddPhoto"));
print '<form name="userfile" action="fiche.php?id='.$product->id.'" enctype="multipart/form-data" METHOD="POST">'; print '<form name="userfile" action="fiche.php" enctype="multipart/form-data" METHOD="POST">';
print '<input type="hidden" name="max_file_size" value="2000000">'; print '<input type="hidden" name="max_file_size" value="'.$conf->maxfilesize.'">';
print '<input type="hidden" name="id" value="'.$product->id.'">';
print '<table class="border" width="100%"><tr>'; print '<table class="border" width="100%"><tr>';
print '<td>'.$langs->trans("File").'</td>'; print '<td>'.$langs->trans("File").' ('.$langs->trans("Size").' <= '.$conf->maxfilesize.')</td>';
print '<td><input type="file" name="photofile"></td></tr>'; print '<td><input type="file" name="photofile"></td></tr>';
print '<tr><td colspan="4" align="center">'; print '<tr><td colspan="4" align="center">';
print '<input type="submit" name="sendit" value="'.$langs->trans("Save").'">&nbsp;'; print '<input type="submit" name="sendit" value="'.$langs->trans("Upload").'"> &nbsp; ';
print '<input type="submit" name="cancel" value="'.$langs->trans("Cancel").'"></td></tr>'; print '<input type="submit" name="cancel" value="'.$langs->trans("Cancel").'"></td></tr>';
print '</table>'; print '</table>';

View File

@ -21,11 +21,11 @@
* *
*/ */
/*! /**
\file htdocs/product/fiche.php \file htdocs/product/fiche.php
\ingroup product \ingroup product
\brief Page de la fiche produit \brief Page de la fiche produit
\version $Revision$ \version $Revision$
*/ */
require("./pre.inc.php"); require("./pre.inc.php");
@ -113,17 +113,20 @@ if ($_GET["id"])
$head[$h][1] = 'Stock'; $head[$h][1] = 'Stock';
$h++; $h++;
} }
}
if ($conf->fournisseur->enabled) if ($conf->fournisseur->enabled)
{ {
$head[$h][0] = DOL_URL_ROOT."/product/fournisseurs.php?id=".$product->id; $head[$h][0] = DOL_URL_ROOT."/product/fournisseurs.php?id=".$product->id;
$head[$h][1] = $langs->trans("Suppliers"); $head[$h][1] = $langs->trans("Suppliers");
$hselected = $h; $hselected = $h;
$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][0] = DOL_URL_ROOT."/product/stats/fiche.php?id=".$product->id;
$head[$h][1] = $langs->trans('Statistics'); $head[$h][1] = $langs->trans('Statistics');
$h++; $h++;

View File

@ -134,8 +134,8 @@ if ($_GET["id"])
print $langs->trans("NotOnSell"); print $langs->trans("NotOnSell");
} }
print '</td></tr>'; print '</td></tr>';
print '<tr><td>'.$langs->trans("Label").'</td><td>'.$product->libelle.'</td>'; print '<tr><td>'.$langs->trans("Label").'</td><td colspan="3">'.$product->libelle.'</td>';
print '<td>'.$langs->trans("SellingPrice").'</td><td>'.price($product->price).'</td></tr>'; print '</tr>';
print '<tr><td>'.$langs->trans("Description").'</td><td colspan="3">'.nl2br($product->description).'</td></tr>'; print '<tr><td>'.$langs->trans("Description").'</td><td colspan="3">'.nl2br($product->description).'</td></tr>';
@ -150,7 +150,7 @@ if ($_GET["id"])
print $product->show_photos($conf->produit->dir_output); print $product->show_photos($conf->produit->dir_output);
} }
print "</div>\n"; print "<br></div>\n";
} }
} }
else else

View File

@ -74,15 +74,17 @@ if($product->type == 0)
$head[$h][1] = $langs->trans("Stock"); $head[$h][1] = $langs->trans("Stock");
$h++; $h++;
} }
}
if ($conf->fournisseur->enabled) { if ($conf->fournisseur->enabled) {
$head[$h][0] = DOL_URL_ROOT."/product/fournisseurs.php?id=".$product->id; $head[$h][0] = DOL_URL_ROOT."/product/fournisseurs.php?id=".$product->id;
$head[$h][1] = $langs->trans("Suppliers"); $head[$h][1] = $langs->trans("Suppliers");
$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][0] = DOL_URL_ROOT."/product/stats/fiche.php?id=".$product->id;
$head[$h][1] = $langs->trans("Statistics"); $head[$h][1] = $langs->trans("Statistics");

View File

@ -127,13 +127,18 @@ if ($_GET["id"])
$head[$h][1] = $langs->trans('Stock'); $head[$h][1] = $langs->trans('Stock');
$h++; $h++;
} }
}
if ($conf->fournisseur->enabled) {
if ($conf->fournisseur->enabled)
{
$head[$h][0] = DOL_URL_ROOT."/product/fournisseurs.php?id=".$product->id; $head[$h][0] = DOL_URL_ROOT."/product/fournisseurs.php?id=".$product->id;
$head[$h][1] = $langs->trans("Suppliers"); $head[$h][1] = $langs->trans("Suppliers");
$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][0] = DOL_URL_ROOT."/product/stats/fiche.php?id=".$product->id;
$head[$h][1] = $langs->trans("Statistics"); $head[$h][1] = $langs->trans("Statistics");

View File

@ -114,12 +114,15 @@ if ($_GET["id"])
$head[$h][1] = $langs->trans("Price"); $head[$h][1] = $langs->trans("Price");
$h++; $h++;
if($product->type == 0) if ($product->type == 0)
{ {
$head[$h][0] = DOL_URL_ROOT."/product/stock/product.php?id=".$product->id; if ($conf->stock->enabled)
$head[$h][1] = $langs->trans("Stock"); {
$hselected=$h; $head[$h][0] = DOL_URL_ROOT."/product/stock/product.php?id=".$product->id;
$h++; $head[$h][1] = $langs->trans("Stock");
$hselected = $h;
$h++;
}
} }
if ($conf->fournisseur->enabled) { if ($conf->fournisseur->enabled) {
@ -127,6 +130,10 @@ if ($_GET["id"])
$head[$h][1] = $langs->trans("Suppliers"); $head[$h][1] = $langs->trans("Suppliers");
$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][0] = DOL_URL_ROOT."/product/stats/fiche.php?id=".$product->id;
$head[$h][1] = $langs->trans("Statistics"); $head[$h][1] = $langs->trans("Statistics");