FIX Can use decimal value in virtual products
This commit is contained in:
parent
f1c391363d
commit
80862f7173
@ -70,13 +70,15 @@ if ($cancel) $action ='';
|
|||||||
if ($action == 'add_prod' && ($user->rights->produit->creer || $user->rights->service->creer))
|
if ($action == 'add_prod' && ($user->rights->produit->creer || $user->rights->service->creer))
|
||||||
{
|
{
|
||||||
$error=0;
|
$error=0;
|
||||||
for ($i=0; $i<$_POST["max_prod"]; $i++)
|
var_dump(GETPOST("max_prod", 'int'));
|
||||||
|
for ($i=0; $i < GETPOST("max_prod", 'int'); $i++)
|
||||||
{
|
{
|
||||||
if ($_POST["prod_qty_".$i] > 0)
|
$qty = price2num(GETPOST("prod_qty_".$i, 'alpha'), 'MS');
|
||||||
|
if ($qty > 0)
|
||||||
{
|
{
|
||||||
if ($object->add_sousproduit($id, $_POST["prod_id_".$i], $_POST["prod_qty_".$i], $_POST["prod_incdec_".$i]) > 0)
|
if ($object->add_sousproduit($id, GETPOST("prod_id_".$i, 'int'), $qty, GETPOST("prod_incdec_".$i, 'int')) > 0)
|
||||||
{
|
{
|
||||||
//var_dump($id.' - '.$_POST["prod_id_".$i].' - '.$_POST["prod_qty_".$i]);exit;
|
//var_dump($i.' '.GETPOST("prod_id_".$i, 'int'), $qty, GETPOST("prod_incdec_".$i, 'int'));
|
||||||
$action = 'edit';
|
$action = 'edit';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -94,7 +96,7 @@ if ($action == 'add_prod' && ($user->rights->produit->creer || $user->rights->se
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ($object->del_sousproduit($id, $_POST["prod_id_".$i]) > 0)
|
if ($object->del_sousproduit($id, GETPOST("prod_id_".$i, 'int')) > 0)
|
||||||
{
|
{
|
||||||
$action = 'edit';
|
$action = 'edit';
|
||||||
}
|
}
|
||||||
@ -106,6 +108,7 @@ if ($action == 'add_prod' && ($user->rights->produit->creer || $user->rights->se
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
header("Location: ".$_SERVER["PHP_SELF"].'?id='.$object->id);
|
header("Location: ".$_SERVER["PHP_SELF"].'?id='.$object->id);
|
||||||
@ -540,7 +543,9 @@ if ($id > 0 || ! empty($ref))
|
|||||||
|
|
||||||
if($num == 0) print '<tr><td colspan="4">'.$langs->trans("NoMatchFound").'</td></tr>';
|
if($num == 0) print '<tr><td colspan="4">'.$langs->trans("NoMatchFound").'</td></tr>';
|
||||||
|
|
||||||
while ($i < $num)
|
$MAX = 100;
|
||||||
|
|
||||||
|
while ($i < min($num, $MAX))
|
||||||
{
|
{
|
||||||
$objp = $db->fetch_object($resql);
|
$objp = $db->fetch_object($resql);
|
||||||
if($objp->rowid != $id)
|
if($objp->rowid != $id)
|
||||||
@ -572,7 +577,8 @@ if ($id > 0 || ! empty($ref))
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
print "\n".'<tr class="oddeven">';
|
print "\n";
|
||||||
|
print '<tr class="oddeven">';
|
||||||
|
|
||||||
$productstatic->id=$objp->rowid;
|
$productstatic->id=$objp->rowid;
|
||||||
$productstatic->ref=$objp->ref;
|
$productstatic->ref=$objp->ref;
|
||||||
@ -620,6 +626,14 @@ if ($id > 0 || ! empty($ref))
|
|||||||
}
|
}
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
|
if ($num > $MAX) {
|
||||||
|
print '<tr class="oddeven">';
|
||||||
|
print '<td><span class="opacitymedium">'.$langs->trans("More").'...</span></td>';
|
||||||
|
print '<td></td>';
|
||||||
|
print '<td></td>';
|
||||||
|
print '<td></td>';
|
||||||
|
print '</tr>';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user