diff --git a/config-dist.php b/config-dist.php index 9b9d7847..7d6f71c9 100644 --- a/config-dist.php +++ b/config-dist.php @@ -97,15 +97,17 @@ Setting('DEFAULT_PERMISSIONS', ['ADMIN']); // When using a thermal printer (thermal printers are receipt printers, not regular printers) // The printer must support the ESC/POS protocol, see https://github.com/mike42/escpos-php -Setting('TPRINTER_IS_NETWORK_PRINTER', false); // Set to true if it is a network printer -Setting('TPRINTER_PRINT_QUANTITY_NAME', true); // Set to true if you want to print the quantity name as well +Setting('TPRINTER_IS_NETWORK_PRINTER', false); // Set to true if it is a network printer +Setting('TPRINTER_PRINT_QUANTITY_NAME', true); // Set to false if you do not want to print the quantity names +Setting('TPRINTER_PRINT_NOTES', true); // Set to false if you do not want to print notes + //Configuration below for network printers. If you are using a USB/serial printer, skip to next section -Setting('TPRINTER_IP', '127.0.0.1'); // IP of the network printer -Setting('TPRINTER_PORT', 9100); // Port of printer, eg. 9100 +Setting('TPRINTER_IP', '127.0.0.1'); // IP of the network printer +Setting('TPRINTER_PORT', 9100); // Port of printer, eg. 9100 //Configuration below if you are using a USB or serial printer -Setting('TPRINTER_CONNECTOR', '/dev/usb/lp0'); // Location of printer. For USB on Linux this is often '/dev/usb/lp0', - // for serial printers it could be similar to '/dev/ttyS0' - // Make sure that the user that runs the webserver has permissions to write to the printer! +Setting('TPRINTER_CONNECTOR', '/dev/usb/lp0'); // Location of printer. For USB on Linux this is often '/dev/usb/lp0', + // for serial printers it could be similar to '/dev/ttyS0' + // Make sure that the user that runs the webserver has permissions to write to the printer! // Default user settings diff --git a/services/StockService.php b/services/StockService.php index e375360a..07e24d2b 100644 --- a/services/StockService.php +++ b/services/StockService.php @@ -949,14 +949,20 @@ class StockService extends BaseService $result = array(); $rowsShoppingListProducts = $this->getDatabase()->uihelper_shopping_list()->where('shopping_list_id = :1', $listId)->fetchAll(); foreach ($rowsShoppingListProducts as $row) { + $note = ""; + if (GROCY_TPRINTER_PRINT_NOTES) { + if (isset($row["note"])) { + $note = ' (' . $row["note"] . ')'; + } + } if (GROCY_TPRINTER_PRINT_QUANTITY_NAME) { $quantityname = $row["qu_name"]; if ($row["amount"] > 1) { $quantityname = $row["qu_name_plural"]; } - array_push($result, $row["amount"] . ' ' . $quantityname . ' ' . $row["product_name"]); + array_push($result, $row["amount"] . ' ' . $quantityname . ' ' . $row["product_name"] . $note); } else { - array_push($result, $row["amount"] . ' ' . $row["product_name"]); + array_push($result, $row["amount"] . ' ' . $row["product_name"] . $note); } } return $result;