Fix: L'onglet photo n'était pas toujours apparent
This commit is contained in:
parent
02980093ee
commit
7be8f1a19c
@ -851,14 +851,13 @@ 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))
|
||||||
@ -869,12 +868,14 @@ class Product
|
|||||||
|
|
||||||
if (file_exists($dir))
|
if (file_exists($dir))
|
||||||
{
|
{
|
||||||
if (doliMoveFileUpload($files['tmp_name'], $dir . $files['name']))
|
// Crée fichier en taille vignette
|
||||||
{
|
// \todo A faire
|
||||||
|
|
||||||
|
// 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 ;-)
|
* Je sais c'est sale mais le besoin est urgent ;-)
|
||||||
*
|
*
|
||||||
|
|||||||
@ -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,6 +365,7 @@ else
|
|||||||
$head[$h][1] = $langs->trans("Stock");
|
$head[$h][1] = $langs->trans("Stock");
|
||||||
$h++;
|
$h++;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ($conf->fournisseur->enabled)
|
if ($conf->fournisseur->enabled)
|
||||||
{
|
{
|
||||||
@ -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").'"> ';
|
print '<input type="submit" name="sendit" value="'.$langs->trans("Upload").'"> ';
|
||||||
|
|
||||||
|
|
||||||
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>';
|
||||||
|
|||||||
@ -21,7 +21,7 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*!
|
/**
|
||||||
\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
|
||||||
@ -113,6 +113,7 @@ if ($_GET["id"])
|
|||||||
$head[$h][1] = 'Stock';
|
$head[$h][1] = 'Stock';
|
||||||
$h++;
|
$h++;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ($conf->fournisseur->enabled)
|
if ($conf->fournisseur->enabled)
|
||||||
{
|
{
|
||||||
@ -122,7 +123,9 @@ if ($_GET["id"])
|
|||||||
$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');
|
||||||
|
|||||||
@ -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
|
||||||
|
|||||||
@ -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");
|
||||||
|
|||||||
@ -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");
|
||||||
|
|||||||
@ -115,12 +115,15 @@ if ($_GET["id"])
|
|||||||
$h++;
|
$h++;
|
||||||
|
|
||||||
if ($product->type == 0)
|
if ($product->type == 0)
|
||||||
|
{
|
||||||
|
if ($conf->stock->enabled)
|
||||||
{
|
{
|
||||||
$head[$h][0] = DOL_URL_ROOT."/product/stock/product.php?id=".$product->id;
|
$head[$h][0] = DOL_URL_ROOT."/product/stock/product.php?id=".$product->id;
|
||||||
$head[$h][1] = $langs->trans("Stock");
|
$head[$h][1] = $langs->trans("Stock");
|
||||||
$hselected = $h;
|
$hselected = $h;
|
||||||
$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;
|
||||||
@ -128,6 +131,10 @@ if ($_GET["id"])
|
|||||||
$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++;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user