Debut Ajout de Photo

This commit is contained in:
Rodolphe Quiedeville 2005-03-03 15:52:00 +00:00
parent c956683296
commit 3c51b7842c

View File

@ -116,7 +116,7 @@ if ($_POST["action"] == 'update' &&
if ($product->update($product->id, $user) > 0)
{
$_GET["action"] = '';
$_GET["id"] = $_POST["id"];
$_GET["id"] = $_POST["id"];
}
else
{
@ -128,7 +128,7 @@ if ($_POST["action"] == 'update' &&
else
{
$_GET["action"] = 're-edit';
$_GET["id"] = $_POST["id"];
$_GET["id"] = $_POST["id"];
$mesg = $langs->trans("ErrorProductBadRefOrLabel");
}
}
@ -351,12 +351,12 @@ else
$h++;
}
if ($conf->fournisseur->enabled)
{
$head[$h][0] = DOL_URL_ROOT."/product/fournisseurs.php?id=".$product->id;
$head[$h][1] = $langs->trans("Suppliers");
$h++;
}
if ($conf->fournisseur->enabled)
{
$head[$h][0] = DOL_URL_ROOT."/product/fournisseurs.php?id=".$product->id;
$head[$h][1] = $langs->trans("Suppliers");
$h++;
}
}
$head[$h][0] = DOL_URL_ROOT."/product/stats/fiche.php?id=".$product->id;
@ -440,7 +440,7 @@ else
}
else
{
print "<td>".$product->stock_reel;
print "<td>".$product->stock_reel;
}
}
print '</td></tr>';
@ -452,60 +452,60 @@ else
print '<tr><td>'.$langs->trans("Duration").'</td><td>'.$product->duration_value.'&nbsp;';
if ($product->duration_value > 1)
{
$dur=array("d"=>$langs->trans("Days"),"w"=>$langs->trans("Weeks"),"m"=>$langs->trans("Months"),"y"=>$langs->trans("Years"));
{
$dur=array("d"=>$langs->trans("Days"),"w"=>$langs->trans("Weeks"),"m"=>$langs->trans("Months"),"y"=>$langs->trans("Years"));
}
else {
$dur=array("d"=>$langs->trans("Day"),"w"=>$langs->trans("Week"),"m"=>$langs->trans("Month"),"y"=>$langs->trans("Year"));
}
else {
$dur=array("d"=>$langs->trans("Day"),"w"=>$langs->trans("Week"),"m"=>$langs->trans("Month"),"y"=>$langs->trans("Year"));
}
print $langs->trans($dur[$product->duration_unit])."&nbsp;";
print $langs->trans($dur[$product->duration_unit])."&nbsp;";
print '</td></tr>';
}
print "</table><br>\n";
print "</div>\n";
}
print "</div>\n";
}
/*
* Edition du prix
*
*/
if ($_GET["action"] == 'edit_price' && $user->rights->produit->creer)
{
print '<div class="titre">'.$langs->trans("NewPrice").'</div>';
print '<form action="fiche.php?id='.$product->id.'" method="post">';
print '<input type="hidden" name="action" value="update_price">';
print '<input type="hidden" name="id" value="'.$product->id.'">';
print '<table class="border" width="100%">';
print '<tr><td width="20%">'.$langs->trans('SellingPrice').'</td><td><input name="price" size="10" value="'.price($product->price).'"></td></tr>';
print '<tr><td colspan="3" align="center"><input type="submit" value="'.$langs->trans("Save").'">&nbsp;';
print '<input type="submit" name="cancel" value="'.$langs->trans("Cancel").'"></td></tr>';
print '</table>';
print '</form>';
}
/*
* Edition du prix
*
*/
if ($_GET["action"] == 'edit_price' && $user->rights->produit->creer)
{
print '<div class="titre">'.$langs->trans("NewPrice").'</div>';
print '<form action="fiche.php?id='.$product->id.'" method="post">';
print '<input type="hidden" name="action" value="update_price">';
print '<input type="hidden" name="id" value="'.$product->id.'">';
print '<table class="border" width="100%">';
print '<tr><td width="20%">'.$langs->trans('SellingPrice').'</td><td><input name="price" size="10" value="'.price($product->price).'"></td></tr>';
print '<tr><td colspan="3" align="center"><input type="submit" value="'.$langs->trans("Save").'">&nbsp;';
print '<input type="submit" name="cancel" value="'.$langs->trans("Cancel").'"></td></tr>';
print '</table>';
print '</form>';
}
/*
* Ajouter un fournisseur
*
*/
if ($_GET["action"] == 'ajout_fourn' && $user->rights->produit->creer)
{
$langs->load("suppliers");
/*
* Ajouter un fournisseur
*
*/
if ($_GET["action"] == 'ajout_fourn' && $user->rights->produit->creer)
{
$langs->load("suppliers");
print_titre($langs->trans("AddSupplier"));
print '<form action="fiche.php?id='.$product->id.'" method="post">';
print '<input type="hidden" name="action" value="add_fourn">';
print '<input type="hidden" name="id" value="'.$product->id.'">';
print '<table class="border" width="100%"><tr>';
print '<td>'.$langs->trans("Suppliers").'</td><td><select name="id_fourn">';
print_titre($langs->trans("AddSupplier"));
print '<form action="fiche.php?id='.$product->id.'" method="post">';
print '<input type="hidden" name="action" value="add_fourn">';
print '<input type="hidden" name="id" value="'.$product->id.'">';
print '<table class="border" width="100%"><tr>';
print '<td>'.$langs->trans("Suppliers").'</td><td><select name="id_fourn">';
$sql = "SELECT s.idp, s.nom, s.ville FROM ".MAIN_DB_PREFIX."societe as s WHERE s.fournisseur=1";
$sql .= " ORDER BY lower(s.nom)";
$sql = "SELECT s.idp, s.nom, s.ville FROM ".MAIN_DB_PREFIX."societe as s WHERE s.fournisseur=1";
$sql .= " ORDER BY lower(s.nom)";
if ($db->query($sql))
if ($db->query($sql))
{
$num = $db->num_rows();
$i = 0;
@ -515,27 +515,51 @@ else
print '<option value="'.$obj->idp.'">'.$obj->nom . ($obj->ville?" ($obj->ville)":"");
$i++;
}
}
print '</select></td><td>'.$langs->trans("Ref").'</td><td><input name="ref_fourn" size="25" value=""></td></tr>';
print '<tr><td colspan="4" align="center"><input type="submit" value="'.$langs->trans("Save").'">&nbsp;';
print '<input type="submit" name="cancel" value="'.$langs->trans("Cancel").'"></td></tr>';
print '</table>';
print '</form>';
}
/*
* Ajouter une photo
*
*/
if ($_GET["action"] == 'ajout_photo' && $user->rights->produit->creer && $product->isproduct)
{
$langs->load("suppliers");
print_titre($langs->trans("AddPhoto"));
print '<form action="fiche.php?id='.$product->id.'" method="post">';
print '<input type="hidden" name="action" value="add_fourn">';
print '<input type="hidden" name="id" value="'.$product->id.'">';
print '<table class="border" width="100%"><tr>';
print '<td>'.$langs->trans("File").'</td>';
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 '<input type="submit" name="cancel" value="'.$langs->trans("Cancel").'"></td></tr>';
print '</table>';
print '</form>';
}
print '</select></td><td>'.$langs->trans("Ref").'</td><td><input name="ref_fourn" size="25" value=""></td></tr>';
print '<tr><td colspan="4" align="center"><input type="submit" value="'.$langs->trans("Save").'">&nbsp;';
print '<input type="submit" name="cancel" value="'.$langs->trans("Cancel").'"></td></tr>';
print '</table>';
print '</form>';
}
}
/*
* Fiche en mode edition
*/
/*
*
* Fiche en mode edition
*
*/
if (($_GET["action"] == 'edit' || $_GET["action"] == 're-edit') && $user->rights->produit->creer)
{
print_fiche_titre('Edition de la fiche '.$types[$product->type].' : '.$product->ref, "");
if ($mesg) {
print '<br><div class="error">'.$mesg.'</div><br>';
if ($mesg) {
print '<br><div class="error">'.$mesg.'</div><br>';
}
print "<form action=\"fiche.php\" method=\"post\">\n";
@ -581,14 +605,14 @@ else
if ($product->type == 1)
{
print '<tr><td>'.$langs->trans("Duration").'</td><td colspan="2"><input name="duration_value" size="3" maxlength="5" value="'.$product->duration_value.'">';
print '&nbsp; ';
print '<input name="duration_unit" type="radio" value="d"'.($product->duration_unit=='d'?' checked':'').'>'.$langs->trans("Day");
print '&nbsp; ';
print '<input name="duration_unit" type="radio" value="w"'.($product->duration_unit=='w'?' checked':'').'>'.$langs->trans("Week");
print '&nbsp; ';
print '<input name="duration_unit" type="radio" value="m"'.($product->duration_unit=='m'?' checked':'').'>'.$langs->trans("Month");
print '&nbsp; ';
print '<input name="duration_unit" type="radio" value="y"'.($product->duration_unit=='y'?' checked':'').'>'.$langs->trans("Year");
print '&nbsp; ';
print '<input name="duration_unit" type="radio" value="d"'.($product->duration_unit=='d'?' checked':'').'>'.$langs->trans("Day");
print '&nbsp; ';
print '<input name="duration_unit" type="radio" value="w"'.($product->duration_unit=='w'?' checked':'').'>'.$langs->trans("Week");
print '&nbsp; ';
print '<input name="duration_unit" type="radio" value="m"'.($product->duration_unit=='m'?' checked':'').'>'.$langs->trans("Month");
print '&nbsp; ';
print '<input name="duration_unit" type="radio" value="y"'.($product->duration_unit=='y'?' checked':'').'>'.$langs->trans("Year");
print '</td></tr>';
}
@ -616,21 +640,32 @@ print "\n<div class=\"tabsAction\">\n";
if ($_GET["action"] == '')
{
if ($product->type == 0 && $user->rights->produit->commander && $num_fournisseur == 1)
if ($product->type == 0 && $user->rights->produit->commander && $num_fournisseur == 1)
{
print '<a class="tabAction" href="fiche.php?action=fastappro&amp;id='.$product->id.'">'.$langs->trans("Order").'</a>';
print '<a class="tabAction" href="fiche.php?action=fastappro&amp;id='.$product->id.'">';
print $langs->trans("Order").'</a>';
}
if ( $user->rights->produit->creer)
if ( $user->rights->produit->creer && $product->isproduct)
{
print '<a class="tabAction" href="fiche.php?action=edit_price&amp;id='.$product->id.'">'.$langs->trans("UpdatePrice").'</a>';
print '<a class="tabAction" href="fiche.php?action=ajout_photo&amp;id='.$product->id.'">';
print $langs->trans("AddPhoto").'</a>';
}
if ( $user->rights->produit->creer)
if ( $user->rights->produit->creer)
{
print '<a class="tabAction" href="fiche.php?action=edit&amp;id='.$product->id.'">'.$langs->trans("Edit").'</a>';
print '<a class="tabAction" href="fiche.php?action=edit_price&amp;id='.$product->id.'">';
print $langs->trans("UpdatePrice").'</a>';
}
if ($product->type == 0 && $conf->stock->enabled)
if ( $user->rights->produit->creer)
{
print '<a class="tabAction" href="stock/product.php?id='.$product->id.'&amp;action=correction">'.$langs->trans("CorrectStock").'</a>';
print '<a class="tabAction" href="fiche.php?action=edit&amp;id='.$product->id.'">'.$langs->trans("Edit").'</a>';
}
if ($product->type == 0 && $conf->stock->enabled)
{
print '<a class="tabAction" href="stock/product.php?id='.$product->id.'&amp;action=correction">'.$langs->trans("CorrectStock").'</a>';
}
}
@ -689,25 +724,25 @@ if ($_GET["id"] && $_GET["action"] == '' && $product->envente)
}
print '</td>';
print '<td width="50%" valign="top">';
print '<td width="50%" valign="top">';
$otherprop = $propal->liste_array(1, '<>'.$user->id);
if (sizeof($otherprop))
{
print '<form method="POST" action="fiche.php?id='.$product->id.'">';
print '<input type="hidden" name="action" value="addinpropal">';
print '<table class="border" width="100%">';
print "<tr>".'<td>Autres Propositions</td><td>';
$htmls->select_array("propalid", $otherprop);
print '</td><td>';
print '<input type="text" name="qty" size="2" value="1"></td><td>Rem.';
print '<input type="text" name="remise_percent" size="1" value="0">%';
print '</td><td align="right">';
print '<input type="submit" value="'.$langs->trans("Add").'">';
print '</td></tr>';
print '</table></form>';
}
print '</td>';
$otherprop = $propal->liste_array(1, '<>'.$user->id);
if (sizeof($otherprop))
{
print '<form method="POST" action="fiche.php?id='.$product->id.'">';
print '<input type="hidden" name="action" value="addinpropal">';
print '<table class="border" width="100%">';
print "<tr>".'<td>Autres Propositions</td><td>';
$htmls->select_array("propalid", $otherprop);
print '</td><td>';
print '<input type="text" name="qty" size="2" value="1"></td><td>Rem.';
print '<input type="text" name="remise_percent" size="1" value="0">%';
print '</td><td align="right">';
print '<input type="submit" value="'.$langs->trans("Add").'">';
print '</td></tr>';
print '</table></form>';
}
print '</td>';
print '</tr>';
}
@ -762,7 +797,7 @@ if ($_GET["id"] && $_GET["action"] == '' && $product->envente)
dolibarr_print_error($db);
}
print '</td><td width="50%" valign="top">';
// \todo Ajouter liste des factures autres
// \todo Ajouter liste des factures autres
print '</td></tr></table>';
}
}