Prepare code to uniformize method addline.

This commit is contained in:
Laurent Destailleur 2013-07-10 16:07:57 +02:00
parent 8d1b86db49
commit 1ee67bd5b9
3 changed files with 14 additions and 8 deletions

View File

@ -112,7 +112,11 @@ while ($i < GEN_NUMBER_FACTURE && $result >= 0)
$prodid = rand(1, $num_prods); $prodid = rand(1, $num_prods);
$product=new Product($db); $product=new Product($db);
$result=$product->fetch($prodids[$prodid]); $result=$product->fetch($prodids[$prodid]);
$result=$facture->addline($facture->id,$product->description,$product->price, rand(1,5), 0, 0, 0, $prodids[$prodid], 0, '', '', 0, 0, '', $product->price_base_type, $product->price_ttc, $product->type); $result=$facture->addline($facture->id, $product->description, $product->price, rand(1,5), 0, 0, 0, $prodids[$prodid], 0, '', '', 0, 0, '', $product->price_base_type, $product->price_ttc, $product->type);
if ($result < 0)
{
dol_print_error($db,$propal->error);
}
$xnbp++; $xnbp++;
} }

View File

@ -143,7 +143,9 @@ while ($i < GEN_NUMBER_PROPAL && $result >= 0)
while ($xnbp < $nbp) while ($xnbp < $nbp)
{ {
$prodid = rand(1, $num_prods); $prodid = rand(1, $num_prods);
$result=$propal->addline($propal->id, 'Description '.$xnbp, '100', rand(1,5), '19.6', 0, 0, $prodids[$prodid], 0); $product=new Product($db);
$result=$product->fetch($prodids[$prodid]);
$result=$propal->addline($propal->id, $product->description, $product->price, rand(1,5), 0, 0, 0, $prodids[$prodid], 0);
if ($result < 0) if ($result < 0)
{ {
dol_print_error($db,$propal->error); dol_print_error($db,$propal->error);

View File

@ -758,7 +758,7 @@ else if ($action == 'add' && $user->rights->facture->creer)
$product->fetch($_POST['idprod'.$i]); $product->fetch($_POST['idprod'.$i]);
$startday=dol_mktime(12, 0, 0, $_POST['date_start'.$i.'month'], $_POST['date_start'.$i.'day'], $_POST['date_start'.$i.'year']); $startday=dol_mktime(12, 0, 0, $_POST['date_start'.$i.'month'], $_POST['date_start'.$i.'day'], $_POST['date_start'.$i.'year']);
$endday=dol_mktime(12, 0, 0, $_POST['date_end'.$i.'month'], $_POST['date_end'.$i.'day'], $_POST['date_end'.$i.'year']); $endday=dol_mktime(12, 0, 0, $_POST['date_end'.$i.'month'], $_POST['date_end'.$i.'day'], $_POST['date_end'.$i.'year']);
$result=$object->addline($id,$product->description,$product->price, $_POST['qty'.$i], $product->tva_tx, $product->localtax1_tx, $product->localtax2_tx, $_POST['idprod'.$i], $_POST['remise_percent'.$i], $startday, $endday, 0, 0, '', $product->price_base_type, $product->price_ttc, $product->type); $result=$object->addline($object->id,$product->description,$product->price, $_POST['qty'.$i], $product->tva_tx, $product->localtax1_tx, $product->localtax2_tx, $_POST['idprod'.$i], $_POST['remise_percent'.$i], $startday, $endday, 0, 0, '', $product->price_base_type, $product->price_ttc, $product->type);
} }
} }
} }
@ -913,7 +913,7 @@ else if ($action == 'add' && $user->rights->facture->creer)
} }
$result = $object->addline( $result = $object->addline(
$id, $object->id,
$langs->trans('Deposit'), $langs->trans('Deposit'),
$amountdeposit, //subprice $amountdeposit, //subprice
1, //quantity 1, //quantity
@ -1016,7 +1016,7 @@ else if ($action == 'add' && $user->rights->facture->creer)
} }
$result = $object->addline( $result = $object->addline(
$id, $object->id,
$desc, $desc,
$lines[$i]->subprice, $lines[$i]->subprice,
$lines[$i]->qty, $lines[$i]->qty,
@ -1093,7 +1093,7 @@ else if ($action == 'add' && $user->rights->facture->creer)
$product->fetch($_POST['idprod'.$i]); $product->fetch($_POST['idprod'.$i]);
$startday=dol_mktime(12, 0, 0, $_POST['date_start'.$i.'month'], $_POST['date_start'.$i.'day'], $_POST['date_start'.$i.'year']); $startday=dol_mktime(12, 0, 0, $_POST['date_start'.$i.'month'], $_POST['date_start'.$i.'day'], $_POST['date_start'.$i.'year']);
$endday=dol_mktime(12, 0, 0, $_POST['date_end'.$i.'month'], $_POST['date_end'.$i.'day'], $_POST['date_end'.$i.'year']); $endday=dol_mktime(12, 0, 0, $_POST['date_end'.$i.'month'], $_POST['date_end'.$i.'day'], $_POST['date_end'.$i.'year']);
$result=$object->addline($id,$product->description,$product->price, $_POST['qty'.$i], $product->tva_tx, $product->localtax1_tx, $product->localtax2_tx, $_POST['idprod'.$i], $_POST['remise_percent'.$i], $startday, $endday, 0, 0, '', $product->price_base_type, $product->price_ttc, $product->type); $result=$object->addline($object->id,$product->description,$product->price, $_POST['qty'.$i], $product->tva_tx, $product->localtax1_tx, $product->localtax2_tx, $_POST['idprod'.$i], $_POST['remise_percent'.$i], $startday, $endday, 0, 0, '', $product->price_base_type, $product->price_ttc, $product->type);
} }
} }
} }
@ -1311,7 +1311,7 @@ else if (($action == 'addline' || $action == 'addline_predef') && $user->rights-
{ {
// Insert line // Insert line
$result = $object->addline( $result = $object->addline(
$id, $object->id,
$desc, $desc,
$pu_ht, $pu_ht,
GETPOST('qty'), GETPOST('qty'),