Fix critical regression in cast
This commit is contained in:
parent
a66164d0f7
commit
e7672cd9e5
7 changed files with 20 additions and 6 deletions
|
|
@ -1263,7 +1263,7 @@ class Invoices extends DolibarrApi
|
|||
throw new RestException(403, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
|
||||
}
|
||||
|
||||
if ($this->invoice->paye) {
|
||||
if ($this->invoice->paye) { // TODO Replace by a test on status
|
||||
throw new RestException(500, 'Alreay paid');
|
||||
}
|
||||
|
||||
|
|
@ -1370,7 +1370,9 @@ class Invoices extends DolibarrApi
|
|||
}
|
||||
|
||||
$discount->amount_ht = $discount->amount_ttc = $total_payments + $total_creditnote_and_deposit - $this->invoice->total_ttc;
|
||||
$discount->total_ht = $discount->total_ttc = $total_payments + $total_creditnote_and_deposit - $this->invoice->total_ttc;
|
||||
$discount->amount_tva = 0;
|
||||
$discount->total_tva = 0;
|
||||
$discount->tva_tx = 0;
|
||||
|
||||
$result = $discount->create(DolibarrApiAccess::$user);
|
||||
|
|
@ -1383,9 +1385,15 @@ class Invoices extends DolibarrApi
|
|||
$discount->amount_ht = abs($amount_ht[$tva_tx]);
|
||||
$discount->amount_tva = abs($amount_tva[$tva_tx]);
|
||||
$discount->amount_ttc = abs($amount_ttc[$tva_tx]);
|
||||
$discount->total_ht = abs($amount_ht[$tva_tx]);
|
||||
$discount->total_tva = abs($amount_tva[$tva_tx]);
|
||||
$discount->total_ttc = abs($amount_ttc[$tva_tx]);
|
||||
$discount->multicurrency_amount_ht = abs($multicurrency_amount_ht[$tva_tx]);
|
||||
$discount->multicurrency_amount_tva = abs($multicurrency_amount_tva[$tva_tx]);
|
||||
$discount->multicurrency_amount_ttc = abs($multicurrency_amount_ttc[$tva_tx]);
|
||||
$discount->multicurrency_total_ht = abs($multicurrency_amount_ht[$tva_tx]);
|
||||
$discount->multicurrency_total_tva = abs($multicurrency_amount_tva[$tva_tx]);
|
||||
$discount->multicurrency_total_ttc = abs($multicurrency_amount_ttc[$tva_tx]);
|
||||
$discount->tva_tx = abs((float) $tva_tx);
|
||||
|
||||
$result = $discount->create(DolibarrApiAccess::$user);
|
||||
|
|
|
|||
|
|
@ -786,7 +786,7 @@ class FactureFournisseur extends CommonInvoice
|
|||
$result_insert = $this->addline(
|
||||
$_facrec->lines[$i]->desc ? $_facrec->lines[$i]->desc : $_facrec->lines[$i]->description,
|
||||
$_facrec->lines[$i]->pu_ht,
|
||||
(float) $tva_tx,
|
||||
$tva_tx,
|
||||
$localtax1_tx,
|
||||
$localtax2_tx,
|
||||
$_facrec->lines[$i]->qty,
|
||||
|
|
|
|||
|
|
@ -376,7 +376,7 @@ class ProductFournisseur extends Product
|
|||
* @param Societe $fourn Supplier
|
||||
* @param int $availability Product availability
|
||||
* @param string $ref_fourn Supplier ref
|
||||
* @param float $tva_tx New VAT Rate (For example 8.5. Should not be a string)
|
||||
* @param float $tva_tx New VAT Rate (For example 8.5. Should NOT be a string)
|
||||
* @param string|float $charges costs affering to product
|
||||
* @param float $remise_percent Discount regarding qty (percent)
|
||||
* @param float $remise Discount regarding qty (amount)
|
||||
|
|
|
|||
|
|
@ -341,9 +341,15 @@ class PaiementFourn extends Paiement
|
|||
$discount->amount_ht = abs($amount_ht[$tva_tx]);
|
||||
$discount->amount_tva = abs($amount_tva[$tva_tx]);
|
||||
$discount->amount_ttc = abs($amount_ttc[$tva_tx]);
|
||||
$discount->total_ht = abs($amount_ht[$tva_tx]);
|
||||
$discount->total_tva = abs($amount_tva[$tva_tx]);
|
||||
$discount->total_ttc = abs($amount_ttc[$tva_tx]);
|
||||
$discount->multicurrency_amount_ht = abs($multicurrency_amount_ht[$tva_tx]);
|
||||
$discount->multicurrency_amount_tva = abs($multicurrency_amount_tva[$tva_tx]);
|
||||
$discount->multicurrency_amount_ttc = abs($multicurrency_amount_ttc[$tva_tx]);
|
||||
$discount->multicurrency_total_ht = abs($multicurrency_amount_ht[$tva_tx]);
|
||||
$discount->multicurrency_total_tva = abs($multicurrency_amount_tva[$tva_tx]);
|
||||
$discount->multicurrency_total_ttc = abs($multicurrency_amount_ttc[$tva_tx]);
|
||||
$discount->tva_tx = abs((float) $tva_tx);
|
||||
|
||||
$result = $discount->create($user);
|
||||
|
|
|
|||
|
|
@ -668,7 +668,7 @@ if (empty($reshook)) {
|
|||
$price_base_type = 'HT';
|
||||
$pu_ht_devise = price2num($price_ht_devise, 'CU');
|
||||
|
||||
$result = $object->addline($desc, (float) $pu_ht, (float) $qty, (float) $tva_tx, $localtax1_tx, $localtax2_tx, 0, 0, $ref_supplier, $remise_percent, $price_base_type, (float) $pu_ttc, $type, 0, 0, $date_start, $date_end, $array_options, $fk_unit, (float) $pu_ht_devise);
|
||||
$result = $object->addline($desc, (float) $pu_ht, (float) $qty, $tva_tx, $localtax1_tx, $localtax2_tx, 0, 0, $ref_supplier, $remise_percent, $price_base_type, (float) $pu_ttc, $type, 0, 0, $date_start, $date_end, $array_options, $fk_unit, (float) $pu_ht_devise);
|
||||
}
|
||||
|
||||
//print "xx".$tva_tx; exit;
|
||||
|
|
|
|||
|
|
@ -697,7 +697,7 @@ if (empty($reshook)) {
|
|||
setEventMessages($mesg, null, 'errors');
|
||||
} else {
|
||||
// Insert line
|
||||
$result = $object->addline($idprod, (string) $ref_fournisseur, $label, $desc, $pu_ht, $pu_ttc, (float) $qty, $remise_percent, (float) $tva_tx, $localtax1_tx, $localtax2_tx, $price_base_type, $type, $date_start_fill, $date_end_fill, $info_bits, $special_code, -1, $fk_unit);
|
||||
$result = $object->addline($idprod, (string) $ref_fournisseur, $label, $desc, $pu_ht, $pu_ttc, (float) $qty, $remise_percent, $tva_tx, $localtax1_tx, $localtax2_tx, $price_base_type, $type, $date_start_fill, $date_end_fill, $info_bits, $special_code, -1, $fk_unit);
|
||||
|
||||
if ($result > 0) {
|
||||
$object->fetch($object->id); // Reload lines
|
||||
|
|
|
|||
|
|
@ -883,7 +883,7 @@ if (empty($reshook)) {
|
|||
$desc,
|
||||
(float) $pu_ht,
|
||||
(float) $qty,
|
||||
(float) $tva_tx,
|
||||
$tva_tx,
|
||||
$localtax1_tx,
|
||||
$localtax2_tx,
|
||||
$idprod,
|
||||
|
|
|
|||
Loading…
Reference in a new issue