Merge pull request #13425 from andreubisquerra/develop

NEW: CUPS printing compatibility for TakePOS
This commit is contained in:
Laurent Destailleur 2020-03-30 18:56:14 +02:00 committed by GitHub
commit 4220236aa8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 6 deletions

View File

@ -1,7 +1,8 @@
<?php
/* Copyright (C) 2013-2016 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2015 Frederic France <frederic.france@free.fr>
* Copyright (C) 2016 Juanjo Menent <jmenent@2byte.es>
/* Copyright (C) 2013-2016 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2015 Frederic France <frederic.france@free.fr>
* Copyright (C) 2016 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2020 Andreu Bisquerra Gaya <jove@bisquerra.com>
*
* 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 '<tr class="oddeven"><td>'.$langs->trans("CONNECTOR_NETWORK_PRINT").':</td><td>'.$langs->trans("CONNECTOR_NETWORK_PRINT_HELP").'</td></tr>';
print '<tr class="oddeven"><td>'.$langs->trans("CONNECTOR_FILE_PRINT").':</td><td>'.$langs->trans("CONNECTOR_FILE_PRINT_HELP").'</td></tr>';
print '<tr class="oddeven"><td>'.$langs->trans("CONNECTOR_WINDOWS_PRINT").':</td><td>'.$langs->trans("CONNECTOR_WINDOWS_PRINT_HELP").'</td></tr>';
//print '<tr class="oddeven"><td>'.$langs->trans("CONNECTOR_JAVA").':</td><td>'.$langs->trans("CONNECTOR_JAVA_HELP").'</td></tr>';
print '<tr class="oddeven"><td>'.$langs->trans("CONNECTOR_CUPS_PRINT").':</td><td>'.$langs->trans("CONNECTOR_CUPS_PRINT_HELP").'</td></tr>';
print '</table>';
dol_fiche_end();

View File

@ -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';

View File

@ -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