forked from Wavyzz/dolibarr
rework an experimental module
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
License
|
||||
-------
|
||||
|
||||
Dolibarr is released under the terms of the GNU General Public License as
|
||||
Dolibarr is released under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 3 of the License,
|
||||
or (at your option) any later version (GPL-3+).
|
||||
More information: https://www.gnu.org/licenses/gpl-3.0.txt
|
||||
@@ -15,13 +15,13 @@ PHP libraries:
|
||||
AdoDb-Date 0.36 Modified BSD License Yes Date convertion (not into rpm package)
|
||||
CKEditor 4.12.1 LGPL-2.1+ Yes Editor WYSIWYG
|
||||
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)
|
||||
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)
|
||||
PEAR Mail_MIME 1.8.9 BSD Yes NuSoap dependency
|
||||
ParseDown 1.6 MIT License Yes Markdown parser
|
||||
PHPDebugBar 1.15.0 MIT License Yes Used only by the module "debugbar" for developers
|
||||
PHPDebugBar 1.15.0 MIT License Yes Used only by the module "debugbar" for developers
|
||||
PHPExcel 1.8.1 LGPL-2.1+ Yes Read/Write XLS files, read ODS files
|
||||
PHPSpreadSheet ? LGPL-2.1+ Yes Read/Write XLS files, read ODS files
|
||||
php-iban 1.4.7 LGPL-3+ Yes Parse and validate IBAN (and IIBAN) bank account information in PHP
|
||||
@@ -37,7 +37,7 @@ TCPDF 6.3.2 LGPL-3+ Yes
|
||||
TCPDI 1.0.0 LGPL-3+ / Apache 2.0 Yes FPDI replacement
|
||||
|
||||
JS libraries:
|
||||
Ace 1.4.6 BSD Yes JS library to get code syntaxique coloration in a textarea.
|
||||
Ace 1.4.6 BSD Yes JS library to get code syntaxique coloration in a textarea.
|
||||
jQuery 3.4.1 MIT License Yes JS library
|
||||
jQuery UI 1.12.1 GPL and MIT License Yes JS library plugin UI
|
||||
jQuery select2 4.0.5 GPL and Apache License Yes JS library plugin for sexier multiselect
|
||||
|
||||
@@ -174,14 +174,19 @@ if ($action == 'testtemplate' && $user->admin) {
|
||||
// }
|
||||
|
||||
// if (! $error) {
|
||||
// // test
|
||||
// $ret = $printer->sendTestToPrinter($printerid);
|
||||
// if ($ret == 0) {
|
||||
setEventMessages($langs->trans("TestTemplateToPrinter", $printername), null);
|
||||
// } else {
|
||||
// setEventMessages($printer->error, $printer->errors, 'errors');
|
||||
// }
|
||||
// }
|
||||
// test
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
|
||||
$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);
|
||||
} else {
|
||||
setEventMessages($printer->error, $printer->errors, 'errors');
|
||||
}
|
||||
//}
|
||||
$action = '';
|
||||
}
|
||||
|
||||
@@ -310,7 +315,7 @@ if ($mode == 'config' && $user->admin) {
|
||||
}
|
||||
}
|
||||
|
||||
if ($action!='editprinter') {
|
||||
if ($action != 'editprinter') {
|
||||
if ($nbofprinters > 0) {
|
||||
print '<tr class="liste_titre">';
|
||||
print '<th>'.$langs->trans("Name").'</th>';
|
||||
@@ -446,7 +451,7 @@ if ($mode == 'template' && $user->admin) {
|
||||
}
|
||||
print '</form>';
|
||||
print '<div><p></div>';
|
||||
print '<table class="noborder" width="100%">'."\n";
|
||||
print '<table class="noborder centpercent">'."\n";
|
||||
print '<tr class="liste_titre">';
|
||||
print '<th>'.$langs->trans("Tag").'</th>';
|
||||
print '<th>'.$langs->trans("Description").'</th>';
|
||||
@@ -462,18 +467,6 @@ if ($mode == 'template' && $user->admin) {
|
||||
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
|
||||
llxFooter();
|
||||
$db->close();
|
||||
|
||||
@@ -59,12 +59,12 @@
|
||||
* <dol_print_payment> Print payment method
|
||||
* <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_order_lines> Print order lines
|
||||
* <dol_print_order_tax> Print order total tax
|
||||
* <dol_print_order_local_tax> Print order local tax
|
||||
* <dol_print_order_total> Print order total
|
||||
* <dol_print_order_number> Print order number
|
||||
* <dol_print_order_number_unique> Print order number after validation
|
||||
* <dol_print_object_lines> Print object lines
|
||||
* <dol_print_object_tax> Print object total tax
|
||||
* <dol_print_object_local_tax> Print object local tax
|
||||
* <dol_print_object_total> Print object total
|
||||
* <dol_print_object_number> Print object number
|
||||
* <dol_print_object_number_unique> Print object number after validation
|
||||
* <dol_print_customer_firstname> Print customer firstname
|
||||
* <dol_print_customer_lastname> Print customer name
|
||||
* <dol_print_customer_mail> Print customer mail
|
||||
@@ -77,15 +77,15 @@
|
||||
* <dol_print_vendor_firstname> Print vendor firstname
|
||||
* <dol_print_vendor_mail> Print vendor mail
|
||||
* <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<69>then Print)
|
||||
* <dol_print_if_customer> Print the line IF a customer is affected to the order
|
||||
* <dol_print_if_vendor> Print the line IF a vendor 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 object
|
||||
* <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_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_account_balance_positive> Print the line IF customer balance > 0
|
||||
*
|
||||
@@ -141,6 +141,7 @@ class dolReceiptPrinter extends Printer
|
||||
{
|
||||
$this->db=$db;
|
||||
$this->tags = array(
|
||||
'dol_line_feed',
|
||||
'dol_align_left',
|
||||
'dol_align_center',
|
||||
'dol_align_right',
|
||||
@@ -167,7 +168,8 @@ class dolReceiptPrinter extends Printer
|
||||
'dol_cut_paper_full',
|
||||
'dol_cut_paper_partial',
|
||||
'dol_open_drawer',
|
||||
'dol_activate_buzzer',
|
||||
//'dol_activate_buzzer',
|
||||
'dol_print_text',
|
||||
'dol_print_qrcode',
|
||||
'dol_print_date',
|
||||
'dol_print_date_time',
|
||||
@@ -181,12 +183,14 @@ class dolReceiptPrinter extends Printer
|
||||
'dol_print_payment',
|
||||
'dol_print_logo',
|
||||
'dol_print_logo_old',
|
||||
'dol_print_order_lines',
|
||||
'dol_print_order_tax',
|
||||
'dol_print_order_local_tax',
|
||||
'dol_print_order_total',
|
||||
'dol_print_order_number',
|
||||
'dol_print_order_number_unique',
|
||||
'dol_print_object_id',
|
||||
'dol_print_object_ref',
|
||||
'dol_print_object_lines',
|
||||
'dol_print_object_tax',
|
||||
'dol_print_object_local_tax',
|
||||
'dol_print_object_total',
|
||||
'dol_print_object_number',
|
||||
'dol_print_object_number_unique',
|
||||
'dol_print_customer_firstname',
|
||||
'dol_print_customer_lastname',
|
||||
'dol_print_customer_mail',
|
||||
@@ -199,13 +203,13 @@ class dolReceiptPrinter extends Printer
|
||||
'dol_print_vendor_firstname',
|
||||
'dol_print_vendor_mail',
|
||||
'dol_print_customer_points',
|
||||
'dol_print_order_points',
|
||||
'dol_print_object_points',
|
||||
'dol_print_if_customer',
|
||||
'dol_print_if_vendor',
|
||||
'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_order_points',
|
||||
'dol_print_if_object_points',
|
||||
'dol_print_if_customer_tax_number',
|
||||
'dol_print_if_customer_account_balance_positive',
|
||||
);
|
||||
@@ -521,12 +525,13 @@ class dolReceiptPrinter extends Printer
|
||||
*/
|
||||
public function sendToPrinter($object, $templateid, $printerid)
|
||||
{
|
||||
global $conf;
|
||||
global $conf, $mysoc;
|
||||
$error = 0;
|
||||
$ret = $this->loadTemplate($templateid);
|
||||
|
||||
// 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_lastname>', $object->customer_lastname, $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_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_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_lastname>', $object->vendor_lastname, $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 ticket
|
||||
$level = 0;
|
||||
$html = '<table border="1" style="width:210px"><pre>';
|
||||
$nbcaractbyline = 47;
|
||||
$ret = $this->initPrinter($printerid);
|
||||
if ($ret>0) {
|
||||
setEventMessages($this->error, $this->errors, 'errors');
|
||||
} else {
|
||||
$nboflines = count($vals);
|
||||
for ($line=0; $line < $nboflines; $line++) {
|
||||
switch ($vals[$line]['tag']) {
|
||||
for ($tplline=0; $tplline < $nboflines; $tplline++) {
|
||||
//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':
|
||||
$this->printer->setJustification(Escpos::JUSTIFY_CENTER);
|
||||
$html.='<center>';
|
||||
$this->printer->text($vals[$line]['value']);
|
||||
$this->printer->setJustification(Printer::JUSTIFY_CENTER);
|
||||
break;
|
||||
case 'DOL_ALIGN_RIGHT':
|
||||
$this->printer->setJustification(Escpos::JUSTIFY_RIGHT);
|
||||
$html.='<right>';
|
||||
$this->printer->setJustification(Printer::JUSTIFY_RIGHT);
|
||||
break;
|
||||
case 'DOL_ALIGN_LEFT':
|
||||
$this->printer->setJustification(Escpos::JUSTIFY_LEFT);
|
||||
$html.='<left>';
|
||||
$this->printer->setJustification(Printer::JUSTIFY_LEFT);
|
||||
break;
|
||||
case 'DOL_OPEN_DRAWER':
|
||||
$this->printer->pulse();
|
||||
$html.= ' ϟ'.nl2br($vals[$line]['value']);
|
||||
break;
|
||||
case 'DOL_ACTIVATE_BUZZER':
|
||||
//$this->printer->buzzer();
|
||||
$html.= ' ♫'.nl2br($vals[$line]['value']);
|
||||
break;
|
||||
case 'DOL_PRINT_BARCODE':
|
||||
// $vals[$line]['value'] -> barcode($content, $type)
|
||||
// $vals[$tplline]['value'] -> barcode($content, $type)
|
||||
$this->printer->barcode($object->barcode);
|
||||
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':
|
||||
// $vals[$line]['value'] -> barcode($content, $type)
|
||||
// $vals[$tplline]['value'] -> barcode($content, $type)
|
||||
$this->printer->barcode($object->customer_id);
|
||||
break;
|
||||
case 'DOL_PRINT_QRCODE':
|
||||
// $vals[$line]['value'] -> qrCode($content, $ec, $size, $model)
|
||||
$this->printer->qrcode($vals[$line]['value']);
|
||||
$html.='QRCODE: '.$vals[$line]['value'];
|
||||
// $vals[$tplline]['value'] -> qrCode($content, $ec, $size, $model)
|
||||
$this->printer->qrcode($vals[$tplline]['value']);
|
||||
break;
|
||||
case 'DOL_CUT_PAPER_FULL':
|
||||
$this->printer->cut(Escpos::CUT_FULL);
|
||||
$html.= ' ✂'.nl2br($vals[$line]['value']);
|
||||
$this->printer->cut(Printer::CUT_FULL);
|
||||
break;
|
||||
case 'DOL_CUT_PAPER_PARTIAL':
|
||||
$this->printer->cut(Escpos::CUT_PARTIAL);
|
||||
$html.= ' ✂'.nl2br($vals[$line]['value']);
|
||||
$this->printer->cut(Printer::CUT_PARTIAL);
|
||||
break;
|
||||
case 'DOL_USE_FONT_A':
|
||||
$this->printer->setFont(Escpos::FONT_A);
|
||||
$this->printer->text($vals[$line]['value']);
|
||||
$this->printer->setFont(Printer::FONT_A);
|
||||
$this->printer->text($vals[$tplline]['value']);
|
||||
break;
|
||||
case 'DOL_USE_FONT_B':
|
||||
$this->printer->setFont(Escpos::FONT_B);
|
||||
$this->printer->text($vals[$line]['value']);
|
||||
$this->printer->setFont(Printer::FONT_B);
|
||||
$this->printer->text($vals[$tplline]['value']);
|
||||
break;
|
||||
case 'DOL_USE_FONT_C':
|
||||
$this->printer->setFont(Escpos::FONT_C);
|
||||
$this->printer->text($vals[$line]['value']);
|
||||
$this->printer->setFont(Printer::FONT_C);
|
||||
$this->printer->text($vals[$tplline]['value']);
|
||||
break;
|
||||
default:
|
||||
$this->printer->text($vals[$line]['value']);
|
||||
$html.= nl2br($vals[$line]['value']);
|
||||
$this->errors[] = 'UnknowTag: <'.strtolower($vals[$line]['tag']).'>';
|
||||
$this->printer->text($vals[$tplline]['value']);
|
||||
$html.= nl2br($vals[$tplline]['value']);
|
||||
$this->errors[] = 'UnknowTag: <'.strtolower($vals[$tplline]['tag']).'>';
|
||||
$error++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
$html.= '</pre></table>';
|
||||
print $html;
|
||||
// Close and print
|
||||
// uncomment next line to see content sent to printer
|
||||
//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_P822D_HELP=P822D Profile No Graphics
|
||||
PROFILE_STAR_HELP=Star Profile
|
||||
DOL_LINE_FEED=Skip line
|
||||
DOL_ALIGN_LEFT=Left align text
|
||||
DOL_ALIGN_CENTER=Center 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_ACTIVATE_BUZZER=Activate buzzer
|
||||
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, "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_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);
|
||||
@@ -163,6 +164,15 @@ print $form->select_all_categories(Categorie::TYPE_PRODUCT, $conf->global->TAKEP
|
||||
print ajax_combobox('TAKEPOS_ROOT_CATEGORY_ID');
|
||||
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
|
||||
print '<tr class="oddeven"><td>';
|
||||
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_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'));
|
||||
|
||||
@@ -193,6 +194,20 @@ if (! empty($conf->stock->enabled))
|
||||
print '<span class="opacitymedium">'.$langs->trans("StockDecreaseForPointOfSaleDisabled").'</span>';
|
||||
}
|
||||
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>';
|
||||
|
||||
@@ -444,8 +444,13 @@ if ($action=="valid" || $action=="history")
|
||||
else $sectionwithinvoicelink.=$langs->trans('BillShortStatusValidated');
|
||||
}
|
||||
$sectionwithinvoicelink.='</span>';
|
||||
if ($conf->global->TAKEPOSCONNECTOR) $sectionwithinvoicelink.=' <button id="buttonprint" type="button" onclick="TakeposPrinting('.$placeid.');">'.$langs->trans('PrintTicket').'</button>';
|
||||
else $sectionwithinvoicelink.=' <button id="buttonprint" type="button" onclick="Print('.$placeid.');">'.$langs->trans('PrintTicket').'</button>';
|
||||
if ($conf->global->TAKEPOSCONNECTOR) {
|
||||
$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>';
|
||||
}
|
||||
|
||||
@@ -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>
|
||||
|
||||
<?php
|
||||
|
||||
@@ -545,6 +545,15 @@ function OpenDrawer(){
|
||||
});
|
||||
}
|
||||
|
||||
function DolibarrOpenDrawer(){
|
||||
console.log("DolibarrOpenDrawer");
|
||||
// $.ajax({
|
||||
// type: "POST",
|
||||
// url: 'http://',
|
||||
// data: "opendrawer"
|
||||
// });
|
||||
}
|
||||
|
||||
function MoreActions(totalactions){
|
||||
if (pageactions==0){
|
||||
pageactions=1;
|
||||
@@ -701,8 +710,11 @@ if ($conf->global->TAKEPOS_BAR_RESTAURANT)
|
||||
//add temp ticket button
|
||||
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);');
|
||||
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) {
|
||||
$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)
|
||||
{
|
||||
@@ -713,6 +725,12 @@ 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("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'));
|
||||
$reshook=$hookmanager->executeHooks('ActionButtons');
|
||||
|
||||
Reference in New Issue
Block a user