mirror of
https://github.com/grocy/grocy.git
synced 2025-04-29 17:45:39 +00:00
* Added escpos-php library * Added button to shoppinglist print menu * Added to translation * Added basic printing logic and API call * Working implementation for printing with the API * Added openapi json * Correctly parsing boolean parameter * Working button in UI * Change to grocy formatting * Add Date * Only show thermal print button when Feature Flag is set * Fixed API call and added error message parsing * Undo translation * Add flag to print quantities as well * Added printing notes * Added quantity conversion * Increse feed * Fixed that checkbox was undefined, as dialog was already closed * Added padding * Formatting * Added note about user permission * Fixed error when using notes instead of products * Review - Default FEATURE_FLAG_THERMAL_PRINTER to disabled - Added missing localization strings (and slightly adjusted one) * Fixed merge conflicts Co-authored-by: Bernd Bestel <bernd@berrnd.de>
76 lines
1.2 KiB
PHP
76 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace Grocy\Services;
|
|
|
|
class BaseService
|
|
{
|
|
private static $instances = [];
|
|
|
|
public function __construct()
|
|
{
|
|
}
|
|
|
|
public static function getInstance()
|
|
{
|
|
$className = get_called_class();
|
|
|
|
if (!isset(self::$instances[$className]))
|
|
{
|
|
self::$instances[$className] = new $className();
|
|
}
|
|
|
|
return self::$instances[$className];
|
|
}
|
|
|
|
protected function getBatteriesService()
|
|
{
|
|
return BatteriesService::getInstance();
|
|
}
|
|
|
|
protected function getChoresService()
|
|
{
|
|
return ChoresService::getInstance();
|
|
}
|
|
|
|
protected function getDatabase()
|
|
{
|
|
return $this->getDatabaseService()->GetDbConnection();
|
|
}
|
|
|
|
protected function getDatabaseService()
|
|
{
|
|
return DatabaseService::getInstance();
|
|
}
|
|
|
|
protected function getLocalizationService()
|
|
{
|
|
if (!defined('GROCY_LOCALE'))
|
|
{
|
|
define('GROCY_LOCALE', GROCY_DEFAULT_LOCALE);
|
|
}
|
|
|
|
return LocalizationService::getInstance(GROCY_LOCALE);
|
|
}
|
|
|
|
protected function getStockservice()
|
|
{
|
|
return StockService::getInstance();
|
|
}
|
|
|
|
protected function getTasksService()
|
|
{
|
|
return TasksService::getInstance();
|
|
}
|
|
|
|
protected function getUsersService()
|
|
{
|
|
return UsersService::getInstance();
|
|
}
|
|
|
|
protected function getPrintService()
|
|
{
|
|
return PrintService::getInstance();
|
|
}
|
|
|
|
}
|