dolibarr/htdocs/public/ticket/index.php

98 lines
4.2 KiB
PHP
Raw Normal View History

<?php
2019-06-19 12:10:05 +02:00
/* Copyright (C) - 2013-2016 Jean-François FERRY <hello@librethic.io>
* Copyright (C) - 2019 Laurent Destailleur <eldy@users.sourceforge.net>
*
* 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/>.
*/
/**
* \file htdocs/public/ticket/index.php
* \ingroup ticket
2019-06-19 12:10:05 +02:00
* \brief Public page to add and manage ticket
*/
2021-02-26 18:58:34 +01:00
if (!defined('NOREQUIREMENU')) {
define('NOREQUIREMENU', '1');
}
2022-05-06 08:19:47 +02:00
if (!defined('NOLOGIN')) {
define('NOLOGIN', '1'); // If this page is public (can be called outside logged session)
2021-02-26 18:58:34 +01:00
}
if (!defined('NOIPCHECK')) {
2022-05-06 08:19:47 +02:00
define('NOIPCHECK', '1'); // Do not check IP defined into conf $dolibarr_main_restrict_ip
2021-02-26 18:58:34 +01:00
}
if (!defined('NOBROWSERNOTIF')) {
define('NOBROWSERNOTIF', '1');
}
2018-08-30 01:13:06 +02:00
// For MultiCompany module.
// Do not use GETPOST here, function is not defined and define must be done before including main.inc.php
$entity = (!empty($_GET['entity']) ? (int) $_GET['entity'] : (!empty($_POST['entity']) ? (int) $_POST['entity'] : 1));
2021-02-26 18:58:34 +01:00
if (is_numeric($entity)) {
define("DOLENTITY", $entity);
}
2018-08-30 01:13:06 +02:00
2018-03-11 23:07:57 +01:00
require '../../main.inc.php';
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';
2018-03-11 23:07:57 +01:00
require_once DOL_DOCUMENT_ROOT.'/core/lib/security.lib.php';
2019-05-03 17:06:57 +02:00
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
2018-05-26 23:52:52 +02:00
// Load translation files required by the page
$langs->loadLangs(array('companies', 'other', 'ticket', 'errors'));
// Get parameters
$track_id = GETPOST('track_id', 'alpha');
2020-09-16 19:39:50 +02:00
$action = GETPOST('action', 'aZ09');
2021-08-31 18:03:37 +02:00
if (empty($conf->ticket->enabled)) {
accessforbidden('', 0, 0, 1);
}
2019-03-04 19:19:09 +01:00
/*
* View
*/
$form = new Form($db);
$formticket = new FormTicket($db);
2021-02-26 18:58:34 +01:00
if (empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE)) {
2019-06-19 12:10:05 +02:00
print $langs->trans('TicketPublicInterfaceForbidden');
exit;
}
$arrayofjs = array();
$arrayofcss = array('/ticket/css/styles.css.php');
2019-06-19 12:10:05 +02:00
llxHeaderTicket($langs->trans("Tickets"), "", 0, 0, $arrayofjs, $arrayofcss);
2020-04-15 11:51:43 +02:00
print '<div class="ticketpublicarea">';
2022-09-01 10:54:20 +02:00
print '<p style="text-align: center">'.(!empty($conf->global->TICKET_PUBLIC_TEXT_HOME) ? $conf->global->TICKET_PUBLIC_TEXT_HOME : '<span class="opacitymedium">'.$langs->trans("TicketPublicDesc")).'</span></p>';
print '<br>';
2019-06-19 12:10:05 +02:00
print '<div class="ticketform">';
2022-09-01 10:54:20 +02:00
print '<a href="create_ticket.php?action=create'.(!empty($entity) && !empty($conf->multicompany->enabled)?'&entity='.$entity:'').'" rel="nofollow noopener" class="butAction marginbottomonly"><div class="index_create bigrounded"><span class="fa fa-15 fa-plus-circle valignmiddle btnTitle-icon"></span><br>'.dol_escape_htmltag($langs->trans("CreateTicket")).'</div></a>';
print '<a href="list.php'.(!empty($entity) && !empty($conf->multicompany->enabled)?'?entity='.$entity:'').'" rel="nofollow noopener" class="butAction marginbottomonly"><div class="index_display bigrounded"><span class="fa fa-15 fa-list-alt valignmiddle btnTitle-icon"></span><br>'.dol_escape_htmltag($langs->trans("ViewMyTicketList")).'</div></a>';
print '<a href="view.php'.(!empty($entity) && !empty($conf->multicompany->enabled)?'?entity='.$entity:'').'" rel="nofollow noopener" class="butAction marginbottomonly"><div class="index_display bigrounded">'.img_picto('', 'ticket', 'class="fa-15"').'<br>'.dol_escape_htmltag($langs->trans("ShowTicketWithTrackId")).'</div></a>';
2019-06-19 12:10:05 +02:00
print '<div style="clear:both;"></div>';
print '</div>';
print '</div>';
// End of page
2019-07-19 23:11:00 +02:00
htmlPrintOnlinePaymentFooter($mysoc, $langs, 0, $suffix, $object);
llxFooter('', 'public');
$db->close();