diff --git a/htdocs/public/ticket/create_ticket.php b/htdocs/public/ticket/create_ticket.php index b663aaa43c3..b7d17244c2a 100644 --- a/htdocs/public/ticket/create_ticket.php +++ b/htdocs/public/ticket/create_ticket.php @@ -17,7 +17,7 @@ */ /** - * \file htdocs/public/ticket/index.php + * \file htdocs/public/ticket/create_ticket.php * \ingroup ticket * \brief Display public form to add new ticket */ diff --git a/htdocs/public/ticket/list.php b/htdocs/public/ticket/list.php index 9da0a4272e1..39736c6d857 100644 --- a/htdocs/public/ticket/list.php +++ b/htdocs/public/ticket/list.php @@ -210,7 +210,8 @@ if ($action == "view_ticketlist") 't.date_read' => array('label' => $langs->trans("TicketReadOn"), 'checked' => 0), 't.date_close' => array('label' => $langs->trans("TicketCloseOn"), 'checked' => 0), 't.ref' => array('label' => $langs->trans("Ref"), 'checked' => 1), - 't.fk_statut' => array('label' => $langs->trans("Statut"), 'checked' => 1), + //'t.track_id' => array('label' => $langs->trans("IDTracking"), 'checked' => 0), + 't.fk_statut' => array('label' => $langs->trans("Statut"), 'checked' => 1), 't.subject' => array('label' => $langs->trans("Subject"), 'checked' => 1), 'type.code' => array('label' => $langs->trans("Type"), 'checked' => 1), 'category.code' => array('label' => $langs->trans("Category"), 'checked' => 1), diff --git a/htdocs/public/ticket/view.php b/htdocs/public/ticket/view.php index 2c23ba1bc71..be77e50ea28 100644 --- a/htdocs/public/ticket/view.php +++ b/htdocs/public/ticket/view.php @@ -17,7 +17,7 @@ */ /** - * \file htdocs/public/ticket/index.php + * \file htdocs/public/ticket/view.php * \ingroup ticket * \brief Public file to add and manage ticket */ @@ -65,7 +65,7 @@ $object = new ActionsTicket($db); * Actions */ -if ($action == "view_ticket" || $action == "add_message" || $action == "close" || $action == "confirm_public_close" || $action == "new_public_message") { +if ($action == "view_ticket" || $action == "add_message" || $action == "close" || $action == "confirm_public_close" || $action == "add_public_message") { $error = 0; $display_ticket = false; if (!strlen($track_id)) { @@ -89,22 +89,28 @@ if ($action == "view_ticket" || $action == "add_message" || $action == "close" | if (!$error) { $ret = $object->fetch('', '', $track_id); if ($ret && $object->dao->id > 0) { - // vérifie si l'adresse email est bien dans les contacts du ticket - $contacts = $object->dao->liste_contact(-1, 'external'); - foreach ($contacts as $contact) { - if ($contact['email'] == $email) { - $display_ticket = true; - $_SESSION['email_customer'] = $email; - break; - } else { - $display_ticket = false; - } - } - + // Check if emails provided is the one of author + if ($object->dao->origin_email == $email) + { + $display_ticket = true; + $_SESSION['email_customer'] = $email; + } + // Check if emails provided is inside list of contacts + else { + $contacts = $object->dao->liste_contact(-1, 'external'); + foreach ($contacts as $contact) { + if ($contact['email'] == $email) { + $display_ticket = true; + $_SESSION['email_customer'] = $email; + break; + } else { + $display_ticket = false; + } + } + } if ($object->dao->fk_soc > 0) { $object->dao->fetch_thirdparty(); } - if ($email == $object->dao->origin_email || $email == $object->dao->thirdparty->email) { $display_ticket = true; $_SESSION['email_customer'] = $email; @@ -116,12 +122,32 @@ if ($action == "view_ticket" || $action == "add_message" || $action == "close" | } } + if ($action == "add_public_message") + { + // TODO Add message... + + + + + if (! $error) + { + $action = 'view_ticket'; + } + } + if ($error || $errors) { setEventMessages($object->error, $object->errors, 'errors'); - $action = ''; + if ($action == "add_public_message") + { + $action = 'add_message'; + } + else + { + $action = ''; + } } } - +//var_dump($action); //$object->doActions($action); @@ -251,16 +277,18 @@ if ($action == "view_ticket" || $action == "add_message" || $action == "close" | $formticket = new FormTicket($db); - $formticket->action = "new_public_message"; + $formticket->action = "add_public_message"; $formticket->track_id = $object->dao->track_id; $formticket->id = $object->dao->id; - $formticket->param = array('fk_user_create' => '-1'); + $formticket->param = array('track_id' => $object->dao->track_id, 'fk_user_create' => '-1', 'returnurl' => DOL_URL_ROOT.'/public/ticket/view.php'); $formticket->withfile = 2; $formticket->showMessageForm('100%'); - } else { - print '
'; + } + + if ($action != 'add_message') { + print ''; print ''; print ''; print ''; diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index 7ab32f20851..29654654110 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -180,7 +180,7 @@ class Ticket extends CommonObject 'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'position'=>1, 'visible'=>-2, 'enabled'=>1, 'position'=>1, 'notnull'=>1, 'index'=>1, 'comment'=>"Id"), 'entity' => array('type'=>'integer', 'label'=>'Entity', 'visible'=>0, 'enabled'=>1, 'position'=>5, 'notnull'=>1, 'index'=>1), 'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'visible'=>1, 'enabled'=>1, 'position'=>10, 'notnull'=>1, 'index'=>1, 'searchall'=>1, 'comment'=>"Reference of object", 'css'=>''), - 'track_id' => array('type'=>'varchar(255)', 'label'=>'TrackID', 'visible'=>0, 'enabled'=>1, 'position'=>11, 'notnull'=>-1, 'searchall'=>1, 'help'=>"Help text"), + 'track_id' => array('type'=>'varchar(255)', 'label'=>'TicketTrackId', 'visible'=>-2, 'enabled'=>1, 'position'=>11, 'notnull'=>-1, 'searchall'=>1, 'help'=>"Help text"), 'fk_user_create' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Author', 'visible'=>1, 'enabled'=>1, 'position'=>15, 'notnull'=>1, 'css'=>'nowraponall'), 'origin_email' => array('type'=>'mail', 'label'=>'OriginEmail', 'visible'=>-2, 'enabled'=>1, 'position'=>16, 'notnull'=>1, 'index'=>1, 'searchall'=>1, 'comment'=>"Reference of object"), 'subject' => array('type'=>'varchar(255)', 'label'=>'Subject', 'visible'=>1, 'enabled'=>1, 'position'=>18, 'notnull'=>-1, 'searchall'=>1, 'help'=>""),