Merge pull request #19099 from johnvan7/develop

New: receipt beep alternative and current date/time
This commit is contained in:
Laurent Destailleur 2022-05-24 22:13:59 +02:00 committed by GitHub
commit 0e3d7c4e2e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 0 deletions

View File

@ -42,6 +42,7 @@
* {dol_cut_paper_partial} Cut ticket partially
* {dol_open_drawer} Open cash drawer
* {dol_beep} Activate buzzer
* {dol_beep_alternative} Activate buzzer (alternative mode)
* {dol_print_barcode} Print barcode
* {dol_print_logo} Print logo stored on printer. Example : <print_logo>32|32
* {dol_print_logo_old} Print logo stored on printer. Must be followed by logo code. For old printers.
@ -52,6 +53,7 @@
* {dol_print_order_lines} Print order lines for Printer
* {dol_print_object_lines_with_notes} Print object lines with notes
* {dol_print_payment} Print payment method
* {dol_print_curr_date} Print the current date/time. Must be followed by format string.
*
* Code which can be placed everywhere
* <dol_value_date> Replaced by date AAAA-MM-DD
@ -178,6 +180,7 @@ class dolReceiptPrinter extends Printer
'dol_cut_paper_partial' => 'DOL_CUT_PAPER_PARTIAL',
'dol_open_drawer' => 'DOL_OPEN_DRAWER',
'dol_beep' => 'DOL_BEEP',
'dol_beep_alternative' => 'DOL_BEEP_ALTERNATIVE',
'dol_print_text' => 'DOL_PRINT_TEXT',
'dol_print_barcode' => 'DOL_PRINT_BARCODE',
'dol_value_date' => 'DateInvoice',
@ -189,6 +192,7 @@ class dolReceiptPrinter extends Printer
'dol_value_day_letters' => 'DOL_VALUE_DAY',
'dol_value_currentdate' => 'DOL_VALUE_CURRENTDATE',
'dol_print_payment' => 'DOL_PRINT_PAYMENT',
'dol_print_curr_date' => 'DOL_PRINT_CURR_DATE',
'dol_print_logo' => 'DOL_PRINT_LOGO',
'dol_print_logo_old' => 'DOL_PRINT_LOGO_OLD',
'dol_value_object_id' => 'InvoiceID',
@ -712,6 +716,10 @@ class dolReceiptPrinter extends Printer
$spaces = str_repeat(' ', $spacestoadd > 0 ? $spacestoadd : 0);
$this->printer->text($title.$spaces.str_pad(price($object->total_ttc), 10, ' ', STR_PAD_LEFT)."\n");
break;
case 'DOL_PRINT_CURR_DATE':
if (strlen($vals[$tplline]['value'])<2) $this->printer->text(date('d/m/Y H:i:s')."\n");
else $this->printer->text(date($vals[$tplline]['value'])."\n");
break;
case 'DOL_LINE_FEED':
$this->printer->feed();
break;
@ -794,6 +802,9 @@ class dolReceiptPrinter extends Printer
case 'DOL_BEEP':
$this->printer->getPrintConnector() -> write("\x1e");
break;
case 'DOL_BEEP_ALTERNATIVE': //if DOL_BEEP not works
$this->printer->getPrintConnector() -> write(Printer::ESC . "B" . chr(4) . chr(1));
break;
case 'DOL_PRINT_ORDER_LINES':
foreach ($object->lines as $line) {
if ($line->special_code == $this->orderprinter) {

View File

@ -55,6 +55,8 @@ DOL_DEFAULT_HEIGHT_WIDTH=Default height and width size
DOL_UNDERLINE=Enable underline
DOL_UNDERLINE_DISABLED=Disable underline
DOL_BEEP=Beep sound
DOL_BEEP_ALTERNATIVE=Beep sound (alternative mode)
DOL_PRINT_CURR_DATE=Print current date/time
DOL_PRINT_TEXT=Print text
DateInvoiceWithTime=Invoice date and time
YearInvoice=Invoice year

View File

@ -55,6 +55,8 @@ DOL_DEFAULT_HEIGHT_WIDTH=Altezza e larghezza predefinite
DOL_UNDERLINE=Abilita sottolineatura
DOL_UNDERLINE_DISABLED=Disabilita la sottolineatura
DOL_BEEP=Suono di Beep
DOL_BEEP_ALTERNATIVE=Suono di Beep (modalità alternativa)
DOL_PRINT_CURR_DATE=Stampa la data/ora corrente
DOL_PRINT_TEXT=Stampa il testo
DateInvoiceWithTime=Data e ora della fattura
YearInvoice=Anno della fattura