diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index b543d6790c6..ebe4e48f264 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -281,6 +281,7 @@ class ActionComm extends CommonObject if (! empty($this->datep) && ! empty($this->datef) && $this->datep > $this->datef) $this->datef=$this->datep; //if (! empty($this->date) && ! empty($this->dateend) && $this->date > $this->dateend) $this->dateend=$this->date; if (! isset($this->fk_project) || $this->fk_project < 0) $this->fk_project = 0; + // For backward compatibility if ($this->elementtype=='facture') $this->elementtype='invoice'; if ($this->elementtype=='commande') $this->elementtype='order'; if ($this->elementtype=='contrat') $this->elementtype='contract'; diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 12b38068c87..3f5480ee455 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -1299,6 +1299,7 @@ function dol_banner_tab($object, $paramid, $morehtml = '', $shownav = 1, $fieldi if ($object->element == 'member') $modulepart='memberphoto'; if ($object->element == 'user') $modulepart='userphoto'; if ($object->element == 'product') $modulepart='product'; + if ($object->element == 'ticket') $modulepart='ticket'; if (class_exists("Imagick")) { diff --git a/htdocs/langs/en_US/ticket.lang b/htdocs/langs/en_US/ticket.lang index 8265df1b370..c84dc17f087 100644 --- a/htdocs/langs/en_US/ticket.lang +++ b/htdocs/langs/en_US/ticket.lang @@ -58,9 +58,10 @@ Notify_TICKET_SENTBYMAIL=Send ticket message by email # Status NotRead=Not read Read=Read -Answered=Answered Assigned=Assigned InProgress=In progress +NeedMoreInformation=Waiting more information +Answered=Answered Waiting=Waiting Closed=Closed Deleted=Deleted diff --git a/htdocs/ticket/agenda.php b/htdocs/ticket/agenda.php index eb863adbfbc..bad8e58497b 100644 --- a/htdocs/ticket/agenda.php +++ b/htdocs/ticket/agenda.php @@ -125,103 +125,102 @@ if (! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/ticketnameonly/', $c $help_url = 'FR:DocumentationModuleTicket'; llxHeader('', $title, $help_url); - if ($socid > 0) { - $object->fetch_thirdparty(); - $head = societe_prepare_head($object->thirdparty); +if ($socid > 0) { + $object->fetch_thirdparty(); + $head = societe_prepare_head($object->thirdparty); - dol_fiche_head($head, 'ticket', $langs->trans("ThirdParty"), 0, 'company'); + dol_fiche_head($head, 'ticket', $langs->trans("ThirdParty"), 0, 'company'); - dol_banner_tab($object->thirdparty, 'socid', '', ($user->societe_id ? 0 : 1), 'rowid', 'nom'); + dol_banner_tab($object->thirdparty, 'socid', '', ($user->societe_id ? 0 : 1), 'rowid', 'nom'); - dol_fiche_end(); - } + dol_fiche_end(); +} - if (!$user->societe_id && $conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY) { - $object->next_prev_filter = "te.fk_user_assign = '" . $user->id . "'"; - } elseif ($user->societe_id > 0) { - $object->next_prev_filter = "te.fk_soc = '" . $user->societe_id . "'"; - } - $head = ticket_prepare_head($object); +if (!$user->societe_id && $conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY) { + $object->next_prev_filter = "te.fk_user_assign = '" . $user->id . "'"; +} elseif ($user->societe_id > 0) { + $object->next_prev_filter = "te.fk_soc = '" . $user->societe_id . "'"; +} +$head = ticket_prepare_head($object); - dol_fiche_head($head, 'tabTicketLogs', $langs->trans("Ticket"), 0, 'ticket'); +dol_fiche_head($head, 'tabTicketLogs', $langs->trans("Ticket"), 0, 'ticket'); - $morehtmlref ='
'; - $morehtmlref.= $object->subject; - // Author - if ($object->fk_user_create > 0) { - $morehtmlref .= '
' . $langs->trans("CreatedBy") . ' '; +$morehtmlref ='
'; +$morehtmlref.= $object->subject; +// Author +if ($object->fk_user_create > 0) { + $morehtmlref .= '
' . $langs->trans("CreatedBy") . ' : '; - $langs->load("users"); - $fuser = new User($db); - $fuser->fetch($object->fk_user_create); - $morehtmlref .= $fuser->getNomUrl(0); - } - if (!empty($object->origin_email)) { - $morehtmlref .= '
' . $langs->trans("CreatedBy") . ' : '; - $morehtmlref .= $object->origin_email . ' (' . $langs->trans("TicketEmailOriginIssuer") . ')'; - } + $langs->load("users"); + $fuser = new User($db); + $fuser->fetch($object->fk_user_create); + $morehtmlref .= $fuser->getNomUrl(0); +} +if (!empty($object->origin_email)) { + $morehtmlref .= '
' . $langs->trans("CreatedBy") . ' : '; + $morehtmlref .= $object->origin_email . ' (' . $langs->trans("TicketEmailOriginIssuer") . ')'; +} - // Thirdparty - if (! empty($conf->societe->enabled)) - { - $morehtmlref.='
'.$langs->trans('ThirdParty'); - /*if ($action != 'editcustomer' && $object->fk_statut < 8 && !$user->societe_id && $user->rights->ticket->write) { - $morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('Edit'), 1) . ''; - }*/ - $morehtmlref.=' : '; - if ($action == 'editcustomer') { - $morehtmlref.=$form->form_thirdparty($url_page_current . '?track_id=' . $object->track_id, $object->socid, 'editcustomer', '', 1, 0, 0, array(), 1); - } else { - $morehtmlref.=$form->form_thirdparty($url_page_current . '?track_id=' . $object->track_id, $object->socid, 'none', '', 1, 0, 0, array(), 1); - } - } +// Thirdparty +if (! empty($conf->societe->enabled)) +{ + $morehtmlref.='
'.$langs->trans('ThirdParty'); + /*if ($action != 'editcustomer' && $object->fk_statut < 8 && !$user->societe_id && $user->rights->ticket->write) { + $morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('Edit'), 1) . ''; + }*/ + $morehtmlref.=' : '; + if ($action == 'editcustomer') { + $morehtmlref.=$form->form_thirdparty($url_page_current . '?track_id=' . $object->track_id, $object->socid, 'editcustomer', '', 1, 0, 0, array(), 1); + } else { + $morehtmlref.=$form->form_thirdparty($url_page_current . '?track_id=' . $object->track_id, $object->socid, 'none', '', 1, 0, 0, array(), 1); + } +} - // Project - if (! empty($conf->projet->enabled)) - { - $langs->load("projects"); - $morehtmlref.='
'.$langs->trans('Project'); - if ($user->rights->ticket->write) - { - if ($action != 'classify') - //$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ''; - $morehtmlref.=' : '; - if ($action == 'classify') { - //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); - $morehtmlref.='
'; - $morehtmlref.=''; - $morehtmlref.=''; - $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', 0, 0, 1, 0, 1, 0, 0, '', 1); - $morehtmlref.=''; - $morehtmlref.='
'; - } else { - $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); - } - } else { - if (! empty($object->fk_project)) { - $proj = new Project($db); - $proj->fetch($object->fk_project); - $morehtmlref.=$proj->getNomUrl(1); - } else { - $morehtmlref.=''; - } - } - } +// Project +if (! empty($conf->projet->enabled)) +{ + $langs->load("projects"); + $morehtmlref.='
'.$langs->trans('Project'); + if ($user->rights->ticket->write) + { + if ($action != 'classify') + //$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ''; + $morehtmlref.=' : '; + if ($action == 'classify') { + //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); + $morehtmlref.='
'; + $morehtmlref.=''; + $morehtmlref.=''; + $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', 0, 0, 1, 0, 1, 0, 0, '', 1); + $morehtmlref.=''; + $morehtmlref.='
'; + } else { + $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + } + } else { + if (! empty($object->fk_project)) { + $proj = new Project($db); + $proj->fetch($object->fk_project); + $morehtmlref.=$proj->getNomUrl(1); + } else { + $morehtmlref.=''; + } + } +} - $morehtmlref.='
'; +$morehtmlref.='
'; - $linkback = '' . $langs->trans("BackToList") . ' '; +$linkback = '' . $langs->trans("BackToList") . ' '; - dol_banner_tab($object, 'ref', $linkback, ($user->societe_id ? 0 : 1), 'ref', 'ref', $morehtmlref, '', 0, '', '', 1); +dol_banner_tab($object, 'ref', $linkback, ($user->societe_id ? 0 : 1), 'ref', 'ref', $morehtmlref, '', 0, '', '', 1); - dol_fiche_end(); +dol_fiche_end(); - print '
'; +print '
'; if (!empty($object->id)) { - print '
'; $param='&id='.$object->id; if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php index dab1b896a67..26fec804370 100644 --- a/htdocs/ticket/card.php +++ b/htdocs/ticket/card.php @@ -818,7 +818,7 @@ if (empty($action) || $action == 'view' || $action == 'addlink' || $action == 'd $morehtmlref.=''; - $linkback = '' . $langs->trans("BackToList") . ' '; + $linkback = '' . $langs->trans("BackToList") . ' '; dol_banner_tab($object, 'ref', $linkback, ($user->societe_id ? 0 : 1), 'ref', 'ref', $morehtmlref); @@ -1218,10 +1218,10 @@ if (empty($action) || $action == 'view' || $action == 'addlink' || $action == 'd print '
'; - // Message list - print load_fiche_titre($langs->trans('TicketMessagesList'), '', 'messages@ticket'); - $show_private_message = ($user->societe_id ? 0 : 1); - $actionobject->viewTicketTimelineMessages($show_private_message, true, $object); + // List of actions on element + include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php'; + $formactions = new FormActions($db); + $somethingshown = $formactions->showactions($object, 'ticket', $socid, 1); print '
'; print ''; diff --git a/htdocs/ticket/class/actions_ticket.class.php b/htdocs/ticket/class/actions_ticket.class.php index 76049a18a4e..b10f8ebe7da 100644 --- a/htdocs/ticket/class/actions_ticket.class.php +++ b/htdocs/ticket/class/actions_ticket.class.php @@ -443,8 +443,7 @@ class ActionsTicket // Sort results to be similar to status object list //sort($exclude_status); - //print '
'; - foreach ($object->statuts_short as $status => $statut_label) { + foreach ($object->statuts_short as $status => $status_label) { if (!in_array($status, $exclude_status)) { print '
'; diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index b68628d0c9b..750354e3356 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -207,10 +207,10 @@ class Ticket extends CommonObject */ const STATUS_NOT_READ = 0; const STATUS_READ = 1; - const STATUS_ANSWERED = 3; - const STATUS_ASSIGNED = 4; - const STATUS_IN_PROGRESS = 5; - const STATUS_WAITING = 6; + const STATUS_ASSIGNED = 2; + const STATUS_IN_PROGRESS = 3; + const STATUS_NEED_MORE_INFO = 5; + const STATUS_WAITING = 7; const STATUS_CLOSED = 8; const STATUS_CANCELED = 9; @@ -224,8 +224,8 @@ class Ticket extends CommonObject { $this->db = $db; - $this->statuts_short = array(0 => 'Unread', 1 => 'Read', 3 => 'Answered', 4 => 'Assigned', 5 => 'InProgress', 6 => 'Waiting', 8 => 'Closed', 9 => 'Deleted'); - $this->statuts = array(0 => 'Unread', 1 => 'Read', 3 => 'Answered', 4 => 'Assigned', 5 => 'InProgress', 6 => 'Waiting', 8 => 'Closed', 9 => 'Deleted'); + $this->statuts_short = array(self::STATUS_NOT_READ => 'Unread', self::STATUS_READ => 'Read', self::STATUS_ASSIGNED => 'Assigned', self::STATUS_IN_PROGRESS => 'InProgress', self::STATUS_NEED_MORE_INFO => 'NeedMoreInformation', self::STATUS_WAITING => 'Waiting', self::STATUS_CLOSED => 'Closed', self::STATUS_CANCELED => 'Canceled'); + $this->statuts = array(self::STATUS_NOT_READ => 'Unread', self::STATUS_READ => 'Read', self::STATUS_ASSIGNED => 'Assigned', self::STATUS_IN_PROGRESS => 'InProgress', self::STATUS_NEED_MORE_INFO => 'NeedMoreInformation', self::STATUS_WAITING => 'Waiting', self::STATUS_CLOSED => 'Closed', self::STATUS_CANCELED => 'Canceled'); } /** @@ -1176,7 +1176,7 @@ class Ticket extends CommonObject * Return status label of object * * @param string $statut id statut - * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto + * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto * @return string Label */ public function LibStatut($statut, $mode = 0) @@ -1191,134 +1191,106 @@ class Ticket extends CommonObject return $langs->trans($this->statuts_short[$statut]); } elseif ($mode == 2) { - if ($statut == 0) { + if ($statut == self::STATUS_NOT_READ) { return img_picto($langs->trans($this->statuts_short[$statut]), 'statut0.png@ticket') . ' ' . $langs->trans($this->statuts_short[$statut]); } - - elseif ($statut == 1) { + elseif ($statut == self::STATUS_READ) { return img_picto($langs->trans($this->statuts_short[$statut]), 'statut1.png@ticket') . ' ' . $langs->trans($this->statuts_short[$statut]); } - - elseif ($statut == 3) { + elseif ($statut == self::STATUS_ASSIGNED) { + return img_picto($langs->trans($this->statuts_short[$statut]), 'statut2.png@ticket') . ' ' . $langs->trans($this->statuts_short[$statut]); + } + elseif ($statut == self::STATUS_IN_PROGRESS) { return img_picto($langs->trans($this->statuts_short[$statut]), 'statut3.png@ticket') . ' ' . $langs->trans($this->statuts_short[$statut]); } - - elseif ($statut == 4) { - return img_picto($langs->trans($this->statuts_short[$statut]), 'statut4.png@ticket') . ' ' . $langs->trans($this->statuts_short[$statut]); - } - - elseif ($statut == 5) { + elseif ($statut == self::STATUS_NEED_MORE_INFO) { return img_picto($langs->trans($this->statuts_short[$statut]), 'statut5.png@ticket') . ' ' . $langs->trans($this->statuts_short[$statut]); } - - elseif ($statut == 6) { + elseif ($statut == self::STATUS_WAITING) { return img_picto($langs->trans($this->statuts_short[$statut]), 'statut6.png@ticket') . ' ' . $langs->trans($this->statuts_short[$statut]); } - - elseif ($statut == 8) { + elseif ($statut == self::STATUS_CLOSED) { return img_picto($langs->trans($this->statuts_short[$statut]), 'statut8.png@ticket') . ' ' . $langs->trans($this->statuts_short[$statut]); } - - elseif ($statut == 9) { + elseif ($statut == self::STATUS_CANCELED) { return img_picto($langs->trans($this->statuts_short[$statut]), 'statut9.png@ticket') . ' ' . $langs->trans($this->statuts_short[$statut]); } } elseif ($mode == 3) { - if ($statut == 0) { + if ($statut == self::STATUS_NOT_READ) { return img_picto($langs->trans($this->statuts_short[$statut]), 'statut0.png@ticket'); } - - elseif ($statut == 1) { + elseif ($statut == self::STATUS_READ) { return img_picto($langs->trans($this->statuts_short[$statut]), 'statut1.png@ticket'); } - - elseif ($statut == 3) { + elseif ($statut == self::STATUS_ASSIGNED) { + return img_picto($langs->trans($this->statuts_short[$statut]), 'statut2.png@ticket'); + } + elseif ($statut == self::STATUS_IN_PROGRESS) { return img_picto($langs->trans($this->statuts_short[$statut]), 'statut3.png@ticket'); } - - elseif ($statut == 4) { - return img_picto($langs->trans($this->statuts_short[$statut]), 'statut4.png@ticket'); - } - - elseif ($statut == 5) { + elseif ($statut == self::STATUS_NEED_MORE_INFO) { return img_picto($langs->trans($this->statuts_short[$statut]), 'statut5.png@ticket'); } - - elseif ($statut == 6) { + elseif ($statut == self::STATUS_WAITING) { return img_picto($langs->trans($this->statuts_short[$statut]), 'statut6.png@ticket'); } - - elseif ($statut == 8) { + elseif ($statut == self::STATUS_CLOSED) { return img_picto($langs->trans($this->statuts_short[$statut]), 'statut8.png@ticket'); } - - elseif ($statut == 9) { + elseif ($statut == self::STATUS_CANCELED) { return img_picto($langs->trans($this->statuts_short[$statut]), 'statut9.png@ticket'); } } elseif ($mode == 4) { - if ($statut == 0) { + if ($statut == self::STATUS_NOT_READ) { return img_picto($langs->trans($this->statuts_short[$statut]), 'statut0.png@ticket') . ' ' . $langs->trans($this->statuts_short[$statut]); } - - elseif ($statut == 1) { + elseif ($statut == self::STATUS_READ) { return img_picto($langs->trans($this->statuts_short[$statut]), 'statut1.png@ticket') . ' ' . $langs->trans($this->statuts_short[$statut]); } - - elseif ($statut == 3) { + elseif ($statut == self::STATUS_ASSIGNED) { + return img_picto($langs->trans($this->statuts_short[$statut]), 'statut2.png@ticket') . ' ' . $langs->trans($this->statuts_short[$statut]); + } + elseif ($statut == self::STATUS_IN_PROGRESS) { return img_picto($langs->trans($this->statuts_short[$statut]), 'statut3.png@ticket') . ' ' . $langs->trans($this->statuts_short[$statut]); } - - elseif ($statut == 4) { - return img_picto($langs->trans($this->statuts_short[$statut]), 'statut4.png@ticket') . ' ' . $langs->trans($this->statuts_short[$statut]); - } - - elseif ($statut == 5) { + elseif ($statut == self::STATUS_NEED_MORE_INFO) { return img_picto($langs->trans($this->statuts_short[$statut]), 'statut5.png@ticket') . ' ' . $langs->trans($this->statuts_short[$statut]); } - - elseif ($statut == 6) { + elseif ($statut == self::STATUS_WAITING) { return img_picto($langs->trans($this->statuts_short[$statut]), 'statut6.png@ticket') . ' ' . $langs->trans($this->statuts_short[$statut]); } - - elseif ($statut == 8) { + elseif ($statut == self::STATUS_CLOSED) { return img_picto($langs->trans($this->statuts_short[$statut]), 'statut8.png@ticket') . ' ' . $langs->trans($this->statuts_short[$statut]); } - - elseif ($statut == 9) { + elseif ($statut == self::STATUS_CANCELED) { return img_picto($langs->trans($this->statuts_short[$statut]), 'statut9.png@ticket') . ' ' . $langs->trans($this->statuts_short[$statut]); } } - elseif ($mode == 5) { - if ($statut == 0) { + elseif ($mode == 5 || $mode == 6) { + if ($statut == self::STATUS_NOT_READ) { return $langs->trans($this->statuts_short[$statut]) . ' ' . img_picto($langs->trans($this->statuts_short[$statut]), 'statut0.png@ticket'); } - - elseif ($statut == 1) { + elseif ($statut == self::STATUS_READ) { return $langs->trans($this->statuts_short[$statut]) . ' ' . img_picto($langs->trans($this->statuts_short[$statut]), 'statut1.png@ticket'); } - - elseif ($statut == 3) { + elseif ($statut == self::STATUS_ASSIGNED) { + return $langs->trans($this->statuts_short[$statut]) . ' ' . img_picto($langs->trans($this->statuts_short[$statut]), 'statut2.png@ticket'); + } + elseif ($statut == self::STATUS_IN_PROGRESS) { return $langs->trans($this->statuts_short[$statut]) . ' ' . img_picto($langs->trans($this->statuts_short[$statut]), 'statut3.png@ticket'); } - - elseif ($statut == 4) { - return $langs->trans($this->statuts_short[$statut]) . ' ' . img_picto($langs->trans($this->statuts_short[$statut]), 'statut4.png@ticket'); - } - - elseif ($statut == 5) { + elseif ($statut == self::STATUS_NEED_MORE_INFO) { return $langs->trans($this->statuts_short[$statut]) . ' ' . img_picto($langs->trans($this->statuts_short[$statut]), 'statut5.png@ticket'); } - - elseif ($statut == 6) { + elseif ($statut == self::STATUS_WAITING) { return $langs->trans($this->statuts_short[$statut]) . ' ' . img_picto($langs->trans($this->statuts_short[$statut]), 'statut6.png@ticket'); } - - elseif ($statut == 8) { + elseif ($statut == self::STATUS_CLOSED) { return $langs->trans($this->statuts_short[$statut]) . ' ' . img_picto($langs->trans($this->statuts_short[$statut]), 'statut8.png@ticket'); } - - elseif ($statut == 9) { + elseif ($statut == self::STATUS_CANCELED) { return $langs->trans($this->statuts_short[$statut]) . ' ' . img_picto($langs->trans($this->statuts_short[$statut]), 'statut9.png@ticket'); } } @@ -1645,6 +1617,8 @@ class Ticket extends CommonObject global $conf, $langs; $error = 0; + $now = dol_now(); + // Clean parameters if (isset($this->fk_track_id)) { $this->fk_track_id = trim($this->fk_track_id); @@ -1654,38 +1628,33 @@ class Ticket extends CommonObject $this->message = trim($this->message); } - // Insert entry into agenda with code 'TICKET_MSG' - $sql.='...'; - - $this->db->begin(); - dol_syslog(get_class($this) . "::create_ticket_message sql=" . $sql, LOG_DEBUG); - $resql = $this->db->query($sql); - if (!$resql) { - $error++; - $this->errors[] = "Error " . $this->db->lasterror(); - } + // Insert entry into agenda with code 'TICKET_MSG' + include_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; + $actioncomm=new ActionComm($this->db); + $actioncomm->type_code = 'AC_OTH_AUTO'; + $actioncomm->code = 'TICKET_MSG'; + $actioncomm->socid = $this->socid; + $actioncomm->label = $this->subject; + $actioncomm->note = $this->message; + $actioncomm->userassigned = array($user->id); + $actioncomm->userownerid = $user->id; + $actioncomm->datep = $now; + $actioncomm->percentage = 100; + $actioncomm->elementtype = 'ticket'; + $actioncomm->fk_element = $this->id; - if (!$error) { - if (!$notrigger) { - // Uncomment this and change MYOBJECT to your own tag if you - // want this action calls a trigger. - //// Call triggers - //include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - //$interface=new Interfaces($this->db); - //$result=$interface->run_triggers('MYOBJECT_CREATE',$this,$user,$langs,$conf); - //if ($result < 0) { $error++; $this->errors=$interface->errors; } - //// End call triggers - } + $actionid = $actioncomm->create($user); + if ($actionid <= 0) + { + $error++; + $this->error = $actioncomm->error; + $this->errors = $actioncomm->errors; } // Commit or rollback if ($error) { - foreach ($this->errors as $errmsg) { - dol_syslog(get_class($this) . "::create_ticket_message " . $errmsg, LOG_ERR); - $this->error .= ($this->error ? ', ' . $errmsg : $errmsg); - } $this->db->rollback(); return -1 * $error; } else { @@ -2493,6 +2462,7 @@ class Ticket extends CommonObject $error = 0; $ret = $object->fetch('', '', GETPOST('track_id', 'alpha')); + $object->socid = $object->fk_soc; $object->fetch_thirdparty(); if ($ret < 0) { @@ -2508,6 +2478,7 @@ class Ticket extends CommonObject } if (!$error) { + $object->subject = GETPOST('subject', 'alphanohtml'); $object->message = GETPOST("message", "none"); $object->private = GETPOST("private_message", "alpha"); $send_email = GETPOST('send_email', 'int'); diff --git a/htdocs/ticket/img/statut0.png b/htdocs/ticket/img/statut0.png index 6e631dc0086..b1cf5df0e75 100644 Binary files a/htdocs/ticket/img/statut0.png and b/htdocs/ticket/img/statut0.png differ diff --git a/htdocs/ticket/img/statut1.png b/htdocs/ticket/img/statut1.png index 5bff8090beb..4e72abd23cc 100644 Binary files a/htdocs/ticket/img/statut1.png and b/htdocs/ticket/img/statut1.png differ diff --git a/htdocs/ticket/img/statut4.png b/htdocs/ticket/img/statut2.png similarity index 100% rename from htdocs/ticket/img/statut4.png rename to htdocs/ticket/img/statut2.png diff --git a/htdocs/ticket/img/statut3.png b/htdocs/ticket/img/statut3.png index 4e72abd23cc..6ea7f62a9ff 100644 Binary files a/htdocs/ticket/img/statut3.png and b/htdocs/ticket/img/statut3.png differ diff --git a/htdocs/ticket/img/statut5.png b/htdocs/ticket/img/statut5.png index 6ea7f62a9ff..6e631dc0086 100644 Binary files a/htdocs/ticket/img/statut5.png and b/htdocs/ticket/img/statut5.png differ diff --git a/htdocs/ticket/img/statut6.png b/htdocs/ticket/img/statut6.png index af7f6d433dc..5bff8090beb 100644 Binary files a/htdocs/ticket/img/statut6.png and b/htdocs/ticket/img/statut6.png differ diff --git a/htdocs/ticket/img/statut8.png b/htdocs/ticket/img/statut8.png index 84f3c5e7fc5..af7f6d433dc 100644 Binary files a/htdocs/ticket/img/statut8.png and b/htdocs/ticket/img/statut8.png differ diff --git a/htdocs/ticket/img/statut9.png b/htdocs/ticket/img/statut9.png new file mode 100644 index 00000000000..84f3c5e7fc5 Binary files /dev/null and b/htdocs/ticket/img/statut9.png differ