rework an experimental module
This commit is contained in:
parent
6cb5f28db1
commit
d797ea590e
@ -15,7 +15,7 @@ PHP libraries:
|
|||||||
AdoDb-Date 0.36 Modified BSD License Yes Date convertion (not into rpm package)
|
AdoDb-Date 0.36 Modified BSD License Yes Date convertion (not into rpm package)
|
||||||
CKEditor 4.12.1 LGPL-2.1+ Yes Editor WYSIWYG
|
CKEditor 4.12.1 LGPL-2.1+ Yes Editor WYSIWYG
|
||||||
EvalMath 1.0 BSD Yes Safe math expressions evaluation
|
EvalMath 1.0 BSD Yes Safe math expressions evaluation
|
||||||
Escpos-php ? MIT License Yes Thermal receipt printer library, for use with ESC/POS compatible printers
|
Escpos-php 2.2 MIT License Yes Thermal receipt printer library, for use with ESC/POS compatible printers
|
||||||
GeoIP 1.4 LGPL-2.1+ Yes Sample code to make geoip convert (not into deb package)
|
GeoIP 1.4 LGPL-2.1+ Yes Sample code to make geoip convert (not into deb package)
|
||||||
Mobiledetect 2.8.33 MIT License Yes Detect mobile devices browsers
|
Mobiledetect 2.8.33 MIT License Yes Detect mobile devices browsers
|
||||||
NuSoap 0.9.5 LGPL 2.1+ Yes Library to develop SOAP Web services (not into rpm and deb package)
|
NuSoap 0.9.5 LGPL 2.1+ Yes Library to develop SOAP Web services (not into rpm and deb package)
|
||||||
|
|||||||
@ -174,13 +174,18 @@ if ($action == 'testtemplate' && $user->admin) {
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
// if (! $error) {
|
// if (! $error) {
|
||||||
// // test
|
// test
|
||||||
// $ret = $printer->sendTestToPrinter($printerid);
|
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||||
// if ($ret == 0) {
|
$object = new Facture($db);
|
||||||
|
//$object->initAsSpecimen();
|
||||||
|
$object->fetch(8);
|
||||||
|
//var_dump($object->lines);
|
||||||
|
$ret = $printer->sendToPrinter($object, $templateid, 1);
|
||||||
|
if ($ret == 0) {
|
||||||
setEventMessages($langs->trans("TestTemplateToPrinter", $printername), null);
|
setEventMessages($langs->trans("TestTemplateToPrinter", $printername), null);
|
||||||
// } else {
|
} else {
|
||||||
// setEventMessages($printer->error, $printer->errors, 'errors');
|
setEventMessages($printer->error, $printer->errors, 'errors');
|
||||||
// }
|
}
|
||||||
//}
|
//}
|
||||||
$action = '';
|
$action = '';
|
||||||
}
|
}
|
||||||
@ -446,7 +451,7 @@ if ($mode == 'template' && $user->admin) {
|
|||||||
}
|
}
|
||||||
print '</form>';
|
print '</form>';
|
||||||
print '<div><p></div>';
|
print '<div><p></div>';
|
||||||
print '<table class="noborder" width="100%">'."\n";
|
print '<table class="noborder centpercent">'."\n";
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<th>'.$langs->trans("Tag").'</th>';
|
print '<th>'.$langs->trans("Tag").'</th>';
|
||||||
print '<th>'.$langs->trans("Description").'</th>';
|
print '<th>'.$langs->trans("Description").'</th>';
|
||||||
@ -462,18 +467,6 @@ if ($mode == 'template' && $user->admin) {
|
|||||||
dol_fiche_end();
|
dol_fiche_end();
|
||||||
}
|
}
|
||||||
|
|
||||||
// to remove after test
|
|
||||||
// $object=new stdClass();
|
|
||||||
// $object->date_time = '2015-11-02 22:30:25';
|
|
||||||
// $object->id = 1234;
|
|
||||||
// $object->customer_firstname = 'John';
|
|
||||||
// $object->customer_lastname = 'Deuf';
|
|
||||||
// $object->vendor_firstname = 'Jim';
|
|
||||||
// $object->vendor_lastname = 'Big';
|
|
||||||
// $object->barcode = '3700123862396';
|
|
||||||
//$printer->sendToPrinter($object, 1, 16);
|
|
||||||
//setEventMessages($printer->error, $printer->errors, 'errors');
|
|
||||||
|
|
||||||
// End of page
|
// End of page
|
||||||
llxFooter();
|
llxFooter();
|
||||||
$db->close();
|
$db->close();
|
||||||
|
|||||||
@ -59,12 +59,12 @@
|
|||||||
* <dol_print_payment> Print payment method
|
* <dol_print_payment> Print payment method
|
||||||
* <dol_print_logo> Print logo stored on printer. Example : <print_logo>32|32
|
* <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.
|
* <dol_print_logo_old> Print logo stored on printer. Must be followed by logo code. For old printers.
|
||||||
* <dol_print_order_lines> Print order lines
|
* <dol_print_object_lines> Print object lines
|
||||||
* <dol_print_order_tax> Print order total tax
|
* <dol_print_object_tax> Print object total tax
|
||||||
* <dol_print_order_local_tax> Print order local tax
|
* <dol_print_object_local_tax> Print object local tax
|
||||||
* <dol_print_order_total> Print order total
|
* <dol_print_object_total> Print object total
|
||||||
* <dol_print_order_number> Print order number
|
* <dol_print_object_number> Print object number
|
||||||
* <dol_print_order_number_unique> Print order number after validation
|
* <dol_print_object_number_unique> Print object number after validation
|
||||||
* <dol_print_customer_firstname> Print customer firstname
|
* <dol_print_customer_firstname> Print customer firstname
|
||||||
* <dol_print_customer_lastname> Print customer name
|
* <dol_print_customer_lastname> Print customer name
|
||||||
* <dol_print_customer_mail> Print customer mail
|
* <dol_print_customer_mail> Print customer mail
|
||||||
@ -77,15 +77,15 @@
|
|||||||
* <dol_print_vendor_firstname> Print vendor firstname
|
* <dol_print_vendor_firstname> Print vendor firstname
|
||||||
* <dol_print_vendor_mail> Print vendor mail
|
* <dol_print_vendor_mail> Print vendor mail
|
||||||
* <dol_print_customer_points> Print customer points
|
* <dol_print_customer_points> Print customer points
|
||||||
* <dol_print_order_points> Print number of points for this order
|
* <dol_print_object_points> Print number of points for this object
|
||||||
*
|
*
|
||||||
* Conditional code at line start (if<EFBFBD>then Print)
|
* Conditional code at line start (if<EFBFBD>then Print)
|
||||||
* <dol_print_if_customer> Print the line IF a customer is affected to the order
|
* <dol_print_if_customer> Print the line IF a customer is affected to the object
|
||||||
* <dol_print_if_vendor> Print the line IF a vendor is affected to the order
|
* <dol_print_if_vendor> Print the line IF a vendor is affected to the object
|
||||||
* <dol_print_if_happy_hour> Print the line IF Happy Hour
|
* <dol_print_if_happy_hour> Print the line IF Happy Hour
|
||||||
* <dol_print_if_num_order_unique> Print the line IF order is validated
|
* <dol_print_if_num_object_unique> Print the line IF object is validated
|
||||||
* <dol_print_if_customer_points> Print the line IF customer points > 0
|
* <dol_print_if_customer_points> Print the line IF customer points > 0
|
||||||
* <dol_print_if_order_points> Print the line IF points of the order > 0
|
* <dol_print_if_object_points> Print the line IF points of the object > 0
|
||||||
* <dol_print_if_customer_tax_number> Print the line IF customer has vat number
|
* <dol_print_if_customer_tax_number> Print the line IF customer has vat number
|
||||||
* <dol_print_if_customer_account_balance_positive> Print the line IF customer balance > 0
|
* <dol_print_if_customer_account_balance_positive> Print the line IF customer balance > 0
|
||||||
*
|
*
|
||||||
@ -141,6 +141,7 @@ class dolReceiptPrinter extends Printer
|
|||||||
{
|
{
|
||||||
$this->db=$db;
|
$this->db=$db;
|
||||||
$this->tags = array(
|
$this->tags = array(
|
||||||
|
'dol_line_feed',
|
||||||
'dol_align_left',
|
'dol_align_left',
|
||||||
'dol_align_center',
|
'dol_align_center',
|
||||||
'dol_align_right',
|
'dol_align_right',
|
||||||
@ -167,7 +168,8 @@ class dolReceiptPrinter extends Printer
|
|||||||
'dol_cut_paper_full',
|
'dol_cut_paper_full',
|
||||||
'dol_cut_paper_partial',
|
'dol_cut_paper_partial',
|
||||||
'dol_open_drawer',
|
'dol_open_drawer',
|
||||||
'dol_activate_buzzer',
|
//'dol_activate_buzzer',
|
||||||
|
'dol_print_text',
|
||||||
'dol_print_qrcode',
|
'dol_print_qrcode',
|
||||||
'dol_print_date',
|
'dol_print_date',
|
||||||
'dol_print_date_time',
|
'dol_print_date_time',
|
||||||
@ -181,12 +183,14 @@ class dolReceiptPrinter extends Printer
|
|||||||
'dol_print_payment',
|
'dol_print_payment',
|
||||||
'dol_print_logo',
|
'dol_print_logo',
|
||||||
'dol_print_logo_old',
|
'dol_print_logo_old',
|
||||||
'dol_print_order_lines',
|
'dol_print_object_id',
|
||||||
'dol_print_order_tax',
|
'dol_print_object_ref',
|
||||||
'dol_print_order_local_tax',
|
'dol_print_object_lines',
|
||||||
'dol_print_order_total',
|
'dol_print_object_tax',
|
||||||
'dol_print_order_number',
|
'dol_print_object_local_tax',
|
||||||
'dol_print_order_number_unique',
|
'dol_print_object_total',
|
||||||
|
'dol_print_object_number',
|
||||||
|
'dol_print_object_number_unique',
|
||||||
'dol_print_customer_firstname',
|
'dol_print_customer_firstname',
|
||||||
'dol_print_customer_lastname',
|
'dol_print_customer_lastname',
|
||||||
'dol_print_customer_mail',
|
'dol_print_customer_mail',
|
||||||
@ -199,13 +203,13 @@ class dolReceiptPrinter extends Printer
|
|||||||
'dol_print_vendor_firstname',
|
'dol_print_vendor_firstname',
|
||||||
'dol_print_vendor_mail',
|
'dol_print_vendor_mail',
|
||||||
'dol_print_customer_points',
|
'dol_print_customer_points',
|
||||||
'dol_print_order_points',
|
'dol_print_object_points',
|
||||||
'dol_print_if_customer',
|
'dol_print_if_customer',
|
||||||
'dol_print_if_vendor',
|
'dol_print_if_vendor',
|
||||||
'dol_print_if_happy_hour',
|
'dol_print_if_happy_hour',
|
||||||
'dol_print_if_num_order_unique',
|
'dol_print_if_num_object_unique',
|
||||||
'dol_print_if_customer_points',
|
'dol_print_if_customer_points',
|
||||||
'dol_print_if_order_points',
|
'dol_print_if_object_points',
|
||||||
'dol_print_if_customer_tax_number',
|
'dol_print_if_customer_tax_number',
|
||||||
'dol_print_if_customer_account_balance_positive',
|
'dol_print_if_customer_account_balance_positive',
|
||||||
);
|
);
|
||||||
@ -521,12 +525,13 @@ class dolReceiptPrinter extends Printer
|
|||||||
*/
|
*/
|
||||||
public function sendToPrinter($object, $templateid, $printerid)
|
public function sendToPrinter($object, $templateid, $printerid)
|
||||||
{
|
{
|
||||||
global $conf;
|
global $conf, $mysoc;
|
||||||
$error = 0;
|
$error = 0;
|
||||||
$ret = $this->loadTemplate($templateid);
|
$ret = $this->loadTemplate($templateid);
|
||||||
|
|
||||||
// tags a remplacer par leur valeur avant de parser
|
// tags a remplacer par leur valeur avant de parser
|
||||||
$this->template = str_replace('<dol_print_num_order>', $object->id, $this->template);
|
$this->template = str_replace('<dol_print_object_id>', $object->id, $this->template);
|
||||||
|
$this->template = str_replace('<dol_print_object_ref>', $object->ref, $this->template);
|
||||||
$this->template = str_replace('<dol_print_customer_firstname>', $object->customer_firstname, $this->template);
|
$this->template = str_replace('<dol_print_customer_firstname>', $object->customer_firstname, $this->template);
|
||||||
$this->template = str_replace('<dol_print_customer_lastname>', $object->customer_lastname, $this->template);
|
$this->template = str_replace('<dol_print_customer_lastname>', $object->customer_lastname, $this->template);
|
||||||
$this->template = str_replace('<dol_print_customer_mail>', $object->customer_mail, $this->template);
|
$this->template = str_replace('<dol_print_customer_mail>', $object->customer_mail, $this->template);
|
||||||
@ -536,7 +541,7 @@ class dolReceiptPrinter extends Printer
|
|||||||
$this->template = str_replace('<dol_print_customer_tax_number>', $object->customer_tax_number, $this->template);
|
$this->template = str_replace('<dol_print_customer_tax_number>', $object->customer_tax_number, $this->template);
|
||||||
$this->template = str_replace('<dol_print_customer_account_balance>', $object->customer_account_balance, $this->template);
|
$this->template = str_replace('<dol_print_customer_account_balance>', $object->customer_account_balance, $this->template);
|
||||||
$this->template = str_replace('<dol_print_customer_points>', $object->customer_points, $this->template);
|
$this->template = str_replace('<dol_print_customer_points>', $object->customer_points, $this->template);
|
||||||
$this->template = str_replace('<dol_print_order_points>', $object->order_points, $this->template);
|
$this->template = str_replace('<dol_print_object_points>', $object->object_points, $this->template);
|
||||||
$this->template = str_replace('<dol_print_vendor_firstname>', $object->vendor_firstname, $this->template);
|
$this->template = str_replace('<dol_print_vendor_firstname>', $object->vendor_firstname, $this->template);
|
||||||
$this->template = str_replace('<dol_print_vendor_lastname>', $object->vendor_lastname, $this->template);
|
$this->template = str_replace('<dol_print_vendor_lastname>', $object->vendor_lastname, $this->template);
|
||||||
$this->template = str_replace('<dol_print_vendor_mail>', $object->vendor_mail, $this->template);
|
$this->template = str_replace('<dol_print_vendor_mail>', $object->vendor_mail, $this->template);
|
||||||
@ -558,78 +563,92 @@ class dolReceiptPrinter extends Printer
|
|||||||
//print '<pre>'.print_r($vals, true).'</pre>';
|
//print '<pre>'.print_r($vals, true).'</pre>';
|
||||||
// print ticket
|
// print ticket
|
||||||
$level = 0;
|
$level = 0;
|
||||||
$html = '<table border="1" style="width:210px"><pre>';
|
$nbcaractbyline = 47;
|
||||||
$ret = $this->initPrinter($printerid);
|
$ret = $this->initPrinter($printerid);
|
||||||
if ($ret>0) {
|
if ($ret>0) {
|
||||||
setEventMessages($this->error, $this->errors, 'errors');
|
setEventMessages($this->error, $this->errors, 'errors');
|
||||||
} else {
|
} else {
|
||||||
$nboflines = count($vals);
|
$nboflines = count($vals);
|
||||||
for ($line=0; $line < $nboflines; $line++) {
|
for ($tplline=0; $tplline < $nboflines; $tplline++) {
|
||||||
switch ($vals[$line]['tag']) {
|
//var_dump($vals[$tplline]['value']);
|
||||||
|
switch ($vals[$tplline]['tag']) {
|
||||||
|
case 'DOL_PRINT_TEXT':
|
||||||
|
$this->printer->text($vals[$tplline]['value']);
|
||||||
|
break;
|
||||||
|
case 'DOL_PRINT_OBJECT_LINES':
|
||||||
|
foreach ($object->lines as $line) {
|
||||||
|
$spacestoadd = $nbcaractbyline - strlen($line->ref) - strlen(price($line->total_ttc, 'MT'));
|
||||||
|
$spaces = str_repeat(' ', $spacestoadd);
|
||||||
|
$this->printer->text($line->ref.$spaces.price($line->total_ttc, 'MT')."\n");
|
||||||
|
//var_dump($line->ref);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'DOL_LINE_FEED':
|
||||||
|
$this->printer->feed();
|
||||||
|
break;
|
||||||
case 'DOL_ALIGN_CENTER':
|
case 'DOL_ALIGN_CENTER':
|
||||||
$this->printer->setJustification(Escpos::JUSTIFY_CENTER);
|
$this->printer->setJustification(Printer::JUSTIFY_CENTER);
|
||||||
$html.='<center>';
|
|
||||||
$this->printer->text($vals[$line]['value']);
|
|
||||||
break;
|
break;
|
||||||
case 'DOL_ALIGN_RIGHT':
|
case 'DOL_ALIGN_RIGHT':
|
||||||
$this->printer->setJustification(Escpos::JUSTIFY_RIGHT);
|
$this->printer->setJustification(Printer::JUSTIFY_RIGHT);
|
||||||
$html.='<right>';
|
|
||||||
break;
|
break;
|
||||||
case 'DOL_ALIGN_LEFT':
|
case 'DOL_ALIGN_LEFT':
|
||||||
$this->printer->setJustification(Escpos::JUSTIFY_LEFT);
|
$this->printer->setJustification(Printer::JUSTIFY_LEFT);
|
||||||
$html.='<left>';
|
|
||||||
break;
|
break;
|
||||||
case 'DOL_OPEN_DRAWER':
|
case 'DOL_OPEN_DRAWER':
|
||||||
$this->printer->pulse();
|
$this->printer->pulse();
|
||||||
$html.= ' ϟ'.nl2br($vals[$line]['value']);
|
|
||||||
break;
|
break;
|
||||||
case 'DOL_ACTIVATE_BUZZER':
|
case 'DOL_ACTIVATE_BUZZER':
|
||||||
//$this->printer->buzzer();
|
//$this->printer->buzzer();
|
||||||
$html.= ' ♫'.nl2br($vals[$line]['value']);
|
|
||||||
break;
|
break;
|
||||||
case 'DOL_PRINT_BARCODE':
|
case 'DOL_PRINT_BARCODE':
|
||||||
// $vals[$line]['value'] -> barcode($content, $type)
|
// $vals[$tplline]['value'] -> barcode($content, $type)
|
||||||
$this->printer->barcode($object->barcode);
|
$this->printer->barcode($object->barcode);
|
||||||
break;
|
break;
|
||||||
|
case 'DOL_PRINT_LOGO':
|
||||||
|
// $vals[$tplline]['value'] -> barcode($content, $type)
|
||||||
|
$img = EscposImage::load(DOL_DATA_ROOT .'/mycompany/logos/'.$mysoc->logo);
|
||||||
|
$this->printer->graphics($img);
|
||||||
|
break;
|
||||||
|
case 'DOL_PRINT_LOGO_OLD':
|
||||||
|
// $vals[$tplline]['value'] -> barcode($content, $type)
|
||||||
|
$img = EscposImage::load(DOL_DATA_ROOT .'/mycompany/logos/'.$mysoc->logo);
|
||||||
|
$this->printer->bitImage($img);
|
||||||
|
break;
|
||||||
case 'DOL_PRINT_BARCODE_CUSTOMER_ID':
|
case 'DOL_PRINT_BARCODE_CUSTOMER_ID':
|
||||||
// $vals[$line]['value'] -> barcode($content, $type)
|
// $vals[$tplline]['value'] -> barcode($content, $type)
|
||||||
$this->printer->barcode($object->customer_id);
|
$this->printer->barcode($object->customer_id);
|
||||||
break;
|
break;
|
||||||
case 'DOL_PRINT_QRCODE':
|
case 'DOL_PRINT_QRCODE':
|
||||||
// $vals[$line]['value'] -> qrCode($content, $ec, $size, $model)
|
// $vals[$tplline]['value'] -> qrCode($content, $ec, $size, $model)
|
||||||
$this->printer->qrcode($vals[$line]['value']);
|
$this->printer->qrcode($vals[$tplline]['value']);
|
||||||
$html.='QRCODE: '.$vals[$line]['value'];
|
|
||||||
break;
|
break;
|
||||||
case 'DOL_CUT_PAPER_FULL':
|
case 'DOL_CUT_PAPER_FULL':
|
||||||
$this->printer->cut(Escpos::CUT_FULL);
|
$this->printer->cut(Printer::CUT_FULL);
|
||||||
$html.= ' ✂'.nl2br($vals[$line]['value']);
|
|
||||||
break;
|
break;
|
||||||
case 'DOL_CUT_PAPER_PARTIAL':
|
case 'DOL_CUT_PAPER_PARTIAL':
|
||||||
$this->printer->cut(Escpos::CUT_PARTIAL);
|
$this->printer->cut(Printer::CUT_PARTIAL);
|
||||||
$html.= ' ✂'.nl2br($vals[$line]['value']);
|
|
||||||
break;
|
break;
|
||||||
case 'DOL_USE_FONT_A':
|
case 'DOL_USE_FONT_A':
|
||||||
$this->printer->setFont(Escpos::FONT_A);
|
$this->printer->setFont(Printer::FONT_A);
|
||||||
$this->printer->text($vals[$line]['value']);
|
$this->printer->text($vals[$tplline]['value']);
|
||||||
break;
|
break;
|
||||||
case 'DOL_USE_FONT_B':
|
case 'DOL_USE_FONT_B':
|
||||||
$this->printer->setFont(Escpos::FONT_B);
|
$this->printer->setFont(Printer::FONT_B);
|
||||||
$this->printer->text($vals[$line]['value']);
|
$this->printer->text($vals[$tplline]['value']);
|
||||||
break;
|
break;
|
||||||
case 'DOL_USE_FONT_C':
|
case 'DOL_USE_FONT_C':
|
||||||
$this->printer->setFont(Escpos::FONT_C);
|
$this->printer->setFont(Printer::FONT_C);
|
||||||
$this->printer->text($vals[$line]['value']);
|
$this->printer->text($vals[$tplline]['value']);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$this->printer->text($vals[$line]['value']);
|
$this->printer->text($vals[$tplline]['value']);
|
||||||
$html.= nl2br($vals[$line]['value']);
|
$html.= nl2br($vals[$tplline]['value']);
|
||||||
$this->errors[] = 'UnknowTag: <'.strtolower($vals[$line]['tag']).'>';
|
$this->errors[] = 'UnknowTag: <'.strtolower($vals[$tplline]['tag']).'>';
|
||||||
$error++;
|
$error++;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$html.= '</pre></table>';
|
|
||||||
print $html;
|
|
||||||
// Close and print
|
// Close and print
|
||||||
// uncomment next line to see content sent to printer
|
// uncomment next line to see content sent to printer
|
||||||
//print '<pre>'.print_r($this->connector, true).'</pre>';
|
//print '<pre>'.print_r($this->connector, true).'</pre>';
|
||||||
|
|||||||
@ -29,6 +29,7 @@ PROFILE_SIMPLE_HELP=Simple Profile No Graphics
|
|||||||
PROFILE_EPOSTEP_HELP=Epos Tep Profile
|
PROFILE_EPOSTEP_HELP=Epos Tep Profile
|
||||||
PROFILE_P822D_HELP=P822D Profile No Graphics
|
PROFILE_P822D_HELP=P822D Profile No Graphics
|
||||||
PROFILE_STAR_HELP=Star Profile
|
PROFILE_STAR_HELP=Star Profile
|
||||||
|
DOL_LINE_FEED=Skip line
|
||||||
DOL_ALIGN_LEFT=Left align text
|
DOL_ALIGN_LEFT=Left align text
|
||||||
DOL_ALIGN_CENTER=Center text
|
DOL_ALIGN_CENTER=Center text
|
||||||
DOL_ALIGN_RIGHT=Right align text
|
DOL_ALIGN_RIGHT=Right align text
|
||||||
@ -42,3 +43,5 @@ DOL_CUT_PAPER_PARTIAL=Cut ticket partially
|
|||||||
DOL_OPEN_DRAWER=Open cash drawer
|
DOL_OPEN_DRAWER=Open cash drawer
|
||||||
DOL_ACTIVATE_BUZZER=Activate buzzer
|
DOL_ACTIVATE_BUZZER=Activate buzzer
|
||||||
DOL_PRINT_QRCODE=Print QR Code
|
DOL_PRINT_QRCODE=Print QR Code
|
||||||
|
DOL_PRINT_LOGO=Print logo of my company
|
||||||
|
DOL_PRINT_LOGO_OLD=Print logo of my company (old printers)
|
||||||
|
|||||||
@ -68,6 +68,7 @@ if (GETPOST('action', 'alpha') == 'set')
|
|||||||
$res = dolibarr_set_const($db, "TAKEPOS_ROOT_CATEGORY_ID", GETPOST('TAKEPOS_ROOT_CATEGORY_ID', 'alpha'), 'chaine', 0, '', $conf->entity);
|
$res = dolibarr_set_const($db, "TAKEPOS_ROOT_CATEGORY_ID", GETPOST('TAKEPOS_ROOT_CATEGORY_ID', 'alpha'), 'chaine', 0, '', $conf->entity);
|
||||||
|
|
||||||
$res = dolibarr_set_const($db, "TAKEPOSCONNECTOR", GETPOST('TAKEPOSCONNECTOR', 'alpha'), 'chaine', 0, '', $conf->entity);
|
$res = dolibarr_set_const($db, "TAKEPOSCONNECTOR", GETPOST('TAKEPOSCONNECTOR', 'alpha'), 'chaine', 0, '', $conf->entity);
|
||||||
|
$res = dolibarr_set_const($db, "TAKEPOS_DOLIBARR_PRINTER", GETPOST('TAKEPOS_DOLIBARR_PRINTER', 'alpha'), 'chaine', 0, '', $conf->entity);
|
||||||
$res = dolibarr_set_const($db, "TAKEPOS_BAR_RESTAURANT", GETPOST('TAKEPOS_BAR_RESTAURANT', 'alpha'), 'chaine', 0, '', $conf->entity);
|
$res = dolibarr_set_const($db, "TAKEPOS_BAR_RESTAURANT", GETPOST('TAKEPOS_BAR_RESTAURANT', 'alpha'), 'chaine', 0, '', $conf->entity);
|
||||||
$res = dolibarr_set_const($db, "TAKEPOS_TICKET_VAT_GROUPPED", GETPOST('TAKEPOS_TICKET_VAT_GROUPPED', 'alpha'), 'chaine', 0, '', $conf->entity);
|
$res = dolibarr_set_const($db, "TAKEPOS_TICKET_VAT_GROUPPED", GETPOST('TAKEPOS_TICKET_VAT_GROUPPED', 'alpha'), 'chaine', 0, '', $conf->entity);
|
||||||
$res = dolibarr_set_const($db, "TAKEPOS_PRINT_SERVER", GETPOST('TAKEPOS_PRINT_SERVER', 'alpha'), 'chaine', 0, '', $conf->entity);
|
$res = dolibarr_set_const($db, "TAKEPOS_PRINT_SERVER", GETPOST('TAKEPOS_PRINT_SERVER', 'alpha'), 'chaine', 0, '', $conf->entity);
|
||||||
@ -163,6 +164,15 @@ print $form->select_all_categories(Categorie::TYPE_PRODUCT, $conf->global->TAKEP
|
|||||||
print ajax_combobox('TAKEPOS_ROOT_CATEGORY_ID');
|
print ajax_combobox('TAKEPOS_ROOT_CATEGORY_ID');
|
||||||
print "</td></tr>\n";
|
print "</td></tr>\n";
|
||||||
|
|
||||||
|
if ($conf->receiptprinter->enabled) {
|
||||||
|
// Use Dolibarr printing
|
||||||
|
print '<tr class="oddeven"><td>';
|
||||||
|
print $langs->trans("DolibarrReceiptPrinterModule");
|
||||||
|
print '<td colspan="2">';
|
||||||
|
print $form->selectyesno("TAKEPOS_DOLIBARR_PRINTER", $conf->global->TAKEPOS_DOLIBARR_PRINTER, 1);
|
||||||
|
print "</td></tr>\n";
|
||||||
|
}
|
||||||
|
|
||||||
// Use Takepos printing
|
// Use Takepos printing
|
||||||
print '<tr class="oddeven"><td>';
|
print '<tr class="oddeven"><td>';
|
||||||
print $langs->trans("DolibarrReceiptPrinter").' (<a href="http://en.takepos.com/connector" target="_blank">'.$langs->trans("TakeposConnectorNecesary").'</a>)';
|
print $langs->trans("DolibarrReceiptPrinter").' (<a href="http://en.takepos.com/connector" target="_blank">'.$langs->trans("TakeposConnectorNecesary").'</a>)';
|
||||||
|
|||||||
@ -81,6 +81,7 @@ if (GETPOST('action', 'alpha') == 'set')
|
|||||||
}
|
}
|
||||||
$res = dolibarr_set_const($db, "CASHDESK_ID_WAREHOUSE".$terminaltouse, (GETPOST('CASHDESK_ID_WAREHOUSE'.$terminaltouse, 'alpha') > 0 ? GETPOST('CASHDESK_ID_WAREHOUSE'.$terminaltouse, 'alpha') : ''), 'chaine', 0, '', $conf->entity);
|
$res = dolibarr_set_const($db, "CASHDESK_ID_WAREHOUSE".$terminaltouse, (GETPOST('CASHDESK_ID_WAREHOUSE'.$terminaltouse, 'alpha') > 0 ? GETPOST('CASHDESK_ID_WAREHOUSE'.$terminaltouse, 'alpha') : ''), 'chaine', 0, '', $conf->entity);
|
||||||
$res = dolibarr_set_const($db, "CASHDESK_NO_DECREASE_STOCK".$terminaltouse, GETPOST('CASHDESK_NO_DECREASE_STOCK'.$terminaltouse, 'alpha'), 'chaine', 0, '', $conf->entity);
|
$res = dolibarr_set_const($db, "CASHDESK_NO_DECREASE_STOCK".$terminaltouse, GETPOST('CASHDESK_NO_DECREASE_STOCK'.$terminaltouse, 'alpha'), 'chaine', 0, '', $conf->entity);
|
||||||
|
$res = dolibarr_set_const($db, "TAKEPOS_PRINTER_TO_USE".$terminaltouse, GETPOST('TAKEPOS_PRINTER_TO_USE'.$terminaltouse, 'alpha'), 'chaine', 0, '', $conf->entity);
|
||||||
|
|
||||||
dol_syslog("admin/cashdesk: level ".GETPOST('level', 'alpha'));
|
dol_syslog("admin/cashdesk: level ".GETPOST('level', 'alpha'));
|
||||||
|
|
||||||
@ -193,6 +194,20 @@ if (! empty($conf->stock->enabled))
|
|||||||
print '<span class="opacitymedium">'.$langs->trans("StockDecreaseForPointOfSaleDisabled").'</span>';
|
print '<span class="opacitymedium">'.$langs->trans("StockDecreaseForPointOfSaleDisabled").'</span>';
|
||||||
}
|
}
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
if ($conf->receiptprinter->enabled) {
|
||||||
|
// Select printer to use with terminal
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/class/dolreceiptprinter.class.php';
|
||||||
|
$printer = new dolReceiptPrinter($db);
|
||||||
|
$printer->listprinters();
|
||||||
|
$printers = array();
|
||||||
|
foreach ($printer->listprinters as $key => $value) {
|
||||||
|
$printers[$key] = $value['name'];
|
||||||
|
}
|
||||||
|
print '<tr class="oddeven"><td>'.$langs->trans("TakeposTerminalPrinterToUse").'</td>';
|
||||||
|
print '<td>';
|
||||||
|
print $form->selectarray('TAKEPOS_PRINTER_TO_USE'.$terminal, $printers, (empty($conf->global->{'TAKEPOS_PRINTER_TO_USE'.$terminal})?'0':$conf->global->{'TAKEPOS_PRINTER_TO_USE'.$terminal}), 1);
|
||||||
|
print '</td></tr>';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|||||||
@ -444,8 +444,13 @@ if ($action=="valid" || $action=="history")
|
|||||||
else $sectionwithinvoicelink.=$langs->trans('BillShortStatusValidated');
|
else $sectionwithinvoicelink.=$langs->trans('BillShortStatusValidated');
|
||||||
}
|
}
|
||||||
$sectionwithinvoicelink.='</span>';
|
$sectionwithinvoicelink.='</span>';
|
||||||
if ($conf->global->TAKEPOSCONNECTOR) $sectionwithinvoicelink.=' <button id="buttonprint" type="button" onclick="TakeposPrinting('.$placeid.');">'.$langs->trans('PrintTicket').'</button>';
|
if ($conf->global->TAKEPOSCONNECTOR) {
|
||||||
else $sectionwithinvoicelink.=' <button id="buttonprint" type="button" onclick="Print('.$placeid.');">'.$langs->trans('PrintTicket').'</button>';
|
$sectionwithinvoicelink.=' <button id="buttonprint" type="button" onclick="TakeposPrinting('.$placeid.');">'.$langs->trans('PrintTicket').'</button>';
|
||||||
|
} elseif ($conf->global->TAKEPOS_DOLIBARR_PRINTER) {
|
||||||
|
$sectionwithinvoicelink.=' <button id="buttonprint" type="button" onclick="DolibarrTakeposPrinting('.$placeid.');">'.$langs->trans('PrintTicket').'</button>';
|
||||||
|
} else {
|
||||||
|
$sectionwithinvoicelink.=' <button id="buttonprint" type="button" onclick="Print('.$placeid.');">'.$langs->trans('PrintTicket').'</button>';
|
||||||
|
}
|
||||||
if ($conf->global->TAKEPOS_AUTO_PRINT_TICKETS) $sectionwithinvoicelink.='<script language="javascript">$("#buttonprint").click();</script>';
|
if ($conf->global->TAKEPOS_AUTO_PRINT_TICKETS) $sectionwithinvoicelink.='<script language="javascript">$("#buttonprint").click();</script>';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -548,6 +553,18 @@ function TakeposPrinting(id){
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
function DolibarrTakeposPrinting(id) {
|
||||||
|
console.log('Printing ticket ' + id)
|
||||||
|
var receipt;
|
||||||
|
// $.get("receipt.php?facid="+id, function(data, status) {
|
||||||
|
// receipt=data.replace(/([^>\r\n]?)(\r\n|\n\r|\r|\n)/g, '');
|
||||||
|
// $.ajax({
|
||||||
|
// type: "POST",
|
||||||
|
// url: 'http://<?php print $conf->global->TAKEPOS_PRINT_SERVER; ?>:8111/print',
|
||||||
|
// data: receipt
|
||||||
|
// });
|
||||||
|
// });
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|||||||
@ -545,6 +545,15 @@ function OpenDrawer(){
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function DolibarrOpenDrawer(){
|
||||||
|
console.log("DolibarrOpenDrawer");
|
||||||
|
// $.ajax({
|
||||||
|
// type: "POST",
|
||||||
|
// url: 'http://',
|
||||||
|
// data: "opendrawer"
|
||||||
|
// });
|
||||||
|
}
|
||||||
|
|
||||||
function MoreActions(totalactions){
|
function MoreActions(totalactions){
|
||||||
if (pageactions==0){
|
if (pageactions==0){
|
||||||
pageactions=1;
|
pageactions=1;
|
||||||
@ -701,8 +710,11 @@ if ($conf->global->TAKEPOS_BAR_RESTAURANT)
|
|||||||
//add temp ticket button
|
//add temp ticket button
|
||||||
if ($conf->global->TAKEPOS_BAR_RESTAURANT)
|
if ($conf->global->TAKEPOS_BAR_RESTAURANT)
|
||||||
{
|
{
|
||||||
if ($conf->global->TAKEPOSCONNECTOR) $menus[$r++]=array('title'=>'<span class="fa fa-receipt paddingrightonly"></span><div class="trunc">'.$langs->trans("Receipt").'</div>','action'=>'TakeposPrinting(placeid);');
|
if ($conf->global->TAKEPOSCONNECTOR) {
|
||||||
else $menus[$r++]=array('title'=>'<span class="fa fa-receipt paddingrightonly"></span><div class="trunc">'.$langs->trans("Receipt").'</div>','action'=>'Print(placeid);');
|
$menus[$r++]=array('title'=>'<span class="fa fa-receipt paddingrightonly"></span><div class="trunc">'.$langs->trans("Receipt").'</div>','action'=>'TakeposPrinting(placeid);');
|
||||||
|
} else {
|
||||||
|
$menus[$r++]=array('title'=>'<span class="fa fa-receipt paddingrightonly"></span><div class="trunc">'.$langs->trans("Receipt").'</div>','action'=>'Print(placeid);');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if ($conf->global->TAKEPOSCONNECTOR && $conf->global->TAKEPOS_ORDER_NOTES==1)
|
if ($conf->global->TAKEPOSCONNECTOR && $conf->global->TAKEPOS_ORDER_NOTES==1)
|
||||||
{
|
{
|
||||||
@ -713,6 +725,12 @@ if ($conf->global->TAKEPOS_BAR_RESTAURANT)
|
|||||||
if ($conf->global->TAKEPOSCONNECTOR) {
|
if ($conf->global->TAKEPOSCONNECTOR) {
|
||||||
$menus[$r++]=array('title'=>'<span class="fa fa-receipt paddingrightonly"></span><div class="trunc">'.$langs->trans("DOL_OPEN_DRAWER").'</div>', 'action'=>'OpenDrawer();');
|
$menus[$r++]=array('title'=>'<span class="fa fa-receipt paddingrightonly"></span><div class="trunc">'.$langs->trans("DOL_OPEN_DRAWER").'</div>', 'action'=>'OpenDrawer();');
|
||||||
}
|
}
|
||||||
|
if ($conf->global->TAKEPOS_DOLIBARR_PRINTER) {
|
||||||
|
$menus[$r++] = array(
|
||||||
|
'title' => '<span class="fa fa-receipt paddingrightonly"></span><div class="trunc">'.$langs->trans("DOL_OPEN_DRAWER").'</div>',
|
||||||
|
'action' => 'DolibarrOpenDrawer();',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
$hookmanager->initHooks(array('takeposfrontend'));
|
$hookmanager->initHooks(array('takeposfrontend'));
|
||||||
$reshook=$hookmanager->executeHooks('ActionButtons');
|
$reshook=$hookmanager->executeHooks('ActionButtons');
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user