Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop

This commit is contained in:
Laurent Destailleur 2012-07-25 17:39:44 +02:00
commit ef86d8e2dc

View File

@ -37,6 +37,7 @@ $langs->load("bills");
$id = GETPOST('id', 'int'); $id = GETPOST('id', 'int');
$ref = GETPOST('ref', 'alpha'); $ref = GETPOST('ref', 'alpha');
$rowid=GETPOST('rowid','int');
$action=GETPOST('action', 'alpha'); $action=GETPOST('action', 'alpha');
$socid=GETPOST('socid', 'int'); $socid=GETPOST('socid', 'int');
$error=0; $mesg = ''; $error=0; $mesg = '';
@ -77,16 +78,16 @@ if ($action == 'remove_pf')
$product = new ProductFournisseur($db); $product = new ProductFournisseur($db);
if ($product->fetch($id) > 0) if ($product->fetch($id) > 0)
{ {
if ($_GET["rowid"]) if ($rowid)
{ {
$result=$product->remove_product_fournisseur_price($_GET["rowid"]); $result=$product->remove_product_fournisseur_price($rowid);
$action = ''; $action = '';
$mesg = '<div class="ok">'.$langs->trans("PriceRemoved").'.</div>'; $mesg = '<div class="ok">'.$langs->trans("PriceRemoved").'.</div>';
} }
} }
} }
if ($action == 'updateprice' && $_POST["cancel"] <> $langs->trans("Cancel")) if ($action == 'updateprice' && GETPOST('cancel') <> $langs->trans("Cancel"))
{ {
$id_fourn=GETPOST("id_fourn"); $id_fourn=GETPOST("id_fourn");
if (empty($id_fourn)) $id_fourn=GETPOST("search_id_fourn"); if (empty($id_fourn)) $id_fourn=GETPOST("search_id_fourn");
@ -255,9 +256,9 @@ if ($id || $ref)
{ {
$langs->load("suppliers"); $langs->load("suppliers");
if ($_GET["rowid"]) if ($rowid)
{ {
$product->fetch_product_fournisseur_price($_GET["rowid"]); $product->fetch_product_fournisseur_price($rowid);
print_fiche_titre($langs->trans("ChangeSupplierPrice")); print_fiche_titre($langs->trans("ChangeSupplierPrice"));
} }
else else
@ -272,14 +273,14 @@ if ($id || $ref)
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
print '<tr><td class="fieldrequired">'.$langs->trans("Supplier").'</td><td colspan="5">'; print '<tr><td class="fieldrequired">'.$langs->trans("Supplier").'</td><td colspan="5">';
if ($_GET["rowid"]) if ($rowid)
{ {
$supplier=new Fournisseur($db); $supplier=new Fournisseur($db);
$supplier->fetch($socid); $supplier->fetch($socid);
print $supplier->getNomUrl(1); print $supplier->getNomUrl(1);
print '<input type="hidden" name="id_fourn" value="'.$socid.'">'; print '<input type="hidden" name="id_fourn" value="'.$socid.'">';
print '<input type="hidden" name="ref_fourn" value="'.$product->fourn_ref.'">'; print '<input type="hidden" name="ref_fourn" value="'.$product->fourn_ref.'">';
print '<input type="hidden" name="ref_fourn_price_id" value="'.$_GET["rowid"].'">'; print '<input type="hidden" name="ref_fourn_price_id" value="'.$rowid.'">';
} }
else else
{ {
@ -297,7 +298,7 @@ if ($id || $ref)
// Ref supplier // Ref supplier
print '<tr><td class="fieldrequired">'.$langs->trans("SupplierRef").'</td><td colspan="5">'; print '<tr><td class="fieldrequired">'.$langs->trans("SupplierRef").'</td><td colspan="5">';
if ($_GET["rowid"]) if ($rowid)
{ {
print $product->fourn_ref; print $product->fourn_ref;
} }
@ -328,8 +329,8 @@ if ($id || $ref)
print '<tr>'; print '<tr>';
print '<td class="fieldrequired">'.$langs->trans("QtyMin").'</td>'; print '<td class="fieldrequired">'.$langs->trans("QtyMin").'</td>';
print '<td>'; print '<td>';
$quantity = $_REQUEST["qty"] ? $_REQUEST["qty"] : "1"; $quantity = GETPOST('qty') ? GETPOST('qty') : "1";
if ($_GET["rowid"]) if ($rowid)
{ {
print '<input type="hidden" name="qty" value="'.$product->fourn_qty.'">'; print '<input type="hidden" name="qty" value="'.$product->fourn_qty.'">';
print $product->fourn_qty; print $product->fourn_qty;
@ -342,18 +343,18 @@ if ($id || $ref)
// Price qty min // Price qty min
print '<td class="fieldrequired">'.$langs->trans("PriceQtyMin").'</td>'; print '<td class="fieldrequired">'.$langs->trans("PriceQtyMin").'</td>';
print '<td><input class="flat" name="price" size="8" value="'.($_POST["price"]?$_POST["price"]:(isset($product->fourn_price)?price($product->fourn_price):'')).'">'; print '<td><input class="flat" name="price" size="8" value="'.(GETPOST('price')?price(GETPOST('price')):(isset($product->fourn_price)?price($product->fourn_price):'')).'">';
print '&nbsp;'; print '&nbsp;';
print $form->select_PriceBaseType(($_POST["price_base_type"]?$_POST["price_base_type"]:$product->price_base_type), "price_base_type"); print $form->select_PriceBaseType((GETPOST('price_base_type')?GETPOST('price_base_type'):$product->price_base_type), "price_base_type");
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
// Charges ???? // Charges ????
if (! empty($conf->global->PRODUCT_LOAD)) if (! empty($conf->margin->enabled))
{ {
print '<tr>'; print '<tr>';
print '<td>'.$langs->trans("Charges").'</td>'; print '<td>'.$langs->trans("Charges").'</td>';
print '<td colspan="3"><input class="flat" name="charges" size="8" value="'.($_POST["charges"]?$_POST["charges"]:price($product->fourn_charges)).'">'; print '<td colspan="3"><input class="flat" name="charges" size="8" value="'.(GETPOST('charges')?price(GETPOST('charges')):(isset($product->fourn_charges)?price($product->fourn_charges):'')).'">';
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
} }
@ -404,10 +405,10 @@ if ($id || $ref)
print '<td class="liste_titre" align="right">'.$langs->trans("VATRate").'</td>'; print '<td class="liste_titre" align="right">'.$langs->trans("VATRate").'</td>';
print '<td class="liste_titre" align="right">'.$langs->trans("PriceQtyMinHT").'</td>'; print '<td class="liste_titre" align="right">'.$langs->trans("PriceQtyMinHT").'</td>';
// Charges ???? // Charges ????
if (! empty($conf->global->PRODUCT_LOAD)) print '<td align="right">'.$langs->trans("Charges").'</td>'; if (! empty($conf->margin->enabled)) print '<td align="right">'.$langs->trans("Charges").'</td>';
print_liste_field_titre($langs->trans("UnitPriceHT"),$_SERVER["PHP_SELF"],"pfp.unitprice","",$param,'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("UnitPriceHT"),$_SERVER["PHP_SELF"],"pfp.unitprice","",$param,'align="right"',$sortfield,$sortorder);
// Charges ???? // Charges ????
if (! empty($conf->global->PRODUCT_LOAD)) print '<td align="right">'.$langs->trans("UnitCharges").'</td>'; if (! empty($conf->margin->enabled)) print '<td align="right">'.$langs->trans("UnitCharges").'</td>';
print '<td class="liste_titre"></td>'; print '<td class="liste_titre"></td>';
print "</tr>\n"; print "</tr>\n";
@ -453,7 +454,7 @@ if ($id || $ref)
print '</td>'; print '</td>';
// Charges ???? // Charges ????
if (! empty($conf->global->PRODUCT_LOAD)) if (! empty($conf->margin->enabled))
{ {
print '<td align="right">'; print '<td align="right">';
print $productfourn->fourn_charges?price($productfourn->fourn_charges):""; print $productfourn->fourn_charges?price($productfourn->fourn_charges):"";
@ -467,7 +468,7 @@ if ($id || $ref)
print '</td>'; print '</td>';
// Unit Charges ??? // Unit Charges ???
if (! empty($conf->global->PRODUCT_LOAD)) if (! empty($conf->margin->enabled))
{ {
print '<td align="right">'; print '<td align="right">';
print $productfourn->fourn_unitcharges?price($productfourn->fourn_unitcharges) : ($productfourn->fourn_qty?price($productfourn->fourn_charges/$productfourn->fourn_qty):"&nbsp;"); print $productfourn->fourn_unitcharges?price($productfourn->fourn_unitcharges) : ($productfourn->fourn_qty?price($productfourn->fourn_charges/$productfourn->fourn_qty):"&nbsp;");