printbox.php 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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('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_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php';
  44. global $langs, $db;
  45. $langs->loadLangs(array("bills", "cashdesk"));
  46. $facid = GETPOST('facid', 'int');
  47. $action = GETPOST('action', 'aZ09');
  48. if (empty($user->rights->takepos->run)) {
  49. accessforbidden();
  50. }
  51. /*
  52. * View
  53. */
  54. $arrayofcss = array('/takepos/css/pos.css.php');
  55. $arrayofjs = array('/takepos/js/jquery.colorbox-min.js');
  56. $head = '';
  57. top_htmlhead($head, '', 0, 0, $arrayofjs, $arrayofcss);
  58. ?>
  59. <script>
  60. /**
  61. * Save (validate)
  62. */
  63. function Save() {
  64. console.log("We click so we call page receipt.php with facid=<?php echo $facid; ?>");
  65. parent.$.colorbox.close();
  66. $.colorbox({href:"receipt.php?facid=<?php echo $facid; ?>&action=<?php echo $action; ?>&label="+$('#label').val()+"&qty="+$('#qty').val(), width:"40%", height:"90%", transition:"none", iframe:"true", title:'<?php echo dol_escape_js($langs->trans("PrintTicket")); ?>'});
  67. }
  68. jQuery(document).ready(function(){
  69. $('#label').focus()
  70. });
  71. </script>
  72. </head>
  73. <body>
  74. <br>
  75. <center>
  76. <?php
  77. if ($action == "without_details") {
  78. $label_default = getDolGlobalString('TAKEPOS_PRINT_WITHOUT_DETAILS_LABEL_DEFAULT');
  79. $qty_default = 1;
  80. print '<input type="text" id="label" name="label" class="takepospay" value="' . $label_default . '" style="width:40%;" placeholder="' . $langs->trans('Label') . '">';
  81. print '<input type="text" id="qty" name="qty" class="takepospay" value="' . $qty_default . '" style="width:10%;" placeholder="' . $langs->trans('Qty') . '">';
  82. }
  83. ?>
  84. <input type="button" class="button takepospay clearboth" value="OK" onclick="Save();">
  85. </center>
  86. </body>
  87. </html>