qr.php 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <?php
  2. /* Copyright (C) 2020 Andreu Bisquerra <jove@bisquerra.com>
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation; either version 3 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  16. */
  17. // This page return an image of a QR code
  18. if (!defined("NOLOGIN")) {
  19. define("NOLOGIN", '1'); // If this page is public (can be called outside logged session)
  20. }
  21. if (!defined('NOIPCHECK')) {
  22. define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
  23. }
  24. if (!defined('NOREQUIRESOC')) {
  25. define('NOREQUIRESOC', '1');
  26. }
  27. if (!defined('NOCSRFCHECK')) {
  28. define('NOCSRFCHECK', '1');
  29. }
  30. if (!defined('NOTOKENRENEWAL')) {
  31. define('NOTOKENRENEWAL', '1');
  32. }
  33. if (!defined('NOREQUIREMENU')) {
  34. define('NOREQUIREMENU', '1');
  35. }
  36. if (!defined('NOREQUIREHTML')) {
  37. define('NOREQUIREHTML', '1');
  38. }
  39. if (!defined('NOREQUIREAJAX')) {
  40. define('NOREQUIREAJAX', '1');
  41. }
  42. require '../../main.inc.php'; // Load $user and permissions
  43. require '../../core/modules/barcode/doc/tcpdfbarcode.modules.php';
  44. $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
  45. $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
  46. /*
  47. * View
  48. */
  49. // The buildBarCode does not include the http headers but this is a page that just return an image.
  50. if (GETPOSTISSET("key")) {
  51. $key = GETPOST('key');
  52. $module = new modTcpdfbarcode();
  53. $result = $module->buildBarCode($urlwithroot."/takepos/public/auto_order.php?key=".$key, 'QRCODE', 'Y');
  54. } else {
  55. $module = new modTcpdfbarcode();
  56. $result = $module->buildBarCode($urlwithroot."/takepos/public/menu.php", 'QRCODE', 'Y');
  57. }