mirror of
				https://github.com/grocy/grocy.git
				synced 2025-10-31 18:49:38 +00:00 
			
		
		
		
	Always execute migration 9999 (can be used to fix things manually) Optimized meal plan navigation / date range filtering Prepared next release Pulled translations from Transifex Various code optimizations
		
			
				
	
	
		
			38 lines
		
	
	
		
			952 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			38 lines
		
	
	
		
			952 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
| <?php
 | |
| 
 | |
| namespace Grocy\Controllers;
 | |
| 
 | |
| use Grocy\Controllers\Users\User;
 | |
| use Grocy\Services\StockService;
 | |
| 
 | |
| class PrintApiController extends BaseApiController
 | |
| {
 | |
| 	public function PrintShoppingListThermal(\Psr\Http\Message\ServerRequestInterface $request, \Psr\Http\Message\ResponseInterface $response, array $args)
 | |
| 	{
 | |
| 		try
 | |
| 		{
 | |
| 			User::checkPermission($request, User::PERMISSION_SHOPPINGLIST);
 | |
| 
 | |
| 			$params = $request->getQueryParams();
 | |
| 
 | |
| 			$listId = 1;
 | |
| 			if (isset($params['list']))
 | |
| 			{
 | |
| 				$listId = $params['list'];
 | |
| 			}
 | |
| 
 | |
| 			$printHeader = true;
 | |
| 			if (isset($params['printHeader']))
 | |
| 			{
 | |
| 				$printHeader = ($params['printHeader'] === 'true');
 | |
| 			}
 | |
| 			$items = $this->getStockService()->GetShoppinglistInPrintableStrings($listId);
 | |
| 			return $this->ApiResponse($response, $this->getPrintService()->printShoppingList($printHeader, $items));
 | |
| 		}
 | |
| 		catch (\Exception $ex)
 | |
| 		{
 | |
| 			return $this->GenericErrorResponse($response, $ex->getMessage());
 | |
| 		}
 | |
| 	}
 | |
| }
 |