function units_operator_add_split_quantity in Units of Measurement 7.2
File
- plugins/
operator/ add.inc, line 35
Code
function units_operator_add_split_quantity($total_quantity, $quantity1, $quantity2, $plugin) {
$greatest_quantity = max($quantity1, $quantity2);
$for_greater_quantity = floor($total_quantity / $greatest_quantity) * $greatest_quantity;
$for_fewer_quantity = $total_quantity - $for_greater_quantity;
return $quantity1 > $quantity2 ? array(
$for_greater_quantity,
$for_fewer_quantity,
) : array(
$for_fewer_quantity,
$for_greater_quantity,
);
}