';
print' Numéro ticket | ' . $t->id . ' |
';
print' Sujet | |
';
print' Assigné à | ';
print $form->selectarray("assigned_user_id", $liste_user, $t->assigned_user_id, 1, 0, 1);
print' |
';
print' Nom du compte | ';
print $form->selectarray("account_id", $liste_cl, $t->account_id, 1, 0, 1);
print' |
';
print' Priorité | ';
print $form->selectarray("priority", $liste_tps, $t->priority, 1, 0, 1);
print' |
';
print' Satut | ';
print $form->selectarray("status", $liste_ts, $t->status, 1, 0, 1);
print' |
';
print' Type | ';
print $form->selectarray("type", $liste_tt, $t->type, 1, 0, 1);
print' |
';
print' Description: | |
';
print' État: | |
';
print'
';
print' '."\n";
print'
';
print'
';
print' ';
}elseif($action=='delete' ){
$html = new Form($db);
$ret=$html->form_confirm($_SERVER["PHP_SELF"]."?id=".$rowid,"Supprimer ticket","Confirmer la suppression","confirm_delete",'',0,"action-delete");
if ($ret == 'html') print '
';
print'Action = delete!';
}elseif($_GET["action"]=='update' || $_POST["action"]=='update'){
if($_POST["valider"]=='Annuler'||$_POST["valider"]=='Annuler'){
$action='';
}else{
$message = "";
if (!$_POST["name"]||!$_POST["account_id"]) {
$message='Donné manquantes';
Header('Location: ' . DOL_URL_ROOT . '/reclamation/ticket.php?action=create&error=1');
exit;
}
if (!$message) {
$Ticket = new ticket($db,$rowid);
$Ticket->name = $_POST["name"];
$Ticket->modified_user_id = $user->login;
$Ticket->description = $_POST["description"];
$Ticket->assigned_user_id = $_POST["assigned_user_id"];
$Ticket->type = $_POST["type"];
$Ticket->status = $_POST["status"];
$Ticket->priority = $_POST["priority"];
$Ticket->state = $_POST["state"];
$Ticket->account_id = $_POST["account_id"];
$result = $Ticket->update($user);
if ($result > 0) {
$db->commit();
$_GET["id"]=$rowid;
$action=null;
} else {
// Creation KO
$message = $Ticket->error;
//$langs->load("errors");
$db->rollback();
exit;
}
}
}
/*}elseif ($action == 'confirm_delete' && $confirm == 'yes' ){
$object->fetch($rowid);
$result = $object->delete($rowid);
if ($result >= 0)
{
Header("Location: ".DOL_URL_ROOT."/reclamation/ticket.php?action=create");
exit;
}
else
{
$langs->load("errors");
$error=$langs->trans($object->error); $errors = $object->errors;
$action='';
}*/
}
if(!$action) {
$t->fetch($rowid);
print'
';
print '
'."\n";
//if ($user->rights->reclamation->creer)
//{
print '
'.$langs->trans("Modify").''."\n";
//}
//if ($user->rights->reclamation->supprimer)
//{
/*if ($conf->use_javascript_ajax)
{
print '
'.$langs->trans('Delete').''."\n";
}
else
{*/
print '
'.$langs->trans('Delete').''."\n";
//}
//}
print '
'."\n";
print '
';
}
}else {
if ($_GET["action"] == 'add' || $_POST["action"] == 'add') {
$message = "";
if (!$_POST["name"]||!$_POST["account_id"]) {
$message='Donné manquantes';
Header('Location: ' . DOL_URL_ROOT . '/reclamation/ticket.php?action=create&error=1');
exit;
}
if (!$message) {
$Ticket = new ticket($db);
$Ticket->name = $_POST["name"];
$Ticket->modified_user_id = $user->login;
$Ticket->created_by = $user->login;
$Ticket->description = $_POST["description"];
$Ticket->assigned_user_id = $_POST["assigned_user_id"];
$Ticket->type = $_POST["type"];
$Ticket->status = $_POST["status"];
$Ticket->priority = $_POST["priority"];
$Ticket->state = $_POST["state"];
$Ticket->account_id = $_POST["account_id"];
$result = $Ticket->create($user);
if ($result > 0) {
Header('Location: ' . DOL_URL_ROOT . '/reclamation/ticket.php?id=' . $result);
exit;
} else {
// Creation KO
$message = $Ticket->error;
//$langs->load("errors");
$db->rollback();
print $message;
Header('Location: ' . DOL_URL_ROOT . '/reclamation/ticket.php?action=create&error=2'); // Go back to create page
exit;
}
}
}
/* * *************
*
* affichage et édition
*
if ($rowid ) {//&& $action != 'edit'
$ticket = new ticket($db);
$res = $ticket->fetch($rowid);
if ($res < 0) {
dol_print_error($db, $ticket->error);
exit;
}
$res = $ticket->fetch_optionals($rowid, $extralabels);
if ($res < 0) {
dol_print_error($db);
exit;
}
dol_fiche_head($head, 'general', $langs->trans("Member"), 0, 'user');
dol_htmloutput_errors($errmsg,$errmsgs);
}
/***************************************************
* PAGE
*
* Put here all code to build page
* ************************************************** */
if ($_GET["action"] == 'create' || $_POST["action"] == 'create') {
$msg=$_GET["error"];
llxHeader('', 'Réclamations', '');
if($msg=='1'){
print'
x
Une ou plusieurs données obligatoires manquantes !
';
}
if($msg=='2'){
print'
x
Un autre ticket existe déjà avec le meme nom !
';
}
$form = new Form($db);
$tps1 = new ticket_priority($db);
$liste_tps = $tps1->liste_array();
$ts1 = new ticket_status($db);
$liste_ts = $ts1->liste_array();
$tt1 = new ticket_type($db);
$liste_tt = $tt1->liste_array();
$soc = new Societe($db);
$liste_cl = $soc->liste_array();
$user = new User($db);
$liste_user = $user->liste_array();
print_fiche_titre("Espace de création d'une nouvelle ticket");
print'
';
print'
Informations du nouvelle ticket:
';
print'