Qual: id of an instance should not be provided into method of instance

This commit is contained in:
Laurent Destailleur 2013-06-14 00:21:17 +02:00
parent bd8f1f2d2f
commit 6750987dcb
2 changed files with 28 additions and 25 deletions

View File

@ -104,7 +104,7 @@ if ($action == 'convert')
if (! empty($price_base_type)) if (! empty($price_base_type))
{ {
print "$newprice, $price_base_type, $newvat, $newminprice, $newlevel, $newnpr<br>\n"; print "$newprice, $price_base_type, $newvat, $newminprice, $newlevel, $newnpr<br>\n";
$ret=$objectstatic->updatePrice($objectstatic->id, $newprice, $price_base_type, $user, $newvat, $newminprice, $newlevel, $newnpr); $ret=$objectstatic->updatePrice($newprice, $price_base_type, $user, $newvat, $newminprice, $newlevel, $newnpr);
} }
// Update multiprice // Update multiprice
foreach ($objectstatic->multiprices as $level => $multiprices) foreach ($objectstatic->multiprices as $level => $multiprices)
@ -128,7 +128,7 @@ if ($action == 'convert')
$newlevel=$level; $newlevel=$level;
print "$newprice, $price_base_type, $newvat, $newminprice, $newlevel, $newnpr<br>\n"; print "$newprice, $price_base_type, $newvat, $newminprice, $newlevel, $newnpr<br>\n";
$retm=$objectstatic->updatePrice($objectstatic->id, $newprice, $price_base_type, $user, $newvat, $newminprice, $newlevel, $newnpr); $retm=$objectstatic->updatePrice($newprice, $price_base_type, $user, $newvat, $newminprice, $newlevel, $newnpr);
if ($retm < 0) if ($retm < 0)
{ {
$error++; $error++;

View File

@ -88,7 +88,7 @@ if ($action == 'update_price' && ! $_POST["cancel"] && ($user->rights->produit->
$newpsq = empty($newpsq) ? 0 : $newpsq; $newpsq = empty($newpsq) ? 0 : $newpsq;
} }
if ($object->updatePrice($object->id, $newprice, $newpricebase, $user, $newvat, $newprice_min, $level, $newnpr, $newpsq) > 0) if ($object->updatePrice($newprice, $newpricebase, $user, $newvat, $newprice_min, $level, $newnpr, $newpsq) > 0)
{ {
$action = ''; $action = '';
$mesg = '<div class="ok">'.$langs->trans("RecordSaved").'</div>'; $mesg = '<div class="ok">'.$langs->trans("RecordSaved").'</div>';
@ -113,7 +113,7 @@ if ($action == 'activate_price_by_qty') { // Activating product price by quantit
$result = $object->fetch($id); $result = $object->fetch($id);
$level=GETPOST('level'); $level=GETPOST('level');
$object->updatePrice($object->id, 0, $object->price_base_type, $user, $object->tva_tx, 0, $level, $object->tva_npr, 1); $object->updatePrice(0, $object->price_base_type, $user, $object->tva_tx, 0, $level, $object->tva_npr, 1);
} }
if ($action == 'edit_price_by_qty') { // Edition d'un prix par quantité if ($action == 'edit_price_by_qty') { // Edition d'un prix par quantité
@ -424,14 +424,16 @@ else
print '</td></tr>'; print '</td></tr>';
// Price by quantity // Price by quantity
if($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY) { if($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY)
{
print '<tr><td>'.$langs->trans("PriceByQuantity"); print '<tr><td>'.$langs->trans("PriceByQuantity");
if($object->prices_by_qty[0] == 0) { if($object->prices_by_qty[0] == 0) {
print '&nbsp;<a href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=activate_price_by_qty&level=1">'.$langs->trans("Activate"); print '&nbsp;<a href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=activate_price_by_qty&level=1">'.$langs->trans("Activate");
} }
print '</td><td>'; print '</td><td>';
if($object->prices_by_qty[0] == 1) { if ($object->prices_by_qty[0] == 1)
{
print '<table width="50%" class="noborder">'; print '<table width="50%" class="noborder">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td>'.$langs->trans("PriceByQuantityRange").'</td>'; print '<td>'.$langs->trans("PriceByQuantityRange").'</td>';
@ -440,7 +442,8 @@ else
print '<td align="right">'.$langs->trans("Discount").'</td>'; print '<td align="right">'.$langs->trans("Discount").'</td>';
print '<td>&nbsp;</td>'; print '<td>&nbsp;</td>';
print '</tr>'; print '</tr>';
foreach ($object->prices_by_qty_list[0] as $ii=> $prices) { foreach ($object->prices_by_qty_list[0] as $ii=> $prices)
{
if($action == 'edit_price_by_qty' && $rowid == $prices['rowid'] && ($user->rights->produit->creer || $user->rights->service->creer)) { if($action == 'edit_price_by_qty' && $rowid == $prices['rowid'] && ($user->rights->produit->creer || $user->rights->service->creer)) {
print '<form action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'" method="POST">'; print '<form action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'" method="POST">';
print '<input type="hidden" name="action" value="update_price_by_qty">'; print '<input type="hidden" name="action" value="update_price_by_qty">';
@ -667,8 +670,8 @@ $sql.= " WHERE fk_product = ".$object->id;
$sql.= " AND p.fk_user_author = u.rowid"; $sql.= " AND p.fk_user_author = u.rowid";
if (! empty($socid) && ! empty($conf->global->PRODUIT_MULTIPRICES)) $sql.= " AND p.price_level = ".$soc->price_level; if (! empty($socid) && ! empty($conf->global->PRODUIT_MULTIPRICES)) $sql.= " AND p.price_level = ".$soc->price_level;
$sql.= " ORDER BY p.date_price DESC, p.price_level ASC"; $sql.= " ORDER BY p.date_price DESC, p.price_level ASC";
//$sql .= $db->plimit();
dol_syslog("sql=".$sql);
$result = $db->query($sql); $result = $db->query($sql);
if ($result) if ($result)
{ {
@ -680,7 +683,7 @@ if ($result)
// Il doit au moins y avoir la ligne de prix initial. // Il doit au moins y avoir la ligne de prix initial.
// On l'ajoute donc pour remettre a niveau (pb vieilles versions) // On l'ajoute donc pour remettre a niveau (pb vieilles versions)
$object->updatePrice($object->id, $object->price, $object->price_base_type, $user, $newprice_min); $object->updatePrice($object->price, $object->price_base_type, $user, $newprice_min);
$result = $db->query($sql); $result = $db->query($sql);
$num = $db->num_rows($result); $num = $db->num_rows($result);