From 5a5811a716b044146421a170efd193df30e8ab14 Mon Sep 17 00:00:00 2001 From: andreubisquerra Date: Sun, 9 May 2021 22:37:00 +0200 Subject: [PATCH 1/3] NEW DOL_VALUE_PLACE tag in TakePOS template Very important in restaurant orders --- htdocs/core/class/dolreceiptprinter.class.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/htdocs/core/class/dolreceiptprinter.class.php b/htdocs/core/class/dolreceiptprinter.class.php index 6933cf2c597..112f6f324d4 100644 --- a/htdocs/core/class/dolreceiptprinter.class.php +++ b/htdocs/core/class/dolreceiptprinter.class.php @@ -224,6 +224,7 @@ class dolReceiptPrinter extends Printer 'dol_value_vendor_lastname' => 'VendorLastname', 'dol_value_vendor_firstname' => 'VendorFirstname', 'dol_value_vendor_mail' => 'VendorEmail', + 'dol_value_place' => 'DOL_VALUE_PLACE', ); } @@ -564,7 +565,7 @@ class dolReceiptPrinter extends Printer */ public function sendToPrinter($object, $templateid, $printerid) { - global $conf, $mysoc, $langs, $user; + global $conf, $mysoc, $langs, $user, $db; $error = 0; $ret = $this->loadTemplate($templateid); @@ -827,6 +828,14 @@ class dolReceiptPrinter extends Printer } } break; + case 'DOL_VALUE_PLACE': ++ $sql = "SELECT floor, label FROM ".MAIN_DB_PREFIX."takepos_floor_tables where rowid=".((int) str_replace(")", "", str_replace("(PROV-POS".$_SESSION["takeposterminal"]."-", "", $object->ref))); ++ $resql = $db->query($sql); ++ $obj = $db->fetch_object($resql); ++ if ($obj) { ++ $this->printer->text($obj->label); ++ } ++ break; default: $this->printer->text($vals[$tplline]['tag']); $this->printer->text($vals[$tplline]['value']); From 8aa8c143233e13292501c8c632ff711d3e8ba9fb Mon Sep 17 00:00:00 2001 From: andreubisquerra Date: Sun, 9 May 2021 22:53:05 +0200 Subject: [PATCH 2/3] Fix --- htdocs/core/class/dolreceiptprinter.class.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/core/class/dolreceiptprinter.class.php b/htdocs/core/class/dolreceiptprinter.class.php index 112f6f324d4..aaf9e60aec5 100644 --- a/htdocs/core/class/dolreceiptprinter.class.php +++ b/htdocs/core/class/dolreceiptprinter.class.php @@ -829,13 +829,13 @@ class dolReceiptPrinter extends Printer } break; case 'DOL_VALUE_PLACE': -+ $sql = "SELECT floor, label FROM ".MAIN_DB_PREFIX."takepos_floor_tables where rowid=".((int) str_replace(")", "", str_replace("(PROV-POS".$_SESSION["takeposterminal"]."-", "", $object->ref))); -+ $resql = $db->query($sql); -+ $obj = $db->fetch_object($resql); -+ if ($obj) { -+ $this->printer->text($obj->label); -+ } -+ break; + $sql = "SELECT floor, label FROM ".MAIN_DB_PREFIX."takepos_floor_tables where rowid=".((int) str_replace(")", "", str_replace("(PROV-POS".$_SESSION["takeposterminal"]."-", "", $object->ref))); + $resql = $db->query($sql); + $obj = $db->fetch_object($resql); + if ($obj) { + $this->printer->text($obj->label); + } + break; default: $this->printer->text($vals[$tplline]['tag']); $this->printer->text($vals[$tplline]['value']); From 3ee26fc881f746e3f2305d088ce6ba6e4f1199af Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Sun, 9 May 2021 21:37:58 +0000 Subject: [PATCH 3/3] Fixing style errors. --- htdocs/core/class/dolreceiptprinter.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/dolreceiptprinter.class.php b/htdocs/core/class/dolreceiptprinter.class.php index aaf9e60aec5..205ee1eafe8 100644 --- a/htdocs/core/class/dolreceiptprinter.class.php +++ b/htdocs/core/class/dolreceiptprinter.class.php @@ -832,9 +832,9 @@ class dolReceiptPrinter extends Printer $sql = "SELECT floor, label FROM ".MAIN_DB_PREFIX."takepos_floor_tables where rowid=".((int) str_replace(")", "", str_replace("(PROV-POS".$_SESSION["takeposterminal"]."-", "", $object->ref))); $resql = $db->query($sql); $obj = $db->fetch_object($resql); - if ($obj) { - $this->printer->text($obj->label); - } + if ($obj) { + $this->printer->text($obj->label); + } break; default: $this->printer->text($vals[$tplline]['tag']);