diff --git a/htdocs/fourn/product/photos.php b/htdocs/fourn/product/photos.php index fd7e69d9a38..e846b9f81b0 100644 --- a/htdocs/fourn/product/photos.php +++ b/htdocs/fourn/product/photos.php @@ -29,15 +29,9 @@ */ require("./pre.inc.php"); -require("../propal.class.php"); -require("../facture.class.php"); +; -$langs->load("products"); -$user->getrights('produit'); -$user->getrights('propale'); -$user->getrights('facture'); -$mesg = ''; if (!$user->rights->produit->lire) accessforbidden(); @@ -56,10 +50,6 @@ if ( $_POST["sendit"] && defined('MAIN_UPLOAD_DOC') && MAIN_UPLOAD_DOC == 1) $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']); } } @@ -73,29 +63,21 @@ llxHeader("","",$langs->trans("CardProduct0")); */ if ($_GET["id"]) { - - $product = new Product($db); $result = $product->fetch($_GET["id"]); - - + if ( $result ) { - - /* * En mode visu */ $h=0; - $head[$h][0] = DOL_URL_ROOT."/product/fiche.php?id=".$product->id; + $head[$h][0] = DOL_URL_ROOT."/fourn/product/fiche.php?id=".$product->id; $head[$h][1] = $langs->trans("Card"); $h++; - $head[$h][0] = DOL_URL_ROOT."/product/price.php?id=".$product->id; - $head[$h][1] = $langs->trans("Price"); - $h++; if ($conf->stock->enabled) { @@ -111,15 +93,11 @@ if ($_GET["id"]) $h++; } - $head[$h][0] = DOL_URL_ROOT."/product/photos.php?id=".$product->id; + $head[$h][0] = DOL_URL_ROOT."/fourn/product/photos.php?id=".$product->id; $head[$h][1] = $langs->trans("Photos"); $hselected = $h; $h++; - $head[$h][0] = DOL_URL_ROOT."/product/stats/fiche.php?id=".$product->id; - $head[$h][1] = $langs->trans('Statistics'); - $h++; - dolibarr_fiche_head($head, $hselected, $langs->trans("CardProduct".$product->type).' : '.$product->ref); print($mesg); @@ -143,17 +121,54 @@ if ($_GET["id"]) print "
\n"; + /* - * Photo + * Ajouter une photo * */ - if ($_GET["id"] && $_GET["action"]=='') + if ($_GET["action"] == 'ajout_photo' && $user->rights->produit->creer && $product->isproduct) { - print $product->show_photos($conf->produit->dir_output); + print_titre($langs->trans("AddPhoto")); + + print '
'; + print ''; + + print ''; + print ''; + print ''; + + print ''; + print '
'.$langs->trans("File").'
'; + print ' '; + + + print '
'; + print '

'; } + + // Affiche photos + $nbphoto=$product->show_photos($conf->produit->dir_output,1); + if ($nbphoto < 1) print $langs->trans("NoPhotoYet")."

"; print "\n"; - } + + } + + print "\n
\n"; + + if ($_GET["action"] == '') + { + if ( $user->rights->produit->creer && $product->isproduct) + { + print ''; + print $langs->trans("AddPhoto").''; + } +} + +print "\n
\n"; + + + } else {