mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-24 21:24:13 -08:00
Merge pull request #11617 from inietov/fixes/components_wrong_remaining_inventory
Fixed wrong calculation of assigned components
This commit is contained in:
commit
bc4032c2cd
|
@ -623,7 +623,7 @@ class Helper
|
|||
{
|
||||
$consumables = Consumable::withCount('consumableAssignments as consumable_assignments_count')->whereNotNull('min_amt')->get();
|
||||
$accessories = Accessory::withCount('users as users_count')->whereNotNull('min_amt')->get();
|
||||
$components = Component::withCount('assets as assets_count')->whereNotNull('min_amt')->get();
|
||||
$components = Component::whereNotNull('min_amt')->get();
|
||||
|
||||
$avail_consumables = 0;
|
||||
$items_array = [];
|
||||
|
@ -668,7 +668,7 @@ class Helper
|
|||
}
|
||||
|
||||
foreach ($components as $component) {
|
||||
$avail = $component->qty - $component->assets_count;
|
||||
$avail = $component->numRemaining();
|
||||
if ($avail < ($component->min_amt) + \App\Models\Setting::getSettings()->alert_threshold) {
|
||||
if ($component->qty > 0) {
|
||||
$percent = number_format((($avail / $component->qty) * 100), 0);
|
||||
|
|
Loading…
Reference in a new issue