Look: Modifications mineures

This commit is contained in:
Laurent Destailleur 2005-06-26 18:13:17 +00:00
parent 62d3d70464
commit fbfb87bcf8
2 changed files with 34 additions and 20 deletions

View File

@ -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

View File

@ -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 '<td width="10%">'.$langs->trans("Ref").'</td><td>'.$product->ref.'</td>';
print '<td valign="middle" align="center" rowspan="'.$nblignes.'">';
// Photo
$nbphoto=$product->show_photo($conf->produit->dir_output,1);
print '</td>';
if ($product->is_photo_available($conf->produit->dir_output))
{
// Photo
print '<td valign="middle" align="center" rowspan="'.$nblignes.'">';
$nbphoto=$product->show_photo($conf->produit->dir_output,1);
print '</td>';
}
print '</tr>';
// Libellé