class dolReceiptPrinter extends Printer (View source)

Class to manage Receipt Printers

Constants

CONNECTOR_DUMMY

CONNECTOR_FILE_PRINT

CONNECTOR_NETWORK_PRINT

CONNECTOR_WINDOWS_PRINT

CONNECTOR_CUPS_PRINT

Properties

DoliDB $db
string[] $tags
Printer $printer
string $template
int $orderprinter

Number of order printer

array<array{rowid: int, name: string, fk_type: int, fk_type_name: string, fk_profile: int, fk_profile_name: string, parameter: string}> $listprinters

Array with list of printers

array<array{rowid: int, name: string, template: string}> $listprinterstemplates

Array with list of printer templates

string $profileresprint
string $resprint
string $error
string[] $errors

Methods

__construct(DoliDB $db)

Constructor

int
listPrinters()

List printers into the array ->listprinters

int
listPrintersTemplates()

List printers templates

selectTypePrinter($selected = '', string $htmlname = 'printertypeid')

Form to Select type printer

selectProfilePrinter($selected = '', string $htmlname = 'printerprofileid')

Form to Select Profile printer

addPrinter($name, int $type, $profile, $parameter)

Function to Add a printer in db

updatePrinter($name, int $type, $profile, $parameter, $printerid)

Function to Update a printer in db

int
deletePrinter($printerid)

Function to Delete a printer from db

addTemplate($name, string $template)

Function to add a printer template in db

int
deleteTemplate($templateid)

Function to delete a printer template in db

updateTemplate($name, string $template, $templateid)

Function to Update a printer template in db

sendTestToPrinter($printerid, int $addimgandbarcode = 0)

Function to Send Test page to Printer

sendToPrinter($object, int $templateid, $printerid)

Function to Print Receipt Ticket

int
loadTemplate($templateid)

Function to load Template into $this->template

void|int
initPrinter($printerid)

Function Init Printer into $this->printer

Details

__construct(DoliDB $db)

Constructor

Parameters

DoliDB $db database

int listPrinters()

List printers into the array ->listprinters

Return Value

int

0 if OK; >0 if KO

int listPrintersTemplates()

List printers templates

Return Value

int

0 if OK; >0 if KO

selectTypePrinter($selected = '', string $htmlname = 'printertypeid')

Form to Select type printer

@param string $selected Id printer type pre-selected

Parameters

$selected
string $htmlname

select html name @return int 0 if OK; >0 if KO

selectProfilePrinter($selected = '', string $htmlname = 'printerprofileid')

Form to Select Profile printer

@param string $selected Id printer profile pre-selected

Parameters

$selected
string $htmlname

select html name @return int 0 if OK; >0 if KO

addPrinter($name, int $type, $profile, $parameter)

Function to Add a printer in db

@param string $name Printer name

Parameters

$name
int $type

Printer type @param int $profile Printer profile @param string $parameter Printer parameter @return int 0 if OK; >0 if KO

$profile
$parameter

updatePrinter($name, int $type, $profile, $parameter, $printerid)

Function to Update a printer in db

@param string $name Printer name

Parameters

$name
int $type

Printer type @param int $profile Printer profile @param string $parameter Printer parameter @param int $printerid Printer id @return int 0 if OK; >0 if KO

$profile
$parameter
$printerid

int deletePrinter($printerid)

Function to Delete a printer from db

@param int $printerid Printer id

Parameters

$printerid

Return Value

int

0 if OK; >0 if KO

addTemplate($name, string $template)

Function to add a printer template in db

@param string $name Template name

Parameters

$name
string $template

Template @return int 0 if OK; >0 if KO

int deleteTemplate($templateid)

Function to delete a printer template in db

@param int $templateid Template ID

Parameters

$templateid

Return Value

int

0 if OK; >0 if KO

updateTemplate($name, string $template, $templateid)

Function to Update a printer template in db

@param string $name Template name

Parameters

$name
string $template

Template @param int $templateid Template id @return int 0 if OK; >0 if KO

$templateid

sendTestToPrinter($printerid, int $addimgandbarcode = 0)

Function to Send Test page to Printer

@param int $printerid Printer id

Parameters

$printerid
int $addimgandbarcode

Add image and barcode into the test @return int 0 if OK; >0 if KO

sendToPrinter($object, int $templateid, $printerid)

Function to Print Receipt Ticket

@param Facture|Commande $object Order or invoice object

Parameters

$object
int $templateid

Template id @param int $printerid Printer id @return int 0 if OK; >0 if KO

$printerid

int loadTemplate($templateid)

Function to load Template into $this->template

@param int $templateid Template id

Parameters

$templateid

Return Value

int

0 if OK; >0 if KO

void|int initPrinter($printerid)

Function Init Printer into $this->printer

@param int $printerid Printer id

Parameters

$printerid

Return Value

void|int

0 if OK; >0 if KO