2018-09-28 13:31:41 +02:00
< ? php
/* Copyright ( C ) 2018 Andreu Bisquerra < jove @ bisquerra . com >
2019-01-11 20:09:38 +01:00
* Copyright ( C ) 2019 Josep Lluís Amador < joseplluis @ lliuretic . cat >
2020-08-29 16:07:01 +02:00
* Copyright ( C ) 2020 Thibault FOUCART < support @ ptibogxiv . net >
2025-02-18 21:48:21 +01:00
* Copyright ( C ) 2024 - 2025 MDW < mdeweerd @ users . noreply . github . com >
2024-11-04 23:53:20 +01:00
* Copyright ( C ) 2024 Frédéric France < frederic . france @ free . fr >
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-28 09:56:01 +01:00
/**
2022-09-08 20:20:57 +02:00
* \file htdocs / takepos / index . php
* \ingroup takepos
* \brief Main TakePOS screen
2019-03-28 09:56:01 +01:00
*/
2022-09-08 20:20:57 +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 ( 'NOREQUIREMENU' )) {
define ( 'NOREQUIREMENU' , '1' );
}
if ( ! defined ( 'NOREQUIREHTML' )) {
define ( 'NOREQUIREHTML' , '1' );
}
if ( ! defined ( 'NOREQUIREAJAX' )) {
define ( 'NOREQUIREAJAX' , '1' );
}
2018-09-28 13:31:41 +02:00
2022-09-08 20:20:57 +02:00
// Load Dolibarr environment
2019-11-08 15:51:54 +01:00
require '../main.inc.php' ; // Load $user and permissions
2020-04-12 18:15:38 +02:00
require_once DOL_DOCUMENT_ROOT . '/core/class/html.form.class.php' ;
2018-09-28 13:31:41 +02:00
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formother.class.php' ;
2019-01-23 20:59:34 +01:00
require_once DOL_DOCUMENT_ROOT . '/core/class/hookmanager.class.php' ;
2021-02-05 17:30:41 +01:00
require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php' ;
2022-09-08 20:20:57 +02:00
require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php' ;
require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php' ;
require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php' ;
2024-11-04 23:53:20 +01:00
/**
* @ var Conf $conf
* @ var DoliDB $db
* @ var HookManager $hookmanager
* @ var Societe $mysoc
* @ var Translate $langs
* @ var User $user
*/
$langs -> loadLangs ( array ( " bills " , " orders " , " commercial " , " cashdesk " , " receiptprinter " , " banks " ));
2018-09-28 13:31:41 +02:00
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 or multiple sales
2020-09-16 19:39:50 +02:00
$action = GETPOST ( 'action' , 'aZ09' );
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
$setterminal = GETPOSTINT ( 'setterminal' );
2020-10-03 22:13:32 +02:00
$setcurrency = GETPOST ( 'setcurrency' , 'aZ09' );
2019-05-08 18:29:00 +02:00
2023-04-27 19:59:51 +02:00
$hookmanager -> initHooks ( array ( 'takeposfrontend' ));
2022-04-08 00:42:39 +02:00
if ( empty ( $_SESSION [ " takeposterminal " ])) {
2022-08-31 14:55:53 +02:00
if ( getDolGlobalInt ( 'TAKEPOS_NUM_TERMINALS' ) == 1 ) {
2021-02-26 21:17:52 +01:00
$_SESSION [ " takeposterminal " ] = 1 ; // Use terminal 1 if there is only 1 terminal
} elseif ( ! empty ( $_COOKIE [ " takeposterminal " ])) {
$_SESSION [ " takeposterminal " ] = preg_replace ( '/[^a-zA-Z0-9_\-]/' , '' , $_COOKIE [ " takeposterminal " ]); // Restore takeposterminal from previous session
}
2020-08-30 09:19:35 +02:00
}
2021-02-26 21:17:52 +01:00
if ( $setterminal > 0 ) {
2019-11-08 15:51:54 +01:00
$_SESSION [ " takeposterminal " ] = $setterminal ;
2024-08-07 03:05:02 +02:00
setcookie ( " takeposterminal " , ( string ) $setterminal , ( time () + ( 86400 * 354 )), '/' , '' , ! empty ( $dolibarr_main_force_https ), true ); // Permanent takeposterminal var in a cookie
2019-05-08 18:29:00 +02:00
}
2018-09-28 13:31:41 +02:00
2021-02-26 21:17:52 +01:00
if ( $setcurrency != " " ) {
2020-10-03 22:13:32 +02:00
$_SESSION [ " takeposcustomercurrency " ] = $setcurrency ;
2021-07-06 03:53:42 +02:00
// We will recalculate amount for foreign currency at next call of invoice.php when $_SESSION["takeposcustomercurrency"] differs from invoice->multicurrency_code.
2020-10-03 22:13:32 +02:00
}
2019-08-28 13:22:54 +02:00
2019-03-15 01:28:54 +01:00
$categorie = new Categorie ( $db );
2020-01-27 01:31:39 +01:00
$maxcategbydefaultforthisdevice = 12 ;
$maxproductbydefaultforthisdevice = 24 ;
2021-02-26 21:17:52 +01:00
if ( $conf -> browser -> layout == 'phone' ) {
2020-10-31 14:32:18 +01:00
$maxcategbydefaultforthisdevice = 8 ;
$maxproductbydefaultforthisdevice = 16 ;
2024-01-07 19:32:47 +01:00
//REDIRECT TO BASIC LAYOUT IF TERMINAL SELECTED AND BASIC MOBILE LAYOUT FORCED
2024-02-10 12:02:09 +01:00
if ( ! empty ( $_SESSION [ " takeposterminal " ]) && getDolGlobalString ( 'TAKEPOS_BAR_RESTAURANT' ) && getDolGlobalInt ( 'TAKEPOS_PHONE_BASIC_LAYOUT' ) == 1 ) {
2019-11-08 15:51:54 +01:00
$_SESSION [ " basiclayout " ] = 1 ;
2019-10-16 16:26:00 +02:00
header ( " Location: phone.php?mobilepage=invoice " );
2019-05-26 16:44:17 +02:00
exit ;
}
2024-01-07 19:32:47 +01:00
} else {
unset ( $_SESSION [ " basiclayout " ]);
2019-03-29 11:45:40 +01:00
}
2023-11-27 12:08:48 +01:00
$MAXCATEG = ( ! getDolGlobalString ( 'TAKEPOS_NB_MAXCATEG' ) ? $maxcategbydefaultforthisdevice : $conf -> global -> TAKEPOS_NB_MAXCATEG );
$MAXPRODUCT = ( ! getDolGlobalString ( 'TAKEPOS_NB_MAXPRODUCT' ) ? $maxproductbydefaultforthisdevice : $conf -> global -> TAKEPOS_NB_MAXPRODUCT );
2019-03-15 01:28:54 +01:00
2024-03-15 22:25:15 +01:00
$term = empty ( $_SESSION [ 'takeposterminal' ]) ? 1 : $_SESSION [ 'takeposterminal' ];
2024-02-06 17:05:52 +01:00
2020-01-01 21:54:47 +01:00
/*
2022-08-22 01:56:19 +02:00
$constforcompanyid = 'CASHDESK_ID_THIRDPARTY' . $_SESSION [ " takeposterminal " ];
$soc = new Societe ( $db );
if ( $invoice -> socid > 0 ) $soc -> fetch ( $invoice -> socid );
2023-10-09 15:44:57 +02:00
else $soc -> fetch ( getDolGlobalInt ( $constforcompanyid ));
2022-08-22 01:56:19 +02:00
*/
2020-01-01 21:54:47 +01:00
2020-01-25 14:23:23 +01:00
// Security check
$result = restrictedArea ( $user , 'takepos' , 0 , '' );
2018-09-28 13:31:41 +02:00
2020-04-12 18:15:38 +02:00
2018-09-28 13:31:41 +02:00
/*
* View
*/
2020-04-12 18:15:38 +02:00
$form = new Form ( $db );
2022-04-08 00:42:39 +02:00
$disablejs = 0 ;
$disablehead = 0 ;
2022-08-22 01:56:19 +02:00
$arrayofjs = array ( '/takepos/js/jquery.colorbox-min.js' ); // TODO It seems we don't need this
$arrayofcss = array ( '/takepos/css/pos.css.php' , '/takepos/css/colorbox.css' );
if ( getDolGlobalInt ( 'TAKEPOS_COLOR_THEME' ) == 1 ) {
$arrayofcss [] = '/takepos/css/colorful.css' ;
}
2022-04-08 00:42:39 +02:00
2018-09-28 13:31:41 +02:00
// Title
2019-11-08 15:51:54 +01:00
$title = 'TakePOS - Dolibarr ' . DOL_VERSION ;
2023-11-27 12:08:48 +01:00
if ( getDolGlobalString ( 'MAIN_APPLICATION_TITLE' )) {
2023-10-15 18:41:39 +02:00
$title = 'TakePOS - ' . getDolGlobalString ( 'MAIN_APPLICATION_TITLE' );
2021-02-26 21:17:52 +01:00
}
2019-11-08 15:51:54 +01:00
$head = ' < meta name = " apple-mobile-web-app-title " content = " TakePOS " />
2018-12-17 22:43:02 +01:00
< meta name = " apple-mobile-web-app-capable " content = " yes " >
< meta name = " mobile-web-app-capable " content = " yes " >
< meta name = " viewport " content = " width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no " /> ' ;
2018-09-28 13:31:41 +02:00
top_htmlhead ( $head , $title , $disablejs , $disablehead , $arrayofjs , $arrayofcss );
2022-08-22 01:56:19 +02:00
2022-04-08 00:42:39 +02:00
$categories = $categorie -> get_full_arbo ( 'product' , (( getDolGlobalInt ( 'TAKEPOS_ROOT_CATEGORY_ID' ) > 0 ) ? getDolGlobalInt ( 'TAKEPOS_ROOT_CATEGORY_ID' ) : 0 ), 1 );
2019-03-15 01:28:54 +01:00
// Search root category to know its level
2019-03-27 20:20:39 +01:00
//$conf->global->TAKEPOS_ROOT_CATEGORY_ID=0;
2019-11-08 15:51:54 +01:00
$levelofrootcategory = 0 ;
2022-04-08 00:42:39 +02:00
if ( getDolGlobalInt ( 'TAKEPOS_ROOT_CATEGORY_ID' ) > 0 ) {
2021-02-26 21:17:52 +01:00
foreach ( $categories as $key => $categorycursor ) {
2024-09-29 21:52:31 +02:00
// @phan-suppress-next-line PhanTypeInvalidDimOffset
2022-04-08 00:42:39 +02:00
if ( $categorycursor [ 'id' ] == getDolGlobalInt ( 'TAKEPOS_ROOT_CATEGORY_ID' )) {
2020-10-31 14:32:18 +01:00
$levelofrootcategory = $categorycursor [ 'level' ];
break ;
}
}
2019-03-15 01:28:54 +01:00
}
2021-02-14 22:44:04 +01:00
2019-03-15 01:28:54 +01:00
$levelofmaincategories = $levelofrootcategory + 1 ;
2019-01-27 21:49:48 +01:00
2019-03-15 00:49:44 +01:00
$maincategories = array ();
$subcategories = array ();
2021-02-26 21:17:52 +01:00
foreach ( $categories as $key => $categorycursor ) {
if ( $categorycursor [ 'level' ] == $levelofmaincategories ) {
2020-10-31 14:32:18 +01:00
$maincategories [ $key ] = $categorycursor ;
} else {
$subcategories [ $key ] = $categorycursor ;
}
2019-03-15 00:49:44 +01:00
}
2019-03-14 16:35:36 +01:00
2020-03-09 17:56:09 +01:00
$maincategories = dol_sort_array ( $maincategories , 'label' );
$subcategories = dol_sort_array ( $subcategories , 'label' );
2018-09-28 13:31:41 +02:00
?>
2019-02-01 15:33:36 +01:00
2022-08-22 01:56:19 +02:00
< body class = " bodytakepos " style = " overflow: hidden; " >
< script >
2019-03-14 16:35:36 +01:00
var categories = < ? php echo json_encode ( $maincategories ); ?> ;
2019-02-01 15:33:36 +01:00
var subcategories = < ? php echo json_encode ( $subcategories ); ?> ;
2018-09-28 13:31:41 +02:00
var currentcat ;
var pageproducts = 0 ;
var pagecategories = 0 ;
2018-12-19 22:52:16 +01:00
var pageactions = 0 ;
2019-11-08 15:51:54 +01:00
var place = " <?php echo $place ; ?> " ;
2018-09-28 13:31:41 +02:00
var editaction = " qty " ;
var editnumber = " " ;
2021-01-02 15:36:19 +01:00
var invoiceid = 0 ;
2021-09-07 14:48:30 +02:00
var search2_timer = null ;
2019-03-28 18:51:04 +01:00
2019-03-29 11:45:40 +01:00
/*
var app = this ;
app . hasKeyboard = false ;
this . keyboardPress = function () {
2021-02-26 21:17:52 +01:00
app . hasKeyboard = true ;
$ ( window ) . unbind ( " keyup " , app . keyboardPress );
localStorage . hasKeyboard = true ;
console . log ( " has keyboard! " )
2019-03-29 11:45:40 +01:00
}
$ ( window ) . on ( " keyup " , app . keyboardPress )
if ( localStorage . hasKeyboard ) {
2021-02-26 21:17:52 +01:00
app . hasKeyboard = true ;
$ ( window ) . unbind ( " keyup " , app . keyboardPress );
console . log ( " has keyboard from localStorage " )
2019-03-29 11:45:40 +01:00
}
*/
2022-06-10 11:31:48 +02:00
function ClearSearch ( clearSearchResults ) {
2019-03-29 11:45:40 +01:00
console . log ( " ClearSearch " );
$ ( " #search " ) . val ( '' );
2022-06-08 02:55:45 +02:00
$ ( " #qty " ) . html ( " <?php echo $langs->trans ( " Qty " ); ?> " ) . removeClass ( 'clicked' );
$ ( " #price " ) . html ( " <?php echo $langs->trans ( " Price " ); ?> " ) . removeClass ( 'clicked' );
2023-05-25 09:07:52 +02:00
$ ( " #reduction " ) . html ( " <?php echo $langs->trans ( " LineDiscountShort " ); ?> " ) . removeClass ( 'clicked' );
2019-09-02 21:26:44 +02:00
< ? php if ( $conf -> browser -> layout == 'classic' ) { ?>
2019-03-29 11:45:40 +01:00
setFocusOnSearchField ();
< ? php } ?>
2023-12-29 03:03:08 +01:00
if ( clearSearchResults ) {
$ ( " #search " ) . trigger ( 'keyup' );
}
2019-03-29 11:45:40 +01:00
}
// Set the focus on search field but only on desktop. On tablet or smartphone, we don't to avoid to have the keyboard open automatically
function setFocusOnSearchField () {
2020-03-16 15:41:21 +01:00
console . log ( " Call setFocusOnSearchField in page index.php " );
2019-03-29 12:19:23 +01:00
< ? php if ( $conf -> browser -> layout == 'classic' ) { ?>
2019-03-29 11:45:40 +01:00
console . log ( " has keyboard from localStorage, so we can force focus on search field " );
$ ( " #search " ) . focus ();
2019-03-29 12:19:23 +01:00
< ? php } ?>
2019-03-29 11:45:40 +01:00
}
2019-03-27 15:42:53 +01:00
function PrintCategories ( first ) {
2019-03-28 18:51:04 +01:00
console . log ( " PrintCategories " );
2023-12-04 13:53:48 +01:00
for ( i = 0 ; i < < ? php echo ( $MAXCATEG - 2 ); ?> ; i++) {
2019-03-28 18:51:04 +01:00
if ( typeof ( categories [ parseInt ( i ) + parseInt ( first )]) == " undefined " )
{
2019-03-29 11:45:40 +01:00
$ ( " #catdivdesc " + i ) . hide ();
2019-03-28 18:51:04 +01:00
$ ( " #catdesc " + i ) . text ( " " );
$ ( " #catimg " + i ) . attr ( " src " , " genimg/empty.png " );
$ ( " #catwatermark " + i ) . hide ();
2019-12-04 21:30:31 +01:00
$ ( " #catdiv " + i ) . attr ( 'class' , 'wrapper divempty' );
2019-03-28 18:51:04 +01:00
continue ;
}
2019-03-29 11:45:40 +01:00
$ ( " #catdivdesc " + i ) . show ();
2021-11-30 16:19:36 +01:00
< ? php
2022-05-08 20:28:37 +02:00
if ( getDolGlobalString ( 'TAKEPOS_SHOW_CATEGORY_DESCRIPTION' ) == 1 ) { ?>
2021-12-01 09:58:01 +01:00
$ ( " #catdesc " + i ) . html ( categories [ parseInt ( i ) + parseInt ( first )][ 'label' ] . bold () + ' - ' + categories [ parseInt ( i ) + parseInt ( first )][ 'description' ]);
2021-11-30 16:19:36 +01:00
< ? php } else { ?>
$ ( " #catdesc " + i ) . text ( categories [ parseInt ( i ) + parseInt ( first )][ 'label' ]);
< ? php } ?>
2021-02-26 21:17:52 +01:00
$ ( " #catimg " + i ) . attr ( " src " , " genimg/index.php?query=cat&id= " + categories [ parseInt ( i ) + parseInt ( first )][ 'rowid' ]);
$ ( " #catdiv " + i ) . data ( " rowid " , categories [ parseInt ( i ) + parseInt ( first )][ 'rowid' ]);
2024-02-10 12:02:09 +01:00
$ ( " #catdiv " + i ) . attr ( " data-rowid " , categories [ parseInt ( i ) + parseInt ( first )][ 'rowid' ]);
2019-12-04 21:30:31 +01:00
$ ( " #catdiv " + i ) . attr ( 'class' , 'wrapper' );
2019-02-24 21:15:11 +01:00
$ ( " #catwatermark " + i ) . show ();
2018-09-28 13:31:41 +02:00
}
}
2019-03-27 15:42:53 +01:00
function MoreCategories ( moreorless ) {
2019-03-27 19:34:13 +01:00
console . log ( " MoreCategories moreorless= " + moreorless + " pagecategories= " + pagecategories );
2023-04-30 03:10:20 +02:00
if ( moreorless == " more " ) {
2018-12-17 22:43:02 +01:00
$ ( '#catimg15' ) . animate ({ opacity : '0.5' }, 1 );
2018-09-28 13:31:41 +02:00
$ ( '#catimg15' ) . animate ({ opacity : '1' }, 100 );
pagecategories = pagecategories + 1 ;
}
2023-04-30 03:10:20 +02:00
if ( moreorless == " less " ) {
2018-12-17 22:43:02 +01:00
$ ( '#catimg14' ) . animate ({ opacity : '0.5' }, 1 );
2018-09-28 13:31:41 +02:00
$ ( '#catimg14' ) . animate ({ opacity : '1' }, 100 );
if ( pagecategories == 0 ) return ; //Return if no less pages
pagecategories = pagecategories - 1 ;
}
2023-12-04 13:53:48 +01:00
if ( typeof ( categories [ < ? php echo ( $MAXCATEG - 2 ); ?> * pagecategories] && moreorless == "more") == "undefined") { // Return if no more pages
2018-09-28 13:31:41 +02:00
pagecategories = pagecategories - 1 ;
return ;
}
2023-05-01 14:33:08 +02:00
2023-12-04 13:53:48 +01:00
for ( i = 0 ; i < < ? php echo ( $MAXCATEG - 2 ); ?> ; i++) {
if ( typeof ( categories [ i + ( < ? php echo ( $MAXCATEG - 2 ); ?> * pagecategories)]) == "undefined") {
2023-05-01 14:33:08 +02:00
// complete with empty record
console . log ( " complete with empty record " );
2019-03-29 11:45:40 +01:00
$ ( " #catdivdesc " + i ) . hide ();
2019-03-27 19:34:13 +01:00
$ ( " #catdesc " + i ) . text ( " " );
$ ( " #catimg " + i ) . attr ( " src " , " genimg/empty.png " );
$ ( " #catwatermark " + i ) . hide ();
continue ;
}
2019-03-29 11:45:40 +01:00
$ ( " #catdivdesc " + i ) . show ();
2021-11-30 16:19:36 +01:00
< ? php
2022-05-08 20:28:37 +02:00
if ( getDolGlobalString ( 'TAKEPOS_SHOW_CATEGORY_DESCRIPTION' ) == 1 ) { ?>
2023-12-04 13:53:48 +01:00
$ ( " #catdesc " + i ) . html ( categories [ i + ( < ? php echo ( $MAXCATEG - 2 ); ?> * pagecategories)]['label'].bold() + ' - ' + categories[i+(<?php echo($MAXCATEG - 2); ?> * pagecategories)]['description']);
2021-11-30 16:19:36 +01:00
< ? php } else { ?>
2023-12-04 13:53:48 +01:00
$ ( " #catdesc " + i ) . text ( categories [ i + ( < ? php echo ( $MAXCATEG - 2 ); ?> * pagecategories)]['label']);
2021-11-30 16:19:36 +01:00
< ? php } ?>
2023-12-04 13:53:48 +01:00
$ ( " #catimg " + i ) . attr ( " src " , " genimg/index.php?query=cat&id= " + categories [ i + ( < ? php echo ( $MAXCATEG - 2 ); ?> * pagecategories)]['rowid']);
$ ( " #catdiv " + i ) . data ( " rowid " , categories [ i + ( < ? php echo ( $MAXCATEG - 2 ); ?> * pagecategories)]['rowid']);
2024-02-10 12:02:09 +01:00
$ ( " #catdiv " + i ) . attr ( " data-rowid " , categories [ i + ( < ? php echo ( $MAXCATEG - 2 ); ?> * pagecategories)]['rowid']);
2019-02-24 21:15:11 +01:00
$ ( " #catwatermark " + i ) . show ();
2018-09-28 13:31:41 +02:00
}
2019-03-28 18:51:04 +01:00
2023-05-23 17:52:34 +02:00
ClearSearch ( false );
2018-09-28 13:31:41 +02:00
}
2019-09-27 10:19:27 +02:00
// LoadProducts
function LoadProducts ( position , issubcat ) {
2024-02-10 12:02:09 +01:00
console . log ( " LoadProducts position= " + position + " issubcat= " + issubcat );
2023-12-04 13:53:48 +01:00
var maxproduct = < ? php echo ( $MAXPRODUCT - 2 ); ?> ;
2019-03-27 17:50:23 +01:00
2024-02-10 12:02:09 +01:00
if ( position == " supplements " ) {
currentcat = " supplements " ;
} else {
2019-12-08 23:16:49 +01:00
$ ( '#catimg' + position ) . animate ({ opacity : '0.5' }, 1 );
$ ( '#catimg' + position ) . animate ({ opacity : '1' }, 100 );
2024-02-10 12:02:09 +01:00
if ( issubcat == true ) {
currentcat = $ ( '#prodiv' + position ) . data ( 'rowid' );
} else {
console . log ( '#catdiv' + position );
currentcat = $ ( '#catdiv' + position ) . data ( 'rowid' );
console . log ( " currentcat= " + currentcat );
}
}
if ( currentcat == undefined ) {
return ;
2019-12-08 23:16:49 +01:00
}
2018-09-28 13:31:41 +02:00
pageproducts = 0 ;
2019-01-27 21:49:48 +01:00
ishow = 0 ; //product to show counter
2019-02-03 14:29:45 +01:00
2019-01-27 21:49:48 +01:00
jQuery . each ( subcategories , function ( i , val ) {
2019-03-27 17:50:23 +01:00
if ( currentcat == val . fk_parent ) {
2019-03-29 11:45:40 +01:00
$ ( " #prodivdesc " + ishow ) . show ();
2022-05-08 20:28:37 +02:00
< ? php if ( getDolGlobalString ( 'TAKEPOS_SHOW_CATEGORY_DESCRIPTION' ) == 1 ) { ?>
2021-11-30 18:22:59 +01:00
$ ( " #prodesc " + ishow ) . html ( val . label . bold () + ' - ' + val . description );
2022-05-08 20:33:23 +02:00
$ ( " #probutton " + ishow ) . html ( val . label );
2021-11-30 18:22:59 +01:00
< ? php } else { ?>
$ ( " #prodesc " + ishow ) . text ( val . label );
2022-05-08 20:33:23 +02:00
$ ( " #probutton " + ishow ) . text ( val . label );
2021-11-30 18:22:59 +01:00
< ? php } ?>
2021-05-23 09:55:01 +02:00
$ ( " #probutton " + ishow ) . show ();
2020-03-16 18:04:22 +01:00
$ ( " #proprice " + ishow ) . attr ( " class " , " hidden " );
$ ( " #proprice " + ishow ) . html ( " " );
2019-02-27 04:21:12 +01:00
$ ( " #proimg " + ishow ) . attr ( " src " , " genimg/index.php?query=cat&id= " + val . rowid );
2019-01-27 21:49:48 +01:00
$ ( " #prodiv " + ishow ) . data ( " rowid " , val . rowid );
2024-02-10 12:02:09 +01:00
$ ( " #prodiv " + ishow ) . attr ( " data-rowid " , val . rowid );
2019-01-27 21:49:48 +01:00
$ ( " #prodiv " + ishow ) . data ( " iscat " , 1 );
2024-02-10 12:02:09 +01:00
$ ( " #prodiv " + ishow ) . attr ( " data-iscat " , 1 );
2019-02-24 21:15:11 +01:00
$ ( " #prowatermark " + ishow ) . show ();
2019-01-27 21:49:48 +01:00
ishow ++ ;
}
});
2019-02-03 14:29:45 +01:00
idata = 0 ; //product data counter
2023-03-20 12:28:18 +01:00
var limit = 0 ;
if ( maxproduct >= 1 ) {
limit = maxproduct - 1 ;
}
// Only show products for sale (tosell=1)
2023-09-09 14:33:13 +02:00
$ . getJSON ( '<?php echo DOL_URL_ROOT ?>/takepos/ajax/ajax.php?action=getProducts&token=<?php echo newToken();?>&thirdpartyid=' + jQuery ( '#thirdpartyid' ) . val () + '&category=' + currentcat + '&tosell=1&limit=' + limit + '&offset=0' , function ( data ) {
2019-10-03 17:40:59 +02:00
console . log ( " Call ajax.php (in LoadProducts) to get Products of category " + currentcat + " then loop on result to fill image thumbs " );
2019-10-20 15:16:40 +02:00
console . log ( data );
2024-02-12 13:41:46 +01:00
2019-03-27 17:50:23 +01:00
while ( ishow < maxproduct ) {
2024-02-12 13:41:46 +01:00
console . log ( " ishow " + ishow + " idata= " + idata );
//console.log(data[idata]);
2019-01-11 20:09:38 +01:00
if ( typeof ( data [ idata ]) == " undefined " ) {
2022-04-08 00:42:39 +02:00
< ? php if ( ! getDolGlobalString ( 'TAKEPOS_HIDE_PRODUCT_IMAGES' )) {
2020-09-16 06:54:01 +02:00
echo '$("#prodivdesc"+ishow).hide();' ;
echo '$("#prodesc"+ishow).text("");' ;
echo '$("#proimg"+ishow).attr("title","");' ;
echo '$("#proimg"+ishow).attr("src","genimg/empty.png");' ;
2020-09-16 07:59:36 +02:00
} else {
2020-09-16 06:54:01 +02:00
echo '$("#probutton"+ishow).hide();' ;
echo '$("#probutton"+ishow).text("");' ;
} ?>
2020-03-16 18:04:22 +01:00
$ ( " #proprice " + ishow ) . attr ( " class " , " hidden " );
$ ( " #proprice " + ishow ) . html ( " " );
2024-02-12 13:41:46 +01:00
2019-01-11 20:09:38 +01:00
$ ( " #prodiv " + ishow ) . data ( " rowid " , " " );
2024-02-10 12:02:09 +01:00
$ ( " #prodiv " + ishow ) . attr ( " data-rowid " , " " );
2024-02-12 13:41:46 +01:00
2019-12-04 21:30:31 +01:00
$ ( " #prodiv " + ishow ) . attr ( " class " , " wrapper2 divempty " );
2023-03-20 12:28:18 +01:00
} else {
2020-03-16 18:04:22 +01:00
< ? php
$titlestring = " ' " . dol_escape_js ( $langs -> transnoentities ( 'Ref' ) . ': ' ) . " ' + data[idata]['ref'] " ;
2024-03-15 22:25:15 +01:00
$titlestring .= " + ' - " . dol_escape_js ( $langs -> trans ( " Barcode " ) . ': ' ) . " ' + data[idata]['barcode'] " ;
2020-03-16 18:04:22 +01:00
?>
var titlestring = < ? php echo $titlestring ; ?> ;
2022-04-08 00:42:39 +02:00
< ? php if ( ! getDolGlobalString ( 'TAKEPOS_HIDE_PRODUCT_IMAGES' )) {
2020-09-16 06:54:01 +02:00
echo '$("#prodivdesc"+ishow).show();' ;
2022-04-08 00:42:39 +02:00
if ( getDolGlobalInt ( 'TAKEPOS_SHOW_PRODUCT_REFERENCE' ) == 1 ) {
2021-11-30 15:41:46 +01:00
echo '$("#prodesc"+ishow).html(data[parseInt(idata)][\'ref\'].bold() + \' - \' + data[parseInt(idata)][\'label\']);' ;
2023-08-28 17:34:05 +02:00
} elseif ( getDolGlobalInt ( 'TAKEPOS_SHOW_PRODUCT_REFERENCE' ) == 2 ) {
echo '$("#prodesc"+ishow).html(data[parseInt(idata)][\'ref\'].bold());' ;
2021-11-30 15:41:46 +01:00
} else {
2022-04-21 07:39:51 +02:00
echo '$("#prodesc"+ishow).html(data[parseInt(idata)][\'label\']);' ;
2021-11-30 15:41:46 +01:00
}
2020-09-16 06:54:01 +02:00
echo '$("#proimg"+ishow).attr("title", titlestring);' ;
echo '$("#proimg"+ishow).attr("src", "genimg/index.php?query=pro&id="+data[idata][\'id\']);' ;
2021-02-26 21:17:52 +01:00
} else {
2020-09-16 06:54:01 +02:00
echo '$("#probutton"+ishow).show();' ;
2022-04-21 07:39:51 +02:00
echo '$("#probutton"+ishow).html(data[parseInt(idata)][\'label\']);' ;
2020-09-16 06:54:01 +02:00
}
?>
2020-03-16 18:04:22 +01:00
if ( data [ parseInt ( idata )][ 'price_formated' ]) {
2024-01-30 17:55:13 +01:00
$ ( " #proprice " + ishow ) . attr ( " class " , " productprice " );
< ? php
if ( getDolGlobalInt ( 'TAKEPOS_CHANGE_PRICE_HT' )) {
?>
$ ( " #proprice " + ishow ) . html ( data [ parseInt ( idata )][ 'price_formated' ]);
< ? php
} else {
?>
$ ( " #proprice " + ishow ) . html ( data [ parseInt ( idata )][ 'price_ttc_formated' ]);
< ? php
}
?>
2020-03-16 18:04:22 +01:00
}
2022-08-22 01:56:19 +02:00
console . log ( " #prodiv " + ishow + " .data(rowid)= " + data [ idata ][ 'id' ]);
2019-10-03 17:40:59 +02:00
$ ( " #prodiv " + ishow ) . data ( " rowid " , data [ idata ][ 'id' ]);
2024-02-10 12:02:09 +01:00
$ ( " #prodiv " + ishow ) . attr ( " data-rowid " , data [ idata ][ 'id' ]);
2022-08-22 01:56:19 +02:00
console . log ( $ ( '#prodiv4' ) . data ( 'rowid' ));
2024-02-12 13:41:46 +01:00
2019-10-03 17:40:59 +02:00
$ ( " #prodiv " + ishow ) . data ( " iscat " , 0 );
2024-02-10 12:02:09 +01:00
$ ( " #prodiv " + ishow ) . attr ( " data-iscat " , 0 );
2024-02-12 13:41:46 +01:00
2019-12-04 21:30:31 +01:00
$ ( " #prodiv " + ishow ) . attr ( " class " , " wrapper2 " );
2023-03-20 12:28:18 +01:00
2022-04-20 14:47:36 +02:00
< ? php
// Add js from hooks
2024-03-15 22:25:15 +01:00
$parameters = array ();
2022-04-20 14:47:36 +02:00
$parameters [ 'caller' ] = 'loadProducts' ;
$hookmanager -> executeHooks ( 'completeJSProductDisplay' , $parameters );
print $hookmanager -> resPrint ;
?>
2018-09-28 13:31:41 +02:00
}
2023-03-20 12:28:18 +01:00
$ ( " #prowatermark " + ishow ) . hide ();
ishow ++ ; //Next product to show after print data product
2024-01-12 17:18:52 +01:00
idata ++ ; //Next data every time
2018-09-28 13:31:41 +02:00
}
});
2019-03-28 18:51:04 +01:00
2023-05-23 17:52:34 +02:00
ClearSearch ( false );
2018-09-28 13:31:41 +02:00
}
2019-03-27 17:50:23 +01:00
function MoreProducts ( moreorless ) {
2019-03-28 18:51:04 +01:00
console . log ( " MoreProducts " );
2022-04-29 09:49:10 +02:00
2022-10-02 13:52:14 +02:00
if ( $ ( '#search_pagination' ) . val () != '' ) {
2023-12-04 13:53:48 +01:00
return Search2 ( '<?php echo(isset($keyCodeForEnter) ? $keyCodeForEnter : ' '); ?>' , moreorless );
2022-10-02 13:52:14 +02:00
}
2022-04-29 09:49:10 +02:00
2023-12-04 13:53:48 +01:00
var maxproduct = < ? php echo ( $MAXPRODUCT - 2 ); ?> ;
2019-03-27 17:50:23 +01:00
2018-09-28 13:31:41 +02:00
if ( moreorless == " more " ){
2018-12-17 22:43:02 +01:00
$ ( '#proimg31' ) . animate ({ opacity : '0.5' }, 1 );
2018-09-28 13:31:41 +02:00
$ ( '#proimg31' ) . animate ({ opacity : '1' }, 100 );
pageproducts = pageproducts + 1 ;
}
if ( moreorless == " less " ){
2018-12-17 22:43:02 +01:00
$ ( '#proimg30' ) . animate ({ opacity : '0.5' }, 1 );
2018-09-28 13:31:41 +02:00
$ ( '#proimg30' ) . animate ({ opacity : '1' }, 100 );
if ( pageproducts == 0 ) return ; //Return if no less pages
pageproducts = pageproducts - 1 ;
}
2023-03-20 12:28:18 +01:00
ishow = 0 ; //product to show counter
idata = 0 ; //product data counter
var limit = 0 ;
if ( maxproduct >= 1 ) {
limit = maxproduct - 1 ;
}
2023-12-04 13:53:48 +01:00
var offset = < ? php echo ( $MAXPRODUCT - 2 ); ?> * pageproducts;
2023-03-20 12:28:18 +01:00
// Only show products for sale (tosell=1)
$ . getJSON ( '<?php echo DOL_URL_ROOT ?>/takepos/ajax/ajax.php?action=getProducts&token=<?php echo newToken();?>&category=' + currentcat + '&tosell=1&limit=' + limit + '&offset=' + offset , function ( data ) {
2019-03-27 17:50:23 +01:00
console . log ( " Call ajax.php (in MoreProducts) to get Products of category " + currentcat );
2023-03-20 12:28:18 +01:00
if ( typeof ( data [ 0 ]) == " undefined " && moreorless == " more " ){ // Return if no more pages
2018-09-28 13:31:41 +02:00
pageproducts = pageproducts - 1 ;
return ;
}
2019-03-27 17:50:23 +01:00
while ( ishow < maxproduct ) {
2019-01-11 20:09:38 +01:00
if ( typeof ( data [ idata ]) == " undefined " ) {
2019-03-29 11:45:40 +01:00
$ ( " #prodivdesc " + ishow ) . hide ();
2019-02-03 14:29:45 +01:00
$ ( " #prodesc " + ishow ) . text ( " " );
2021-05-23 09:55:01 +02:00
$ ( " #probutton " + ishow ) . text ( " " );
$ ( " #probutton " + ishow ) . hide ();
2020-03-16 18:04:22 +01:00
$ ( " #proprice " + ishow ) . attr ( " class " , " " );
$ ( " #proprice " + ishow ) . html ( " " );
2019-02-24 21:15:11 +01:00
$ ( " #proimg " + ishow ) . attr ( " src " , " genimg/empty.png " );
2019-01-11 20:09:38 +01:00
$ ( " #prodiv " + ishow ) . data ( " rowid " , " " );
2024-02-10 12:02:09 +01:00
$ ( " #prodiv " + ishow ) . attr ( " data-rowid " , " " );
2023-03-20 12:28:18 +01:00
} else {
2019-03-29 11:45:40 +01:00
$ ( " #prodivdesc " + ishow ) . show ();
2023-08-28 17:34:05 +02:00
< ? php if ( getDolGlobalInt ( 'TAKEPOS_SHOW_PRODUCT_REFERENCE' ) == 1 ) { ?>
2021-11-30 15:41:46 +01:00
$ ( " #prodesc " + ishow ) . html ( data [ parseInt ( idata )][ 'ref' ] . bold () + ' - ' + data [ parseInt ( idata )][ 'label' ]);
2023-08-28 17:34:05 +02:00
< ? php } elseif ( getDolGlobalInt ( 'TAKEPOS_SHOW_PRODUCT_REFERENCE' ) == 2 ) { ?>
$ ( " #prodesc " + ishow ) . html ( data [ parseInt ( idata )][ 'ref' ] . bold ());
2021-11-30 15:41:46 +01:00
< ? php } else { ?>
2022-04-21 07:39:51 +02:00
$ ( " #prodesc " + ishow ) . html ( data [ parseInt ( idata )][ 'label' ]);
2021-11-30 15:41:46 +01:00
< ? php } ?>
2022-04-21 07:39:51 +02:00
$ ( " #probutton " + ishow ) . html ( data [ parseInt ( idata )][ 'label' ]);
2021-05-23 09:55:01 +02:00
$ ( " #probutton " + ishow ) . show ();
2020-03-16 18:04:22 +01:00
if ( data [ parseInt ( idata )][ 'price_formated' ]) {
2024-01-30 17:55:13 +01:00
$ ( " #proprice " + ishow ) . attr ( " class " , " productprice " );
< ? php
if ( getDolGlobalInt ( 'TAKEPOS_CHANGE_PRICE_HT' )) {
?>
$ ( " #proprice " + ishow ) . html ( data [ parseInt ( idata )][ 'price_formated' ]);
< ? php
} else {
?>
$ ( " #proprice " + ishow ) . html ( data [ parseInt ( idata )][ 'price_ttc_formated' ]);
< ? php
}
?>
2020-03-16 18:04:22 +01:00
}
2019-02-27 04:21:12 +01:00
$ ( " #proimg " + ishow ) . attr ( " src " , " genimg/index.php?query=pro&id= " + data [ idata ][ 'id' ]);
2019-01-11 20:09:38 +01:00
$ ( " #prodiv " + ishow ) . data ( " rowid " , data [ idata ][ 'id' ]);
2024-02-10 12:02:09 +01:00
$ ( " #prodiv " + ishow ) . attr ( " data-rowid " , data [ idata ][ 'id' ]);
2019-01-27 21:49:48 +01:00
$ ( " #prodiv " + ishow ) . data ( " iscat " , 0 );
2018-09-28 13:31:41 +02:00
}
2019-02-24 21:15:11 +01:00
$ ( " #prowatermark " + ishow ) . hide ();
2023-03-20 12:28:18 +01:00
ishow ++ ; //Next product to show after print data product
2024-01-12 17:18:52 +01:00
idata ++ ; //Next data every time
2018-09-28 13:31:41 +02:00
}
});
2019-03-28 18:51:04 +01:00
2023-05-23 17:52:34 +02:00
ClearSearch ( false );
2018-09-28 13:31:41 +02:00
}
2022-02-09 16:37:41 +01:00
function ClickProduct ( position , qty = 1 ) {
2022-08-22 01:56:19 +02:00
console . log ( " ClickProduct at position " + position );
2024-11-07 23:42:03 +01:00
if ( $ ( '#invoiceid' ) . val () == " " ) {
invoiceid = $ ( '#invoiceid' ) . val ();
Refresh ();
}
2021-02-26 21:17:52 +01:00
$ ( '#proimg' + position ) . animate ({ opacity : '0.5' }, 1 );
2018-09-28 13:31:41 +02:00
$ ( '#proimg' + position ) . animate ({ opacity : '1' }, 100 );
2019-01-27 21:49:48 +01:00
if ( $ ( '#prodiv' + position ) . data ( 'iscat' ) == 1 ){
2019-03-27 17:50:23 +01:00
console . log ( " Click on a category at position " + position );
2019-01-27 21:49:48 +01:00
LoadProducts ( position , true );
}
else {
2022-08-22 01:56:19 +02:00
console . log ( $ ( '#prodiv4' ) . data ( 'rowid' ));
2024-03-21 13:06:09 +01:00
invoiceid = $ ( " #invoiceid " ) . val ();
2019-01-27 21:49:48 +01:00
idproduct = $ ( '#prodiv' + position ) . data ( 'rowid' );
2024-08-29 19:45:11 +02:00
console . log ( " Click on product at position " + position + " for idproduct " + idproduct + " , qty= " + qty + " invoiceid= " + invoiceid );
if ( idproduct == " " ) {
return ;
}
2019-03-27 17:50:23 +01:00
// Call page invoice.php to generate the section with product lines
2024-08-29 19:45:11 +02:00
$ ( " #poslines " ) . load ( " invoice.php?action=addline&token=<?php echo newToken(); ?>&place= " + place + " &idproduct= " + idproduct + " &qty= " + qty + " &invoiceid= " + invoiceid , function () {
2023-12-04 13:53:48 +01:00
< ? php if ( getDolGlobalString ( 'TAKEPOS_CUSTOMER_DISPLAY' )) {
2024-03-15 22:25:15 +01:00
echo " CustomerDisplay(); " ;
2023-12-04 13:53:48 +01:00
} ?>
2019-01-27 21:49:48 +01:00
});
}
2019-03-28 19:33:22 +01:00
2023-05-23 17:52:34 +02:00
ClearSearch ( false );
2018-09-28 13:31:41 +02:00
}
2020-08-29 16:07:01 +02:00
function ChangeThirdparty ( idcustomer ) {
console . log ( " ChangeThirdparty " );
// Call page list.php to change customer
2024-01-07 19:32:47 +01:00
$ ( " #poslines " ) . load ( " <?php echo DOL_URL_ROOT ?>/societe/list.php?action=change&token=<?php echo newToken();?>&type=t&contextpage=poslist&idcustomer= " + idcustomer + " &place= " + place + " " , function () {
2020-08-29 16:07:01 +02:00
});
2023-05-23 17:52:34 +02:00
ClearSearch ( false );
2020-08-29 16:07:01 +02:00
}
2019-03-27 17:50:23 +01:00
function deleteline () {
2024-03-21 13:06:09 +01:00
invoiceid = $ ( " #invoiceid " ) . val ();
2024-03-22 02:11:58 +01:00
console . log ( " Delete line invoiceid= " + invoiceid );
2024-03-21 14:22:12 +01:00
$ ( " #poslines " ) . load ( " invoice.php?action=deleteline&token=<?php echo newToken(); ?>&place= " + place + " &idline= " + selectedline + " &invoiceid= " + invoiceid , function () {
2019-03-27 20:20:39 +01:00
//$('#poslines').scrollTop($('#poslines')[0].scrollHeight);
2018-09-28 13:31:41 +02:00
});
2023-05-23 17:52:34 +02:00
ClearSearch ( false );
2018-09-28 13:31:41 +02:00
}
2019-03-27 17:50:23 +01:00
function Customer () {
2019-08-01 12:23:02 +02:00
console . log ( " Open box to select the thirdparty place= " + place );
2020-09-29 17:10:08 +02:00
$ . colorbox ({ href : " ../societe/list.php?type=t&contextpage=poslist&nomassaction=1&place= " + place , width : " 90% " , height : " 80% " , transition : " none " , iframe : " true " , title : " <?php echo $langs->trans ( " Customer " ); ?> " });
2018-09-28 13:31:41 +02:00
}
2023-10-13 16:19:10 +02:00
function Contact () {
console . log ( " Open box to select the contact place= " + place );
$ . colorbox ({ href : " ../contact/list.php?type=c&contextpage=poslist&nomassaction=1&place= " + place , width : " 90% " , height : " 80% " , transition : " none " , iframe : " true " , title : " <?php echo $langs->trans ( " Contact " ); ?> " });
}
2019-04-28 18:12:33 +02:00
function History ()
{
2021-02-26 21:17:52 +01:00
console . log ( " Open box to select the history " );
$ . colorbox ({ href : " ../compta/facture/list.php?contextpage=poslist " , width : " 90% " , height : " 80% " , transition : " none " , iframe : " true " , title : " <?php echo $langs->trans ( " History " ); ?> " });
2019-04-28 18:12:33 +02:00
}
2020-03-11 12:30:07 +01:00
function Reduction () {
invoiceid = $ ( " #invoiceid " ) . val ();
console . log ( " Open popup to enter reduction on invoiceid= " + invoiceid );
$ . colorbox ({ href : " reduction.php?place= " + place + " &invoiceid= " + invoiceid , width : " 80% " , height : " 90% " , transition : " none " , iframe : " true " , title : " " });
}
2024-11-17 11:54:21 +01:00
var closeBillParams = " " ;
2019-03-27 17:50:23 +01:00
function CloseBill () {
2024-02-19 15:12:34 +01:00
< ? php
2024-11-17 11:54:21 +01:00
$parameters = array ();
$reshook = $hookmanager -> executeHooks ( 'paramsForCloseBill' , $parameters , $obj , $action );
2025-01-05 18:34:01 +01:00
if ( getDolGlobalString ( 'TAKEPOS_FORBID_SALES_TO_DEFAULT_CUSTOMER' )) {
2024-02-19 15:12:34 +01:00
echo " customerAnchorTag = document.querySelector('a[id= \" customer \" ]'); " ;
echo " if (customerAnchorTag && customerAnchorTag.innerText.trim() === ' " . $langs -> trans ( " Customer " ) . " ') { " ;
2024-10-19 00:56:00 +02:00
echo " alert(' " . dol_escape_js ( $langs -> trans ( " NoClientErrorMessage " )) . " '); " ;
2024-02-19 15:12:34 +01:00
echo " return; } \n " ;
}
?>
2019-03-27 15:42:53 +01:00
invoiceid = $ ( " #invoiceid " ) . val ();
console . log ( " Open popup to enter payment on invoiceid= " + invoiceid );
2023-05-21 19:01:50 +02:00
< ? php if ( getDolGlobalInt ( " TAKEPOS_NO_GENERIC_THIRDPARTY " )) { ?>
2023-05-19 11:54:21 +02:00
if ( $ ( " #idcustomer " ) . val () == " " ) {
alert ( " <?php echo $langs->trans ('TakePosCustomerMandatory'); ?> " );
2024-03-19 02:30:05 +01:00
< ? php if ( getDolGlobalString ( 'TAKEPOS_CHOOSE_CONTACT' )) { ?>
2023-05-19 11:54:21 +02:00
Contact ();
< ? php } else { ?>
Customer ();
< ? php } ?>
return ;
}
2023-05-19 11:54:51 +02:00
< ? php } ?>
2024-01-02 09:47:52 +01:00
< ? php
$alternative_payurl = getDolGlobalString ( 'TAKEPOS_ALTERNATIVE_PAYMENT_SCREEN' );
2024-01-03 16:54:56 +01:00
if ( empty ( $alternative_payurl )) {
2024-01-02 09:47:52 +01:00
$payurl = " pay.php " ;
} else {
$payurl = dol_buildpath ( $alternative_payurl , 1 );
}
?>
2024-11-17 11:54:21 +01:00
$ . colorbox ({ href : " <?php echo $payurl ; ?>?place= " + place + " &invoiceid= " + invoiceid + closeBillParams , width : " 80% " , height : " 90% " , transition : " none " , iframe : " true " , title : " " });
2018-09-28 13:31:41 +02:00
}
2021-08-21 22:29:18 +02:00
function Split () {
invoiceid = $ ( " #invoiceid " ) . val ();
console . log ( " Open popup to split on invoiceid= " + invoiceid );
$ . colorbox ({ href : " split.php?place= " + place + " &invoiceid= " + invoiceid , width : " 80% " , height : " 90% " , transition : " none " , iframe : " true " , title : " " });
}
2019-03-27 17:50:23 +01:00
function Floors () {
2020-06-30 12:07:24 +02:00
console . log ( " Open box to select floor place= " + place );
2019-11-08 15:51:54 +01:00
$ . colorbox ({ href : " floors.php?place= " + place , width : " 90% " , height : " 90% " , transition : " none " , iframe : " true " , title : " <?php echo $langs->trans ( " Floors " ); ?> " });
2018-09-28 13:31:41 +02:00
}
2019-03-27 17:50:23 +01:00
function FreeZone () {
2024-03-22 02:11:58 +01:00
invoiceid = $ ( " #invoiceid " ) . val ();
console . log ( " Open box to enter a free product on invoiceid= " + invoiceid );
$ . colorbox ({ href : " freezone.php?action=freezone&token=<?php echo newToken(); ?>&place= " + place + " &invoiceid= " + invoiceid , width : " 80% " , height : " 40% " , transition : " none " , iframe : " true " , title : " <?php echo $langs->trans ( " FreeZone " ); ?> " });
2019-03-03 12:50:36 +01:00
}
2019-03-27 17:50:23 +01:00
function TakeposOrderNotes () {
2019-03-28 18:51:04 +01:00
console . log ( " Open box to order notes " );
2021-04-14 00:15:02 +02:00
ModalBox ( 'ModalNote' );
$ ( " #textinput " ) . focus ();
2018-09-28 13:31:41 +02:00
}
2019-03-27 17:50:23 +01:00
function Refresh () {
2021-01-02 15:36:19 +01:00
console . log ( " Refresh by reloading place= " + place + " invoiceid= " + invoiceid );
$ ( " #poslines " ) . load ( " invoice.php?place= " + place + " &invoiceid= " + invoiceid , function () {
2019-03-27 20:20:39 +01:00
//$('#poslines').scrollTop($('#poslines')[0].scrollHeight);
2018-09-28 13:31:41 +02:00
});
}
2019-04-02 17:36:27 +02:00
function New () {
2019-08-27 15:39:35 +02:00
// If we go here,it means $conf->global->TAKEPOS_BAR_RESTAURANT is not defined
2023-09-09 14:29:16 +02:00
invoiceid = $ ( " #invoiceid " ) . val (); // This is a hidden field added by invoice.php
2020-12-30 21:22:54 +01:00
console . log ( " New with place = <?php echo $place ; ?>, js place= " + place + " , invoiceid= " + invoiceid );
2022-09-12 12:22:00 +02:00
$ . getJSON ( '<?php echo DOL_URL_ROOT ?>/takepos/ajax/ajax.php?action=getInvoice&token=<?php echo newToken();?>&id=' + invoiceid , function ( data ) {
2020-03-09 17:40:32 +01:00
var r ;
if ( parseInt ( data [ 'paye' ]) === 1 ) {
r = true ;
} else {
2023-12-04 13:53:48 +01:00
r = confirm ( '<?php echo($place > 0 ? $langs->transnoentitiesnoconv("ConfirmDeletionOfThisPOSSale") : $langs->transnoentitiesnoconv("ConfirmDiscardOfThisPOSSale")); ?>' );
2020-03-09 17:40:32 +01:00
}
if ( r == true ) {
2020-07-07 03:50:14 +02:00
// Reload section with invoice lines
2020-10-01 10:50:54 +02:00
$ ( " #poslines " ) . load ( " invoice.php?action=delete&token=<?php echo newToken(); ?>&place= " + place , function () {
2020-03-09 17:40:32 +01:00
//$('#poslines').scrollTop($('#poslines')[0].scrollHeight);
});
2024-01-05 09:07:13 +01:00
2023-05-23 17:52:34 +02:00
ClearSearch ( false );
2023-05-19 11:54:21 +02:00
$ ( " #idcustomer " ) . val ( " " );
2020-03-09 17:40:32 +01:00
}
});
2019-04-02 17:36:27 +02:00
}
2020-02-24 13:57:36 +01:00
/**
* Search products
*
2023-05-01 14:33:08 +02:00
* @ param keyCodeForEnter Key code for " enter " or '' if not
* @ param moreorless " more " or " less "
2022-11-06 22:47:56 +01:00
* return void
2020-02-24 13:57:36 +01:00
*/
2022-04-29 10:00:25 +02:00
function Search2 ( keyCodeForEnter , moreorless ) {
2022-10-11 22:08:26 +02:00
var eventKeyCode = window . event . keyCode ;
console . log ( " Search2 Call ajax search to replace products keyCodeForEnter= " + keyCodeForEnter + " , eventKeyCode= " + eventKeyCode );
2020-03-10 14:08:28 +01:00
2022-04-29 10:00:25 +02:00
var search_term = $ ( '#search' ) . val ();
var search_start = 0 ;
var search_limit = < ? php echo $MAXPRODUCT - 2 ; ?> ;
if ( moreorless != null ) {
search_term = $ ( '#search_pagination' ) . val ();
search_start = $ ( '#search_start_' + moreorless ) . val ();
}
2022-11-06 22:47:56 +01:00
console . log ( " search_term= " + search_term );
2022-05-06 10:32:12 +02:00
if ( search_term == '' ) {
2022-04-20 17:46:16 +02:00
$ ( " [id^=prowatermark] " ) . html ( " " );
$ ( " [id^=prodesc] " ) . text ( " " );
$ ( " [id^=probutton] " ) . text ( " " );
$ ( " [id^=probutton] " ) . hide ();
$ ( " [id^=proprice] " ) . attr ( " class " , " hidden " );
$ ( " [id^=proprice] " ) . html ( " " );
$ ( " [id^=proimg] " ) . attr ( " src " , " genimg/empty.png " );
$ ( " [id^=prodiv] " ) . data ( " rowid " , " " );
2024-02-10 12:02:09 +01:00
$ ( " [id^=prodiv] " ) . attr ( " data-rowid " , " " );
2022-04-20 17:46:16 +02:00
return ;
}
2020-03-10 14:08:28 +01:00
var search = false ;
2022-11-06 22:47:56 +01:00
if ( keyCodeForEnter == '' || eventKeyCode == keyCodeForEnter ) {
2020-03-10 14:08:28 +01:00
search = true ;
}
if ( search === true ) {
2022-10-11 22:08:26 +02:00
// if a timer has been already started (search2_timer is a global js variable), we cancel it now
// we click onto another key, we will restart another timer just after
2021-09-07 14:48:30 +02:00
if ( search2_timer ) {
clearTimeout ( search2_timer );
}
2022-10-11 22:08:26 +02:00
// temporization time to give time to type
2021-09-07 14:48:30 +02:00
search2_timer = setTimeout ( function (){
pageproducts = 0 ;
jQuery ( " .wrapper2 .catwatermark " ) . hide ();
2022-04-29 10:00:25 +02:00
var nbsearchresults = 0 ;
2024-11-21 19:51:29 +01:00
$ . getJSON ( '<?php echo DOL_URL_ROOT ?>/takepos/ajax/ajax.php?action=search&token=<?php echo newToken();?>&search_term=' + search_term + '&thirdpartyid=' + jQuery ( '#thirdpartyid' ) . val () + '&search_start=' + search_start + '&search_limit=' + search_limit , function ( data ) {
2021-09-07 14:48:30 +02:00
for ( i = 0 ; i < < ? php echo $MAXPRODUCT ?> ; i++) {
if ( typeof ( data [ i ]) == " undefined " ) {
2022-04-20 17:46:16 +02:00
$ ( " #prowatermark " + i ) . html ( " " );
2021-09-07 14:48:30 +02:00
$ ( " #prodesc " + i ) . text ( " " );
$ ( " #probutton " + i ) . text ( " " );
$ ( " #probutton " + i ) . hide ();
$ ( " #proprice " + i ) . attr ( " class " , " hidden " );
$ ( " #proprice " + i ) . html ( " " );
$ ( " #proimg " + i ) . attr ( " src " , " genimg/empty.png " );
$ ( " #prodiv " + i ) . data ( " rowid " , " " );
2024-02-10 12:02:09 +01:00
$ ( " #prodiv " + i ) . attr ( " data-rowid " , " " );
2021-09-07 14:48:30 +02:00
continue ;
}
< ? php
$titlestring = " ' " . dol_escape_js ( $langs -> transnoentities ( 'Ref' ) . ': ' ) . " ' + data[i]['ref'] " ;
$titlestring .= " + ' - " . dol_escape_js ( $langs -> trans ( " Barcode " ) . ': ' ) . " ' + data[i]['barcode'] " ;
?>
var titlestring = < ? php echo $titlestring ; ?> ;
2023-08-28 17:34:05 +02:00
< ? php if ( getDolGlobalInt ( 'TAKEPOS_SHOW_PRODUCT_REFERENCE' ) == 1 ) { ?>
$ ( " #prodesc " + i ) . html ( data [ i ][ 'ref' ] . bold () + ' - ' + data [ i ][ 'label' ]);
< ? php } elseif ( getDolGlobalInt ( 'TAKEPOS_SHOW_PRODUCT_REFERENCE' ) == 2 ) { ?>
$ ( " #prodesc " + i ) . html ( data [ i ][ 'ref' ] . bold ());
2021-11-30 15:41:46 +01:00
< ? php } else { ?>
2022-04-21 07:39:51 +02:00
$ ( " #prodesc " + i ) . html ( data [ i ][ 'label' ]);
2021-11-30 15:41:46 +01:00
< ? php } ?>
2021-09-07 14:48:30 +02:00
$ ( " #prodivdesc " + i ) . show ();
2022-04-21 07:39:51 +02:00
$ ( " #probutton " + i ) . html ( data [ i ][ 'label' ]);
2021-09-07 14:48:30 +02:00
$ ( " #probutton " + i ) . show ();
if ( data [ i ][ 'price_formated' ]) {
$ ( " #proprice " + i ) . attr ( " class " , " productprice " );
2024-01-30 17:55:13 +01:00
< ? php
if ( getDolGlobalInt ( 'TAKEPOS_CHANGE_PRICE_HT' )) {
?>
$ ( " #proprice " + i ) . html ( data [ i ][ 'price_formated' ]);
< ? php
} else {
?>
$ ( " #proprice " + i ) . html ( data [ i ][ 'price_ttc_formated' ]);
< ? php
}
?>
2021-09-07 14:48:30 +02:00
}
$ ( " #proimg " + i ) . attr ( " title " , titlestring );
2021-09-07 15:02:27 +02:00
if ( undefined !== data [ i ][ 'img' ]) {
$ ( " #proimg " + i ) . attr ( " src " , data [ i ][ 'img' ]);
}
else {
$ ( " #proimg " + i ) . attr ( " src " , " genimg/index.php?query=pro&id= " + data [ i ][ 'rowid' ]);
}
2021-09-07 14:48:30 +02:00
$ ( " #prodiv " + i ) . data ( " rowid " , data [ i ][ 'rowid' ]);
2024-02-10 12:02:09 +01:00
$ ( " #prodiv " + i ) . attr ( " data-rowid " , data [ i ][ 'rowid' ]);
2021-09-07 14:48:30 +02:00
$ ( " #prodiv " + i ) . data ( " iscat " , 0 );
2024-02-10 12:02:09 +01:00
$ ( " #prodiv " + i ) . attr ( " data-iscat " , 0 );
2022-05-04 01:18:43 +02:00
2022-04-20 14:47:36 +02:00
< ? php
// Add js from hooks
2024-03-15 22:25:15 +01:00
$parameters = array ();
2022-04-20 14:47:36 +02:00
$parameters [ 'caller' ] = 'search2' ;
$hookmanager -> executeHooks ( 'completeJSProductDisplay' , $parameters );
print $hookmanager -> resPrint ;
?>
2022-05-04 01:18:43 +02:00
2022-04-29 10:00:25 +02:00
nbsearchresults ++ ;
2020-09-18 16:00:47 +02:00
}
2021-09-07 14:48:30 +02:00
}) . always ( function ( data ) {
// If there is only 1 answer
if ( $ ( '#search' ) . val () . length > 0 && data . length == 1 ) {
console . log ( $ ( '#search' ) . val () + ' - ' + data [ 0 ][ 'barcode' ]);
if ( $ ( '#search' ) . val () == data [ 0 ][ 'barcode' ] && 'thirdparty' == data [ 0 ][ 'object' ]) {
console . log ( " There is only 1 answer with barcode matching the search, so we change the thirdparty " + data [ 0 ][ 'rowid' ]);
ChangeThirdparty ( data [ 0 ][ 'rowid' ]);
}
2024-11-19 13:21:31 +01:00
else if ( 'product' == data [ 0 ][ 'object' ] && $ ( '#search' ) . val () == data [ 0 ][ 'barcode' ]) {
2022-09-12 12:25:15 +02:00
console . log ( " There is only 1 answer and we found search on a barcode, so we add the product in basket, qty= " + data [ 0 ][ 'qty' ]);
2022-02-09 16:37:41 +01:00
ClickProduct ( 0 , data [ 0 ][ 'qty' ]);
2021-09-07 14:48:30 +02:00
}
2020-03-16 18:04:22 +01:00
}
2021-09-07 14:48:30 +02:00
if ( eventKeyCode == keyCodeForEnter ){
if ( data . length == 0 ) {
$ ( '#search' ) . val ( ' < ? php
$langs -> load ( 'errors' );
2022-10-11 22:08:26 +02:00
echo dol_escape_js ( $langs -> transnoentitiesnoconv ( " ErrorRecordNotFoundShort " ));
?> ('+search_term+')');
2021-09-07 14:48:30 +02:00
$ ( '#search' ) . select ();
}
2023-05-23 17:52:34 +02:00
else ClearSearch ( false );
2020-08-04 08:11:44 +02:00
}
2022-04-29 10:00:25 +02:00
// memorize search_term and start for pagination
$ ( " #search_pagination " ) . val ( $ ( " #search " ) . val ());
if ( search_start == 0 ) {
$ ( " #prodiv<?php echo $MAXPRODUCT - 2; ?> span " ) . hide ();
}
else {
$ ( " #prodiv<?php echo $MAXPRODUCT - 2; ?> span " ) . show ();
var search_start_less = Math . max ( 0 , parseInt ( search_start ) - parseInt ( < ? php echo $MAXPRODUCT - 2 ; ?> ));
$ ( " #search_start_less " ) . val ( search_start_less );
}
if ( nbsearchresults != < ? php echo $MAXPRODUCT - 2 ; ?> ) {
$ ( " #prodiv<?php echo $MAXPRODUCT - 1; ?> span " ) . hide ();
}
else {
$ ( " #prodiv<?php echo $MAXPRODUCT - 1; ?> span " ) . show ();
var search_start_more = parseInt ( search_start ) + parseInt ( < ? php echo $MAXPRODUCT - 2 ; ?> );
$ ( " #search_start_more " ) . val ( search_start_more );
}
2021-09-07 14:48:30 +02:00
});
2021-09-09 03:42:12 +02:00
}, 500 ); // 500ms delay
2020-03-10 14:08:28 +01:00
}
2020-09-18 16:00:47 +02:00
2018-09-28 13:31:41 +02:00
}
2022-06-08 02:55:45 +02:00
/* Function called on an action into the PAD */
2019-03-28 18:51:04 +01:00
function Edit ( number ) {
2022-06-08 02:55:45 +02:00
console . log ( " We click on PAD on key= " + number );
2019-03-28 18:51:04 +01:00
2021-12-06 02:13:15 +01:00
if ( typeof ( selectedtext ) == " undefined " ) {
return ; // We click on an action on the number pad but there is no line selected
}
2019-03-28 18:51:04 +01:00
2021-02-26 21:17:52 +01:00
var text = selectedtext + " <br> " ;
2021-12-06 02:13:15 +01:00
2022-06-08 02:55:45 +02:00
if ( number == 'c' ) {
editnumber = '' ;
2021-02-26 21:17:52 +01:00
Refresh ();
2022-06-08 02:55:45 +02:00
$ ( " #qty " ) . html ( " <?php echo $langs->trans ( " Qty " ); ?> " ) . removeClass ( 'clicked' );
$ ( " #price " ) . html ( " <?php echo $langs->trans ( " Price " ); ?> " ) . removeClass ( 'clicked' );
2023-05-25 09:07:52 +02:00
$ ( " #reduction " ) . html ( " <?php echo $langs->trans ( " LineDiscountShort " ); ?> " ) . removeClass ( 'clicked' );
2021-02-26 21:17:52 +01:00
return ;
2022-06-08 02:55:45 +02:00
} else if ( number == 'qty' ) {
if ( editaction == 'qty' && editnumber != '' ) {
2022-09-12 12:22:00 +02:00
$ ( " #poslines " ) . load ( " invoice.php?action=updateqty&token=<?php echo newToken(); ?>&place= " + place + " &idline= " + selectedline + " &number= " + editnumber , function () {
2021-02-26 21:17:52 +01:00
editnumber = " " ;
//$('#poslines').scrollTop($('#poslines')[0].scrollHeight);
2022-06-08 02:55:45 +02:00
$ ( " #qty " ) . html ( " <?php echo $langs->trans ( " Qty " ); ?> " ) . removeClass ( 'clicked' );
2021-02-26 21:17:52 +01:00
});
setFocusOnSearchField ();
return ;
}
else {
editaction = " qty " ;
}
2022-06-08 02:55:45 +02:00
} else if ( number == 'p' ) {
if ( editaction == 'p' && editnumber != " " ) {
2022-09-12 12:22:00 +02:00
$ ( " #poslines " ) . load ( " invoice.php?action=updateprice&token=<?php echo newToken(); ?>&place= " + place + " &idline= " + selectedline + " &number= " + editnumber , function () {
2021-02-26 21:17:52 +01:00
editnumber = " " ;
//$('#poslines').scrollTop($('#poslines')[0].scrollHeight);
2022-06-08 02:55:45 +02:00
$ ( " #price " ) . html ( " <?php echo $langs->trans ( " Price " ); ?> " ) . removeClass ( 'clicked' );
2021-02-26 21:17:52 +01:00
});
2023-05-23 17:52:34 +02:00
ClearSearch ( false );
2021-02-26 21:17:52 +01:00
return ;
}
else {
editaction = " p " ;
}
2022-06-08 02:55:45 +02:00
} else if ( number == 'r' ) {
if ( editaction == 'r' && editnumber != " " ) {
2022-09-12 12:22:00 +02:00
$ ( " #poslines " ) . load ( " invoice.php?action=updatereduction&token=<?php echo newToken(); ?>&place= " + place + " &idline= " + selectedline + " &number= " + editnumber , function () {
2021-02-26 21:17:52 +01:00
editnumber = " " ;
//$('#poslines').scrollTop($('#poslines')[0].scrollHeight);
2023-05-25 09:07:52 +02:00
$ ( " #reduction " ) . html ( " <?php echo $langs->trans ( " LineDiscountShort " ); ?> " ) . removeClass ( 'clicked' );
2021-02-26 21:17:52 +01:00
});
2023-05-23 17:52:34 +02:00
ClearSearch ( false );
2021-02-26 21:17:52 +01:00
return ;
}
else {
editaction = " r " ;
}
}
else {
editnumber = editnumber + number ;
}
if ( editaction == 'qty' ){
text = text + " <?php echo $langs->trans ( " Modify " ). " -> " . $langs->trans ( " Qty " ). " : " ; ?> " ;
2022-06-08 02:55:45 +02:00
$ ( " #qty " ) . html ( " OK " ) . addClass ( " clicked " );
$ ( " #price " ) . html ( " <?php echo $langs->trans ( " Price " ); ?> " ) . removeClass ( 'clicked' );
2023-05-25 09:07:52 +02:00
$ ( " #reduction " ) . html ( " <?php echo $langs->trans ( " LineDiscountShort " ); ?> " ) . removeClass ( 'clicked' );
2021-02-26 21:17:52 +01:00
}
if ( editaction == 'p' ){
text = text + " <?php echo $langs->trans ( " Modify " ). " -> " . $langs->trans ( " Price " ). " : " ; ?> " ;
2022-06-08 02:55:45 +02:00
$ ( " #qty " ) . html ( " <?php echo $langs->trans ( " Qty " ); ?> " ) . removeClass ( 'clicked' );
$ ( " #price " ) . html ( " OK " ) . addClass ( " clicked " );
2023-05-25 09:07:52 +02:00
$ ( " #reduction " ) . html ( " <?php echo $langs->trans ( " LineDiscountShort " ); ?> " ) . removeClass ( 'clicked' );
2021-02-26 21:17:52 +01:00
}
if ( editaction == 'r' ){
2023-05-25 09:07:52 +02:00
text = text + " <?php echo $langs->trans ( " Modify " ). " -> " . $langs->trans ( " LineDiscountShort " ). " : " ; ?> " ;
2022-06-08 02:55:45 +02:00
$ ( " #qty " ) . html ( " <?php echo $langs->trans ( " Qty " ); ?> " ) . removeClass ( 'clicked' );
$ ( " #price " ) . html ( " <?php echo $langs->trans ( " Price " ); ?> " ) . removeClass ( 'clicked' );
$ ( " #reduction " ) . html ( " OK " ) . addClass ( " clicked " );
2021-02-26 21:17:52 +01:00
}
$ ( '#' + selectedline ) . find ( " td:first " ) . html ( text + editnumber );
2018-09-28 13:31:41 +02:00
}
2021-12-06 02:13:15 +01:00
2018-09-28 13:31:41 +02:00
function TakeposPrintingOrder (){
2019-03-28 18:51:04 +01:00
console . log ( " TakeposPrintingOrder " );
2022-09-12 12:22:00 +02:00
$ ( " #poslines " ) . load ( " invoice.php?action=order&token=<?php echo newToken();?>&place= " + place , function () {
2019-03-27 20:20:39 +01:00
//$('#poslines').scrollTop($('#poslines')[0].scrollHeight);
2018-09-28 13:31:41 +02:00
});
}
2018-12-07 00:40:00 +01:00
function TakeposPrintingTemp (){
2019-03-28 18:51:04 +01:00
console . log ( " TakeposPrintingTemp " );
2022-09-12 12:22:00 +02:00
$ ( " #poslines " ) . load ( " invoice.php?action=temp&token=<?php echo newToken();?>&place= " + place , function () {
2019-03-27 20:20:39 +01:00
//$('#poslines').scrollTop($('#poslines')[0].scrollHeight);
2018-12-07 00:40:00 +01:00
});
}
2018-11-21 16:54:40 +01:00
function OpenDrawer (){
2021-07-08 12:17:32 +02:00
console . log ( " OpenDrawer call ajax url http://<?php print getDolGlobalString('TAKEPOS_PRINT_SERVER'); ?>:8111/print " );
2018-11-21 16:54:40 +01:00
$ . ajax ({
2019-11-03 15:06:20 +01:00
type : " POST " ,
2021-06-17 03:37:52 +02:00
data : { token : 'notrequired' },
2020-12-19 22:28:16 +01:00
< ? php
2021-07-08 12:17:32 +02:00
if ( getDolGlobalString ( 'TAKEPOS_PRINT_SERVER' ) && filter_var ( $conf -> global -> TAKEPOS_PRINT_SERVER , FILTER_VALIDATE_URL ) == true ) {
2022-04-08 00:42:39 +02:00
echo " url: ' " . getDolGlobalString ( 'TAKEPOS_PRINT_SERVER' , 'localhost' ) . " /printer/drawer.php', " ;
2021-02-26 21:17:52 +01:00
} else {
2022-04-08 00:42:39 +02:00
echo " url: 'http:// " . getDolGlobalString ( 'TAKEPOS_PRINT_SERVER' , 'localhost' ) . " :8111/print', " ;
2021-02-26 21:17:52 +01:00
}
2020-12-19 22:28:16 +01:00
?>
2019-11-03 15:06:20 +01:00
data : " opendrawer "
});
2018-11-21 16:54:40 +01:00
}
2019-11-03 15:06:20 +01:00
function DolibarrOpenDrawer () {
2024-03-20 21:09:32 +01:00
console . log ( " DolibarrOpenDrawer call ajax url /takepos/ajax/ajax.php?action=opendrawer&token=<?php echo newToken();?>&term=<?php print urlencode(empty( $_SESSION["takeposterminal"] ) ? '' : $_SESSION["takeposterminal"] ); ?> " );
2019-11-03 15:06:20 +01:00
$ . ajax ({
type : " GET " ,
2021-06-17 03:37:52 +02:00
data : { token : '<?php echo currentToken(); ?>' },
2024-03-20 21:09:32 +01:00
url : " <?php print DOL_URL_ROOT.'/takepos/ajax/ajax.php?action=opendrawer&token='.newToken().'&term='.urlencode(empty( $_SESSION["takeposterminal"] ) ? '' : $_SESSION["takeposterminal"] ); ?> " ,
2019-11-03 15:06:20 +01:00
});
2019-11-03 00:50:58 +01:00
}
2018-12-19 22:52:16 +01:00
function MoreActions ( totalactions ){
if ( pageactions == 0 ){
pageactions = 1 ;
for ( i = 0 ; i <= totalactions ; i ++ ){
2020-04-11 16:31:08 +02:00
if ( i < 12 ) $ ( " #action " + i ) . hide ();
2018-12-19 22:52:16 +01:00
else $ ( " #action " + i ) . show ();
}
}
else if ( pageactions == 1 ){
pageactions = 0 ;
2019-02-03 14:29:45 +01:00
for ( i = 0 ; i <= totalactions ; i ++ ){
2020-04-11 16:31:08 +02:00
if ( i < 12 ) $ ( " #action " + i ) . show ();
2018-12-19 22:52:16 +01:00
else $ ( " #action " + i ) . hide ();
}
2019-02-03 14:29:45 +01:00
}
2023-05-01 14:33:08 +02:00
return true ;
2018-12-19 22:52:16 +01:00
}
2020-03-30 20:05:45 +02:00
function ControlCashOpening ()
{
2021-02-26 21:17:52 +01:00
$ . colorbox ({ href : " ../compta/cashcontrol/cashcontrol_card.php?action=create&contextpage=takepos " , width : " 90% " , height : " 60% " , transition : " none " , iframe : " true " , title : " <?php echo $langs->trans ( " NewCashFence " ); ?> " });
2020-03-30 20:05:45 +02:00
}
function CloseCashFence ( rowid )
{
2021-02-26 21:17:52 +01:00
$ . colorbox ({ href : " ../compta/cashcontrol/cashcontrol_card.php?id= " + rowid + " &contextpage=takepos " , width : " 90% " , height : " 90% " , transition : " none " , iframe : " true " , title : " <?php echo $langs->trans ( " NewCashFence " ); ?> " });
2020-03-30 20:05:45 +02:00
}
function CashReport ( rowid )
{
2021-02-26 21:17:52 +01:00
$ . colorbox ({ href : " ../compta/cashcontrol/report.php?id= " + rowid + " &contextpage=takepos " , width : " 60% " , height : " 90% " , transition : " none " , iframe : " true " , title : " <?php echo $langs->trans ( " CashReport " ); ?> " });
2020-03-30 20:05:45 +02:00
}
2020-10-03 22:13:32 +02:00
// TakePOS Popup
function ModalBox ( ModalID )
2019-05-08 18:29:00 +02:00
{
2021-02-26 21:17:52 +01:00
var modal = document . getElementById ( ModalID );
2020-09-27 11:11:31 +02:00
modal . style . display = " block " ;
2019-05-08 18:29:00 +02:00
}
2019-08-20 23:44:30 +02:00
function DirectPayment (){
console . log ( " DirectPayment " );
2022-09-12 12:22:00 +02:00
$ ( " #poslines " ) . load ( " invoice.php?place= " + place + " &action=valid&token=<?php echo newToken(); ?>&pay=LIQ " , function () {
2024-11-07 23:42:03 +01:00
$ ( '#invoiceid' ) . val ( " " );
2019-08-20 23:44:30 +02:00
});
}
2020-01-27 01:31:39 +01:00
function FullScreen () {
document . documentElement . requestFullscreen ();
}
2020-09-13 21:12:14 +02:00
function WeighingScale (){
console . log ( " Weighing Scale " );
2021-02-26 21:17:52 +01:00
$ . ajax ({
type : " POST " ,
2021-06-17 03:37:52 +02:00
data : { token : 'notrequired' },
2021-07-08 12:17:32 +02:00
url : '<?php print getDolGlobalString(' TAKEPOS_PRINT_SERVER '); ?>/scale/index.php' ,
2021-02-26 21:17:52 +01:00
})
2020-09-13 21:12:14 +02:00
. done ( function ( editnumber ) {
2024-01-07 19:32:47 +01:00
$ ( " #poslines " ) . load ( " invoice.php?token=<?php echo newToken(); ?>&place= " + place + " &idline= " + selectedline + " &number= " + editnumber , function () {
2021-02-26 21:17:52 +01:00
editnumber = " " ;
});
2020-09-13 21:12:14 +02:00
});
}
2018-09-28 13:31:41 +02:00
$ ( document ) . ready ( function () {
2021-02-26 21:17:52 +01:00
PrintCategories ( 0 );
2018-09-28 13:31:41 +02:00
LoadProducts ( 0 );
Refresh ();
2019-05-08 18:29:00 +02:00
< ? php
2024-03-20 21:09:32 +01:00
// IF NO TERMINAL SELECTED
if ( empty ( $_SESSION [ " takeposterminal " ]) || $_SESSION [ " takeposterminal " ] == " " ) {
2020-10-03 22:13:32 +02:00
print " ModalBox('ModalTerminal'); " ;
2019-05-24 08:36:43 +02:00
}
2021-11-11 16:14:48 +01:00
2021-07-08 12:17:32 +02:00
if ( getDolGlobalString ( 'TAKEPOS_CONTROL_CASH_OPENING' )) {
2021-02-26 21:17:52 +01:00
$sql = " SELECT rowid, status FROM " . MAIN_DB_PREFIX . " pos_cash_fence WHERE " ;
2021-11-11 16:14:48 +01:00
$sql .= " entity = " . (( int ) $conf -> entity ) . " AND " ;
2021-11-11 16:06:21 +01:00
$sql .= " posnumber = " . (( int ) $_SESSION [ " takeposterminal " ]) . " AND " ;
2021-02-26 21:17:52 +01:00
$sql .= " date_creation > ' " . $db -> idate ( dol_get_first_hour ( dol_now ())) . " ' " ;
2020-03-30 20:05:45 +02:00
$resql = $db -> query ( $sql );
if ( $resql ) {
$obj = $db -> fetch_object ( $resql );
// If there is no cash control from today open it
2023-05-02 16:05:28 +02:00
if ( ! isset ( $obj -> rowid ) || is_null ( $obj -> rowid )) {
2021-02-26 21:17:52 +01:00
print " ControlCashOpening(); " ;
}
2020-03-30 20:05:45 +02:00
}
}
2019-05-08 18:29:00 +02:00
?>
2022-11-01 23:23:42 +01:00
2022-10-28 12:36:48 +02:00
/* For Header Scroll */
var elem1 = $ ( " #topnav-left " )[ 0 ];
var elem2 = $ ( " #topnav-right " )[ 0 ];
var checkOverflow = function () {
if ( scrollBars () . horizontal ) $ ( " #topnav " ) . addClass ( " overflow " );
2022-11-01 23:23:42 +01:00
else $ ( " #topnav " ) . removeClass ( " overflow " );
2022-10-28 12:36:48 +02:00
}
2022-11-01 23:23:42 +01:00
2022-10-28 12:36:48 +02:00
var scrollBars = function (){
var container = $ ( '#topnav' )[ 0 ];
return {
vertical : container . scrollHeight > container . clientHeight ,
horizontal : container . scrollWidth > container . clientWidth
2022-12-30 18:43:43 +01:00
}
2022-10-28 12:36:48 +02:00
}
2022-11-01 23:23:42 +01:00
2022-10-28 12:36:48 +02:00
$ ( window ) . resize ( function (){
checkOverflow ();
});
2022-11-01 23:23:42 +01:00
2022-10-28 12:44:04 +02:00
let resizeObserver = new ResizeObserver (() => {
checkOverflow ();
});
resizeObserver . observe ( elem1 );
resizeObserver . observe ( elem2 );
2022-10-28 12:36:48 +02:00
checkOverflow ();
2022-11-01 23:23:42 +01:00
2022-10-28 12:36:48 +02:00
var pressTimer = [];
var direction = 1 ;
var step = 200 ;
2022-11-01 23:23:42 +01:00
2022-10-28 12:36:48 +02:00
$ ( " .indicator " ) . mousedown ( function (){
direction = $ ( this ) . hasClass ( " left " ) ? - 1 : 1 ;
scrollTo ();
pressTimer . push ( setInterval ( scrollTo , 100 ));
});
2022-11-01 23:23:42 +01:00
2022-10-28 12:36:48 +02:00
$ ( " .indicator " ) . mouseup ( function (){
pressTimer . forEach ( clearInterval );
});
2022-11-01 23:23:42 +01:00
2022-10-28 12:36:48 +02:00
$ ( " body " ) . mouseup ( function (){
pressTimer . forEach ( clearInterval );
2024-01-20 16:48:39 +01:00
console . log ( " body mouseup " );
2022-10-28 12:36:48 +02:00
});
2022-11-01 23:23:42 +01:00
2022-10-28 12:36:48 +02:00
function scrollTo (){
console . log ( " here " );
var pos = $ ( " #topnav " ) . scrollLeft ();
document . getElementById ( " topnav " ) . scrollTo ({ left : $ ( " #topnav " ) . scrollLeft () + direction * step , behavior : 'smooth' })
}
2022-11-01 23:23:42 +01:00
2022-10-28 12:36:48 +02:00
$ ( " #topnav " ) . scroll ( function (){
if (( $ ( " #topnav " ) . offsetWidth + $ ( " #topnav " ) . scrollLeft >= $ ( " #topnav " ) . scrollWidth )) {
console . log ( " end " );
}
});
/* End Header Scroll */
2018-09-28 13:31:41 +02:00
});
</ script >
2019-05-08 18:29:00 +02:00
< ? php
2024-03-20 21:09:32 +01:00
$keyCodeForEnter = '' ;
if ( ! empty ( $_SESSION [ 'takeposterminal' ])) {
$keyCodeForEnter = getDolGlobalInt ( 'CASHDESK_READER_KEYCODE_FOR_ENTER' . $_SESSION [ 'takeposterminal' ]) > 0 ? getDolGlobalString ( 'CASHDESK_READER_KEYCODE_FOR_ENTER' . $_SESSION [ 'takeposterminal' ]) : '' ;
}
2019-05-08 18:29:00 +02:00
?>
2019-01-27 01:28:32 +01:00
< div class = " container " >
2020-01-27 01:31:39 +01:00
< ? php
2023-11-27 12:08:48 +01:00
if ( ! getDolGlobalString ( 'TAKEPOS_HIDE_HEAD_BAR' )) {
2020-01-27 01:52:35 +01:00
?>
2020-01-27 01:31:39 +01:00
< div class = " header " >
2022-10-28 12:36:48 +02:00
< div id = " topnav " class = " topnav " >
< div id = " topnav-left " class = " topnav-left " >
2021-12-20 13:39:34 +01:00
< div class = " inline-block valignmiddle " >
2023-04-30 04:26:50 +02:00
< a class = " topnav-terminalhour " onclick = " ModalBox('ModalTerminal') " >
2021-12-20 13:39:34 +01:00
< span class = " fa fa-cash-register " ></ span >
< span class = " hideonsmartphone " >
2024-03-20 21:09:32 +01:00
< ? php
if ( ! empty ( $_SESSION [ " takeposterminal " ])) {
echo getDolGlobalString ( " TAKEPOS_TERMINAL_NAME_ " . $_SESSION [ " takeposterminal " ], $langs -> trans ( " TerminalName " , $_SESSION [ " takeposterminal " ]));
}
?>
2021-12-20 13:39:34 +01:00
</ span >
2022-07-27 11:09:02 +02:00
< ? php
2023-12-04 13:53:48 +01:00
echo '<span class="hideonsmartphone"> - ' . dol_print_date ( dol_now (), " day " ) . '</span>' ; ?>
2021-12-20 13:39:34 +01:00
</ a >
< ? php
2022-08-26 17:03:20 +02:00
if ( isModEnabled ( 'multicurrency' )) {
2023-04-30 04:26:50 +02:00
print '<a class="valignmiddle tdoverflowmax100" id="multicurrency" onclick="ModalBox(\'ModalCurrency\')" title=""><span class="fas fa-coins paddingrightonly"></span>' ;
2021-12-20 13:39:34 +01:00
print '<span class="hideonsmartphone">' . $langs -> trans ( " Currency " ) . '</span>' ;
print '</a>' ;
2023-12-04 13:53:48 +01:00
} ?>
2021-12-20 13:39:34 +01:00
</ div >
<!-- section for customer -->
< div class = " inline-block valignmiddle " id = " customerandsales " ></ div >
2023-05-19 11:54:21 +02:00
< input type = " hidden " id = " idcustomer " value = " " >
2021-12-20 13:39:34 +01:00
<!-- section for shopping carts -->
< div class = " inline-block valignmiddle " id = " shoppingcart " ></ div >
<!-- More info about customer -->
< div class = " inline-block valignmiddle tdoverflowmax150onsmartphone " id = " moreinfo " ></ div >
< ? php
2022-08-26 17:03:20 +02:00
if ( isModEnabled ( 'stock' )) {
2021-12-20 13:39:34 +01:00
?>
<!-- More info about warehouse -->
< div class = " inline-block valignmiddle tdoverflowmax150onsmartphone " id = " infowarehouse " ></ div >
< ? php
2023-12-04 13:53:48 +01:00
} ?>
2020-01-27 01:31:39 +01:00
</ div >
2022-10-28 12:36:48 +02:00
< div id = " topnav-right " class = " topnav-right " >
2023-04-27 19:59:51 +02:00
< ? php
$reshook = $hookmanager -> executeHooks ( 'takepos_login_block_other' );
2024-01-07 11:43:29 +01:00
if ( $reshook == 0 ) { //Search method
?>
2024-06-22 01:18:10 +02:00
< div class = " login_block_other takepos " >
2024-01-07 11:43:29 +01:00
< input type = " text " id = " search " name = " search " class = " input-nobottom " onkeyup = " Search2('<?php echo dol_escape_js( $keyCodeForEnter ); ?>', null); " placeholder = " <?php echo dol_escape_htmltag( $langs->trans ( " Search " )); ?> " autofocus >
2024-01-07 13:40:36 +01:00
< a onclick = " ClearSearch(false); " class = " nohover " >< span class = " fa fa-backspace " ></ span ></ a >
2023-04-27 19:59:51 +02:00
< a href = " <?php echo DOL_URL_ROOT.'/'; ?> " target = " backoffice " rel = " opener " ><!-- we need rel = " opener " here , we are on same domain and we need to be able to reuse this tab several times -->
< span class = " fas fa-home " ></ span ></ a >
2024-01-07 11:43:29 +01:00
< ? php if ( empty ( $conf -> dol_use_jmobile )) { ?>
< a class = " hideonsmartphone " onclick = " FullScreen(); " title = " <?php echo dol_escape_htmltag( $langs->trans ( " ClickFullScreenEscapeToLeave " )); ?> " >< span class = " fa fa-expand-arrows-alt " ></ span ></ a >
< ? php } ?>
2023-04-27 19:59:51 +02:00
</ div >
2023-12-13 15:20:53 +01:00
< ? php
2024-01-07 11:43:29 +01:00
}
?>
2020-02-24 19:24:38 +01:00
< div class = " login_block_user " >
< ? php
2024-03-21 13:34:16 +01:00
print top_menu_user ( 1 , DOL_URL_ROOT . '/user/logout.php?token=' . newToken () . '&urlfrom=' . urlencode ( '/takepos/?setterminal=' . (( int ) $term )));
2024-01-07 11:43:29 +01:00
?>
2020-02-24 19:24:38 +01:00
</ div >
2020-01-27 01:31:39 +01:00
</ div >
2022-10-28 12:36:48 +02:00
< div class = " arrows " >
< span class = " indicator left " >< i class = " fa fa-arrow-left " ></ i ></ span >
< span class = " indicator right " >< i class = " fa fa-arrow-right " ></ i ></ span >
</ div >
2020-01-27 01:31:39 +01:00
</ div >
</ div >
2019-12-09 08:39:11 +01:00
< ? php
2020-01-27 01:31:39 +01:00
}
?>
2020-09-27 11:11:31 +02:00
<!-- Modal terminal box -->
< div id = " ModalTerminal " class = " modal " >
< div class = " modal-content " >
< div class = " modal-header " >
2023-05-19 17:27:07 +02:00
< ? php
2023-11-27 12:08:48 +01:00
if ( ! getDolGlobalString ( 'TAKEPOS_FORCE_TERMINAL_SELECT' )) {
2023-05-19 17:27:07 +02:00
?>
< span class = " close " href = " # " onclick = " document.getElementById('ModalTerminal').style.display = 'none'; " >& times ; </ span >
2023-12-04 13:53:48 +01:00
< ? php
} ?>
2020-10-07 15:01:28 +02:00
< h3 >< ? php print $langs -> trans ( " TerminalSelect " ); ?> </h3>
2020-09-27 11:11:31 +02:00
</ div >
< div class = " modal-body " >
2022-07-28 17:36:58 +02:00
< button type = " button " class = " block " onclick = " location.href='index.php?setterminal=1' " >< ? php print getDolGlobalString ( " TAKEPOS_TERMINAL_NAME_1 " , $langs -> trans ( " TerminalName " , 1 )); ?> </button>
2020-09-27 11:11:31 +02:00
< ? php
2022-04-08 00:42:39 +02:00
$nbloop = getDolGlobalInt ( 'TAKEPOS_NUM_TERMINALS' );
for ( $i = 2 ; $i <= $nbloop ; $i ++ ) {
2022-07-28 17:36:58 +02:00
print '<button type="button" class="block" onclick="location.href=\'index.php?setterminal=' . $i . '\'">' . getDolGlobalString ( " TAKEPOS_TERMINAL_NAME_ " . $i , $langs -> trans ( " TerminalName " , $i )) . '</button>' ;
2020-09-27 11:35:07 +02:00
}
2020-09-27 11:11:31 +02:00
?>
</ div >
</ div >
</ div >
2020-10-03 22:13:32 +02:00
<!-- Modal multicurrency box -->
2022-08-26 17:03:20 +02:00
< ? php if ( isModEnabled ( 'multicurrency' )) { ?>
2020-10-03 22:13:32 +02:00
< div id = " ModalCurrency " class = " modal " >
< div class = " modal-content " >
< div class = " modal-header " >
< span class = " close " href = " # " onclick = " document.getElementById('ModalCurrency').style.display = 'none'; " >& times ; </ span >
2020-10-06 09:57:04 +02:00
< h3 >< ? php print $langs -> trans ( " SetMultiCurrencyCode " ); ?> </h3>
2020-10-03 22:13:32 +02:00
</ div >
< div class = " modal-body " >
< ? php
$sql = 'SELECT code FROM ' . MAIN_DB_PREFIX . 'multicurrency' ;
2020-10-04 14:04:44 +02:00
$sql .= " WHERE entity IN (' " . getEntity ( 'multicurrency' ) . " ') " ;
2020-10-03 22:31:55 +02:00
$resql = $db -> query ( $sql );
2021-02-26 21:17:52 +01:00
if ( $resql ) {
while ( $obj = $db -> fetch_object ( $resql )) {
print '<button type="button" class="block" onclick="location.href=\'index.php?setcurrency=' . $obj -> code . '\'">' . $obj -> code . '</button>' ;
}
2020-10-03 22:31:55 +02:00
}
2020-10-03 22:13:32 +02:00
?>
</ div >
</ div >
</ div >
2020-10-06 09:57:04 +02:00
< ? php } ?>
2020-09-27 11:11:31 +02:00
2020-10-25 20:03:25 +01:00
<!-- Modal terminal Credit Note -->
< div id = " ModalCreditNote " class = " modal " >
< div class = " modal-content " >
< div class = " modal-header " >
< span class = " close " href = " # " onclick = " document.getElementById('ModalCreditNote').style.display = 'none'; " >& times ; </ span >
< h3 >< ? php print $langs -> trans ( " invoiceAvoirWithLines " ); ?> </h3>
</ div >
< div class = " modal-body " >
< button type = " button " class = " block " onclick = " CreditNote(); document.getElementById('ModalCreditNote').style.display = 'none'; " >< ? php print $langs -> trans ( " Yes " ); ?> </button>
< button type = " button " class = " block " onclick = " document.getElementById('ModalCreditNote').style.display = 'none'; " >< ? php print $langs -> trans ( " No " ); ?> </button>
</ div >
</ div >
2021-04-14 00:15:02 +02:00
</ div >
<!-- Modal Note -->
< div id = " ModalNote " class = " modal " >
< div class = " modal-content " >
< div class = " modal-header " >
< span class = " close " href = " # " onclick = " document.getElementById('ModalNote').style.display = 'none'; " >& times ; </ span >
2021-04-14 00:32:49 +02:00
< h3 >< ? php print $langs -> trans ( " Note " ); ?> </h3>
2021-04-14 00:15:02 +02:00
</ div >
< div class = " modal-body " >
< input type = " text " class = " block " id = " textinput " >
< button type = " button " class = " block " onclick = " SetNote(); document.getElementById('ModalNote').style.display = 'none'; " > OK </ button >
</ div >
</ div >
2020-10-25 20:03:25 +01:00
</ div >
2023-11-27 12:08:48 +01:00
< div class = " row1<?php if (!getDolGlobalString('TAKEPOS_HIDE_HEAD_BAR')) {
2024-03-15 22:25:15 +01:00
print 'withhead' ;
2021-02-26 21:17:52 +01:00
} ?> ">
2018-09-28 13:31:41 +02:00
2019-02-02 23:57:38 +01:00
< div id = " poslines " class = " div1 " >
2019-01-27 01:28:32 +01:00
</ div >
< div class = " div2 " >
< button type = " button " class = " calcbutton " onclick = " Edit(7); " > 7 </ button >
< button type = " button " class = " calcbutton " onclick = " Edit(8); " > 8 </ button >
< button type = " button " class = " calcbutton " onclick = " Edit(9); " > 9 </ button >
2023-04-30 04:26:50 +02:00
< button type = " button " id = " qty " class = " calcbutton2 " onclick = " Edit('qty') " >< ? php echo $langs -> trans ( " Qty " ); ?> </button>
2019-01-27 01:28:32 +01:00
< button type = " button " class = " calcbutton " onclick = " Edit(4); " > 4 </ button >
< button type = " button " class = " calcbutton " onclick = " Edit(5); " > 5 </ button >
< button type = " button " class = " calcbutton " onclick = " Edit(6); " > 6 </ button >
2023-04-30 04:26:50 +02:00
< button type = " button " id = " price " class = " calcbutton2 " onclick = " Edit('p') " >< ? php echo $langs -> trans ( " Price " ); ?> </button>
2019-01-27 01:28:32 +01:00
< button type = " button " class = " calcbutton " onclick = " Edit(1); " > 1 </ button >
< button type = " button " class = " calcbutton " onclick = " Edit(2); " > 2 </ button >
< button type = " button " class = " calcbutton " onclick = " Edit(3); " > 3 </ button >
2023-05-25 09:07:52 +02:00
< button type = " button " id = " reduction " class = " calcbutton2 " onclick = " Edit('r') " >< ? php echo $langs -> trans ( " LineDiscountShort " ); ?> </button>
2019-01-27 01:28:32 +01:00
< button type = " button " class = " calcbutton " onclick = " Edit(0); " > 0 </ button >
2023-04-30 04:26:50 +02:00
< button type = " button " class = " calcbutton " onclick = " Edit('.') " >.</ button >
< button type = " button " class = " calcbutton poscolorblue " onclick = " Edit('c') " > C </ button >
< button type = " button " class = " calcbutton2 poscolordelete " id = " delete " onclick = " deleteline() " >< span class = " fa fa-trash " ></ span ></ button >
2019-01-27 01:28:32 +01:00
</ div >
2018-09-28 13:31:41 +02:00
< ? php
2019-03-27 12:40:32 +01:00
2019-02-02 23:57:38 +01:00
// TakePOS setup check
2021-09-07 14:27:31 +02:00
if ( isset ( $_SESSION [ " takeposterminal " ]) && $_SESSION [ " takeposterminal " ]) {
2021-09-07 13:31:09 +02:00
$sql = " SELECT code, libelle FROM " . MAIN_DB_PREFIX . " c_paiement " ;
2021-09-07 14:27:31 +02:00
$sql .= " WHERE entity IN ( " . getEntity ( 'c_paiement' ) . " ) " ;
2021-09-07 13:31:09 +02:00
$sql .= " AND active = 1 " ;
$sql .= " ORDER BY libelle " ;
2021-09-07 14:27:31 +02:00
$resql = $db -> query ( $sql );
2021-09-07 13:31:09 +02:00
$paiementsModes = array ();
2021-09-07 14:27:31 +02:00
if ( $resql ) {
2023-12-04 13:53:48 +01:00
while ( $obj = $db -> fetch_object ( $resql )) {
2021-09-07 13:31:09 +02:00
$paycode = $obj -> code ;
2021-09-07 14:27:31 +02:00
if ( $paycode == 'LIQ' ) {
2021-09-07 13:31:09 +02:00
$paycode = 'CASH' ;
}
2021-09-07 14:27:31 +02:00
if ( $paycode == 'CHQ' ) {
2021-09-07 13:31:09 +02:00
$paycode = 'CHEQUE' ;
}
2019-03-27 12:40:32 +01:00
2021-09-07 13:31:09 +02:00
$constantforkey = " CASHDESK_ID_BANKACCOUNT_ " . $paycode . $_SESSION [ " takeposterminal " ];
2023-10-09 15:44:57 +02:00
//var_dump($constantforkey.' '.getDolGlobalInt($constantforkey));
2023-12-23 19:47:10 +01:00
if ( getDolGlobalInt ( $constantforkey ) > 0 ) {
2021-09-07 14:27:31 +02:00
array_push ( $paiementsModes , $obj );
2021-09-07 13:31:09 +02:00
}
2021-02-26 21:17:52 +01:00
}
2019-03-15 12:07:33 +01:00
}
2019-10-03 17:11:41 +02:00
2024-02-27 15:30:37 +01:00
if ( empty ( $paiementsModes ) && isModEnabled ( " bank " )) {
2021-09-07 14:27:31 +02:00
$langs -> load ( 'errors' );
setEventMessages ( $langs -> trans ( " ErrorModuleSetupNotComplete " , $langs -> transnoentitiesnoconv ( " TakePOS " )), null , 'errors' );
setEventMessages ( $langs -> trans ( " ProblemIsInSetupOfTerminal " , $_SESSION [ " takeposterminal " ]), null , 'errors' );
2021-09-07 13:31:09 +02:00
}
2019-02-02 23:57:38 +01:00
}
2021-09-07 13:31:09 +02:00
2019-11-08 15:51:54 +01:00
if ( count ( $maincategories ) == 0 ) {
2023-11-27 13:26:44 +01:00
if ( getDolGlobalInt ( 'TAKEPOS_ROOT_CATEGORY_ID' ) > 0 ) {
2021-02-14 22:44:04 +01:00
$tmpcategory = new Categorie ( $db );
2025-02-18 21:48:21 +01:00
$tmpcategory -> fetch ( getDolGlobalInt ( 'TAKEPOS_ROOT_CATEGORY_ID' ));
2021-02-14 22:44:04 +01:00
setEventMessages ( $langs -> trans ( " TakeposNeedsAtLeastOnSubCategoryIntoParentCategory " , $tmpcategory -> label ), null , 'errors' );
} else {
setEventMessages ( $langs -> trans ( " TakeposNeedsCategories " ), null , 'errors' );
}
2019-02-03 19:15:41 +01:00
}
2018-09-28 13:31:41 +02:00
// User menu and external TakePOS modules
$menus = array ();
2019-11-08 15:51:54 +01:00
$r = 0 ;
2019-04-02 17:36:27 +02:00
2023-11-27 12:08:48 +01:00
if ( ! getDolGlobalString ( 'TAKEPOS_BAR_RESTAURANT' )) {
2024-03-15 22:25:15 +01:00
$menus [ $r ++ ] = array ( 'title' => '<span class="fa fa-layer-group paddingrightonly"></span><div class="trunc">' . $langs -> trans ( " New " ) . '</div>' , 'action' => 'New();' );
2020-05-21 15:05:19 +02:00
} else {
2020-10-31 14:32:18 +01:00
// BAR RESTAURANT specific menu
2024-03-15 22:25:15 +01:00
$menus [ $r ++ ] = array ( 'title' => '<span class="fa fa-layer-group paddingrightonly"></span><div class="trunc">' . $langs -> trans ( " Place " ) . '</div>' , 'action' => 'Floors();' );
2019-04-02 17:36:27 +02:00
}
2023-11-27 12:08:48 +01:00
if ( getDolGlobalString ( 'TAKEPOS_HIDE_HEAD_BAR' )) {
2023-10-13 16:19:10 +02:00
if ( getDolGlobalString ( 'TAKEPOS_CHOOSE_CONTACT' )) {
2024-03-15 22:25:15 +01:00
$menus [ $r ++ ] = array ( 'title' => '<span class="far fa-building paddingrightonly"></span><div class="trunc">' . $langs -> trans ( " Contact " ) . '</div>' , 'action' => 'Contact();' );
2023-10-13 16:19:10 +02:00
} else {
2024-03-15 22:25:15 +01:00
$menus [ $r ++ ] = array ( 'title' => '<span class="far fa-building paddingrightonly"></span><div class="trunc">' . $langs -> trans ( " Customer " ) . '</div>' , 'action' => 'Customer();' );
2023-10-13 16:19:10 +02:00
}
2020-01-27 01:31:39 +01:00
}
2023-12-04 13:53:48 +01:00
if ( ! getDolGlobalString ( 'TAKEPOS_HIDE_HISTORY' )) {
2024-03-15 22:25:15 +01:00
$menus [ $r ++ ] = array ( 'title' => '<span class="fa fa-history paddingrightonly"></span><div class="trunc">' . $langs -> trans ( " History " ) . '</div>' , 'action' => 'History();' );
2023-05-17 15:51:35 +02:00
}
2024-03-15 22:25:15 +01:00
$menus [ $r ++ ] = array ( 'title' => '<span class="fa fa-cube paddingrightonly"></span><div class="trunc">' . $langs -> trans ( " FreeZone " ) . '</div>' , 'action' => 'FreeZone();' );
$menus [ $r ++ ] = array ( 'title' => '<span class="fa fa-percent paddingrightonly"></span><div class="trunc">' . $langs -> trans ( " InvoiceDiscountShort " ) . '</div>' , 'action' => 'Reduction();' );
2019-08-20 23:44:30 +02:00
2024-06-04 19:33:54 +02:00
if ( ! getDolGlobalString ( 'TAKEPOS_NO_SPLIT_SALE' )) {
$menus [ $r ++ ] = array ( 'title' => '<span class="fas fa-cut paddingrightonly"></span><div class="trunc">' . $langs -> trans ( " SplitSale " ) . '</div>' , 'action' => 'Split();' );
}
2021-08-21 22:29:18 +02:00
2019-03-27 18:00:44 +01:00
// BAR RESTAURANT specific menu
2021-07-08 12:17:32 +02:00
if ( getDolGlobalString ( 'TAKEPOS_BAR_RESTAURANT' )) {
2022-04-08 00:42:39 +02:00
if ( getDolGlobalString ( 'TAKEPOS_ORDER_PRINTERS' )) {
2024-03-15 22:25:15 +01:00
$menus [ $r ++ ] = array ( 'title' => '<span class="fa fa-blender-phone paddingrightonly"></span><div class="trunc">' . $langs -> trans ( " Order " ) . '</span>' , 'action' => 'TakeposPrintingOrder();' );
2018-12-17 22:43:02 +01:00
}
2024-01-05 02:25:31 +01:00
}
// Last action that close the sell (payments)
2024-03-15 22:25:15 +01:00
$menus [ $r ++ ] = array ( 'title' => '<span class="far fa-money-bill-alt paddingrightonly"></span><div class="trunc">' . $langs -> trans ( " Payment " ) . '</div>' , 'action' => 'CloseBill();' );
2024-01-05 02:25:31 +01:00
if ( getDolGlobalString ( 'TAKEPOS_DIRECT_PAYMENT' )) {
2024-03-15 22:25:15 +01:00
$menus [ $r ++ ] = array ( 'title' => '<span class="far fa-money-bill-alt paddingrightonly"></span><div class="trunc">' . $langs -> trans ( " DirectPayment " ) . ' <span class="opacitymedium">(' . $langs -> trans ( " Cash " ) . ')</span></div>' , 'action' => 'DirectPayment();' );
2024-01-05 02:25:31 +01:00
}
// BAR RESTAURANT specific menu
if ( getDolGlobalString ( 'TAKEPOS_BAR_RESTAURANT' )) {
2020-04-02 22:11:16 +02:00
//Button to print receipt before payment
2021-07-08 12:17:32 +02:00
if ( getDolGlobalString ( 'TAKEPOS_BAR_RESTAURANT' )) {
if ( getDolGlobalString ( 'TAKEPOS_PRINT_METHOD' ) == " takeposconnector " ) {
if ( getDolGlobalString ( 'TAKEPOS_PRINT_SERVER' ) && filter_var ( $conf -> global -> TAKEPOS_PRINT_SERVER , FILTER_VALIDATE_URL ) == true ) {
2024-03-15 22:25:15 +01:00
$menus [ $r ++ ] = array ( 'title' => '<span class="fa fa-receipt paddingrightonly"></span><div class="trunc">' . $langs -> trans ( " Receipt " ) . '</div>' , 'action' => 'TakeposConnector(placeid);' );
2021-02-26 21:17:52 +01:00
} else {
2024-03-15 22:25:15 +01:00
$menus [ $r ++ ] = array ( 'title' => '<span class="fa fa-receipt paddingrightonly"></span><div class="trunc">' . $langs -> trans ( " Receipt " ) . '</div>' , 'action' => 'TakeposPrinting(placeid);' );
2021-02-26 21:17:52 +01:00
}
2024-02-06 17:05:52 +01:00
} elseif (( isModEnabled ( 'receiptprinter' ) && getDolGlobalInt ( 'TAKEPOS_PRINTER_TO_USE' . $term ) > 0 ) || getDolGlobalString ( 'TAKEPOS_PRINT_METHOD' ) == " receiptprinter " ) {
2024-03-15 22:25:15 +01:00
$menus [ $r ++ ] = array ( 'title' => '<span class="fa fa-receipt paddingrightonly"></span><div class="trunc">' . $langs -> trans ( " Receipt " ) . '</div>' , 'action' => 'DolibarrTakeposPrinting(placeid);' );
2019-11-03 00:50:58 +01:00
} else {
2024-03-15 22:25:15 +01:00
$menus [ $r ++ ] = array ( 'title' => '<span class="fa fa-receipt paddingrightonly"></span><div class="trunc">' . $langs -> trans ( " Receipt " ) . '</div>' , 'action' => 'Print(placeid);' );
2019-11-03 00:50:58 +01:00
}
2018-12-17 22:43:02 +01:00
}
2021-07-08 12:17:32 +02:00
if ( getDolGlobalString ( 'TAKEPOS_PRINT_METHOD' ) == " takeposconnector " && getDolGlobalString ( 'TAKEPOS_ORDER_NOTES' ) == 1 ) {
2024-03-15 22:25:15 +01:00
$menus [ $r ++ ] = array ( 'title' => '<span class="fa fa-sticky-note paddingrightonly"></span><div class="trunc">' . $langs -> trans ( " OrderNotes " ) . '</div>' , 'action' => 'TakeposOrderNotes();' );
2019-03-03 12:50:36 +01:00
}
2021-07-08 12:17:32 +02:00
if ( getDolGlobalString ( 'TAKEPOS_SUPPLEMENTS' )) {
2024-03-15 22:25:15 +01:00
$menus [ $r ++ ] = array ( 'title' => '<span class="fa fa-receipt paddingrightonly"></span><div class="trunc">' . $langs -> trans ( " ProductSupplements " ) . '</div>' , 'action' => 'LoadProducts(\'supplements\');' );
2019-12-08 23:16:49 +01:00
}
2018-09-28 13:31:41 +02:00
}
2018-12-07 00:40:00 +01:00
2021-07-08 12:17:32 +02:00
if ( getDolGlobalString ( 'TAKEPOS_PRINT_METHOD' ) == " takeposconnector " ) {
2024-03-15 22:25:15 +01:00
$menus [ $r ++ ] = array ( 'title' => '<span class="fa fa-receipt paddingrightonly"></span><div class="trunc">' . $langs -> trans ( " DOL_OPEN_DRAWER " ) . '</div>' , 'action' => 'OpenDrawer();' );
2018-11-21 16:54:40 +01:00
}
2024-02-06 17:05:52 +01:00
if ( getDolGlobalInt ( 'TAKEPOS_PRINTER_TO_USE' . $term ) > 0 || getDolGlobalString ( 'TAKEPOS_PRINT_METHOD' ) == " receiptprinter " ) {
2020-10-31 14:32:18 +01:00
$menus [ $r ++ ] = array (
2019-11-03 00:50:58 +01:00
'title' => '<span class="fa fa-receipt paddingrightonly"></span><div class="trunc">' . $langs -> trans ( " DOL_OPEN_DRAWER " ) . '</div>' ,
'action' => 'DolibarrOpenDrawer();' ,
);
}
2019-01-23 20:59:34 +01:00
2021-02-02 23:09:23 +01:00
$sql = " SELECT rowid, status, entity FROM " . MAIN_DB_PREFIX . " pos_cash_fence WHERE " ;
2021-11-11 16:14:48 +01:00
$sql .= " entity = " . (( int ) $conf -> entity ) . " AND " ;
2024-03-20 21:09:32 +01:00
$sql .= " posnumber = " . (( int ) empty ( $_SESSION [ " takeposterminal " ]) ? 0 : $_SESSION [ " takeposterminal " ]) . " AND " ;
2021-02-03 23:18:44 +01:00
$sql .= " date_creation > ' " . $db -> idate ( dol_get_first_hour ( dol_now ())) . " ' " ;
2021-11-11 18:30:17 +01:00
2020-03-30 20:05:45 +02:00
$resql = $db -> query ( $sql );
2021-02-26 21:17:52 +01:00
if ( $resql ) {
2020-03-30 20:05:45 +02:00
$num = $db -> num_rows ( $resql );
2021-02-26 21:17:52 +01:00
if ( $num ) {
2020-03-30 20:05:45 +02:00
$obj = $db -> fetch_object ( $resql );
2024-03-15 22:25:15 +01:00
$menus [ $r ++ ] = array ( 'title' => '<span class="fas fa-file-invoice-dollar paddingrightonly"></span><div class="trunc">' . $langs -> trans ( " CashReport " ) . '</div>' , 'action' => 'CashReport(' . $obj -> rowid . ');' );
2021-02-26 21:17:52 +01:00
if ( $obj -> status == 0 ) {
2024-03-15 22:25:15 +01:00
$menus [ $r ++ ] = array ( 'title' => '<span class="fas fa-cash-register paddingrightonly"></span><div class="trunc">' . $langs -> trans ( " CloseCashFence " ) . '</div>' , 'action' => 'CloseCashFence(' . $obj -> rowid . ');' );
2021-02-26 21:17:52 +01:00
}
2020-03-30 20:05:45 +02:00
}
}
2024-03-15 22:25:15 +01:00
$parameters = array ( 'menus' => $menus );
2021-10-27 17:00:46 +02:00
$reshook = $hookmanager -> executeHooks ( 'ActionButtons' , $parameters );
2021-10-27 15:59:27 +02:00
if ( $reshook == 0 ) { //add buttons
2023-12-04 13:53:48 +01:00
if ( is_array ( $hookmanager -> resArray )) {
2021-10-27 17:00:46 +02:00
foreach ( $hookmanager -> resArray as $resArray ) {
foreach ( $resArray as $butmenu ) {
$menus [ $r ++ ] = $butmenu ;
}
}
2021-10-27 17:44:07 +02:00
} elseif ( $reshook == 1 ) {
2021-10-27 17:00:46 +02:00
$r = 0 ; //replace buttons
2023-12-04 13:53:48 +01:00
if ( is_array ( $hookmanager -> resArray )) {
2021-10-27 17:00:46 +02:00
foreach ( $hookmanager -> resArray as $resArray ) {
foreach ( $resArray as $butmenu ) {
$menus [ $r ++ ] = $butmenu ;
}
}
}
}
2019-02-03 14:29:45 +01:00
}
2019-01-23 20:59:34 +01:00
2021-02-26 21:17:52 +01:00
if ( $r % 3 == 2 ) {
2024-03-15 22:25:15 +01:00
$menus [ $r ++ ] = array ( 'title' => '' , 'style' => 'visibility: hidden;' );
2021-02-26 21:17:52 +01:00
}
2019-03-28 18:51:04 +01:00
2023-11-27 12:08:48 +01:00
if ( getDolGlobalString ( 'TAKEPOS_HIDE_HEAD_BAR' )) {
2024-09-28 17:05:44 +02:00
$menus [ $r ++ ] = array ( 'title' => '<span class="fa fa-sign-out-alt pictofixedwidth"></span><div class="trunc">' . $langs -> trans ( " Logout " ) . '</div>' , 'action' => 'window.location.href=\'' . DOL_URL_ROOT . '/user/logout.php?token=' . newToken () . '\';' );
2020-01-27 01:31:39 +01:00
}
2019-03-28 18:51:04 +01:00
2023-11-27 12:08:48 +01:00
if ( getDolGlobalString ( 'TAKEPOS_WEIGHING_SCALE' )) {
2024-09-28 17:05:44 +02:00
$menus [ $r ++ ] = array ( 'title' => '<span class="fa fa-balance-scale pictofixedwidth"></span><div class="trunc">' . $langs -> trans ( " WeighingScale " ) . '</div>' , 'action' => 'WeighingScale();' );
2020-09-13 21:12:14 +02:00
}
2018-09-28 13:31:41 +02:00
?>
2019-03-28 18:51:04 +01:00
<!-- Show buttons -->
2019-01-27 01:28:32 +01:00
< div class = " div3 " >
2019-03-28 18:51:04 +01:00
< ? php
2020-10-31 14:32:18 +01:00
$i = 0 ;
2021-02-26 21:17:52 +01:00
foreach ( $menus as $menu ) {
2020-10-31 14:32:18 +01:00
$i ++ ;
2021-02-26 21:17:52 +01:00
if ( count ( $menus ) > 12 and $i == 12 ) {
2023-04-30 04:26:50 +02:00
echo '<button style="' . ( empty ( $menu [ 'style' ]) ? '' : $menu [ 'style' ]) . '" type="button" id="actionnext" class="actionbutton" onclick="MoreActions(' . count ( $menus ) . ')">' . $langs -> trans ( " Next " ) . '</button>' ;
2021-07-08 12:17:32 +02:00
echo '<button style="display: none;" type="button" id="action' . $i . '" class="actionbutton" onclick="' . ( empty ( $menu [ 'action' ]) ? '' : $menu [ 'action' ]) . '">' . $menu [ 'title' ] . '</button>' ;
2021-02-26 21:17:52 +01:00
} elseif ( $i > 12 ) {
2021-07-08 12:17:32 +02:00
echo '<button style="display: none;" type="button" id="action' . $i . '" class="actionbutton" onclick="' . ( empty ( $menu [ 'action' ]) ? '' : $menu [ 'action' ]) . '">' . $menu [ 'title' ] . '</button>' ;
2021-02-26 21:17:52 +01:00
} else {
2021-07-08 12:17:32 +02:00
echo '<button style="' . ( empty ( $menu [ 'style' ]) ? '' : $menu [ 'style' ]) . '" type="button" id="action' . $i . '" class="actionbutton" onclick="' . ( empty ( $menu [ 'action' ]) ? '' : $menu [ 'action' ]) . '">' . $menu [ 'title' ] . '</button>' ;
2021-02-26 21:17:52 +01:00
}
2020-10-31 14:32:18 +01:00
}
2019-03-15 00:49:44 +01:00
2024-06-18 18:35:50 +02:00
if ( getDolGlobalString ( 'TAKEPOS_HIDE_HEAD_BAR' ) && ! getDolGlobalString ( 'TAKEPOS_HIDE_SEARCH' )) {
2020-01-27 01:31:39 +01:00
print '<!-- Show the search input text -->' . " \n " ;
print '<div class="margintoponly">' ;
2023-12-29 02:59:38 +01:00
print '<input type="text" id="search" class="input-search-takepos input-nobottom" name="search" onkeyup="Search2(\'' . dol_escape_js ( $keyCodeForEnter ) . '\', null);" style="width: 80%; width:calc(100% - 51px); font-size: 150%;" placeholder="' . dol_escape_htmltag ( $langs -> trans ( " Search " )) . '" autofocus> ' ;
2023-05-23 17:52:34 +02:00
print '<a class="marginleftonly hideonsmartphone" onclick="ClearSearch(false);">' . img_picto ( '' , 'searchclear' ) . '</a>' ;
2020-01-27 01:31:39 +01:00
print '</div>' ;
}
2020-10-31 14:32:18 +01:00
?>
2019-01-27 01:28:32 +01:00
</ div >
</ div >
2019-03-15 00:49:44 +01:00
2023-11-27 12:08:48 +01:00
< div class = " row2<?php if (!getDolGlobalString('TAKEPOS_HIDE_HEAD_BAR')) {
2024-03-15 22:25:15 +01:00
print 'withhead' ;
2021-02-26 21:17:52 +01:00
} ?> ">
2019-03-28 18:51:04 +01:00
<!-- Show categories -->
2021-12-01 10:26:24 +01:00
< ? php
2022-04-08 00:42:39 +02:00
if ( getDolGlobalInt ( 'TAKEPOS_HIDE_CATEGORIES' ) == 1 ) {
2021-12-01 10:53:28 +01:00
print '<div class="div4" style= "display: none;">' ;
} else {
print '<div class="div4">' ;
}
2022-04-08 00:42:39 +02:00
$count = 0 ;
2021-12-01 10:53:28 +01:00
while ( $count < $MAXCATEG ) {
?>
2021-02-26 21:17:52 +01:00
< div class = " wrapper " < ? php if ( $count == ( $MAXCATEG - 2 )) {
2023-04-30 04:26:50 +02:00
echo 'onclick="MoreCategories(\'less\')"' ;
2021-02-26 21:17:52 +01:00
} elseif ( $count == ( $MAXCATEG - 1 )) {
2023-04-30 04:26:50 +02:00
echo 'onclick="MoreCategories(\'more\')"' ;
2021-02-26 21:17:52 +01:00
} else {
2023-04-30 04:26:50 +02:00
echo 'onclick="LoadProducts(' . $count . ')"' ;
2021-02-26 21:17:52 +01:00
} ?> id="catdiv<?php echo $count; ?>">
2019-03-29 11:45:40 +01:00
< ? php
2019-11-08 15:51:54 +01:00
if ( $count == ( $MAXCATEG - 2 )) {
2020-10-31 14:32:18 +01:00
//echo '<img class="imgwrapper" src="img/arrow-prev-top.png" height="100%" id="catimg'.$count.'" />';
2022-04-29 10:00:25 +02:00
echo '<span class="fa fa-chevron-left centerinmiddle" style="font-size: 5em; cursor: pointer;"></span>' ;
2020-05-21 15:05:19 +02:00
} elseif ( $count == ( $MAXCATEG - 1 )) {
2020-10-31 14:32:18 +01:00
//echo '<img class="imgwrapper" src="img/arrow-next-top.png" height="100%" id="catimg'.$count.'" />';
2022-04-29 10:00:25 +02:00
echo '<span class="fa fa-chevron-right centerinmiddle" style="font-size: 5em; cursor: pointer;"></span>' ;
2020-05-21 15:05:19 +02:00
} else {
2021-07-08 12:17:32 +02:00
if ( ! getDolGlobalString ( 'TAKEPOS_HIDE_CATEGORY_IMAGES' )) {
2023-03-06 13:51:53 +01:00
echo '<img class="imgwrapper" id="catimg' . $count . '" />' ;
2021-02-26 21:17:52 +01:00
}
2023-12-04 13:53:48 +01:00
} ?>
2024-03-15 22:25:15 +01:00
< ? php if ( $count != $MAXCATEG - 2 && $count != $MAXCATEG - 1 ) { ?>
2019-11-08 15:51:54 +01:00
< div class = " description " id = " catdivdesc<?php echo $count ; ?> " >
< div class = " description_content " id = " catdesc<?php echo $count ; ?> " ></ div >
2019-01-27 01:28:32 +01:00
</ div >
2024-03-15 22:25:15 +01:00
< ? php } ?>
2019-12-04 20:15:48 +01:00
< div class = " catwatermark " id = 'catwatermark<?php echo $count; ?>' >...</ div >
2019-01-27 01:28:32 +01:00
</ div >
2024-03-15 22:25:15 +01:00
< ? php
$count ++ ;
2021-12-01 10:53:28 +01:00
}
?>
2019-01-27 01:28:32 +01:00
</ div >
2018-09-28 13:31:41 +02:00
2021-02-26 21:17:52 +01:00
<!-- Show product -->
2023-12-04 13:53:48 +01:00
< div class = " div5<?php if (getDolGlobalInt('TAKEPOS_HIDE_CATEGORIES') == 1) {
print ' centpercent' ;
} ?> ">
2021-02-26 21:17:52 +01:00
< ? php
2020-10-31 14:32:18 +01:00
$count = 0 ;
2021-02-26 21:17:52 +01:00
while ( $count < $MAXPRODUCT ) {
2023-12-04 13:53:48 +01:00
print '<div class="wrapper2 arrow" id="prodiv' . $count . '" ' ; ?>
2025-02-18 21:48:21 +01:00
< ? php if ( $count == ( $MAXPRODUCT - 2 )) {
?> onclick="MoreProducts('less')" <?php
}
if ( $count == ( $MAXPRODUCT - 1 )) {
?> onclick="MoreProducts('more')" <?php
} else {
echo 'onclick="ClickProduct(' . $count . ')"' ;
} ?> >
2021-02-26 21:17:52 +01:00
< ? php
2020-10-31 14:32:18 +01:00
if ( $count == ( $MAXPRODUCT - 2 )) {
2024-03-19 01:18:42 +01:00
//echo '<img class="imgwrapper" src="img/arrow-prev-top.png" height="100%" id="proimg'.$count.'" />';
print '<span class="fa fa-chevron-left centerinmiddle" style="font-size: 5em; cursor: pointer;"></span>' ;
2020-10-31 14:32:18 +01:00
} elseif ( $count == ( $MAXPRODUCT - 1 )) {
2024-03-19 01:18:42 +01:00
//echo '<img class="imgwrapper" src="img/arrow-next-top.png" height="100%" id="proimg'.$count.'" />';
print '<span class="fa fa-chevron-right centerinmiddle" style="font-size: 5em; cursor: pointer;"></span>' ;
2020-10-31 14:32:18 +01:00
} else {
2023-09-06 02:38:08 +02:00
if ( ! getDolGlobalString ( 'TAKEPOS_HIDE_PRODUCT_PRICES' )) {
print '<div class="" id="proprice' . $count . '"></div>' ;
}
2021-07-08 12:17:32 +02:00
if ( getDolGlobalString ( 'TAKEPOS_HIDE_PRODUCT_IMAGES' )) {
2023-09-06 02:38:08 +02:00
print '<button type="button" id="probutton' . $count . '" class="productbutton" style="display: none;"></button>' ;
2021-02-26 21:17:52 +01:00
} else {
2023-03-06 13:51:53 +01:00
print '<img class="imgwrapper" title="" id="proimg' . $count . '">' ;
2020-09-16 06:54:01 +02:00
}
2023-12-04 13:53:48 +01:00
} ?>
2024-03-19 01:18:42 +01:00
< ? php if ( $count != $MAXPRODUCT - 2 && $count != $MAXPRODUCT - 1 && ! getDolGlobalString ( 'TAKEPOS_HIDE_PRODUCT_IMAGES' )) { ?>
2021-02-26 21:17:52 +01:00
< div class = " description " id = " prodivdesc<?php echo $count ; ?> " >
< div class = " description_content " id = " prodesc<?php echo $count ; ?> " ></ div >
</ div >
2024-03-19 01:18:42 +01:00
< ? php } ?>
2021-02-26 21:17:52 +01:00
< div class = " catwatermark " id = 'prowatermark<?php echo $count; ?>' >...</ div >
</ div >
2024-09-29 21:52:31 +02:00
< ? php
$count ++ ;
2020-10-31 14:32:18 +01:00
}
?>
2022-04-29 10:00:25 +02:00
< input type = " hidden " id = " search_start_less " value = " 0 " >
< input type = " hidden " id = " search_start_more " value = " 0 " >
< input type = " hidden " id = " search_pagination " value = " " >
2019-01-27 01:28:32 +01:00
</ div >
</ div >
2018-09-28 13:31:41 +02:00
</ div >
</ body >
< ? php
llxFooter ();
$db -> close ();