This commit is contained in:
Rodolphe Quiedeville 2005-04-15 16:07:58 +00:00
parent 8e99a0dde9
commit 2cef63805a

View File

@ -199,10 +199,8 @@ if ($_POST["cancel"] == $langs->trans("Cancel"))
} }
// Le produit n'est pas encore chargé a ce stade // Le produit n'est pas encore chargé a ce stade
//llxHeader("","",$langs->trans("CardProduct".$product->type));
llxHeader("","",$langs->trans("CardProduct0")); llxHeader("","",$langs->trans("CardProduct0"));
/* /*
* Création du produit * Création du produit
* *
@ -291,7 +289,7 @@ else
$result = $product->fetch($_GET["id"]); $result = $product->fetch($_GET["id"]);
} }
if ( $result ) if ( $product->id > 0 )
{ {
if ($_GET["action"] <> 'edit' && $_GET["action"] <> 're-edit') if ($_GET["action"] <> 'edit' && $_GET["action"] <> 're-edit')
@ -410,7 +408,8 @@ else
{ {
$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 { else
{
$dur=array("d"=>$langs->trans("Day"),"w"=>$langs->trans("Week"),"m"=>$langs->trans("Month"),"y"=>$langs->trans("Year")); $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;";
@ -419,7 +418,6 @@ else
} }
print "</table><br>\n"; print "</table><br>\n";
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
print '<tr class="liste_titre"><td>'; print '<tr class="liste_titre"><td>';
print $langs->trans("Suppliers").'</td>'; print $langs->trans("Suppliers").'</td>';
@ -430,8 +428,9 @@ else
$sql = "SELECT s.nom, s.idp, pf.ref_fourn, pfp.price, pfp.quantity"; $sql = "SELECT s.nom, s.idp, pf.ref_fourn, pfp.price, pfp.quantity";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."product_fournisseur as pf"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."product_fournisseur as pf";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp ON s.idp = pfp.fk_soc AND pfp.fk_product =".$product->id; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp ON s.idp = pfp.fk_soc";
$sql .=" WHERE pf.fk_soc = s.idp AND pf.fk_product = ".$product->id; $sql .= " AND pfp.fk_product =".$product->id;
$sql .= " WHERE pf.fk_soc = s.idp AND pf.fk_product = ".$product->id;
$sql .= " ORDER BY pfp.price ASC, lower(s.nom)"; $sql .= " ORDER BY pfp.price ASC, lower(s.nom)";
if ( $db->query($sql) ) if ( $db->query($sql) )
@ -460,9 +459,8 @@ else
$db->free(); $db->free();
} }
print '</table>'; print '</table>';
print "</div>\n"; print "</div>\n";
}
/* /*
* Ajouter un fournisseur * Ajouter un fournisseur
@ -479,24 +477,26 @@ else
print '<table class="border" width="100%"><tr>'; print '<table class="border" width="100%"><tr>';
print '<td>'.$langs->trans("Suppliers").'</td><td><select name="id_fourn">'; 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 = "SELECT s.idp, s.nom, s.ville";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s WHERE s.fournisseur=1";
$sql .= " ORDER BY lower(s.nom)"; $sql .= " ORDER BY lower(s.nom)";
if ($db->query($sql)) $resql = $db->query($sql);
if ($resql)
{ {
$num = $db->num_rows(); $num = $db->num_rows($resql);
$i = 0; $i = 0;
while ($i < $num) while ($i < $num)
{ {
$obj = $db->fetch_object($i); $obj = $db->fetch_object($resql);
print '<option value="'.$obj->idp.'">'.$obj->nom . ($obj->ville?" ($obj->ville)":""); print '<option value="'.$obj->idp.'">'.$obj->nom . ($obj->ville?" ($obj->ville)":"");
$i++; $i++;
} }
$db->free($resql);
} }
print '</select></td><td>'.$langs->trans("Ref").'</td>'; print '</select></td></tr><tr><td>'.$langs->trans("SupplierRef").'</td>';
print '<td><input name="ref_fourn" size="25" value=""></td></tr>'; print '<td><input name="ref_fourn" size="25" value=""></td></tr>';
print '<tr><td colspan="4" align="center">'; print '<tr><td colspan="2" align="center">';
print '<input type="submit" value="'.$langs->trans("Save").'">&nbsp;'; 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>';
@ -561,24 +561,18 @@ else
print '</table>'; print '</table>';
print '</form>'; print '</form>';
} }
}
else
/* ************************************************************************** */
/* */
/* Barre d'action */
/* */
/* ************************************************************************** */
print "\n<div class=\"tabsAction\">\n";
if ($_GET["action"] == '')
{ {
print $langs->trans("ErrorUnknown");
}
}
/* ************************************************************************** */
/* */
/* Barre d'action */
/* */
/* ************************************************************************** */
print "\n<div class=\"tabsAction\">\n";
if ($_GET["action"] == '')
{
print '<a class="butAction" href="fiche.php?id='.$product->id.'&amp;action=ajout_fourn">'.$langs->trans("AddSupplier").'</a>'; print '<a class="butAction" href="fiche.php?id='.$product->id.'&amp;action=ajout_fourn">'.$langs->trans("AddSupplier").'</a>';
@ -597,9 +591,21 @@ if ($_GET["action"] == '')
{ {
print '<a class="tabAction" href="'.DOL_URL_ROOT.'/product/stock/product.php?id='.$product->id.'&amp;action=correction">'.$langs->trans("CorrectStock").'</a>'; print '<a class="tabAction" href="'.DOL_URL_ROOT.'/product/stock/product.php?id='.$product->id.'&amp;action=correction">'.$langs->trans("CorrectStock").'</a>';
} }
} }
print "\n</div>\n"; print "\n</div>\n";
}
else
{
print $langs->trans("BadId");
}
}
else
{
print $langs->trans("BadId");
}
}
$db->close(); $db->close();