Implement department-specific customer pricing functionality
This commit is contained in:
@@ -1436,7 +1436,7 @@ class orders_o extends db
|
||||
throw new Exception('No user found matching the customer number in the usage log');
|
||||
}
|
||||
if (!products_o::priceResolutionIsCustomMissing($priceResolution)) {
|
||||
$product_price = $user->applyProductCustomerPricing((int)$order_item->product_id->value(), (int)$product_price);
|
||||
$product_price = $user->applyProductCustomerPricing((int)$order_item->product_id->value(), (int)$product_price, true, (int)$this->department_id->value());
|
||||
}
|
||||
$order_item->notes->set(null); // Set notes for the simulated order item
|
||||
$order_item->price->set((int)$product_price); // Set the price based on the product price and discount percentage
|
||||
@@ -1509,7 +1509,7 @@ class orders_o extends db
|
||||
if (products_o::priceResolutionIsCustomMissing($priceResolution)) {
|
||||
return $price;
|
||||
}
|
||||
return $current_user->applyProductCustomerPricing((int)$product->id, $price);
|
||||
return $current_user->applyProductCustomerPricing((int)$product->id, $price, true, (int)$this->department_id->value());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1598,7 +1598,7 @@ class orders_o extends db
|
||||
}
|
||||
$unitPrice = (int)$department_price_cache[$product_id]['price'];
|
||||
if (!products_o::priceResolutionIsCustomMissing($department_price_cache[$product_id])) {
|
||||
$unitPrice = $tmp_user->applyProductCustomerPricing($product_id, $unitPrice, false);
|
||||
$unitPrice = $tmp_user->applyProductCustomerPricing($product_id, $unitPrice, false, $department_id);
|
||||
}
|
||||
$post_discount = $unitPrice * $quantity;
|
||||
$total += $post_discount;
|
||||
|
||||
Reference in New Issue
Block a user