mirror of
https://github.com/grocy/grocy.git
synced 2026-04-05 20:36:15 +02:00
Fix all the not working things...
This commit is contained in:
parent
a88a9953bd
commit
34ecf85a29
|
|
@ -122,7 +122,7 @@ class BaseController
|
|||
return CalendarService::getInstance();
|
||||
}
|
||||
|
||||
private function getSessionService()
|
||||
protected function getSessionService()
|
||||
{
|
||||
return SessionService::getInstance();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ class OpenApiController extends BaseApiController
|
|||
|
||||
public function DocumentationSpec(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
||||
{
|
||||
$applicationService = $this->getApplicationService;
|
||||
$applicationService = $this->getApplicationService();
|
||||
|
||||
$versionInfo = $applicationService->GetInstalledVersion();
|
||||
$this->getOpenApiSpec()->info->version = $versionInfo->Version;
|
||||
|
|
|
|||
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
namespace Grocy\Controllers;
|
||||
|
||||
use \Grocy\Services\StockService;
|
||||
|
||||
class StockApiController extends BaseApiController
|
||||
{
|
||||
public function __construct(\DI\Container $container)
|
||||
|
|
@ -541,7 +543,7 @@ class StockApiController extends BaseApiController
|
|||
{
|
||||
try
|
||||
{
|
||||
$this->ApiResponse($response, $this->StockService->UndoBooking($args['bookingId']));
|
||||
$this->ApiResponse($response, $this->getStockService()->UndoBooking($args['bookingId']));
|
||||
return $this->EmptyApiResponse($response);
|
||||
}
|
||||
catch (\Exception $ex)
|
||||
|
|
@ -554,7 +556,7 @@ class StockApiController extends BaseApiController
|
|||
{
|
||||
try
|
||||
{
|
||||
$this->ApiResponse($response, $this->StockService->UndoTransaction($args['transactionId']));
|
||||
$this->ApiResponse($response, $this->getStockService()->UndoTransaction($args['transactionId']));
|
||||
return $this->EmptyApiResponse($response);
|
||||
}
|
||||
catch (\Exception $ex)
|
||||
|
|
@ -571,17 +573,17 @@ class StockApiController extends BaseApiController
|
|||
$allowSubproductSubstitution = true;
|
||||
}
|
||||
|
||||
return $this->ApiResponse($response, $this->StockService->GetProductStockEntries($args['productId'], false, $allowSubproductSubstitution));
|
||||
return $this->ApiResponse($response, $this->getStockService()->GetProductStockEntries($args['productId'], false, $allowSubproductSubstitution));
|
||||
}
|
||||
|
||||
public function ProductStockLocations(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
||||
{
|
||||
return $this->ApiResponse($response, $this->getStockService()->GetProductStockEntries($args['productId']));
|
||||
return $this->ApiResponse($response, $this->getStockService()->GetProductStockLocations($args['productId']));
|
||||
}
|
||||
|
||||
public function StockEntry(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
||||
{
|
||||
return $this->ApiResponse($response, $this->StockService->GetStockEntry($args['entryId']));
|
||||
return $this->ApiResponse($response, $this->getStockService()->GetStockEntry($args['entryId']));
|
||||
}
|
||||
|
||||
public function StockBooking(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
||||
|
|
|
|||
|
|
@ -31,10 +31,10 @@ class StockController extends BaseController
|
|||
|
||||
public function Stockentries(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
||||
{
|
||||
$usersService = new UsersService();
|
||||
$usersService = $this->getUsersService();
|
||||
$nextXDays = $usersService->GetUserSettings(GROCY_USER_ID)['stock_expring_soon_days'];
|
||||
|
||||
return $this->AppContainer->view($response, 'stockentries', [
|
||||
return $this->renderPage($response, 'stockentries', [
|
||||
'products' => $this->getDatabase()->products()->orderBy('name'),
|
||||
'quantityunits' => $this->getDatabase()->quantity_units()->orderBy('name'),
|
||||
'locations' => $this->getDatabase()->locations()->orderBy('name'),
|
||||
|
|
@ -82,7 +82,7 @@ class StockController extends BaseController
|
|||
|
||||
public function StockEntryEditForm(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
||||
{
|
||||
return $this->View->render($response, 'stockentryform', [
|
||||
return $this->renderPage($response, 'stockentryform', [
|
||||
'stockEntry' => $this->getDatabase()->stock()->where('id', $args['entryId'])->fetch(),
|
||||
'products' => $this->getDatabase()->products()->orderBy('name'),
|
||||
'locations' => $this->getDatabase()->locations()->orderBy('name')
|
||||
|
|
@ -296,7 +296,7 @@ class StockController extends BaseController
|
|||
|
||||
public function ShoppingListSettings(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
||||
{
|
||||
return $this->View->render($response, 'shoppinglistsettings');
|
||||
return $this->renderPage($response, 'shoppinglistsettings');
|
||||
}
|
||||
|
||||
public function Journal(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
namespace Grocy\Controllers;
|
||||
|
||||
use \Grocy\Services\DatabaseMigrationService;
|
||||
use \Grocy\Services\DemoDataGeneratorService;
|
||||
|
||||
class SystemController extends BaseController
|
||||
{
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ class RecipesService extends BaseService
|
|||
if (!empty($recipeRow->product_id))
|
||||
{
|
||||
$recipeResolvedRow = $this->getDatabase()->recipes_resolved()->where('recipe_id = :1', $recipeId)->fetch();
|
||||
$this->StockService->AddProduct($recipeRow->product_id, floatval($recipeRow->desired_servings), null, StockService::TRANSACTION_TYPE_SELF_PRODUCTION, date('Y-m-d'), floatval($recipeResolvedRow->costs));
|
||||
$this->getStockService()->AddProduct($recipeRow->product_id, floatval($recipeRow->desired_servings), null, StockService::TRANSACTION_TYPE_SELF_PRODUCTION, date('Y-m-d'), floatval($recipeResolvedRow->costs));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -916,7 +916,7 @@ class StockService extends BaseService
|
|||
|
||||
private function LocationExists($locationId)
|
||||
{
|
||||
$locationRow = $this->Database->locations()->where('id = :1', $locationId)->fetch();
|
||||
$locationRow = $this->getDatabase()->locations()->where('id = :1', $locationId)->fetch();
|
||||
return $locationRow !== null;
|
||||
}
|
||||
|
||||
|
|
@ -938,7 +938,7 @@ class StockService extends BaseService
|
|||
if (file_exists($path))
|
||||
{
|
||||
require_once $path;
|
||||
return new $pluginName($this->getDatabase()->locations()->fetchAll(), $this->Database->quantity_units()->fetchAll());
|
||||
return new $pluginName($this->getDatabase()->locations()->fetchAll(), $this->getDatabase()->quantity_units()->fetchAll());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user