Past inventories used to list all current products,

not just the ones that existed at the time of inventory. Fixed.
This commit is contained in:
Erik Thuning 2024-02-26 13:10:50 +01:00
parent 746ad28545
commit 437ec951bd

@ -295,13 +295,19 @@ abstract class Page extends Responder {
final protected function build_inventory_details($inventory,
$interactive = true) {
$startdate = format_date($inventory->get_starttime());
$all_products = get_items('product');
$seen = $inventory->get_seen_products();
$unseen = array();
foreach($all_products as $product) {
if(!in_array($product, $seen)) {
$unseen[] = $product;
if($interactive) {
$all_products = get_items('product');
$total_count = count($all_products);
foreach($all_products as $product) {
if(!in_array($product, $seen)) {
$unseen[] = $product;
}
}
} else {
$unseen = $inventory->get_unseen_products();
$total_count = count($unseen) + count($seen);
}
$missing = i18n('Missing products');
$hidden = 'hidden';
@ -318,7 +324,7 @@ abstract class Page extends Responder {
$seen_table = $this->build_seen_table($seen, $inventory);
}
return replace(array('start_date' => $startdate,
'total_count' => count($all_products),
'total_count' => $total_count,
'seen_count' => count($seen),
'hide' => $hidden,
'unseen_title' => $missing,