2018-09-28 13:31:41 +02:00
< ? php
2022-08-21 12:28:00 +02:00
/* Copyright ( C ) 2018 Andreu Bisquerra < jove @ bisquerra . com >
* Copyright ( C ) 2021 - 2022 Thibault FOUCART < support @ ptibogxiv . net >
2024-05-01 16:20:29 +02:00
* Copyright ( C ) 2024 Frédéric France < frederic . france @ free . fr >
2025-02-18 21:48:21 +01:00
* Copyright ( C ) 2024 - 2025 MDW < mdeweerd @ users . noreply . github . com >
2018-09-28 13:31:41 +02:00
*
* This program is free software ; you can redistribute it and / or modify
* it 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 .
*
* This program is distributed in the hope that it will be useful ,
* but WITHOUT ANY WARRANTY ; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
* GNU General Public License for more details .
*
* You should have received a copy of the GNU General Public License
2019-09-23 21:55:30 +02:00
* along with this program . If not , see < https :// www . gnu . org / licenses />.
2018-09-28 13:31:41 +02:00
*/
2019-03-27 15:42:53 +01:00
/**
* \file htdocs / takepos / pay . php
* \ingroup takepos
* \brief Page with the content of the popup to enter payments
*/
2022-09-08 20:12:52 +02:00
// if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER', '1'); // Not disabled cause need to load personalized language
// if (! defined('NOREQUIREDB')) define('NOREQUIREDB', '1'); // Not disabled cause need to load personalized language
// if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC', '1');
// if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN', '1');
2021-02-26 21:17:52 +01:00
if ( ! defined ( 'NOTOKENRENEWAL' )) {
define ( 'NOTOKENRENEWAL' , '1' );
}
if ( ! defined ( 'NOREQUIREMENU' )) {
define ( 'NOREQUIREMENU' , '1' );
}
if ( ! defined ( 'NOREQUIREHTML' )) {
define ( 'NOREQUIREHTML' , '1' );
}
2018-09-28 13:31:41 +02:00
2022-09-07 20:08:59 +02:00
// Load Dolibarr environment
2019-11-28 12:36:20 +01:00
require '../main.inc.php' ; // Load $user and permissions
require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php' ;
2022-06-12 21:34:35 +02:00
require_once DOL_DOCUMENT_ROOT . '/stripe/class/stripe.class.php' ;
2018-09-28 13:31:41 +02:00
2022-09-08 20:12:52 +02:00
2024-11-04 23:53:20 +01:00
/**
* @ var Conf $conf
* @ var DoliDB $db
* @ var HookManager $hookmanager
* @ var Translate $langs
* @ var User $user
*/
2022-09-08 20:12:52 +02:00
// Load translation files required by the page
2020-06-29 17:58:04 +02:00
$langs -> loadLangs ( array ( " main " , " bills " , " cashdesk " , " banks " ));
2020-03-23 15:02:15 +01:00
$place = ( GETPOST ( 'place' , 'aZ09' ) ? GETPOST ( 'place' , 'aZ09' ) : '0' ); // $place is id of table for Bar or Restaurant
2019-03-27 20:13:12 +01:00
Fix: GETPOST(...,'int') to GETPOSTINT(...) (#28448)
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: GETPOST(...,'int') to GETPOSTINT(...)
# Fix: GETPOST(...,'int') to GETPOSTINT(...)
Converted using Phan plugin
* Fix: Update spelling exceptions
* Qual: Ignore Phan Notice
2024-02-27 14:05:53 +01:00
$invoiceid = GETPOSTINT ( 'invoiceid' );
2018-09-28 13:31:41 +02:00
2022-08-21 12:28:00 +02:00
$hookmanager -> initHooks ( array ( 'takepospay' ));
2023-10-15 18:41:39 +02:00
if ( ! $user -> hasRight ( 'takepos' , 'run' )) {
2020-03-23 15:46:16 +01:00
accessforbidden ();
2020-03-16 18:04:22 +01:00
}
2022-08-22 01:56:19 +02:00
/*
* View
*/
$arrayofcss = array ( '/takepos/css/pos.css.php' );
$arrayofjs = array ();
$head = '' ;
$title = '' ;
$disablejs = 0 ;
$disablehead = 0 ;
2024-03-08 02:54:18 +01:00
$head = '<link rel="stylesheet" href="css/pos.css.php">' ;
2022-08-22 01:56:19 +02:00
if ( getDolGlobalInt ( 'TAKEPOS_COLOR_THEME' ) == 1 ) {
$head .= '<link rel="stylesheet" href="css/colorful.css">' ;
}
top_htmlhead ( $head , $title , $disablejs , $disablehead , $arrayofjs , $arrayofcss );
?>
< body >
< ? php
2023-10-10 11:16:28 +02:00
$usestripeterminals = 0 ;
2024-09-13 03:09:23 +02:00
$keyforstripeterminalbank = '' ;
$stripe = null ;
2024-11-15 23:59:30 +01:00
$servicestatus = 0 ;
2025-02-18 21:48:21 +01:00
$stripeacc = null ;
2023-10-10 11:16:28 +02:00
2022-09-25 22:00:20 +02:00
if ( isModEnabled ( 'stripe' )) {
2022-06-12 21:34:35 +02:00
$service = 'StripeTest' ;
2024-11-15 23:59:30 +01:00
2023-11-27 12:08:48 +01:00
if ( getDolGlobalString ( 'STRIPE_LIVE' ) && ! GETPOST ( 'forcesandbox' , 'alpha' )) {
2022-06-12 21:34:35 +02:00
$service = 'StripeLive' ;
$servicestatus = 1 ;
}
// Force to use the correct API key
global $stripearrayofkeysbyenv ;
$site_account = $stripearrayofkeysbyenv [ $servicestatus ][ 'publishable_key' ];
$stripe = new Stripe ( $db );
$stripeacc = $stripe -> getStripeAccount ( $service ); // Get Stripe OAuth connect account (no remote access to Stripe here)
2023-10-09 15:44:57 +02:00
include_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php' ;
$invoicetmp = new Facture ( $db );
$invoicetmp -> fetch ( $invoiceid );
$stripecu = $stripe -> getStripeCustomerAccount ( $invoicetmp -> socid , $servicestatus , $site_account ); // Get remote Stripe customer 'cus_...' (no remote access to Stripe here)
$keyforstripeterminalbank = " CASHDESK_ID_BANKACCOUNT_STRIPETERMINAL " . ( empty ( $_SESSION [ 'takeposterminal' ]) ? '' : $_SESSION [ 'takeposterminal' ]);
2023-07-30 14:00:22 +02:00
$usestripeterminals = getDolGlobalString ( 'STRIPE_LOCATION' );
if ( $usestripeterminals ) {
?>
2022-06-12 21:34:35 +02:00
< script src = " https://js.stripe.com/terminal/v1/ " ></ script >
< script >
var terminal = StripeTerminal . create ({
onFetchConnectionToken : fetchConnectionToken ,
onUnexpectedReaderDisconnect : unexpectedDisconnect ,
});
2023-07-30 14:00:22 +02:00
2022-06-12 21:34:35 +02:00
function unexpectedDisconnect () {
// In this function, your app should notify the user that the reader disconnected.
// You can also include a way to attempt to reconnect to a reader.
console . log ( " Disconnected from reader " )
}
2023-07-30 14:00:22 +02:00
2022-06-12 21:34:35 +02:00
function fetchConnectionToken () {
2023-07-30 14:00:22 +02:00
< ? php
2024-03-08 02:54:18 +01:00
$urlconnexiontoken = DOL_URL_ROOT . '/stripe/ajax/ajax.php?action=getConnexionToken&token=' . newToken () . '&servicestatus=' . urlencode (( string ) ( $servicestatus ));
2023-11-27 12:08:48 +01:00
if ( getDolGlobalString ( 'STRIPE_LOCATION' )) {
2024-01-05 04:18:53 +01:00
$urlconnexiontoken .= '&location=' . urlencode ( getDolGlobalString ( 'STRIPE_LOCATION' ));
2023-07-30 14:00:22 +02:00
}
if ( ! empty ( $stripeacc )) {
$urlconnexiontoken .= '&stripeacc=' . urlencode ( $stripeacc );
2023-12-04 13:53:48 +01:00
} ?>
2022-06-12 21:34:35 +02:00
// Do not cache or hardcode the ConnectionToken. The SDK manages the ConnectionToken's lifecycle.
return fetch ( '<?php echo $urlconnexiontoken; ?>' , { method : " POST " })
. then ( function ( response ) {
return response . json ();
})
. then ( function ( data ) {
return data . secret ;
});
}
2023-07-30 14:00:22 +02:00
2022-06-12 21:34:35 +02:00
</ script >
2023-07-30 14:00:22 +02:00
< ? php
}
}
2018-09-28 13:31:41 +02:00
2023-11-27 12:08:48 +01:00
if ( isModEnabled ( 'stripe' ) && isset ( $keyforstripeterminalbank ) && ( ! getDolGlobalString ( 'STRIPE_LIVE' ) || GETPOST ( 'forcesandbox' , 'alpha' ))) {
2024-09-20 01:46:07 +02:00
dol_htmloutput_mesg ( $langs -> trans ( 'YouAreCurrentlyInSandboxMode' , 'Stripe' ), [], 'warning' , 1 );
2022-06-12 21:34:35 +02:00
}
2019-03-27 15:42:53 +01:00
$invoice = new Facture ( $db );
2021-02-26 21:17:52 +01:00
if ( $invoiceid > 0 ) {
2020-09-07 10:18:17 +02:00
$invoice -> fetch ( $invoiceid );
2020-05-21 15:05:19 +02:00
} else {
2024-03-31 13:56:44 +02:00
$sql = " SELECT rowid FROM " . MAIN_DB_PREFIX . " facture " ;
$sql .= " WHERE entity IN ( " . getEntity ( 'invoice' ) . " ) " ;
2024-04-04 11:19:45 +02:00
$sql .= " AND ref = '(PROV-POS " . $_SESSION [ " takeposterminal " ] . " - " . $place . " )' " ;
2020-09-07 10:18:17 +02:00
$resql = $db -> query ( $sql );
$obj = $db -> fetch_object ( $resql );
2021-02-26 21:17:52 +01:00
if ( $obj ) {
2020-09-07 10:18:17 +02:00
$invoiceid = $obj -> rowid ;
}
2021-02-26 21:17:52 +01:00
if ( ! $invoiceid ) {
2020-09-07 10:18:17 +02:00
$invoiceid = 0 ; // Invoice does not exist yet
} else {
$invoice -> fetch ( $invoiceid );
}
2018-09-28 13:31:41 +02:00
}
2022-06-12 21:34:35 +02:00
?>
< script >
2023-10-10 11:16:28 +02:00
< ? php
if ( $usestripeterminals && $invoice -> type != $invoice :: TYPE_CREDIT_NOTE ) {
2025-02-18 21:48:21 +01:00
if ( ! getDolGlobalString (( string ) $keyforstripeterminalbank ) || $stripeacc === null ) { ?>
2023-10-10 11:16:28 +02:00
const config = {
2023-11-27 12:08:48 +01:00
simulated : < ? php if ( empty ( $servicestatus ) && getDolGlobalString ( 'STRIPE_TERMINAL_SIMULATED' )) { ?> true <?php } else { ?> false <?php } ?>
2024-11-22 12:07:48 +01:00
< ? php if ( getDolGlobalString ( 'STRIPE_LOCATION' )) { ?> , location: '<?php echo dol_escape_js(getDolGlobalString('STRIPE_LOCATION')); ?>'<?php } ?>
2023-10-10 11:16:28 +02:00
}
terminal . discoverReaders ( config ) . then ( function ( discoverResult ) {
if ( discoverResult . error ) {
console . log ( 'Failed to discover: ' , discoverResult . error );
} else if ( discoverResult . discoveredReaders . length === 0 ) {
console . log ( 'No available readers.' );
2022-06-12 21:34:35 +02:00
} else {
2023-10-10 11:16:28 +02:00
// You should show the list of discoveredReaders to the
// cashier here and let them select which to connect to (see below).
selectedReader = discoverResult . discoveredReaders [ 0 ];
//console.log('terminal.discoverReaders', selectedReader); // only active for development
terminal . connectReader ( selectedReader ) . then ( function ( connectResult ) {
if ( connectResult . error ) {
document . getElementById ( " card-present-alert " ) . innerHTML = '<div class="error">' + connectResult . error . message + '</div>' ;
console . log ( 'Failed to connect: ' , connectResult . error );
} else {
document . getElementById ( " card-present-alert " ) . innerHTML = '' ;
console . log ( 'Connected to reader: ' , connectResult . reader . label );
if ( document . getElementById ( " StripeTerminal " )) {
document . getElementById ( " StripeTerminal " ) . innerHTML = '<button type="button" class="calcbutton2" onclick="ValidateStripeTerminal();"><span class="fa fa-2x fa-credit-card iconwithlabel"></span><br>' + connectResult . reader . label + '</button>' ;
}
2022-06-12 21:34:35 +02:00
}
2023-10-10 11:16:28 +02:00
});
2022-06-12 21:34:35 +02:00
}
2023-10-10 23:04:47 +02:00
});
2023-10-10 11:16:28 +02:00
< ? php } else { ?>
2025-02-18 21:48:21 +01:00
terminal . connectReader ( < ? php echo json_encode ( $stripe -> getSelectedReader ( getDolGlobalString (( string ) $keyforstripeterminalbank ), $stripeacc , $servicestatus )); ?> ).then(function(connectResult) {
2023-10-10 23:04:47 +02:00
if ( connectResult . error ) {
2022-08-11 16:29:55 +02:00
document . getElementById ( " card-present-alert " ) . innerHTML = '<div class="error clearboth">' + connectResult . error . message + '</div>' ;
2022-06-12 21:34:35 +02:00
console . log ( 'Failed to connect: ' , connectResult . error );
} else {
document . getElementById ( " card-present-alert " ) . innerHTML = '' ;
console . log ( 'Connected to reader: ' , connectResult . reader . label );
if ( document . getElementById ( " StripeTerminal " )) {
document . getElementById ( " StripeTerminal " ) . innerHTML = '<button type="button" class="calcbutton2" onclick="ValidateStripeTerminal();"><span class="fa fa-2x fa-credit-card iconwithlabel"></span><br>' + connectResult . reader . label + '</button>' ;
}
}
});
2023-12-04 13:53:48 +01:00
< ? php }
} ?>
2022-06-12 21:34:35 +02:00
</ script >
< ? php
2025-02-18 21:48:21 +01:00
// Define list of possible payments
$arrayOfValidPaymentModes = array ();
2020-06-29 17:58:04 +02:00
$arrayOfValidBankAccount = array ();
2019-03-15 12:07:33 +01:00
2019-03-27 12:40:32 +01:00
$sql = " SELECT code, libelle as label FROM " . MAIN_DB_PREFIX . " c_paiement " ;
2019-11-13 19:37:08 +01:00
$sql .= " WHERE entity IN ( " . getEntity ( 'c_paiement' ) . " ) " ;
$sql .= " AND active = 1 " ;
$sql .= " ORDER BY libelle " ;
2019-03-15 12:07:33 +01:00
$resql = $db -> query ( $sql );
2020-06-29 17:58:04 +02:00
2019-03-26 20:12:32 +01:00
if ( $resql ) {
while ( $obj = $db -> fetch_object ( $resql )) {
2020-09-07 10:18:17 +02:00
$paycode = $obj -> code ;
2021-02-26 21:17:52 +01:00
if ( $paycode == 'LIQ' ) {
$paycode = 'CASH' ;
}
if ( $paycode == 'CB' ) {
$paycode = 'CB' ;
}
if ( $paycode == 'CHQ' ) {
$paycode = 'CHEQUE' ;
}
2020-09-07 10:18:17 +02:00
$accountname = " CASHDESK_ID_BANKACCOUNT_ " . $paycode . $_SESSION [ " takeposterminal " ];
2023-10-09 15:44:57 +02:00
if ( getDolGlobalInt ( $accountname ) > 0 ) {
$arrayOfValidBankAccount [ getDolGlobalInt ( $accountname )] = getDolGlobalInt ( $accountname );
2020-09-07 10:18:17 +02:00
$arrayOfValidPaymentModes [] = $obj ;
}
2024-02-27 15:30:37 +01:00
if ( ! isModEnabled ( 'bank' )) {
2023-12-04 13:53:48 +01:00
if ( $paycode == 'CASH' || $paycode == 'CB' ) {
$arrayOfValidPaymentModes [] = $obj ;
}
2022-06-06 06:44:15 +02:00
}
2019-03-15 12:07:33 +01:00
}
}
2024-03-02 14:49:27 +01:00
2018-09-28 13:31:41 +02:00
?>
2019-03-27 12:40:32 +01:00
< script >
2019-03-27 15:42:53 +01:00
< ? php
$remaintopay = 0 ;
2021-02-26 21:17:52 +01:00
if ( $invoice -> id > 0 ) {
2020-09-07 10:18:17 +02:00
$remaintopay = $invoice -> getRemainToPay ();
2019-03-27 15:42:53 +01:00
}
$alreadypayed = ( is_object ( $invoice ) ? ( $invoice -> total_ttc - $remaintopay ) : 0 );
2023-10-26 17:45:03 +02:00
if ( ! getDolGlobalInt ( " TAKEPOS_NUMPAD " )) {
2021-02-26 21:17:52 +01:00
print " var received=''; " ;
} else {
print " var received=0; " ;
}
2019-03-27 15:42:53 +01:00
?>
var alreadypayed = < ? php echo $alreadypayed ?> ;
2019-03-27 12:40:32 +01:00
2018-09-28 13:31:41 +02:00
function addreceived ( price )
{
2021-02-26 21:17:52 +01:00
< ? php
2023-10-26 17:45:03 +02:00
if ( ! getDolGlobalInt ( " TAKEPOS_NUMPAD " )) {
2021-02-26 21:17:52 +01:00
print 'received+=String(price);' . " \n " ;
} else {
print 'received+=parseFloat(price);' . " \n " ;
}
2020-09-07 10:18:17 +02:00
?>
2021-02-26 21:17:52 +01:00
$ ( '.change1' ) . html ( pricejs ( parseFloat ( received ), 'MT' ));
$ ( '.change1' ) . val ( parseFloat ( received ));
2019-03-28 19:02:47 +01:00
alreadypaydplusreceived = price2numjs ( alreadypayed + parseFloat ( received ));
2021-02-26 21:17:52 +01:00
//console.log("already+received = "+alreadypaydplusreceived);
2024-11-22 12:07:48 +01:00
//console.log("total_ttc = "+<?php echo (float) $invoice->total_ttc; ?>);
if ( alreadypaydplusreceived > < ? php echo ( float ) $invoice -> total_ttc ; ?> )
2021-02-26 21:17:52 +01:00
{
2024-11-22 12:07:48 +01:00
var change = parseFloat ( alreadypayed + parseFloat ( received ) - < ? php echo ( float ) $invoice -> total_ttc ; ?> );
2019-03-27 12:40:32 +01:00
$ ( '.change2' ) . html ( pricejs ( change , 'MT' ));
2021-02-26 21:17:52 +01:00
$ ( '.change2' ) . val ( change );
$ ( '.change1' ) . removeClass ( 'colorred' );
$ ( '.change1' ) . addClass ( 'colorgreen' );
$ ( '.change2' ) . removeClass ( 'colorwhite' );
$ ( '.change2' ) . addClass ( 'colorred' );
2018-09-28 13:31:41 +02:00
}
2021-02-26 21:17:52 +01:00
else
{
2019-03-27 12:40:32 +01:00
$ ( '.change2' ) . html ( pricejs ( 0 , 'MT' ));
2021-02-26 21:17:52 +01:00
$ ( '.change2' ) . val ( 0 );
if ( alreadypaydplusreceived == < ? php echo $invoice -> total_ttc ; ?> )
{
$ ( '.change1' ) . removeClass ( 'colorred' );
$ ( '.change1' ) . addClass ( 'colorgreen' );
$ ( '.change2' ) . removeClass ( 'colorred' );
$ ( '.change2' ) . addClass ( 'colorwhite' );
}
else
{
$ ( '.change1' ) . removeClass ( 'colorgreen' );
$ ( '.change1' ) . addClass ( 'colorred' );
$ ( '.change2' ) . removeClass ( 'colorred' );
$ ( '.change2' ) . addClass ( 'colorwhite' );
}
}
2023-05-01 14:33:08 +02:00
return true ;
2018-09-28 13:31:41 +02:00
}
function reset ()
{
received = 0 ;
2019-03-27 15:42:53 +01:00
$ ( '.change1' ) . html ( pricejs ( received , 'MT' ));
$ ( '.change1' ) . val ( price2numjs ( received ));
2019-03-27 12:40:32 +01:00
$ ( '.change2' ) . html ( pricejs ( received , 'MT' ));
$ ( '.change2' ) . val ( price2numjs ( received ));
2021-02-26 21:17:52 +01:00
$ ( '.change1' ) . removeClass ( 'colorgreen' );
$ ( '.change1' ) . addClass ( 'colorred' );
$ ( '.change2' ) . removeClass ( 'colorred' );
$ ( '.change2' ) . addClass ( 'colorwhite' );
2018-09-28 13:31:41 +02:00
}
2019-03-27 12:40:32 +01:00
function Validate ( payment )
{
2023-10-10 11:51:52 +02:00
console . log ( " Launch Validate " );
2023-12-04 13:53:48 +01:00
var invoiceid = < ? php echo ( $invoiceid > 0 ? $invoiceid : 0 ); ?> ;
2020-06-29 17:58:04 +02:00
var accountid = $ ( " #selectaccountid " ) . val ();
2019-03-27 12:40:32 +01:00
var amountpayed = $ ( " #change1 " ) . val ();
2020-08-22 18:28:15 +02:00
var excess = $ ( " #change2 " ) . val ();
2019-03-27 12:40:32 +01:00
if ( amountpayed > < ? php echo $invoice -> total_ttc ; ?> ) {
amountpayed = < ? php echo $invoice -> total_ttc ; ?> ;
}
console . log ( " We click on the payment mode to pay amount = " + amountpayed );
2022-09-12 12:22:00 +02:00
parent . $ ( " #poslines " ) . load ( " invoice.php?place=<?php echo $place ; ?>&action=valid&token=<?php echo newToken(); ?>&pay= " + payment + " &amount= " + amountpayed + " &excess= " + excess + " &invoiceid= " + invoiceid + " &accountid= " + accountid , function () {
2021-02-26 21:17:52 +01:00
if ( amountpayed > < ? php echo $remaintopay ; ?> || amountpayed == <?php echo $remaintopay; ?> || amountpayed==0 ) {
console . log ( " Close popup " );
2024-11-07 23:42:03 +01:00
parent . $ ( '#invoiceid' ) . val ( " " );
2021-02-26 21:17:52 +01:00
parent . $ . colorbox . close ();
}
2020-12-04 00:58:51 +01:00
else {
2023-10-26 17:45:03 +02:00
console . log ( " Amount is not complete, so we do NOT close popup and reload it. " );
2020-12-04 00:58:51 +01:00
location . reload ();
}
2019-03-15 12:07:33 +01:00
});
2023-05-01 14:33:08 +02:00
return true ;
2018-09-28 13:31:41 +02:00
}
2019-11-25 23:15:39 +01:00
2022-06-12 21:34:35 +02:00
function fetchPaymentIntentClientSecret ( amount , invoiceid ) {
const bodyContent = JSON . stringify ({ amount : amount , invoiceid : invoiceid });
< ? php
2024-04-23 13:07:03 +02:00
$urlpaymentintent = DOL_URL_ROOT . '/stripe/ajax/ajax.php?action=createPaymentIntent&token=' . newToken () . '&servicestatus=' . urlencode (( string ) $servicestatus );
2023-12-04 13:53:48 +01:00
if ( ! empty ( $stripeacc )) {
$urlpaymentintent .= '&stripeacc=' . $stripeacc ;
}
2022-06-12 21:34:35 +02:00
?>
return fetch ( '<?php echo $urlpaymentintent; ?>' , {
method : " POST " ,
headers : {
'Content-Type' : 'application/json'
},
body : bodyContent
})
. then ( function ( response ) {
return response . json ();
})
. then ( function ( data ) {
return data . client_secret ;
});
}
function capturePaymentIntent ( paymentIntentId ) {
const bodyContent = JSON . stringify ({ " id " : paymentIntentId })
< ? php
2024-03-08 02:54:18 +01:00
$urlpaymentintent = DOL_URL_ROOT . '/stripe/ajax/ajax.php?action=capturePaymentIntent&token=' . newToken () . '&servicestatus=' . urlencode (( string ) ( $servicestatus ));
2022-09-12 12:22:00 +02:00
if ( ! empty ( $stripeacc )) {
$urlpaymentintent .= '&stripeacc=' . urlencode ( $stripeacc );
}
2022-06-12 21:34:35 +02:00
?>
return fetch ( '<?php echo $urlpaymentintent; ?>' , {
method : " POST " ,
headers : {
'Content-Type' : 'application/json'
},
body : bodyContent
})
. then ( function ( response ) {
return response . json ();
})
. then ( function ( data ) {
return data . client_secret ;
});
}
function ValidateStripeTerminal () {
console . log ( " Launch ValidateStripeTerminal " );
var invoiceid = < ? php echo ( $invoiceid > 0 ? $invoiceid : 0 ); ?> ;
var accountid = $ ( " #selectaccountid " ) . val ();
var amountpayed = $ ( " #change1 " ) . val ();
var excess = $ ( " #change2 " ) . val ();
if ( amountpayed > < ? php echo $invoice -> getRemainToPay (); ?> ) {
amountpayed = < ? php echo $invoice -> getRemainToPay (); ?> ;
}
if ( amountpayed == 0 ) {
amountpayed = < ? php echo $invoice -> getRemainToPay (); ?> ;
}
console . log ( " Pay with terminal " , amountpayed );
fetchPaymentIntentClientSecret ( amountpayed , invoiceid ) . then ( function ( client_secret ) {
2023-11-27 12:08:48 +01:00
< ? php if ( empty ( $servicestatus ) && getDolGlobalString ( 'STRIPE_TERMINAL_SIMULATED' )) { ?>
2024-11-22 12:07:48 +01:00
terminal . setSimulatorConfiguration ({ testCardNumber : '<?php echo dol_escape_js(getDolGlobalString(' STRIPE_TERMINAL_SIMULATED ')); ?>' });
2022-06-12 21:34:35 +02:00
< ? php } ?>
2022-08-11 16:29:55 +02:00
document . getElementById ( " card-present-alert " ) . innerHTML = '<div class="warning clearboth"><?php echo $langs->trans(' PaymentSendToStripeTerminal '); ?></div>' ;
2022-06-12 21:34:35 +02:00
terminal . collectPaymentMethod ( client_secret ) . then ( function ( result ) {
if ( result . error ) {
// Placeholder for handling result.error
document . getElementById ( " card-present-alert " ) . innerHTML = '<div class="error clearboth">' + result . error . message + '</div>' ;
} else {
document . getElementById ( " card-present-alert " ) . innerHTML = '<div class="warning clearboth"><?php echo $langs->trans(' PaymentBeingProcessed '); ?></div>' ;
console . log ( 'terminal.collectPaymentMethod' , result . paymentIntent );
terminal . processPayment ( result . paymentIntent ) . then ( function ( result ) {
if ( result . error ) {
2022-08-11 16:29:55 +02:00
document . getElementById ( " card-present-alert " ) . innerHTML = '<div class="error clearboth">' + result . error . message + '</div>' ;
2022-06-12 21:34:35 +02:00
console . log ( result . error )
} else if ( result . paymentIntent ) {
paymentIntentId = result . paymentIntent . id ;
console . log ( 'terminal.processPayment' , result . paymentIntent );
capturePaymentIntent ( paymentIntentId ) . then ( function ( client_secret ) {
if ( result . error ) {
// Placeholder for handling result.error
document . getElementById ( " card-present-alert " ) . innerHTML = '<div class="error clearboth">' + result . error . message + '</div>' ;
console . log ( " error when capturing paymentIntent " , result . error );
} else {
2022-08-11 16:29:55 +02:00
document . getElementById ( " card-present-alert " ) . innerHTML = '<div class="warning clearboth"><?php echo $langs->trans(' PaymentValidated '); ?></div>' ;
2024-01-12 17:18:52 +01:00
console . log ( " Capture paymentIntent successful " + paymentIntentId );
2022-09-12 12:22:00 +02:00
parent . $ ( " #poslines " ) . load ( " invoice.php?place=<?php echo $place ; ?>&action=valid&token=<?php echo newToken(); ?>&pay=CB&amount= " + amountpayed + " &excess= " + excess + " &invoiceid= " + invoiceid + " &accountid= " + accountid , function () {
2022-06-12 21:34:35 +02:00
if ( amountpayed > < ? php echo $remaintopay ; ?> || amountpayed == <?php echo $remaintopay; ?> || amountpayed==0 ) {
console . log ( " Close popup " );
parent . $ . colorbox . close ();
}
else {
console . log ( " Amount is not comple, so we do NOT close popup and reload it. " );
location . reload ();
}
});
}
2022-08-11 16:29:55 +02:00
});
2022-06-12 21:34:35 +02:00
}
});
}
});
});
}
2019-11-25 23:15:39 +01:00
function ValidateSumup () {
2019-12-04 18:06:05 +01:00
console . log ( " Launch ValidateSumup " );
< ? php $_SESSION [ 'SMP_CURRENT_PAYMENT' ] = " NEW " ?>
2021-02-26 21:17:52 +01:00
var invoiceid = < ? php echo ( $invoiceid > 0 ? $invoiceid : 0 ); ?> ;
var amountpayed = $ ( " #change1 " ) . val ();
if ( amountpayed > < ? php echo $invoice -> total_ttc ; ?> ) {
amountpayed = < ? php echo $invoice -> total_ttc ; ?> ;
}
2023-12-01 05:05:11 +01:00
if ( amountpayed == 0 ) {
2023-12-01 19:53:25 +01:00
amountpayed = < ? php echo $invoice -> total_ttc ; ?> ;
}
2023-12-01 06:25:58 +01:00
var currencycode = " <?php echo $invoice->multicurrency_code ; ?> " ;
2021-02-26 21:17:52 +01:00
// Starting sumup app
2023-12-01 19:53:25 +01:00
window . open ( 'sumupmerchant://pay/1.0?affiliate-key=<?php echo urlencode(getDolGlobalString(' TAKEPOS_SUMUP_AFFILIATE ')) ?>&app-id=<?php echo urlencode(getDolGlobalString(' TAKEPOS_SUMUP_APPID ')) ?>&amount=' + amountpayed + '¤cy=' + currencycode + '&title=' + invoiceid + '&callback=<?php echo DOL_MAIN_URL_ROOT ?>/takepos/smpcb.php' );
2021-02-26 21:17:52 +01:00
var loop = window . setInterval ( function () {
2021-06-17 03:37:52 +02:00
$ . ajax ({
method : 'POST' ,
data : { token : '<?php echo currentToken(); ?>' },
url : '<?php echo DOL_URL_ROOT ?>/takepos/smpcb.php?status' }) . done ( function ( data ) {
2021-02-26 21:17:52 +01:00
console . log ( data );
if ( data === " SUCCESS " ) {
2023-10-09 15:44:57 +02:00
parent . $ ( " #poslines " ) . load ( " invoice.php?place=<?php echo urlencode( $place ); ?>&action=valid&token=<?php echo newToken(); ?>&pay=CB&amount= " + amountpayed + " &invoiceid= " + invoiceid , function () {
2021-02-26 21:17:52 +01:00
//parent.$("#poslines").scrollTop(parent.$("#poslines")[0].scrollHeight);
parent . $ . colorbox . close ();
//parent.setFocusOnSearchField(); // This does not have effect
});
clearInterval ( loop );
} else if ( data === " FAILED " ) {
parent . $ . colorbox . close ();
clearInterval ( loop );
}
});
}, 2500 );
}
2021-10-05 11:44:48 +02:00
2021-08-08 19:13:31 +02:00
< ? php
2023-11-27 12:08:48 +01:00
if ( getDolGlobalString ( 'TAKEPOS_CUSTOMER_DISPLAY' )) {
2024-03-08 02:54:18 +01:00
echo " var line1=' " . $langs -> trans ( 'TotalTTC' ) . " '.substring(0,20); " ;
echo " line1=line1.padEnd(20); " ;
echo " var line2=' " . price ( $invoice -> total_ttc , 1 , '' , 1 , - 1 , - 1 ) . " '.substring(0,20); " ;
echo " line2=line2.padEnd(20); " ;
echo " $ .ajax( {
2021-08-08 19:13:31 +02:00
type : 'GET' ,
data : { text : line1 + line2 },
url : '".getDolGlobalString(' TAKEPOS_PRINT_SERVER ')."/display/index.php' ,
}); " ;
}
?>
2018-09-28 13:31:41 +02:00
</ script >
2024-03-02 14:49:27 +01:00
< ? php
2024-05-01 16:20:29 +02:00
$sessioncurrency = $_SESSION [ " takeposcustomercurrency " ] ? ? '' ;
2024-12-09 11:20:35 +01:00
print '<!-- conf->currency = ' . $conf -> currency . ' - sessioncurrency = ' . $sessioncurrency . ' -->' . " \n " ;
2025-02-18 21:48:21 +01:00
$multicurrency = null ;
2024-05-01 16:20:29 +02:00
if ( isModEnabled ( 'multicurrency' ) && $sessioncurrency != " " && $conf -> currency != $sessioncurrency ) {
2024-04-30 12:42:10 +02:00
// Only show customer currency if multicurrency module is enabled, if currency selected and if this currency selected is not the same as main currency
2024-03-02 14:49:27 +01:00
include_once DOL_DOCUMENT_ROOT . '/multicurrency/class/multicurrency.class.php' ;
$multicurrency = new MultiCurrency ( $db );
2024-05-01 16:20:29 +02:00
$multicurrency -> fetch ( 0 , $sessioncurrency );
2024-03-02 14:49:27 +01:00
}
?>
2022-06-12 21:34:35 +02:00
< div style = " position:relative; padding-top: 20px; left:5%; height:140px; width:90%; " >
2021-10-12 15:52:59 +02:00
< div class = " paymentbordline paymentbordlinetotal center " >
2024-03-02 14:49:27 +01:00
< span class = " takepospay colorwhite " >< ? php echo $langs -> trans ( 'TotalTTC' ); ?> : <span id="totaldisplay" class="colorwhite"><?php
echo price ( $invoice -> total_ttc , 1 , '' , 1 , - 1 , - 1 , $conf -> currency );
2025-02-18 21:48:21 +01:00
if ( $multicurrency !== null ) {
2024-05-01 16:20:29 +02:00
print ' <span id="linecolht-span-total opacitymedium" style="font-size:0.9em; font-style:italic;">(' . price ( $invoice -> total_ht * $multicurrency -> rate -> rate ) . ' ' . $sessioncurrency . ')</span>' ;
2024-03-02 14:49:27 +01:00
}
?> </span></span>
2021-10-12 15:52:59 +02:00
</ div >
< ? php if ( $remaintopay != $invoice -> total_ttc ) { ?>
< div class = " paymentbordline paymentbordlineremain center " >
2024-03-02 14:49:27 +01:00
< span class = " takepospay colorwhite " >< ? php echo $langs -> trans ( 'RemainToPay' ); ?> : <span id="remaintopaydisplay" class="colorwhite"><?php
2024-12-09 11:20:35 +01:00
echo price ( $remaintopay , 1 , '' , 1 , - 1 , - 1 , $conf -> currency );
2025-02-18 21:48:21 +01:00
if ( $multicurrency !== null ) {
2024-05-01 16:20:29 +02:00
print ' <span id="linecolht-span-total opacitymedium" style="font-size:0.9em; font-style:italic;">(' . price ( $remaintopay * $multicurrency -> rate -> rate ) . ' ' . $sessioncurrency . ')</span>' ;
2024-03-02 14:49:27 +01:00
}
?> </span></span>
2021-10-12 14:11:19 +02:00
</ div >
2021-10-12 15:52:59 +02:00
< ? php } ?>
< div class = " paymentbordline paymentbordlinereceived center " >
2024-03-02 14:49:27 +01:00
< span class = " takepospay colorwhite " >< ? php echo $langs -> trans ( " Received " ); ?> : <span class="change1 colorred"><?php
2024-12-09 11:20:35 +01:00
echo price ( 0 , 1 , '' , 1 , - 1 , - 1 , $conf -> currency );
2025-02-18 21:48:21 +01:00
if ( $multicurrency !== null ) {
2024-05-01 16:20:29 +02:00
print ' <span id="linecolht-span-total opacitymedium" style="font-size:0.9em; font-style:italic;">(' . price ( 0 * $multicurrency -> rate -> rate ) . ' ' . $sessioncurrency . ')</span>' ;
2024-03-02 14:49:27 +01:00
}
?> </span><input type="hidden" id="change1" class="change1" value="0"></span>
2021-10-12 14:11:19 +02:00
</ div >
2021-10-12 15:52:59 +02:00
< div class = " paymentbordline paymentbordlinechange center " >
2024-03-02 14:49:27 +01:00
< span class = " takepospay colorwhite " >< ? php echo $langs -> trans ( " Change " ); ?> : <span class="change2 colorwhite"><?php
2024-12-09 11:20:35 +01:00
echo price ( 0 , 1 , '' , 1 , - 1 , - 1 , $conf -> currency );
2025-02-18 21:48:21 +01:00
if ( $multicurrency !== null ) {
2024-05-01 16:20:29 +02:00
print ' <span id="linecolht-span-total opacitymedium" style="font-size:0.9em; font-style:italic;">(' . price ( 0 * $multicurrency -> rate -> rate ) . ' ' . $sessioncurrency . ')</span>' ;
2024-03-02 14:49:27 +01:00
}
?> </span><input type="hidden" id="change2" class="change2" value="0"></span>
2021-10-12 15:52:59 +02:00
</ div >
< ? php
2023-11-27 12:08:48 +01:00
if ( getDolGlobalString ( 'TAKEPOS_CAN_FORCE_BANK_ACCOUNT_DURING_PAYMENT' )) {
2021-10-12 15:52:59 +02:00
require_once DOL_DOCUMENT_ROOT . '/core/class/html.form.class.php' ;
print '<div class="paymentbordline paddingtop paddingbottom center">' ;
$filter = '' ;
$form = new Form ( $db );
print '<span class="takepospay colorwhite">' . $langs -> trans ( " BankAccount " ) . ': </span>' ;
$form -> select_comptes ( 0 , 'accountid' , 0 , $filter , 1 , '' );
print ajax_combobox ( 'selectaccountid' );
print '</div>' ;
}
?>
2018-09-28 13:31:41 +02:00
</ div >
2020-06-29 17:58:04 +02:00
< div style = " position:absolute; left:5%; height:52%; width:90%; " >
2019-01-23 20:59:34 +01:00
< ? php
2019-03-15 12:07:33 +01:00
$action_buttons = array (
2024-03-08 02:54:18 +01:00
array (
2024-08-07 02:53:45 +02:00
" function " => " reset() " ,
" span " => " style='font-size: 150%;' " ,
" text " => " C " ,
" class " => " poscolorblue "
2024-03-08 02:54:18 +01:00
),
array (
2024-08-07 02:53:45 +02:00
" function " => " parent. $ .colorbox.close(); " ,
" span " => " id='printtext' style='font-weight: bold; font-size: 18pt;' " ,
" text " => " X " ,
" class " => " poscolordelete "
2024-03-08 02:54:18 +01:00
),
2019-03-15 12:07:33 +01:00
);
2024-01-05 04:18:53 +01:00
$numpad = getDolGlobalString ( 'TAKEPOS_NUMPAD' );
2023-11-27 12:08:48 +01:00
if ( isModEnabled ( 'stripe' ) && isset ( $keyforstripeterminalbank ) && getDolGlobalString ( 'STRIPE_CARD_PRESENT' )) {
2022-06-12 21:34:35 +02:00
print '<span id="card-present-alert">' ;
2024-09-20 01:46:07 +02:00
dol_htmloutput_mesg ( $langs -> trans ( 'ConnectingToStripeTerminal' , 'Stripe' ), [], 'warning' , 1 );
2022-06-12 21:34:35 +02:00
print '</span>' ;
}
2023-04-30 04:26:50 +02:00
print '<button type="button" class="calcbutton" onclick="addreceived(' . ( $numpad == 0 ? '7' : '10' ) . ')">' . ( $numpad == 0 ? '7' : '10' ) . '</button>' ;
print '<button type="button" class="calcbutton" onclick="addreceived(' . ( $numpad == 0 ? '8' : '20' ) . ')">' . ( $numpad == 0 ? '8' : '20' ) . '</button>' ;
print '<button type="button" class="calcbutton" onclick="addreceived(' . ( $numpad == 0 ? '9' : '50' ) . ')">' . ( $numpad == 0 ? '9' : '50' ) . '</button>' ;
2019-01-23 20:59:34 +01:00
?>
2020-06-29 17:58:04 +02:00
< ? php if ( count ( $arrayOfValidPaymentModes ) > 0 ) {
2020-09-07 10:18:17 +02:00
$paycode = $arrayOfValidPaymentModes [ 0 ] -> code ;
2020-03-10 11:20:15 +01:00
$payIcon = '' ;
if ( $paycode == 'LIQ' ) {
2023-11-27 12:08:48 +01:00
if ( ! isset ( $conf -> global -> TAKEPOS_NUMPAD_USE_PAYMENT_ICON ) || getDolGlobalString ( 'TAKEPOS_NUMPAD_USE_PAYMENT_ICON' )) {
2021-02-26 21:17:52 +01:00
$payIcon = 'coins' ;
}
2020-03-10 11:20:15 +01:00
} elseif ( $paycode == 'CB' ) {
2023-11-27 12:08:48 +01:00
if ( ! isset ( $conf -> global -> TAKEPOS_NUMPAD_USE_PAYMENT_ICON ) || getDolGlobalString ( 'TAKEPOS_NUMPAD_USE_PAYMENT_ICON' )) {
2021-02-26 21:17:52 +01:00
$payIcon = 'credit-card' ;
}
2020-03-10 11:20:15 +01:00
} elseif ( $paycode == 'CHQ' ) {
2023-11-27 12:08:48 +01:00
if ( ! isset ( $conf -> global -> TAKEPOS_NUMPAD_USE_PAYMENT_ICON ) || getDolGlobalString ( 'TAKEPOS_NUMPAD_USE_PAYMENT_ICON' )) {
2021-02-26 21:17:52 +01:00
$payIcon = 'money-check' ;
}
2020-03-10 11:20:15 +01:00
}
2023-04-30 04:26:50 +02:00
print '<button type="button" class="calcbutton2" onclick="Validate(\'' . dol_escape_js ( $paycode ) . '\')">' . ( ! empty ( $payIcon ) ? '<span class="fa fa-2x fa-' . $payIcon . ' iconwithlabel"></span><span class="hideonsmartphone"><br>' . $langs -> trans ( " PaymentTypeShort " . $arrayOfValidPaymentModes [ 0 ] -> code ) : $langs -> trans ( " PaymentTypeShort " . $arrayOfValidPaymentModes [ 0 ] -> code )) . '</span></button>' ;
2020-03-10 11:20:15 +01:00
} else {
2020-03-12 12:45:44 +01:00
print '<button type="button" class="calcbutton2">' . $langs -> trans ( " NoPaimementModesDefined " ) . '</button>' ;
2020-03-10 11:20:15 +01:00
}
2023-04-30 04:26:50 +02:00
print '<button type="button" class="calcbutton" onclick="addreceived(' . ( $numpad == 0 ? '4' : '1' ) . ')">' . ( $numpad == 0 ? '4' : '1' ) . '</button>' ;
print '<button type="button" class="calcbutton" onclick="addreceived(' . ( $numpad == 0 ? '5' : '2' ) . ')">' . ( $numpad == 0 ? '5' : '2' ) . '</button>' ;
print '<button type="button" class="calcbutton" onclick="addreceived(' . ( $numpad == 0 ? '6' : '5' ) . ')">' . ( $numpad == 0 ? '6' : '5' ) . '</button>' ;
2020-03-10 11:20:15 +01:00
?>
2020-06-29 17:58:04 +02:00
< ? php if ( count ( $arrayOfValidPaymentModes ) > 1 ) {
2020-09-07 10:18:17 +02:00
$paycode = $arrayOfValidPaymentModes [ 1 ] -> code ;
2020-03-10 11:20:15 +01:00
$payIcon = '' ;
if ( $paycode == 'LIQ' ) {
2023-11-27 12:08:48 +01:00
if ( ! isset ( $conf -> global -> TAKEPOS_NUMPAD_USE_PAYMENT_ICON ) || getDolGlobalString ( 'TAKEPOS_NUMPAD_USE_PAYMENT_ICON' )) {
2021-02-26 21:17:52 +01:00
$payIcon = 'coins' ;
}
2020-03-10 11:20:15 +01:00
} elseif ( $paycode == 'CB' ) {
2023-11-27 12:08:48 +01:00
if ( ! isset ( $conf -> global -> TAKEPOS_NUMPAD_USE_PAYMENT_ICON ) || getDolGlobalString ( 'TAKEPOS_NUMPAD_USE_PAYMENT_ICON' )) {
2021-02-26 21:17:52 +01:00
$payIcon = 'credit-card' ;
}
2020-03-10 11:20:15 +01:00
} elseif ( $paycode == 'CHQ' ) {
2023-11-27 12:08:48 +01:00
if ( ! isset ( $conf -> global -> TAKEPOS_NUMPAD_USE_PAYMENT_ICON ) || getDolGlobalString ( 'TAKEPOS_NUMPAD_USE_PAYMENT_ICON' )) {
2021-02-26 21:17:52 +01:00
$payIcon = 'money-check' ;
}
2020-03-10 11:20:15 +01:00
}
2023-04-30 04:26:50 +02:00
print '<button type="button" class="calcbutton2" onclick="Validate(\'' . dol_escape_js ( $paycode ) . '\')">' . ( ! empty ( $payIcon ) ? '<span class="fa fa-2x fa-' . $payIcon . ' iconwithlabel"></span><br> ' . $langs -> trans ( " PaymentTypeShort " . $arrayOfValidPaymentModes [ 1 ] -> code ) : $langs -> trans ( " PaymentTypeShort " . $arrayOfValidPaymentModes [ 1 ] -> code )) . '</button>' ;
2020-03-10 11:20:15 +01:00
} else {
$button = array_pop ( $action_buttons );
2020-03-12 12:45:44 +01:00
print '<button type="button" class="calcbutton2" onclick="' . $button [ " function " ] . '"><span ' . $button [ " span " ] . '>' . $button [ " text " ] . '</span></button>' ;
2020-03-10 11:20:15 +01:00
}
2023-04-30 04:26:50 +02:00
print '<button type="button" class="calcbutton" onclick="addreceived(' . ( $numpad == 0 ? '1' : '0.10' ) . ')">' . ( $numpad == 0 ? '1' : '0.10' ) . '</button>' ;
print '<button type="button" class="calcbutton" onclick="addreceived(' . ( $numpad == 0 ? '2' : '0.20' ) . ')">' . ( $numpad == 0 ? '2' : '0.20' ) . '</button>' ;
print '<button type="button" class="calcbutton" onclick="addreceived(' . ( $numpad == 0 ? '3' : '0.50' ) . ')">' . ( $numpad == 0 ? '3' : '0.50' ) . '</button>' ;
2020-03-10 11:20:15 +01:00
?>
2020-06-29 17:58:04 +02:00
< ? php if ( count ( $arrayOfValidPaymentModes ) > 2 ) {
2020-09-07 10:18:17 +02:00
$paycode = $arrayOfValidPaymentModes [ 2 ] -> code ;
2020-03-10 11:20:15 +01:00
$payIcon = '' ;
if ( $paycode == 'LIQ' ) {
2023-11-27 12:08:48 +01:00
if ( ! isset ( $conf -> global -> TAKEPOS_NUMPAD_USE_PAYMENT_ICON ) || getDolGlobalString ( 'TAKEPOS_NUMPAD_USE_PAYMENT_ICON' )) {
2021-02-26 21:17:52 +01:00
$payIcon = 'coins' ;
}
2020-03-10 11:20:15 +01:00
} elseif ( $paycode == 'CB' ) {
2023-11-27 12:08:48 +01:00
if ( ! isset ( $conf -> global -> TAKEPOS_NUMPAD_USE_PAYMENT_ICON ) || getDolGlobalString ( 'TAKEPOS_NUMPAD_USE_PAYMENT_ICON' )) {
2021-02-26 21:17:52 +01:00
$payIcon = 'credit-card' ;
}
2020-03-10 11:20:15 +01:00
} elseif ( $paycode == 'CHQ' ) {
2023-11-27 12:08:48 +01:00
if ( ! isset ( $conf -> global -> TAKEPOS_NUMPAD_USE_PAYMENT_ICON ) || getDolGlobalString ( 'TAKEPOS_NUMPAD_USE_PAYMENT_ICON' )) {
2021-02-26 21:17:52 +01:00
$payIcon = 'money-check' ;
}
2020-03-10 11:20:15 +01:00
}
2023-04-30 04:26:50 +02:00
print '<button type="button" class="calcbutton2" onclick="Validate(\'' . dol_escape_js ( $paycode ) . '\')">' . ( ! empty ( $payIcon ) ? '<span class="fa fa-2x fa-' . $payIcon . ' iconwithlabel"></span><br>' . $langs -> trans ( " PaymentTypeShort " . $arrayOfValidPaymentModes [ 2 ] -> code ) : $langs -> trans ( " PaymentTypeShort " . $arrayOfValidPaymentModes [ 2 ] -> code )) . '</button>' ;
2020-03-10 11:20:15 +01:00
} else {
2020-09-07 10:18:17 +02:00
$button = array_pop ( $action_buttons );
2020-03-12 12:45:44 +01:00
print '<button type="button" class="calcbutton2" onclick="' . $button [ " function " ] . '"><span ' . $button [ " span " ] . '>' . $button [ " text " ] . '</span></button>' ;
2020-03-10 11:20:15 +01:00
}
2023-04-30 04:26:50 +02:00
print '<button type="button" class="calcbutton" onclick="addreceived(' . ( $numpad == 0 ? '0' : '0.01' ) . ')">' . ( $numpad == 0 ? '0' : '0.01' ) . '</button>' ;
print '<button type="button" class="calcbutton" onclick="addreceived(' . ( $numpad == 0 ? '\'000\'' : '0.02' ) . ')">' . ( $numpad == 0 ? '000' : '0.02' ) . '</button>' ;
print '<button type="button" class="calcbutton" onclick="addreceived(' . ( $numpad == 0 ? '\'.\'' : '0.05' ) . ')">' . ( $numpad == 0 ? '.' : '0.05' ) . '</button>' ;
2020-03-10 11:20:15 +01:00
2019-11-28 12:36:20 +01:00
$i = 3 ;
2020-06-29 17:58:04 +02:00
while ( $i < count ( $arrayOfValidPaymentModes )) {
2021-09-24 11:48:43 +02:00
$paycode = $arrayOfValidPaymentModes [ $i ] -> code ;
$payIcon = '' ;
if ( $paycode == 'LIQ' ) {
2023-11-27 12:08:48 +01:00
if ( ! isset ( $conf -> global -> TAKEPOS_NUMPAD_USE_PAYMENT_ICON ) || getDolGlobalString ( 'TAKEPOS_NUMPAD_USE_PAYMENT_ICON' )) {
2021-09-24 11:48:43 +02:00
$payIcon = 'coins' ;
}
} elseif ( $paycode == 'CB' ) {
2023-11-27 12:08:48 +01:00
if ( ! isset ( $conf -> global -> TAKEPOS_NUMPAD_USE_PAYMENT_ICON ) || getDolGlobalString ( 'TAKEPOS_NUMPAD_USE_PAYMENT_ICON' )) {
2021-09-24 11:48:43 +02:00
$payIcon = 'credit-card' ;
}
} elseif ( $paycode == 'CHQ' ) {
2023-11-27 12:08:48 +01:00
if ( ! isset ( $conf -> global -> TAKEPOS_NUMPAD_USE_PAYMENT_ICON ) || getDolGlobalString ( 'TAKEPOS_NUMPAD_USE_PAYMENT_ICON' )) {
2021-09-24 11:48:43 +02:00
$payIcon = 'money-check' ;
}
}
2023-04-30 04:26:50 +02:00
print '<button type="button" class="calcbutton2" onclick="Validate(\'' . dol_escape_js ( $paycode ) . '\')">' . ( ! empty ( $payIcon ) ? '<span class="fa fa-2x fa-' . $payIcon . ' iconwithlabel"></span><br>' . $langs -> trans ( " PaymentTypeShort " . $arrayOfValidPaymentModes [ $i ] -> code ) : $langs -> trans ( " PaymentTypeShort " . $arrayOfValidPaymentModes [ $i ] -> code )) . '</button>' ;
2024-08-07 02:53:45 +02:00
$i += 1 ;
2019-03-15 12:07:33 +01:00
}
2019-11-25 23:15:39 +01:00
2023-11-27 12:08:48 +01:00
if ( isModEnabled ( 'stripe' ) && isset ( $keyforstripeterminalbank ) && getDolGlobalString ( 'STRIPE_CARD_PRESENT' )) {
2022-06-12 21:34:35 +02:00
$keyforstripeterminalbank = " CASHDESK_ID_BANKACCOUNT_STRIPETERMINAL " . $_SESSION [ " takeposterminal " ];
print '<span id="StripeTerminal"></span>' ;
2025-02-18 21:48:21 +01:00
if ( getDolGlobalString (( string ) $keyforstripeterminalbank )) {
2023-10-09 15:44:57 +02:00
// Nothing
2022-06-12 21:34:35 +02:00
} else {
$langs -> loadLangs ( array ( " errors " , " admin " ));
//print '<button type="button" class="calcbutton2 disabled" title="'.$langs->trans("SetupNotComplete").'">TerminalOff</button>';
}
}
2019-12-04 18:06:05 +01:00
$keyforsumupbank = " CASHDESK_ID_BANKACCOUNT_SUMUP " . $_SESSION [ " takeposterminal " ];
2023-10-26 17:45:03 +02:00
if ( getDolGlobalInt ( " TAKEPOS_ENABLE_SUMUP " )) {
2023-10-09 15:44:57 +02:00
if ( getDolGlobalString ( $keyforsumupbank )) {
2019-12-04 18:06:05 +01:00
print '<button type="button" class="calcbutton2" onclick="ValidateSumup();">Sumup</button>' ;
} else {
2020-08-24 12:27:19 +02:00
$langs -> loadLangs ( array ( " errors " , " admin " ));
2019-12-04 18:06:05 +01:00
print '<button type="button" class="calcbutton2 disabled" title="' . $langs -> trans ( " SetupNotComplete " ) . '">Sumup</button>' ;
}
2019-11-25 23:15:39 +01:00
}
2022-08-04 14:46:20 +02:00
$parameters = array ();
$reshook = $hookmanager -> executeHooks ( 'addMoreActionsButtons' , $parameters , $invoice , $action ); // Note that $action and $object may have been modified by hook
2023-12-04 13:53:48 +01:00
if ( $reshook < 0 ) {
setEventMessages ( $hookmanager -> error , $hookmanager -> errors , 'errors' );
}
2022-08-04 14:46:20 +02:00
2019-11-28 12:36:20 +01:00
$class = ( $i == 3 ) ? " calcbutton3 " : " calcbutton2 " ;
foreach ( $action_buttons as $button ) {
2020-09-07 10:18:17 +02:00
$newclass = $class . ( $button [ " class " ] ? " " . $button [ " class " ] : " " );
2020-03-10 11:20:15 +01:00
print '<button type="button" class="' . $newclass . '" onclick="' . $button [ " function " ] . '"><span ' . $button [ " span " ] . '>' . $button [ " text " ] . '</span></button>' ;
2019-03-15 12:07:33 +01:00
}
2020-08-11 07:49:54 +02:00
2023-04-30 04:26:50 +02:00
if ( getDolGlobalString ( 'TAKEPOS_DELAYED_PAYMENT' )) {
print '<button type="button" class="calcbutton2" onclick="Validate(\'delayed\')">' . $langs -> trans ( " Reported " ) . '</button>' ;
2020-08-11 07:49:54 +02:00
}
2019-03-15 12:07:33 +01:00
?>
2022-08-11 16:29:55 +02:00
< ? php
// Add code from hooks
2024-03-08 02:54:18 +01:00
$parameters = array ();
2022-08-11 16:29:55 +02:00
$hookmanager -> executeHooks ( 'completePayment' , $parameters , $invoice );
print $hookmanager -> resPrint ;
?>
2018-09-28 13:31:41 +02:00
</ div >
</ body >
2018-11-28 13:04:59 +01:00
</ html >