From f2f18d260d6002db7037ad623f915e914feec0f9 Mon Sep 17 00:00:00 2001 From: Bernd Bestel Date: Fri, 21 Apr 2017 12:50:53 +0200 Subject: [PATCH] Show how much is in stock on dashboard --- GrocyPhpHelper.php | 11 +++++++++++ views/dashboard.php | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/GrocyPhpHelper.php b/GrocyPhpHelper.php index bb6b6e45..28c9015b 100644 --- a/GrocyPhpHelper.php +++ b/GrocyPhpHelper.php @@ -46,4 +46,15 @@ class GrocyPhpHelper return $returnArray; } + + public static function SumArrayValue($array, $propertyName) + { + $sum = 0; + foreach($array as $object) + { + $sum += $object->{$propertyName}; + } + + return $sum; + } } diff --git a/views/dashboard.php b/views/dashboard.php index 6d96c9e4..a126cf1c 100644 --- a/views/dashboard.php +++ b/views/dashboard.php @@ -2,7 +2,7 @@

Dashboard

-

Stock overview

+

Stock overview products with units in stock