mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
fix: allow list mass action update price when price mode is multiprice price
This commit is contained in:
parent
36b48a81ec
commit
02dea8d103
|
|
@ -1281,18 +1281,38 @@ if (!$error && ($action == 'updateprice' && $confirm == 'yes') && $permissiontoa
|
|||
$result = $object->fetch($toselectid);
|
||||
//var_dump($contcats);exit;
|
||||
if ($result > 0) {
|
||||
if ($obj->price_base_type == 'TTC') {
|
||||
$newprice = $object->price_ttc * (100 + $pricepercentage) / 100;
|
||||
$minprice = $object->price_min_ttc;
|
||||
if (getDolGlobalString('PRODUIT_MULTIPRICES')) {
|
||||
for ($level = 1; $level <= getDolGlobalInt('PRODUIT_MULTIPRICES_LIMIT'); $level++) {
|
||||
// Force the update of the price of the product using the new VAT
|
||||
if ($object->price_base_type == 'TTC') {
|
||||
$newprice = $object->multiprices_ttc[$level] * (100 + $pricepercentage) / 100;
|
||||
$minprice = $object->multiprices_min_ttc[$level];
|
||||
} else {
|
||||
$newprice = $object->multiprices[$level] * (100 + $pricepercentage) / 100;
|
||||
$minprice = $object->multiprices_min[$level];
|
||||
}
|
||||
$ret = $object->updatePrice($newprice, $object->price_base_type, $user, $object->tva_tx, $minprice, $level, $object->tva_npr, 0, 0, array(), $object->default_vat_code);
|
||||
|
||||
if ($res > 0) {
|
||||
$nbok++;
|
||||
} else {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$newprice = $object->price * (100 + $pricepercentage) / 100;
|
||||
$minprice = $object->price_min;
|
||||
}
|
||||
$res = $object->updatePrice($newprice, $obj->price_base_type, $user, $object->tva_tx, $minprice, 0, $object->tva_npr, 0, 0, array(), $object->default_vat_code);
|
||||
if ($res > 0) {
|
||||
$nbok++;
|
||||
} else {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
if ($object->price_base_type == 'TTC') {
|
||||
$newprice = $object->price_ttc * (100 + $pricepercentage) / 100;
|
||||
$minprice = $object->price_min_ttc;
|
||||
} else {
|
||||
$newprice = $object->price * (100 + $pricepercentage) / 100;
|
||||
$minprice = $object->price_min;
|
||||
}
|
||||
$res = $object->updatePrice($newprice, $object->price_base_type, $user, $object->tva_tx, $minprice, 0, $object->tva_npr, 0, 0, array(), $object->default_vat_code);
|
||||
if ($res > 0) {
|
||||
$nbok++;
|
||||
} else {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
}
|
||||
} else {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
|
|
|
|||
|
|
@ -829,9 +829,8 @@ $arrayofmassactions = array(
|
|||
//'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
|
||||
);
|
||||
if ($user->hasRight($rightskey, 'creer')) {
|
||||
if (getDolGlobalString('PRODUCT_PRICE_UNIQ') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES')) {
|
||||
$arrayofmassactions['preupdateprice'] = img_picto('', 'edit', 'class="pictofixedwidth"').$langs->trans("UpdatePrice");
|
||||
}
|
||||
$arrayofmassactions['preupdateprice'] = img_picto('', 'edit', 'class="pictofixedwidth"').$langs->trans("UpdatePrice");
|
||||
|
||||
|
||||
$arrayofmassactions['switchonsalestatus'] = img_picto('', 'stop-circle', 'class="pictofixedwidth"').$langs->trans("SwitchOnSaleStatus");
|
||||
$arrayofmassactions['switchonpurchasestatus'] = img_picto('', 'stop-circle', 'class="pictofixedwidth"').$langs->trans("SwitchOnPurchaseStatus");
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user