27if (!defined(
'NOTOKENRENEWAL')) {
 
   28  define(
'NOTOKENRENEWAL', 
'1'); 
 
   30if (!defined(
'NOREQUIREHTML')) {
 
   31  define(
'NOREQUIREHTML', 
'1');
 
   33if (!defined(
'NOREQUIREAJAX')) {
 
   34  define(
'NOREQUIREAJAX', 
'1');
 
   36if (!defined(
'NOREQUIRESOC')) {
 
   37  define(
'NOREQUIRESOC', 
'1');
 
   40if (!defined(
'NOREQUIREMENU')) {
 
   41  define(
'NOREQUIREMENU', 
'1');
 
   43if (!defined(
"NOLOGIN")) {
 
   44  define(
"NOLOGIN", 
'1');
 
   46if (!defined(
'NOIPCHECK')) {
 
   47  define(
'NOIPCHECK', 
'1'); 
 
   49if (!defined(
'NOBROWSERNOTIF')) {
 
   50  define(
'NOBROWSERNOTIF', 
'1');
 
   53include_once 
'../../../main.inc.php'; 
 
   55$action = 
GETPOST(
'action', 
'aZ09');
 
   57$email = 
GETPOST(
'email', 
'custom', 0, FILTER_VALIDATE_EMAIL);
 
   60if (!isModEnabled(
'ticket')) {
 
   65  httponly_accessforbidden(
'Option TICKET_CREATE_THIRD_PARTY_WITH_CONTACT_IF_NOT_EXIST of module ticket is not enabled');
 
   75if ($action == 
'getContacts') {
 
   77    'contacts' => array(),
 
   82    require_once DOL_DOCUMENT_ROOT.
'/ticket/class/ticket.class.php';
 
   85    $arrayofcontacts = $ticket->searchContactByEmail($email);
 
   86    if (is_array($arrayofcontacts)) {
 
   87      $arrayofminimalcontacts = array();
 
   88      foreach ($arrayofcontacts as $tmpval) {
 
   90        $tmpresult->id = $tmpval->id;
 
   91        $tmpresult->firstname = $tmpval->firstname;
 
   92        $tmpresult->lastname = $tmpval->lastname;
 
   93        $arrayofminimalcontacts[] = $tmpresult;
 
   96      $return[
'contacts'] = $arrayofminimalcontacts;
 
   98      $return[
'error'] = $ticket->errorsToString();
 
  102  echo json_encode($return);
 
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
 
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
 
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
 
if(!defined( 'NOREQUIREMENU')) if(!empty(GETPOST('seteventmessages', 'alpha'))) if(!function_exists("llxHeader")) top_httphead($contenttype='text/html', $forcenocache=0)
Show HTTP header.
 
Class to generate the form for creating a new ticket.
 
httponly_accessforbidden($message='1', $http_response_code=403, $stringalreadysanitized=0)
Show a message to say access is forbidden and stop program.