Ajout affichage de la photo

This commit is contained in:
Rodolphe Quiedeville 2005-03-10 16:30:56 +00:00
parent 57b0636c45
commit 71336021c3

View File

@ -39,15 +39,34 @@ $user->getrights('propale');
$user->getrights('facture'); $user->getrights('facture');
$mesg = ''; $mesg = '';
if (!$user->rights->produit->lire) if (!$user->rights->produit->lire) accessforbidden();
{
accessforbidden();
}
$types[0] = $langs->trans("Product"); $types[0] = $langs->trans("Product");
$types[1] = $langs->trans("Service"); $types[1] = $langs->trans("Service");
/*
*
*/
if ( $_POST["sendit"] && defined('MAIN_UPLOAD_DOC') && MAIN_UPLOAD_DOC == 1)
{
if ($_GET["id"])
{
$product = new Product($db);
$result = $product->fetch($_GET["id"]);
// if (doliMoveFileUpload($_FILES['userfile']['tmp_name'], $upload_dir . "/" . $_FILES['userfile']['name']))
// var_dump($_FILES);
$product->add_photo($conf->produit->dir_output, $_FILES['photofile']);
}
}
/*
*
*/
if ($_GET["action"] == 'fastappro') if ($_GET["action"] == 'fastappro')
{ {
@ -357,6 +376,11 @@ else
$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;
@ -517,8 +541,10 @@ else
} }
} }
print '</select></td><td>'.$langs->trans("Ref").'</td><td><input name="ref_fourn" size="25" value=""></td></tr>'; print '</select></td><td>'.$langs->trans("Ref").'</td>';
print '<tr><td colspan="4" align="center"><input type="submit" value="'.$langs->trans("Save").'">&nbsp;'; print '<td><input name="ref_fourn" size="25" value=""></td></tr>';
print '<tr><td colspan="4" align="center">';
print '<input type="submit" value="'.$langs->trans("Save").'">&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>';
print '</form>'; print '</form>';
@ -530,10 +556,6 @@ else
*/ */
if ($_GET["action"] == 'ajout_photo' && $user->rights->produit->creer && $product->isproduct) if ($_GET["action"] == 'ajout_photo' && $user->rights->produit->creer && $product->isproduct)
{ {
$product->add_photo($conf->produit->dir_output);
$langs->load("suppliers");
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?id='.$product->id.'" enctype="multipart/form-data" METHOD="POST">';
@ -543,7 +565,10 @@ else
print '<td>'.$langs->trans("File").'</td>'; print '<td>'.$langs->trans("File").'</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"><input type="submit" value="'.$langs->trans("Save").'">&nbsp;'; print '<tr><td colspan="4" align="center">';
print '<input type="submit" name="sendit" value="'.$langs->trans("Save").'">&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>';
print '</form>'; print '</form>';
@ -674,7 +699,14 @@ if ($_GET["action"] == '')
print "\n</div>\n"; print "\n</div>\n";
/*
* Photo
*
*/
if ($_GET["id"] && $_GET["action"]=='')
{
print $product->show_photo($conf->produit->dir_output);
}
if ($_GET["id"] && $_GET["action"] == '' && $product->envente) if ($_GET["id"] && $_GET["action"] == '' && $product->envente)
{ {