diff --git a/htdocs/product.class.php b/htdocs/product.class.php index 68b3d04d938..ab0493a9019 100644 --- a/htdocs/product.class.php +++ b/htdocs/product.class.php @@ -986,6 +986,30 @@ class Product } + /** + * \brief Affiche la première photo du produit + * \param sdir Répertoire à scanner + * \return boolean true si photo dispo, flase sinon + */ + function is_photo_available($sdir) + { + $pdir = get_exdir($this->id) . $this->id ."/photos/"; + $dir = $sdir . '/'. $pdir; + + $nbphoto=0; + if (file_exists($dir)) + { + $handle=opendir($dir); + + while (($file = readdir($handle)) != false) + { + if (is_file($dir.$file)) return true; + } + } + return false; + } + + /** * \brief Affiche la première photo du produit * \param sdir Répertoire à scanner diff --git a/htdocs/product/fiche.php b/htdocs/product/fiche.php index 4479ee2f30f..9e9efd3bd42 100644 --- a/htdocs/product/fiche.php +++ b/htdocs/product/fiche.php @@ -43,22 +43,6 @@ $types[0] = $langs->trans("Product"); $types[1] = $langs->trans("Service"); -/* - * Upload photo - */ -if ( $_POST["sendit"] && $conf->upload) -{ - if ($_POST["id"]) - { - $product = new Product($db); - $result = $product->fetch($_POST["id"]); - - $product->add_photo($conf->produit->dir_output, $_FILES['photofile']); - } - - $_GET["id"]=$_POST["id"]; -} - /* * */ @@ -161,6 +145,7 @@ if ($_POST["action"] == 'addinpropal') Header("Location: ../comm/propal.php?propalid=".$propal->id); } + /* * Ajout du produit dans une facture */ @@ -360,10 +345,15 @@ if ($_GET["id"]) // Reference print '