FIX Update of sale price (log not correctly updated)
This commit is contained in:
commit
f222328ff8
@ -418,7 +418,7 @@ TotalLT2IN=Total SGST
|
|||||||
HT=HT
|
HT=HT
|
||||||
TTC=TTC
|
TTC=TTC
|
||||||
INCVATONLY=TVA incluse
|
INCVATONLY=TVA incluse
|
||||||
INCT=TTC
|
INCT=TVA+Taxes locales incluses
|
||||||
VAT=TVA
|
VAT=TVA
|
||||||
VATIN=IGST
|
VATIN=IGST
|
||||||
VATs=TVA
|
VATs=TVA
|
||||||
|
|||||||
@ -2044,7 +2044,7 @@ class Product extends CommonObject
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Modify customer price of a product/Service
|
* Modify customer price of a product/Service for a given level
|
||||||
*
|
*
|
||||||
* @param double $newprice New price
|
* @param double $newprice New price
|
||||||
* @param string $newpricebase HT or TTC
|
* @param string $newpricebase HT or TTC
|
||||||
|
|||||||
@ -192,15 +192,50 @@ if (empty($reshook)) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!$error) {
|
if (!$error) {
|
||||||
// Force the update of the price of the product to 0 if error
|
if (!empty($conf->global->PRODUIT_MULTIPRICES) || !empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) {
|
||||||
|
for ($i = 1; $i <= $conf->global->PRODUIT_MULTIPRICES_LIMIT; $i++) {
|
||||||
|
// Force the update of the price of the product using the new VAT
|
||||||
|
if ($object->multiprices_base_type[$i] == 'HT') {
|
||||||
|
$oldprice = $object->multiprices[$i];
|
||||||
|
$oldminprice = $object->multiprices_min[$i];
|
||||||
|
} else {
|
||||||
|
$oldprice = $object->multiprices_ttc[$i];
|
||||||
|
$oldminprice = $object->multiprices_min_ttc[$i];
|
||||||
|
}
|
||||||
|
$oldpricebasetype = $object->multiprices_base_type[$i];
|
||||||
|
$oldnpr = $object->multiprices_recuperableonly[$i];
|
||||||
|
|
||||||
//$localtaxarray=array('0'=>$localtax1_type,'1'=>$localtax1,'2'=>$localtax2_type,'3'=>$localtax2);
|
//$localtaxarray=array('0'=>$localtax1_type,'1'=>$localtax1,'2'=>$localtax2_type,'3'=>$localtax2);
|
||||||
$localtaxarray = array(); // We do not store localtaxes into product, we will use instead the "vat code" to retrieve them.
|
$localtaxarray = array(); // We do not store localtaxes into product, we will use instead the "vat code" to retrieve them.
|
||||||
$ret = $object->updatePrice(0, $object->price_base_type, $user, $tva_tx, '', 0, $npr, 0, 0, $localtaxarray, $vatratecode);
|
$level = $i;
|
||||||
|
$ret = $object->updatePrice($oldprice, $oldpricebasetype, $user, $tva_tx, $oldminprice, $level, $oldnpr, 0, 0, $localtaxarray, $vatratecode);
|
||||||
|
|
||||||
if ($ret < 0) {
|
if ($ret < 0) {
|
||||||
$error++;
|
$error++;
|
||||||
setEventMessages($object->error, $object->errors, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Force the update of the price of the product using the new VAT
|
||||||
|
if ($object->price_base_type == 'HT') {
|
||||||
|
$oldprice = $object->price;
|
||||||
|
$oldminprice = $object->price_min;
|
||||||
|
} else {
|
||||||
|
$oldprice = $object->price_ttc;
|
||||||
|
$oldminprice = $object->price_min_ttc;
|
||||||
|
}
|
||||||
|
$oldpricebasetype = $object->price_base_type;
|
||||||
|
$oldnpr = $object->tva_npr;
|
||||||
|
|
||||||
|
//$localtaxarray=array('0'=>$localtax1_type,'1'=>$localtax1,'2'=>$localtax2_type,'3'=>$localtax2);
|
||||||
|
$localtaxarray = array(); // We do not store localtaxes into product, we will use instead the "vat code" to retrieve them.
|
||||||
|
$level = 0;
|
||||||
|
$ret = $object->updatePrice($oldprice, $oldpricebasetype, $user, $tva_tx, $oldminprice, $level, $oldnpr, 0, 0, $localtaxarray, $vatratecode);
|
||||||
|
|
||||||
|
if ($ret < 0) {
|
||||||
|
$error++;
|
||||||
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1731,7 +1766,7 @@ if ((empty($conf->global->PRODUIT_CUSTOMER_PRICES) || $action == 'showlog_defaul
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Line for default price
|
// Line for default price
|
||||||
if ($object->price_base_type == 'HT') {
|
if ($objp->price_base_type == 'HT') {
|
||||||
$pu = $objp->price;
|
$pu = $objp->price;
|
||||||
} else {
|
} else {
|
||||||
$pu = $objp->price_ttc;
|
$pu = $objp->price_ttc;
|
||||||
@ -2079,11 +2114,9 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
|
|||||||
print '<td class="center">'.$langs->trans("PriceBase").'</td>';
|
print '<td class="center">'.$langs->trans("PriceBase").'</td>';
|
||||||
print '<td class="right">'.$langs->trans("DefaultTaxRate").'</td>';
|
print '<td class="right">'.$langs->trans("DefaultTaxRate").'</td>';
|
||||||
print '<td class="right">'.$langs->trans("HT").'</td>';
|
print '<td class="right">'.$langs->trans("HT").'</td>';
|
||||||
|
print '<td class="right">'.$langs->trans("TTC").'</td>';
|
||||||
if ($mysoc->localtax1_assuj == "1" || $mysoc->localtax2_assuj == "1") {
|
if ($mysoc->localtax1_assuj == "1" || $mysoc->localtax2_assuj == "1") {
|
||||||
//print '<td class="right">' . $langs->trans("INCVATONLY") . '</td>';
|
|
||||||
print '<td class="right">'.$langs->trans("INCT").'</td>';
|
print '<td class="right">'.$langs->trans("INCT").'</td>';
|
||||||
} else {
|
|
||||||
print '<td class="right">'.$langs->trans("TTC").'</td>';
|
|
||||||
}
|
}
|
||||||
print '<td class="right">'.$langs->trans("MinPrice").' '.$langs->trans("HT").'</td>';
|
print '<td class="right">'.$langs->trans("MinPrice").' '.$langs->trans("HT").'</td>';
|
||||||
print '<td class="right">'.$langs->trans("MinPrice").' '.$langs->trans("TTC").'</td>';
|
print '<td class="right">'.$langs->trans("MinPrice").' '.$langs->trans("TTC").'</td>';
|
||||||
@ -2144,11 +2177,9 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
|
|||||||
print "</td>";
|
print "</td>";
|
||||||
print '<td class="right">'.price($line->price)."</td>";
|
print '<td class="right">'.price($line->price)."</td>";
|
||||||
|
|
||||||
|
print '<td class="right">'.price($line->price_ttc)."</td>";
|
||||||
if ($mysoc->localtax1_assuj == "1" || $mysoc->localtax2_assuj == "1") {
|
if ($mysoc->localtax1_assuj == "1" || $mysoc->localtax2_assuj == "1") {
|
||||||
//print '<td class="right">' . price($line->price_ttc) . "</td>";
|
|
||||||
print '<td class="right">'.price($resultarray[2]).'</td>';
|
print '<td class="right">'.price($resultarray[2]).'</td>';
|
||||||
} else {
|
|
||||||
print '<td class="right">'.price($line->price_ttc)."</td>";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<td class="right">'.price($line->price_min).'</td>';
|
print '<td class="right">'.price($line->price_min).'</td>';
|
||||||
@ -2350,11 +2381,10 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) {
|
|||||||
print "</td>";
|
print "</td>";
|
||||||
print '<td class="right">'.price($line->price)."</td>";
|
print '<td class="right">'.price($line->price)."</td>";
|
||||||
|
|
||||||
|
print '<td class="right">'.price($line->price_ttc)."</td>";
|
||||||
if ($mysoc->localtax1_assuj == "1" || $mysoc->localtax2_assuj == "1") {
|
if ($mysoc->localtax1_assuj == "1" || $mysoc->localtax2_assuj == "1") {
|
||||||
//print '<td class="right">' . price($line->price_ttc) . "</td>";
|
//print '<td class="right">' . price($line->price_ttc) . "</td>";
|
||||||
print '<td class="right">'.price($resultarray[2]).'</td>';
|
print '<td class="right">'.price($resultarray[2]).'</td>';
|
||||||
} else {
|
|
||||||
print '<td class="right">'.price($line->price_ttc)."</td>";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<td class="right">'.price($line->price_min).'</td>';
|
print '<td class="right">'.price($line->price_min).'</td>';
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user