Fix: L'onglet photo n'tait pas toujours apparent
This commit is contained in:
parent
02980093ee
commit
7be8f1a19c
@ -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 ;-)
|
||||
*
|
||||
|
||||
@ -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 '<form name="userfile" action="fiche.php?id='.$product->id.'" enctype="multipart/form-data" METHOD="POST">';
|
||||
print '<input type="hidden" name="max_file_size" value="2000000">';
|
||||
print '<form name="userfile" action="fiche.php" enctype="multipart/form-data" METHOD="POST">';
|
||||
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 '<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 '<tr><td colspan="4" align="center">';
|
||||
print '<input type="submit" name="sendit" value="'.$langs->trans("Save").'"> ';
|
||||
|
||||
print '<input type="submit" name="sendit" value="'.$langs->trans("Upload").'"> ';
|
||||
|
||||
print '<input type="submit" name="cancel" value="'.$langs->trans("Cancel").'"></td></tr>';
|
||||
print '</table>';
|
||||
|
||||
@ -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++;
|
||||
|
||||
@ -134,8 +134,8 @@ if ($_GET["id"])
|
||||
print $langs->trans("NotOnSell");
|
||||
}
|
||||
print '</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Label").'</td><td>'.$product->libelle.'</td>';
|
||||
print '<td>'.$langs->trans("SellingPrice").'</td><td>'.price($product->price).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Label").'</td><td colspan="3">'.$product->libelle.'</td>';
|
||||
print '</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 "</div>\n";
|
||||
print "<br></div>\n";
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@ -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");
|
||||
|
||||
@ -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");
|
||||
|
||||
@ -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");
|
||||
|
||||
Loading…
Reference in New Issue
Block a user