diff --git a/htdocs/admin/receiptprinter.php b/htdocs/admin/receiptprinter.php index 96c00f48312..78b82f42b82 100644 --- a/htdocs/admin/receiptprinter.php +++ b/htdocs/admin/receiptprinter.php @@ -1,7 +1,8 @@ - * Copyright (C) 2015 Frederic France - * Copyright (C) 2016 Juanjo Menent +/* Copyright (C) 2013-2016 Laurent Destailleur + * Copyright (C) 2015 Frederic France + * Copyright (C) 2016 Juanjo Menent + * Copyright (C) 2020 Andreu Bisquerra Gaya * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -355,7 +356,7 @@ if ($mode == 'config' && $user->admin) { print ''.$langs->trans("CONNECTOR_NETWORK_PRINT").':'.$langs->trans("CONNECTOR_NETWORK_PRINT_HELP").''; print ''.$langs->trans("CONNECTOR_FILE_PRINT").':'.$langs->trans("CONNECTOR_FILE_PRINT_HELP").''; print ''.$langs->trans("CONNECTOR_WINDOWS_PRINT").':'.$langs->trans("CONNECTOR_WINDOWS_PRINT_HELP").''; - //print ''.$langs->trans("CONNECTOR_JAVA").':'.$langs->trans("CONNECTOR_JAVA_HELP").''; + print ''.$langs->trans("CONNECTOR_CUPS_PRINT").':'.$langs->trans("CONNECTOR_CUPS_PRINT_HELP").''; print ''; dol_fiche_end(); diff --git a/htdocs/core/class/dolreceiptprinter.class.php b/htdocs/core/class/dolreceiptprinter.class.php index d241c2a8c5a..468cdf050bc 100644 --- a/htdocs/core/class/dolreceiptprinter.class.php +++ b/htdocs/core/class/dolreceiptprinter.class.php @@ -104,6 +104,7 @@ require_once DOL_DOCUMENT_ROOT.'/includes/mike42/escpos-php/autoload.php'; use Mike42\Escpos\PrintConnectors\FilePrintConnector; use Mike42\Escpos\PrintConnectors\NetworkPrintConnector; use Mike42\Escpos\PrintConnectors\WindowsPrintConnector; +use Mike42\Escpos\PrintConnectors\CupsPrintConnector; use Mike42\Escpos\PrintConnectors\DummyPrintConnector; use Mike42\Escpos\CapabilityProfile; use Mike42\Escpos\Printer; @@ -119,7 +120,7 @@ class dolReceiptPrinter extends Printer const CONNECTOR_FILE_PRINT = 2; const CONNECTOR_NETWORK_PRINT = 3; const CONNECTOR_WINDOWS_PRINT = 4; - //const CONNECTOR_JAVA = 5; + const CONNECTOR_CUPS_PRINT = 5; /** * @var DoliDB Database handler. @@ -262,7 +263,7 @@ class dolReceiptPrinter extends Printer $row['fk_type_name'] = 'CONNECTOR_WINDOWS_PRINT'; break; case 5: - $row['fk_type_name'] = 'CONNECTOR_JAVA'; + $row['fk_type_name'] = 'CONNECTOR_CUPS_PRINT'; break; default: $row['fk_type_name'] = 'CONNECTOR_UNKNOWN'; @@ -343,6 +344,7 @@ class dolReceiptPrinter extends Printer 2 => $langs->trans('CONNECTOR_FILE_PRINT'), 3 => $langs->trans('CONNECTOR_NETWORK_PRINT'), 4 => $langs->trans('CONNECTOR_WINDOWS_PRINT'), + 5 => $langs->trans('CONNECTOR_CUPS_PRINT'), ); $this->resprint = Form::selectarray($htmlname, $options, $selected); @@ -839,6 +841,9 @@ class dolReceiptPrinter extends Printer break; case 4: $this->connector = new WindowsPrintConnector($parameter); + break; + case 5: + $this->connector = new CupsPrintConnector($parameter); break; default: $this->connector = 'CONNECTOR_UNKNOWN'; diff --git a/htdocs/langs/en_US/receiptprinter.lang b/htdocs/langs/en_US/receiptprinter.lang index 3df49b9fe67..b0b60c60840 100644 --- a/htdocs/langs/en_US/receiptprinter.lang +++ b/htdocs/langs/en_US/receiptprinter.lang @@ -15,10 +15,12 @@ CONNECTOR_DUMMY=Dummy Printer CONNECTOR_NETWORK_PRINT=Network Printer CONNECTOR_FILE_PRINT=Local Printer CONNECTOR_WINDOWS_PRINT=Local Windows Printer +CONNECTOR_CUPS_PRINT=Cups Printer CONNECTOR_DUMMY_HELP=Fake Printer for test, does nothing CONNECTOR_NETWORK_PRINT_HELP=10.x.x.x:9100 CONNECTOR_FILE_PRINT_HELP=/dev/usb/lp0, /dev/usb/lp1 CONNECTOR_WINDOWS_PRINT_HELP=LPT1, COM1, smb://FooUser:secret@computername/workgroup/Receipt Printer +CONNECTOR_CUPS_PRINT_HELP=CUPS printer name, example: HPRT_TP805L PROFILE_DEFAULT=Default Profile PROFILE_SIMPLE=Simple Profile PROFILE_EPOSTEP=Epos Tep Profile