2018-03-10 04:23:59 +01:00
< ? php
2018-04-12 23:17:46 +02:00
/* Copyright ( C ) 2013 - 2016 Jean - François FERRY < hello @ librethic . io >
* Copyright ( C ) 2016 Christophe Battarel < christophe @ altairis . fr >
2023-02-22 02:21:48 +01:00
* Copyright ( C ) 2023 Laurent Destailleur < eldy @ users . sourceforge . net >
2025-02-12 00:52:24 +01:00
* Copyright ( C ) 2024 - 2025 MDW < mdeweerd @ users . noreply . github . com >
2024-09-09 03:13:43 +02:00
* Copyright ( C ) 2024 Frédéric France < frederic . france @ free . fr >
2018-03-10 04:23:59 +01: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
2021-11-09 03:01:48 +01:00
* the Free Software Foundation ; either version 3 of the License , or
2018-03-10 04:23:59 +01:00
* ( 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-03-10 04:23:59 +01:00
*/
/**
2019-07-19 20:06:02 +02:00
* \file htdocs / public / ticket / create_ticket . php
2018-06-04 21:49:29 +02:00
* \ingroup ticket
2018-04-19 15:11:26 +02:00
* \brief Display public form to add new ticket
2018-03-10 04:23:59 +01:00
*/
2022-09-01 10:54:20 +02:00
/* We need object $user -> default_values
2021-02-26 18:58:34 +01:00
if ( ! defined ( 'NOREQUIREUSER' )) {
define ( 'NOREQUIREUSER' , '1' );
2022-09-01 10:54:20 +02:00
} */
2021-02-26 18:58:34 +01:00
if ( ! defined ( 'NOREQUIREMENU' )) {
define ( 'NOREQUIREMENU' , '1' );
}
if ( ! defined ( 'NOREQUIREHTML' )) {
define ( 'NOREQUIREHTML' , '1' );
}
if ( ! defined ( 'NOLOGIN' )) {
define ( " NOLOGIN " , 1 ); // This means this output page does not require to be logged.
}
if ( ! defined ( 'NOIPCHECK' )) {
define ( 'NOIPCHECK' , '1' ); // Do not check IP defined into conf $dolibarr_main_restrict_ip
}
if ( ! defined ( 'NOBROWSERNOTIF' )) {
define ( 'NOBROWSERNOTIF' , '1' );
}
2020-10-25 13:48:08 +01:00
2021-12-17 11:10:08 +01:00
// For MultiCompany module.
// Do not use GETPOST here, function is not defined and define must be done before including main.inc.php
2024-03-28 20:19:28 +01:00
// Because 2 entities can have the same ref.
2021-12-17 11:10:08 +01:00
$entity = ( ! empty ( $_GET [ 'entity' ]) ? ( int ) $_GET [ 'entity' ] : ( ! empty ( $_POST [ 'entity' ]) ? ( int ) $_POST [ 'entity' ] : 1 ));
if ( is_numeric ( $entity )) {
define ( " DOLENTITY " , $entity );
}
2018-03-10 04:23:59 +01:00
2022-09-07 20:08:59 +02:00
// Load Dolibarr environment
2018-03-11 23:07:57 +01:00
require '../../main.inc.php' ;
2018-06-04 21:49:29 +02:00
require_once DOL_DOCUMENT_ROOT . '/ticket/class/actions_ticket.class.php' ;
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formticket.class.php' ;
require_once DOL_DOCUMENT_ROOT . '/core/lib/ticket.lib.php' ;
2019-05-03 17:16:04 +02:00
require_once DOL_DOCUMENT_ROOT . '/core/lib/security.lib.php' ;
require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php' ;
require_once DOL_DOCUMENT_ROOT . '/core/lib/payments.lib.php' ;
2022-11-28 11:06:36 +01:00
require_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php' ;
2018-03-11 23:07:57 +01:00
require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php' ;
require_once DOL_DOCUMENT_ROOT . '/user/class/user.class.php' ;
2022-05-12 16:52:02 +02:00
require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php' ;
2018-03-10 04:23:59 +01:00
2024-11-04 23:53:20 +01:00
/**
* @ var Conf $conf
* @ var DoliDB $db
* @ var HookManager $hookmanager
* @ var Societe $mysoc
* @ var Translate $langs
*/
2018-05-26 23:52:52 +02:00
// Load translation files required by the page
2018-06-04 21:49:29 +02:00
$langs -> loadLangs ( array ( 'companies' , 'other' , 'mails' , 'ticket' ));
2018-03-10 04:23:59 +01:00
// Get parameters
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
$id = GETPOSTINT ( 'id' );
$msg_id = GETPOSTINT ( 'msg_id' );
$socid = GETPOSTINT ( 'socid' );
2022-08-29 16:23:33 +02:00
$suffix = " " ;
2018-03-10 04:23:59 +01:00
2020-09-16 19:39:50 +02:00
$action = GETPOST ( 'action' , 'aZ09' );
2022-09-01 10:54:20 +02:00
$cancel = GETPOST ( 'cancel' , 'aZ09' );
2023-11-17 11:39:16 +01:00
2022-09-01 10:54:20 +02:00
$backtopage = '' ;
2018-03-10 04:23:59 +01:00
2024-06-30 21:02:50 +02:00
// Initialize a technical object to manage hooks of page. Note that conf->hooks_modules contains an array of hook context
2020-10-24 13:17:23 +02:00
$hookmanager -> initHooks ( array ( 'publicnewticketcard' , 'globalcard' ));
2018-06-04 21:49:29 +02:00
$object = new Ticket ( $db );
2018-04-12 23:17:46 +02:00
$extrafields = new ExtraFields ( $db );
2022-05-12 16:52:02 +02:00
$contacts = array ();
$with_contact = null ;
2023-11-17 11:39:16 +01:00
if ( getDolGlobalInt ( 'TICKET_CREATE_THIRD_PARTY_WITH_CONTACT_IF_NOT_EXIST' )) {
2022-05-12 16:52:02 +02:00
$with_contact = new Contact ( $db );
}
2019-10-06 14:41:52 +02:00
$extrafields -> fetch_name_optionals_label ( $object -> table_element );
2018-04-12 23:17:46 +02:00
2022-09-25 06:16:11 +02:00
if ( ! isModEnabled ( 'ticket' )) {
2022-09-09 13:58:54 +02:00
httponly_accessforbidden ( 'Module Ticket not enabled' );
2021-08-31 18:03:37 +02:00
}
2020-01-27 14:01:35 +01:00
2018-03-10 04:23:59 +01:00
/*
2018-04-12 23:33:38 +02:00
* Actions
2018-03-10 04:23:59 +01:00
*/
2021-04-27 02:52:24 +02:00
2020-10-24 13:17:23 +02:00
$parameters = array (
'id' => $id ,
);
// Note that $action and $object may have been modified by some hooks
$reshook = $hookmanager -> executeHooks ( 'doActions' , $parameters , $object , $action );
if ( $reshook < 0 ) {
2020-10-27 19:46:07 +01:00
setEventMessages ( $hookmanager -> error , $hookmanager -> errors , 'errors' );
2020-10-24 13:17:23 +02:00
}
2018-04-12 23:33:38 +02:00
// Add file in email form
2022-09-01 10:54:20 +02:00
if ( empty ( $reshook )) {
if ( $cancel ) {
2024-02-27 00:24:22 +01:00
$backtopage = getDolGlobalString ( 'TICKET_URL_PUBLIC_INTERFACE' , DOL_URL_ROOT . '/public/ticket/' );
2020-04-16 00:42:57 +02:00
2022-09-01 10:54:20 +02:00
header ( " Location: " . $backtopage );
exit ;
}
2018-03-10 04:23:59 +01:00
2022-09-01 10:54:20 +02:00
if ( GETPOST ( 'addfile' , 'alpha' ) && ! GETPOST ( 'save' , 'alpha' )) {
include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php' ;
2023-05-13 16:39:42 +02:00
// Set tmp directory
// TODO Use a dedicated directory for temporary emails files
2022-09-01 10:54:20 +02:00
$vardir = $conf -> ticket -> dir_output ;
$upload_dir_tmp = $vardir . '/temp/' . session_id ();
if ( ! dol_is_dir ( $upload_dir_tmp )) {
dol_mkdir ( $upload_dir_tmp );
}
2018-03-10 04:23:59 +01:00
2022-09-01 10:54:20 +02:00
dol_add_file_process ( $upload_dir_tmp , 0 , 0 , 'addedfile' , '' , null , '' , 0 );
$action = 'create_ticket' ;
}
2018-03-10 04:23:59 +01:00
2022-09-01 10:54:20 +02:00
// Remove file
if ( GETPOST ( 'removedfile' , 'alpha' ) && ! GETPOST ( 'save' , 'alpha' )) {
include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php' ;
2020-04-15 12:32:59 +02:00
2022-09-01 10:54:20 +02:00
// Set tmp directory
2023-05-13 16:39:42 +02:00
// TODO Use a dedicated directory for temporary emails files
2022-09-01 10:54:20 +02:00
$vardir = $conf -> ticket -> dir_output . '/' ;
$upload_dir_tmp = $vardir . '/temp/' . session_id ();
2020-04-16 00:42:57 +02:00
2023-05-13 16:39:42 +02:00
// TODO Delete only files that was uploaded from form
2025-02-12 00:52:24 +01:00
dol_remove_file_process ( GETPOSTINT ( 'removedfile' ), 0 , 0 );
2022-09-01 10:54:20 +02:00
$action = 'create_ticket' ;
}
2020-04-16 00:42:57 +02:00
2024-09-30 11:38:29 +02:00
if ( $action == 'create_ticket' && GETPOST ( 'save' , 'alpha' )) { // Test on permission not required. This is a public form. Security is managed by mitigation.
2022-09-01 10:54:20 +02:00
$error = 0 ;
2025-02-12 00:52:24 +01:00
$cid = - 1 ;
2024-07-28 14:54:06 +02:00
$origin_email = GETPOST ( 'email' , 'email' );
2022-09-01 10:54:20 +02:00
if ( empty ( $origin_email )) {
2020-04-16 00:42:57 +02:00
$error ++ ;
2022-09-01 10:54:20 +02:00
array_push ( $object -> errors , $langs -> trans ( " ErrorFieldRequired " , $langs -> transnoentities ( " Email " )));
2020-04-16 00:42:57 +02:00
$action = '' ;
2022-09-01 10:54:20 +02:00
} else {
// Search company saved with email
2025-02-12 00:52:24 +01:00
$searched_companies = $object -> searchSocidByEmail ( $origin_email , 0 );
2020-04-16 00:42:57 +02:00
2024-01-12 17:55:52 +01:00
// Chercher un contact existent avec cette address email
2022-09-01 10:54:20 +02:00
// Le premier contact trouvé est utilisé pour déterminer le contact suivi
$contacts = $object -> searchContactByEmail ( $origin_email );
2025-02-12 00:52:24 +01:00
if ( ! is_array ( $contacts )) {
$contacts = array ();
}
2022-05-12 16:52:02 +02:00
2022-11-11 15:28:04 +01:00
// Ensure that contact is active and select first active contact
foreach ( $contacts as $key => $contact ) {
2025-02-12 00:52:24 +01:00
if (( int ) $contact -> status == 1 ) {
2022-11-11 15:28:04 +01:00
$cid = $key ;
break ;
}
}
2020-04-16 00:42:57 +02:00
2022-09-01 10:54:20 +02:00
// Option to require email exists to create ticket
2023-11-17 11:39:16 +01:00
if ( getDolGlobalInt ( 'TICKET_EMAIL_MUST_EXISTS' ) && ( $cid < 0 || empty ( $contacts [ $cid ] -> socid ))) {
2022-05-12 16:52:02 +02:00
$error ++ ;
2022-09-01 10:54:20 +02:00
array_push ( $object -> errors , $langs -> trans ( " ErrorEmailMustExistToCreateTicket " ));
2022-05-12 16:52:02 +02:00
$action = '' ;
}
}
2022-09-01 10:54:20 +02:00
$contact_lastname = '' ;
$contact_firstname = '' ;
$company_name = '' ;
$contact_phone = '' ;
if ( $with_contact ) {
// set linked contact to add in form
2025-02-12 00:52:24 +01:00
if ( /* is_array($contacts) && */ count ( $contacts ) == 1 ) {
2022-09-01 10:54:20 +02:00
$with_contact = current ( $contacts );
}
2020-04-16 00:42:57 +02:00
2022-09-01 10:54:20 +02:00
// check mandatory fields on contact
$contact_lastname = trim ( GETPOST ( 'contact_lastname' , 'alphanohtml' ));
$contact_firstname = trim ( GETPOST ( 'contact_firstname' , 'alphanohtml' ));
$company_name = trim ( GETPOST ( 'company_name' , 'alphanohtml' ));
$contact_phone = trim ( GETPOST ( 'contact_phone' , 'alphanohtml' ));
if ( ! ( $with_contact -> id > 0 )) {
// check lastname
if ( empty ( $contact_lastname )) {
$error ++ ;
array_push ( $object -> errors , $langs -> trans ( 'ErrorFieldRequired' , $langs -> transnoentities ( 'Lastname' )));
$action = '' ;
}
// check firstname
if ( empty ( $contact_firstname )) {
$error ++ ;
array_push ( $object -> errors , $langs -> trans ( 'ErrorFieldRequired' , $langs -> transnoentities ( 'Firstname' )));
$action = '' ;
}
}
}
2021-02-18 19:27:50 +01:00
2024-09-20 00:21:42 +02:00
$fieldsToCheck = [
'type_code' => [ 'check' => 'alpha' , 'langs' => 'TicketTypeRequest' ],
'category_code' => [ 'check' => 'alpha' , 'langs' => 'TicketCategory' ],
'severity_code' => [ 'check' => 'alpha' , 'langs' => 'TicketSeverity' ],
'subject' => [ 'check' => 'alphanohtml' , 'langs' => 'Subject' ],
'message' => [ 'check' => 'restricthtml' , 'langs' => 'Message' ]
];
FormTicket :: checkRequiredFields ( $fieldsToCheck , $error );
2020-04-16 00:42:57 +02:00
2022-09-01 10:54:20 +02:00
// Check email address
if ( ! empty ( $origin_email ) && ! isValidEmail ( $origin_email )) {
$error ++ ;
array_push ( $object -> errors , $langs -> trans ( " ErrorBadEmailAddress " , $langs -> transnoentities ( " email " )));
$action = '' ;
}
2020-04-16 00:42:57 +02:00
2022-09-01 10:54:20 +02:00
// Check Captcha code if is enabled
2023-11-17 11:39:16 +01:00
if ( getDolGlobalInt ( 'MAIN_SECURITY_ENABLECAPTCHA_TICKET' )) {
2022-09-01 10:54:20 +02:00
$sessionkey = 'dol_antispam_value' ;
2024-08-07 03:05:02 +02:00
$ok = ( array_key_exists ( $sessionkey , $_SESSION ) && ( strtolower ( $_SESSION [ $sessionkey ]) === strtolower ( GETPOST ( 'code' , 'restricthtml' ))));
2022-09-01 10:54:20 +02:00
if ( ! $ok ) {
$error ++ ;
array_push ( $object -> errors , $langs -> trans ( " ErrorBadValueForCode " ));
$action = '' ;
}
}
2020-04-16 00:42:57 +02:00
2022-09-01 10:54:20 +02:00
if ( ! $error ) {
2022-09-08 10:59:24 +02:00
$object -> type_code = GETPOST ( " type_code " , 'aZ09' );
$object -> category_code = GETPOST ( " category_code " , 'aZ09' );
$object -> severity_code = GETPOST ( " severity_code " , 'aZ09' );
$object -> ip = getUserRemoteIP ();
2022-11-29 10:24:21 +01:00
$nb_post_max = getDolGlobalInt ( " MAIN_SECURITY_MAX_POST_ON_PUBLIC_PAGES_BY_IP_ADDRESS " , 200 );
2022-11-28 11:06:36 +01:00
$now = dol_now ();
$minmonthpost = dol_time_plus_duree ( $now , - 1 , " m " );
2022-09-13 02:21:24 +02:00
// Calculate nb of post for IP
$nb_post_ip = 0 ;
if ( $nb_post_max > 0 ) { // Calculate only if there is a limit to check
$sql = " SELECT COUNT(ref) as nb_tickets " ;
$sql .= " FROM " . MAIN_DB_PREFIX . " ticket " ;
$sql .= " WHERE ip = ' " . $db -> escape ( $object -> ip ) . " ' " ;
2022-11-28 11:06:36 +01:00
$sql .= " AND datec > ' " . $db -> idate ( $minmonthpost ) . " ' " ;
2022-09-13 02:21:24 +02:00
$resql = $db -> query ( $sql );
if ( $resql ) {
$num = $db -> num_rows ( $resql );
$i = 0 ;
while ( $i < $num ) {
$i ++ ;
$obj = $db -> fetch_object ( $resql );
$nb_post_ip = $obj -> nb_tickets ;
}
2022-09-08 10:59:24 +02:00
}
2022-08-04 16:53:58 +02:00
}
2020-04-16 00:42:57 +02:00
2022-09-01 10:54:20 +02:00
$object -> track_id = generate_random_id ( 16 );
2022-05-12 16:52:02 +02:00
2022-09-13 02:21:24 +02:00
$object -> db -> begin ();
2022-09-07 14:39:00 +02:00
2024-07-28 14:54:06 +02:00
$object -> subject = GETPOST ( " subject " , " alphanohtml " );
2022-09-01 10:54:20 +02:00
$object -> message = GETPOST ( " message " , " restricthtml " );
$object -> origin_email = $origin_email ;
2024-07-28 14:54:06 +02:00
$object -> email_from = $origin_email ;
2022-05-12 16:52:02 +02:00
2022-09-01 10:54:20 +02:00
$object -> type_code = GETPOST ( " type_code " , 'aZ09' );
$object -> category_code = GETPOST ( " category_code " , 'aZ09' );
$object -> severity_code = GETPOST ( " severity_code " , 'aZ09' );
if ( ! is_object ( $user )) {
$user = new User ( $db );
2022-05-12 16:52:02 +02:00
}
2022-09-01 10:54:20 +02:00
// create third-party with contact
$usertoassign = 0 ;
if ( $with_contact && ! ( $with_contact -> id > 0 )) {
$company = new Societe ( $db );
if ( ! empty ( $company_name )) {
$company -> name = $company_name ;
} else {
$company -> particulier = 1 ;
$company -> name = dolGetFirstLastname ( $contact_firstname , $contact_lastname );
}
$result = $company -> create ( $user );
2022-05-12 16:52:02 +02:00
if ( $result < 0 ) {
$error ++ ;
2022-09-01 10:54:20 +02:00
$errors = ( $company -> error ? array ( $company -> error ) : $company -> errors );
2025-02-12 00:52:24 +01:00
$object -> errors = array_merge ( $object -> errors , $errors );
2022-05-12 16:52:02 +02:00
$action = 'create_ticket' ;
2022-09-01 10:54:20 +02:00
}
// create contact and link to this new company
if ( ! $error ) {
$with_contact -> email = $origin_email ;
$with_contact -> lastname = $contact_lastname ;
$with_contact -> firstname = $contact_firstname ;
$with_contact -> socid = $company -> id ;
$with_contact -> phone_pro = $contact_phone ;
$result = $with_contact -> create ( $user );
if ( $result < 0 ) {
$error ++ ;
$errors = ( $with_contact -> error ? array ( $with_contact -> error ) : $with_contact -> errors );
2025-02-12 00:52:24 +01:00
$object -> errors = array_merge ( $object -> errors , $errors );
2022-09-01 10:54:20 +02:00
$action = 'create_ticket' ;
} else {
$contacts = array ( $with_contact );
}
2022-05-12 16:52:02 +02:00
}
}
2022-11-08 16:27:04 +01:00
if ( ! empty ( $searched_companies ) && is_array ( $searched_companies )) {
2022-09-01 10:54:20 +02:00
$object -> fk_soc = $searched_companies [ 0 ] -> id ;
}
2020-04-16 00:42:57 +02:00
2025-02-12 00:52:24 +01:00
if ( /* is_array($contacts) && */ count ( $contacts ) > 0 && $cid >= 0 ) {
2022-11-11 15:28:04 +01:00
$object -> fk_soc = $contacts [ $cid ] -> socid ;
$usertoassign = $contacts [ $cid ] -> id ;
2022-09-01 10:54:20 +02:00
}
2020-04-16 00:42:57 +02:00
2022-09-01 10:54:20 +02:00
$ret = $extrafields -> setOptionalsFromPost ( null , $object );
2020-04-16 00:42:57 +02:00
2022-09-01 10:54:20 +02:00
// Generate new ref
$object -> ref = $object -> getDefaultRef ();
2020-04-16 00:42:57 +02:00
2022-09-01 10:54:20 +02:00
$object -> context [ 'disableticketemail' ] = 1 ; // Disable emails sent by ticket trigger when creation is done from this page, emails are already sent later
2024-02-02 21:41:40 +01:00
$object -> context [ 'contactid' ] = GETPOSTINT ( 'contactid' ); // Disable emails sent by ticket trigger when creation is done from this page, emails are already sent later
2020-04-16 00:42:57 +02:00
2024-02-21 18:08:35 +01:00
$object -> context [ 'createdfrompublicinterface' ] = 1 ; // To make a difference between a ticket created from the public interface and a ticket directly created from dolibarr
2022-09-13 02:21:24 +02:00
if ( $nb_post_max > 0 && $nb_post_ip >= $nb_post_max ) {
2022-09-01 10:54:20 +02:00
$error ++ ;
2022-11-08 16:27:04 +01:00
array_push ( $object -> errors , $langs -> trans ( " AlreadyTooMuchPostOnThisIPAdress " ));
2022-09-01 10:54:20 +02:00
$action = 'create_ticket' ;
}
2020-04-16 00:42:57 +02:00
2022-09-01 10:54:20 +02:00
if ( ! $error ) {
2023-05-13 16:39:42 +02:00
// Creation of the ticket
2022-09-08 10:59:24 +02:00
$id = $object -> create ( $user );
if ( $id <= 0 ) {
$error ++ ;
$errors = ( $object -> error ? array ( $object -> error ) : $object -> errors );
2025-02-12 00:52:24 +01:00
if ( $object -> error ) {
array_push ( $object -> errors , $object -> error );
}
2022-09-08 10:59:24 +02:00
$action = 'create_ticket' ;
}
2022-09-01 10:54:20 +02:00
}
2020-04-16 00:42:57 +02:00
2022-09-01 10:54:20 +02:00
if ( ! $error && $id > 0 ) {
if ( $usertoassign > 0 ) {
$object -> add_contact ( $usertoassign , " SUPPORTCLI " , 'external' , 0 );
}
2020-04-16 00:42:57 +02:00
2022-09-08 10:59:24 +02:00
if ( ! $error ) {
$object -> db -> commit ();
$action = " infos_success " ;
} else {
$object -> db -> rollback ();
setEventMessages ( $object -> error , $object -> errors , 'errors' );
$action = 'create_ticket' ;
}
2020-04-16 00:42:57 +02:00
2022-09-08 10:59:24 +02:00
if ( ! $error ) {
$res = $object -> fetch ( $id );
if ( $res ) {
// Create form object
include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php' ;
include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php' ;
$formmail = new FormMail ( $db );
2022-09-01 10:54:20 +02:00
2022-09-08 10:59:24 +02:00
// Init to avoid errors
$filepath = array ();
$filename = array ();
$mimetype = array ();
$attachedfiles = $formmail -> get_attached_files ();
$filepath = $attachedfiles [ 'paths' ];
$filename = $attachedfiles [ 'names' ];
$mimetype = $attachedfiles [ 'mimes' ];
// Send email to customer
2023-09-29 16:27:07 +02:00
$appli = $mysoc -> name ;
2022-09-01 10:54:20 +02:00
2023-09-29 16:27:07 +02:00
$subject = '[' . $appli . '] ' . $langs -> transnoentities ( 'TicketNewEmailSubject' , $object -> ref , $object -> track_id );
2023-11-17 11:39:16 +01:00
$message = ( getDolGlobalString ( 'TICKET_MESSAGE_MAIL_NEW' ) !== '' ? getDolGlobalString ( 'TICKET_MESSAGE_MAIL_NEW' ) : $langs -> transnoentities ( 'TicketNewEmailBody' )) . '<br><br>' ;
2022-09-08 10:59:24 +02:00
$message .= $langs -> transnoentities ( 'TicketNewEmailBodyInfosTicket' ) . '<br>' ;
2022-09-01 10:54:20 +02:00
2024-02-27 01:12:53 +01:00
$url_public_ticket = getDolGlobalString ( 'TICKET_URL_PUBLIC_INTERFACE' , dol_buildpath ( '/public/ticket/' , 2 )) . 'view.php?track_id=' . $object -> track_id ;
2022-09-08 10:59:24 +02:00
$infos_new_ticket = $langs -> transnoentities ( 'TicketNewEmailBodyInfosTrackId' , '<a href="' . $url_public_ticket . '" rel="nofollow noopener">' . $object -> track_id . '</a>' ) . '<br>' ;
$infos_new_ticket .= $langs -> transnoentities ( 'TicketNewEmailBodyInfosTrackUrl' ) . '<br><br>' ;
$message .= $infos_new_ticket ;
$message .= getDolGlobalString ( 'TICKET_MESSAGE_MAIL_SIGNATURE' , $langs -> transnoentities ( 'TicketMessageMailSignatureText' , $mysoc -> name ));
$sendto = GETPOST ( 'email' , 'alpha' );
2023-10-15 18:39:13 +02:00
$from = getDolGlobalString ( 'MAIN_INFO_SOCIETE_NOM' ) . ' <' . getDolGlobalString ( 'TICKET_NOTIFICATION_EMAIL_FROM' ) . '>' ;
2022-09-01 10:54:20 +02:00
$replyto = $from ;
2022-09-08 10:59:24 +02:00
$sendtocc = '' ;
$deliveryreceipt = 0 ;
2022-09-01 10:54:20 +02:00
2025-02-12 00:52:24 +01:00
$old_MAIN_MAIL_AUTOCOPY_TO = getDolGlobalString ( 'TICKET_DISABLE_MAIL_AUTOCOPY_TO' );
if ( $old_MAIN_MAIL_AUTOCOPY_TO !== '' ) {
2022-09-01 10:54:20 +02:00
$conf -> global -> MAIN_MAIL_AUTOCOPY_TO = '' ;
}
include_once DOL_DOCUMENT_ROOT . '/core/class/CMailFile.class.php' ;
2022-09-08 10:59:24 +02:00
$mailfile = new CMailFile ( $subject , $sendto , $from , $message , $filepath , $mimetype , $filename , $sendtocc , '' , $deliveryreceipt , - 1 , '' , '' , 'tic' . $object -> id , '' , 'ticket' );
2022-09-11 21:53:25 +02:00
if ( $mailfile -> error || ! empty ( $mailfile -> errors )) {
2022-09-01 10:54:20 +02:00
setEventMessages ( $mailfile -> error , $mailfile -> errors , 'errors' );
} else {
$result = $mailfile -> sendfile ();
}
2025-02-12 00:52:24 +01:00
if ( $old_MAIN_MAIL_AUTOCOPY_TO !== '' ) {
2022-09-01 10:54:20 +02:00
$conf -> global -> MAIN_MAIL_AUTOCOPY_TO = $old_MAIN_MAIL_AUTOCOPY_TO ;
}
2022-09-08 10:59:24 +02:00
// Send email to TICKET_NOTIFICATION_EMAIL_TO
2023-11-17 11:39:16 +01:00
$sendto = getDolGlobalString ( 'TICKET_NOTIFICATION_EMAIL_TO' );
2022-09-08 10:59:24 +02:00
if ( $sendto ) {
2023-09-29 16:27:07 +02:00
$appli = $mysoc -> name ;
$subject = '[' . $appli . '] ' . $langs -> transnoentities ( 'TicketNewEmailSubjectAdmin' , $object -> ref , $object -> track_id );
2022-09-08 10:59:24 +02:00
$message_admin = $langs -> transnoentities ( 'TicketNewEmailBodyAdmin' , $object -> track_id ) . '<br><br>' ;
$message_admin .= '<ul><li>' . $langs -> trans ( 'Title' ) . ' : ' . $object -> subject . '</li>' ;
$message_admin .= '<li>' . $langs -> trans ( 'Type' ) . ' : ' . $object -> type_label . '</li>' ;
$message_admin .= '<li>' . $langs -> trans ( 'Category' ) . ' : ' . $object -> category_label . '</li>' ;
$message_admin .= '<li>' . $langs -> trans ( 'Severity' ) . ' : ' . $object -> severity_label . '</li>' ;
$message_admin .= '<li>' . $langs -> trans ( 'From' ) . ' : ' . $object -> origin_email . '</li>' ;
// Extrafields
$extrafields -> fetch_name_optionals_label ( $object -> table_element );
if ( is_array ( $object -> array_options ) && count ( $object -> array_options ) > 0 ) {
foreach ( $object -> array_options as $key => $value ) {
$key = substr ( $key , 8 ); // remove "options_"
$message_admin .= '<li>' . $langs -> trans ( $extrafields -> attributes [ $object -> table_element ][ 'label' ][ $key ]) . ' : ' . $extrafields -> showOutputField ( $key , $value , '' , $object -> table_element ) . '</li>' ;
}
}
$message_admin .= '</ul>' ;
$message_admin .= '<p>' . $langs -> trans ( 'Message' ) . ' : <br>' . $object -> message . '</p>' ;
$message_admin .= '<p><a href="' . dol_buildpath ( '/ticket/card.php' , 2 ) . '?track_id=' . $object -> track_id . '" rel="nofollow noopener">' . $langs -> trans ( 'SeeThisTicketIntomanagementInterface' ) . '</a></p>' ;
2023-10-15 18:39:13 +02:00
$from = getDolGlobalString ( 'MAIN_INFO_SOCIETE_NOM' ) . ' <' . getDolGlobalString ( 'TICKET_NOTIFICATION_EMAIL_FROM' ) . '>' ;
2022-09-08 10:59:24 +02:00
$replyto = $from ;
2025-02-12 00:52:24 +01:00
$old_MAIN_MAIL_AUTOCOPY_TO = getDolGlobalString ( 'TICKET_DISABLE_MAIL_AUTOCOPY_TO' );
if ( $old_MAIN_MAIL_AUTOCOPY_TO !== '' ) {
2022-09-08 10:59:24 +02:00
$conf -> global -> MAIN_MAIL_AUTOCOPY_TO = '' ;
}
include_once DOL_DOCUMENT_ROOT . '/core/class/CMailFile.class.php' ;
$mailfile = new CMailFile ( $subject , $sendto , $from , $message_admin , $filepath , $mimetype , $filename , $sendtocc , '' , $deliveryreceipt , - 1 , '' , '' , 'tic' . $object -> id , '' , 'ticket' );
2022-09-13 02:15:31 +02:00
if ( $mailfile -> error || ! empty ( $mailfile -> errors )) {
setEventMessages ( $mailfile -> error , $mailfile -> errors , 'errors' );
2022-09-08 10:59:24 +02:00
} else {
$result = $mailfile -> sendfile ();
}
2025-02-12 00:52:24 +01:00
if ( $old_MAIN_MAIL_AUTOCOPY_TO !== '' ) {
2022-09-08 10:59:24 +02:00
$conf -> global -> MAIN_MAIL_AUTOCOPY_TO = $old_MAIN_MAIL_AUTOCOPY_TO ;
}
}
2022-09-01 10:54:20 +02:00
}
2020-04-16 00:42:57 +02:00
2022-09-08 10:59:24 +02:00
// Copy files into ticket directory
2023-05-13 16:39:42 +02:00
$object -> copyFilesForTicket ( '' );
2020-04-16 00:42:57 +02:00
2022-09-08 10:59:24 +02:00
//setEventMessages($langs->trans('YourTicketSuccessfullySaved'), null, 'mesgs');
2020-04-16 00:42:57 +02:00
2022-09-08 10:59:24 +02:00
// Make a redirect to avoid to have ticket submitted twice if we make back
$messagetoshow = $langs -> trans ( 'MesgInfosPublicTicketCreatedWithTrackId' , '{s1}' , '{s2}' );
$messagetoshow = str_replace ( array ( '{s1}' , '{s2}' ), array ( '<strong>' . $object -> track_id . '</strong>' , '<strong>' . $object -> ref . '</strong>' ), $messagetoshow );
setEventMessages ( $messagetoshow , null , 'warnings' );
setEventMessages ( $langs -> trans ( 'PleaseRememberThisId' ), null , 'warnings' );
2022-09-01 12:39:25 +02:00
2023-12-04 13:49:31 +01:00
header ( " Location: index.php " . ( ! empty ( $entity ) && isModEnabled ( 'multicompany' ) ? '?entity=' . $entity : '' ));
2022-09-08 10:59:24 +02:00
exit ;
}
} else {
setEventMessages ( $object -> error , $object -> errors , 'errors' );
2022-09-01 10:54:20 +02:00
}
2020-04-16 00:42:57 +02:00
}
}
2018-03-10 04:23:59 +01:00
}
2023-11-17 11:39:16 +01:00
if ( ! empty ( $object -> errors ) || ! empty ( $object -> error )) {
setEventMessages ( $object -> error , $object -> errors , 'errors' );
}
2018-03-10 04:23:59 +01:00
2018-04-12 23:17:46 +02:00
/*
* View
*/
2018-03-10 04:23:59 +01:00
$form = new Form ( $db );
2018-06-04 21:49:29 +02:00
$formticket = new FormTicket ( $db );
2018-03-10 04:23:59 +01:00
2023-11-17 11:39:16 +01:00
if ( ! getDolGlobalInt ( 'TICKET_ENABLE_PUBLIC_INTERFACE' )) {
2020-04-16 00:42:57 +02:00
print '<div class="error">' . $langs -> trans ( 'TicketPublicInterfaceForbidden' ) . '</div>' ;
$db -> close ();
exit ();
2018-03-10 04:23:59 +01:00
}
2019-07-05 11:21:04 +02:00
$arrayofjs = array ();
2024-02-27 00:47:28 +01:00
2024-07-27 22:25:13 +02:00
$arrayofcss = array ( getDolGlobalString ( 'TICKET_URL_PUBLIC_INTERFACE' , '/public/ticket/' ) . 'css/styles.css.php' );
2019-07-05 11:21:04 +02:00
llxHeaderTicket ( $langs -> trans ( " CreateTicket " ), " " , 0 , 0 , $arrayofjs , $arrayofcss );
2023-03-12 21:31:33 +01:00
print '<div class="ticketpublicarea ticketlargemargin centpercent">' ;
2018-03-10 04:23:59 +01:00
if ( $action != " infos_success " ) {
2020-04-16 00:42:57 +02:00
$formticket -> withfromsocid = isset ( $socid ) ? $socid : $user -> socid ;
$formticket -> withtitletopic = 1 ;
$formticket -> withcompany = 0 ;
$formticket -> withusercreate = 1 ;
$formticket -> fk_user_create = 0 ;
$formticket -> withemail = 1 ;
$formticket -> ispublic = 1 ;
$formticket -> withfile = 2 ;
$formticket -> action = 'create_ticket' ;
2022-09-01 10:54:20 +02:00
$formticket -> withcancel = 1 ;
2020-04-16 00:42:57 +02:00
$formticket -> param = array ( 'returnurl' => $_SERVER [ 'PHP_SELF' ] . ( $conf -> entity > 1 ? '?entity=' . $conf -> entity : '' ));
2024-09-09 03:13:43 +02:00
print load_fiche_titre ( $langs -> trans ( 'NewTicket' ), '' , '' , 0 , '' , 'marginleftonly' );
2020-04-16 00:42:57 +02:00
2024-04-20 18:49:24 +02:00
if ( ! getDolGlobalString ( 'TICKET_NOTIFICATION_EMAIL_FROM' )) {
2020-04-16 00:42:57 +02:00
$langs -> load ( " errors " );
print '<div class="error">' ;
print $langs -> trans ( " ErrorFieldRequired " , $langs -> transnoentities ( " TicketEmailNotificationFrom " )) . '<br>' ;
print $langs -> trans ( " ErrorModuleSetupNotComplete " , $langs -> transnoentities ( " Ticket " ));
2021-07-30 01:16:04 +02:00
print '</div>' ;
2020-05-21 15:05:19 +02:00
} else {
2022-09-01 10:54:20 +02:00
//print '<div class="info marginleftonly marginrightonly">'.$langs->trans('TicketPublicInfoCreateTicket').'</div>';
2024-07-28 14:54:06 +02:00
$formticket -> showForm ( 0 , ( $action ? $action : 'create' ), 1 , $with_contact , '' , $object );
2020-04-16 00:42:57 +02:00
}
2018-03-10 04:23:59 +01:00
}
2019-07-05 11:21:04 +02:00
2018-03-10 04:23:59 +01:00
print '</div>' ;
2024-06-27 00:49:50 +02:00
print '<br>' ;
2023-07-31 04:14:18 +02:00
if ( getDolGlobalInt ( 'TICKET_SHOW_COMPANY_FOOTER' )) {
// End of page
htmlPrintOnlineFooter ( $mysoc , $langs , 0 , $suffix , $object );
}
2018-04-12 23:17:46 +02:00
2019-05-03 17:16:04 +02:00
llxFooter ( '' , 'public' );
2018-04-12 23:17:46 +02:00
$db -> close ();