printbox.php 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. <?php
  2. /* Copyright (C) 2018 Andreu Bisquerra <jove@bisquerra.com>
  3. * Copyright (C) 2020 Laurent Destailleur <eldy@users.sourceforge.net>
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 3 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  17. */
  18. /**
  19. * \file htdocs/takepos/printbox.php
  20. * \ingroup takepos
  21. * \brief Popup to enter details before printing
  22. */
  23. //if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Not disabled cause need to load personalized language
  24. //if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Not disabled cause need to load personalized language
  25. //if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1');
  26. //if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1');
  27. if (!defined('NOTOKENRENEWAL')) {
  28. define('NOTOKENRENEWAL', '1');
  29. }
  30. if (!defined('NOREQUIREMENU')) {
  31. define('NOREQUIREMENU', '1');
  32. }
  33. if (!defined('NOREQUIREHTML')) {
  34. define('NOREQUIREHTML', '1');
  35. }
  36. if (!defined('NOREQUIREAJAX')) {
  37. define('NOREQUIREAJAX', '1');
  38. }
  39. // Load Dolibarr environment
  40. require '../main.inc.php'; // Load $user and permissions
  41. require_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php';
  42. global $langs, $db;
  43. $langs->loadLangs(array("bills", "cashdesk"));
  44. $facid = GETPOST('facid', 'int');
  45. $action = GETPOST('action', 'aZ09');
  46. if (!$user->hasRight('takepos', 'run')) {
  47. accessforbidden();
  48. }
  49. /*
  50. * View
  51. */
  52. $arrayofcss = array('/takepos/css/pos.css.php');
  53. $arrayofjs = array('/takepos/js/jquery.colorbox-min.js');
  54. $head = '';
  55. top_htmlhead($head, '', 0, 0, $arrayofjs, $arrayofcss);
  56. ?>
  57. <body>
  58. <script>
  59. /**
  60. * Save (validate)
  61. */
  62. function Save() {
  63. console.log("We click so we call page receipt.php with facid=<?php echo $facid; ?>");
  64. parent.$.colorbox.close();
  65. $.colorbox({ href:"receipt.php?facid=<?php echo $facid; ?>&action=<?php echo $action; ?>&token=<?php echo newToken(); ?>&label="+$('#label').val()+"&qty="+$('#qty').val(), width:"40%", height:"90%", transition:"none", iframe:"true", title:'<?php echo dol_escape_js($langs->trans("PrintTicket")); ?>'});
  66. }
  67. jQuery(document).ready(function(){
  68. $('#label').focus()
  69. });
  70. </script>
  71. <br>
  72. <center>
  73. <?php
  74. if ($action == "without_details") {
  75. $label_default = getDolGlobalString('TAKEPOS_PRINT_WITHOUT_DETAILS_LABEL_DEFAULT');
  76. $qty_default = 1;
  77. print '<input type="text" id="label" name="label" class="takepospay" value="' . $label_default . '" style="width:40%;" placeholder="' . $langs->trans('Label') . '">';
  78. print '<input type="text" id="qty" name="qty" class="takepospay" value="' . $qty_default . '" style="width:10%;" placeholder="' . $langs->trans('Qty') . '">';
  79. }
  80. ?>
  81. <input type="button" class="button takepospay clearboth" value="OK" onclick="Save();">
  82. </center>
  83. </body>
  84. </html>