diff --git a/Grocy.php b/Grocy.php index 06c0adfa..60c676ea 100644 --- a/Grocy.php +++ b/Grocy.php @@ -54,6 +54,9 @@ class Grocy return self::$DbConnection; } + /** + * @return boolean + */ public static function ExecuteDbStatement(PDO $pdo, string $sql) { if ($pdo->exec(utf8_encode($sql)) === false) @@ -64,6 +67,9 @@ class Grocy return true; } + /** + * @return boolean|PDOStatement + */ public static function ExecuteDbQuery(PDO $pdo, string $sql) { if (self::ExecuteDbStatement($pdo, $sql) === true) @@ -74,12 +80,18 @@ class Grocy return false; } + /** + * @return boolean + */ public static function IsDemoInstallation() { return file_exists(__DIR__ . '/data/demo.txt'); } private static $InstalledVersion; + /** + * @return string + */ public static function GetInstalledVersion() { if (self::$InstalledVersion == null) diff --git a/GrocyLogicStock.php b/GrocyLogicStock.php index 67eccd82..48b6ead3 100644 --- a/GrocyLogicStock.php +++ b/GrocyLogicStock.php @@ -8,7 +8,8 @@ class GrocyLogicStock public static function GetCurrentStock() { - return Grocy::ExecuteDbQuery(Grocy::GetDbConnectionRaw(), 'SELECT product_id, SUM(amount) AS amount, MIN(best_before_date) AS best_before_date from stock GROUP BY product_id ORDER BY MIN(best_before_date) ASC')->fetchAll(PDO::FETCH_OBJ); + $sql = 'SELECT product_id, SUM(amount) AS amount, MIN(best_before_date) AS best_before_date from stock GROUP BY product_id ORDER BY MIN(best_before_date) ASC'; + return Grocy::ExecuteDbQuery(Grocy::GetDbConnectionRaw(), $sql)->fetchAll(PDO::FETCH_OBJ); } public static function GetProductDetails(int $productId) diff --git a/build.bat b/build.bat index 5835331b..09231ef1 100644 --- a/build.bat +++ b/build.bat @@ -7,5 +7,5 @@ mkdir "%releasePath%" for /f "tokens=*" %%a in ('type version.txt') do set version=%%a del "%releasePath%\grocy_%version%.zip" -"build_tools\7za.exe" a -r "%releasePath%\grocy_%version%.zip" "%projectPath%\*" -xr!.* -xr!build_tools -xr!build.bat -xr!composer.json -xr!composer.lock -xr!composer.phar -xr!grocy.phpproj -xr!grocy.phpproj.user -xr!grocy.sln -"build_tools\7za.exe" d "%releasePath%\grocy_%version%.zip" data\add_before_end_body.html data\demo.txt data\config.php data\grocy.db data\.gitignore bower.json +"build_tools\7za.exe" a -r "%releasePath%\grocy_%version%.zip" "%projectPath%\*" -xr!.* -xr!build_tools -xr!build.bat -xr!composer.json -xr!composer.lock -xr!composer.phar -xr!grocy.phpproj -xr!grocy.phpproj.user -xr!grocy.sln -xr!bower.json +"build_tools\7za.exe" d "%releasePath%\grocy_%version%.zip" data\*.* diff --git a/grocy.js b/grocy.js index f69bf312..f43799b1 100644 --- a/grocy.js +++ b/grocy.js @@ -86,7 +86,8 @@ Grocy.GetUriParam = function(key) var currentUri = decodeURIComponent(window.location.search.substring(1)); var vars = currentUri.split('&'); - for (i = 0; i < vars.length; i++) { + for (i = 0; i < vars.length; i++) + { var currentParam = vars[i].split('='); if (currentParam[0] === key) diff --git a/style.css b/style.css index 779a7236..498edb04 100644 --- a/style.css +++ b/style.css @@ -118,3 +118,13 @@ .error-bg { background-color: #f2dede !important; } + +.discrete-content-separator { + padding-top: 5px; + padding-bottom: 5px; +} + +.discrete-content-separator-2x { + padding-top: 10px; + padding-bottom: 10px; +} diff --git a/views/consumption.php b/views/consumption.php index bb46fe93..e5147f73 100644 --- a/views/consumption.php +++ b/views/consumption.php @@ -1,4 +1,5 @@