Mark that amount is unknown in part tables and info page

Fixes issue #282
This commit is contained in:
Jan Böhmer 2023-04-29 22:33:46 +02:00
parent 6ffd45a82a
commit 334d81db08
3 changed files with 44 additions and 4 deletions

View file

@ -160,9 +160,25 @@ trait InstockTrait
return $this->getAmountSum() < $this->getMinAmount();
}
/**
* Returns true, if at least one of the part lots has an unknown amount.
* It is possible that other part lots have a known amount, then getAmountSum() will return sum of all known amounts.
* @return bool True if at least one part lot has an unknown amount.
*/
public function isAmountUnknown(): bool
{
foreach ($this->getPartLots() as $lot) {
if ($lot->isInstockUnknown()) {
return true;
}
}
return false;
}
/**
* Returns the summed amount of this part (over all part lots)
* Part Lots that have unknown value or are expired, are not used for this value.
* Part Lots that have unknown value or are expired, are not used for this value (counted as 0).
*
* @return float The amount of parts given in partUnit
*/