';
print '
';
diff --git a/htdocs/ticketsup/class/actions_ticketsup.class.php b/htdocs/ticketsup/class/actions_ticketsup.class.php
index 1186b7fbd1e..4d0acda3e35 100644
--- a/htdocs/ticketsup/class/actions_ticketsup.class.php
+++ b/htdocs/ticketsup/class/actions_ticketsup.class.php
@@ -152,15 +152,15 @@ class ActionsTicketsup
$object->track_id = generate_random_id(16);
$object->ref = GETPOST("ref", 'alpha');
- $object->fk_soc = GETPOST("socid", 'int');
+ $object->fk_soc = GETPOST("socid", 'int') > 0 ? GETPOST("socid", 'int') : 0;
$object->subject = GETPOST("subject", 'alpha');
$object->message = GETPOST("message");
$object->type_code = GETPOST("type_code", 'alpha');
$object->category_code = GETPOST("category_code", 'alpha');
$object->severity_code = GETPOST("severity_code", 'alpha');
- $notNotifyTiers = GETPOST("not_notify_tiers_at_create", 'alpha');
- $object->notify_tiers_at_create = empty($notNotifyTiers) ? 1 : 0;
+ $notifyTiers = GETPOST("notify_tiers_at_create", 'alpha');
+ $object->notify_tiers_at_create = empty($notifyTiers) ? 0 : 1;
$extrafields = new ExtraFields($this->db);
$extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
@@ -174,7 +174,8 @@ class ActionsTicketsup
$action = 'create_ticket';
}
- if (!$error && $id > 0) {
+ if (!$error && $id > 0)
+ {
$this->db->commit();
// File transfer
@@ -189,7 +190,7 @@ class ActionsTicketsup
}
// altairis: link ticket to project
- if (GETPOST('projectid')) {
+ if (GETPOST('projectid') > 0) {
$object->setProject(GETPOST('projectid'));
}
@@ -216,7 +217,8 @@ class ActionsTicketsup
}
// Auto create fiche intervention
- if ($conf->global->TICKETS_AUTO_CREATE_FICHINTER_CREATE) {
+ if ($conf->global->TICKETS_AUTO_CREATE_FICHINTER_CREATE)
+ {
$fichinter = new Fichinter($this->db);
$fichinter->socid = $object->fk_soc;
$fichinter->fk_project = GETPOST('projectid', 'int');
@@ -623,6 +625,8 @@ class ActionsTicketsup
$contactstatic = new Contact($this->db);
$error = 0;
+
+ $object = new Ticketsup($this->db);
$ret = $object->fetch('', GETPOST('track_id'));
$object->socid = $object->fk_soc;
$object->fetch_thirdparty();
diff --git a/htdocs/ticketsup/class/ticketsup.class.php b/htdocs/ticketsup/class/ticketsup.class.php
index 7f011d7f459..584f9508f6d 100644
--- a/htdocs/ticketsup/class/ticketsup.class.php
+++ b/htdocs/ticketsup/class/ticketsup.class.php
@@ -352,8 +352,8 @@ class Ticketsup extends CommonObject
$sql .= ") VALUES (";
$sql .= " " . (!isset($this->ref) ? '' : "'" . $this->db->escape($this->ref) . "'") . ",";
$sql .= " " . (!isset($this->track_id) ? 'NULL' : "'" . $this->db->escape($this->track_id) . "'") . ",";
- $sql .= " " . (!isset($this->fk_soc) ? '0' : "'" . $this->db->escape($this->fk_soc) . "'") . ",";
- $sql .= " " . (!isset($this->fk_project) ? '0' : "'" . $this->db->escape($this->fk_project) . "'") . ",";
+ $sql .= " " . ($this->fk_soc > 0 ? $this->db->escape($this->fk_soc) : "null") . ",";
+ $sql .= " " . ($this->fk_project > 0 ? $this->db->escape($this->fk_project) : "null") . ",";
$sql .= " " . (!isset($this->origin_email) ? 'NULL' : "'" . $this->db->escape($this->origin_email) . "'") . ",";
$sql .= " " . ($this->fk_user_create > 0 ? $this->fk_user_create : ($user->id > 0 ? $user->id : 'NULL')) . ",";
$sql .= " " . ($this->fk_user_assign > 0 ? $this->fk_user_assign : 'NULL') . ",";
@@ -2412,78 +2412,6 @@ class Ticketsup extends CommonObject
return $defaultref;
}
- /**
- * Show tab footer of a card
- *
- * @param string $paramid Name of parameter to use to name the id into the URL next/previous link
- * @param string $morehtml More html content to output just before the nav bar
- * @param int $shownav Show Condition (navigation is shown if value is 1)
- * @param string $fieldid Nom du champ en base a utiliser pour select next et previous (we make the select max and min on this field)
- * @param string $fieldref Nom du champ objet ref (object->ref) a utiliser pour select next et previous
- * @param string $morehtmlref More html to show after ref
- * @param string $moreparam More param to add in nav link url.
- * @param int $nodbprefix Do not include DB prefix to forge table name
- * @param string $morehtmlleft More html code to show before ref
- * @param string $morehtmlright More html code to show before navigation arrows
- * @param string $onlybanner 1
- * @return void
- */
- public function ticketsupBannerTab($paramid, $morehtml = '', $shownav = 1, $fieldid = 'id', $fieldref = 'ref', $morehtmlref = '', $moreparam = '', $nodbprefix = 0, $morehtmlleft = '', $morehtmlright = '', $onlybanner=0)
- {
- global $conf, $form, $user, $langs;
-
- $maxvisiblephotos = 1;
- $showimage = 1;
- $showbarcode = empty($conf->barcode->enabled) ? 0 : ($this->barcode ? 1 : 0);
- if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->barcode->lire_advance)) {
- $showbarcode = 0;
- }
-
- $modulepart = 'ticketsup';
- print '
';
-
- $width = 80;
- $height = 70;
- $cssclass = 'photoref';
- //$showimage=$this->is_photo_available($conf->ticketsup->multidir_output[$this->entity]);
- $showimage = $this->is_photo_available($conf->ticketsup->dir_output . '/' . $this->track_id);
- $maxvisiblephotos = (isset($conf->global->PRODUCT_MAX_VISIBLE_PHOTO) ? $conf->global->PRODUCT_MAX_VISIBLE_PHOTO : $maxvisiblephotos);
- if ($conf->browser->phone) {
- $maxvisiblephotos = 1;
- }
-
- if ($showimage) {
- $morehtmlleft .= '
'
- . $this->show_photos($conf->ticketsup->dir_output, 'small', $maxvisiblephotos, 0, 0, 0, $height, $width, 0)
- . '
';
- } else {
- $nophoto = '/public/theme/common/nophoto.png';
- $morehtmlleft .= '
';
- }
- $morehtmlright .= $this->getLibStatut(2);
-
- if (!empty($this->name_alias)) {
- $morehtmlref .= '
' . $this->name_alias . '
';
- }
- // For thirdparty
- if (!empty($this->label)) {
- $morehtmlref .= '
' . $this->label . '
';
- }
- // For product
- if ($this->element != 'product') {
- $morehtmlref .= '
';
- $morehtmlref .= $this->getBannerAddress('refaddress', $this);
- $morehtmlref .= '
';
- }
- if (!empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) {
- $morehtmlref .= '
';
- $morehtmlref .= $langs->trans("TechnicalID") . ': ' . $this->id;
- $morehtmlref .= '
';
- }
- print $form->showrefnav($this, 'ref', $morehtml, $shownav, $fieldid, $fieldref, $morehtmlref, $moreparam, $nodbprefix, $morehtmlleft, $morehtmlright);
- print '
';
- print '
';
- }
/**
* Return if at least one photo is available
diff --git a/htdocs/ticketsup/contact.php b/htdocs/ticketsup/contact.php
index 356aa47ffd5..5dceabe9476 100644
--- a/htdocs/ticketsup/contact.php
+++ b/htdocs/ticketsup/contact.php
@@ -149,17 +149,26 @@ if ($id > 0 || !empty($track_id) || !empty($ref)) {
dol_fiche_head($head, 'contact', $langs->trans("Ticket"), -1, 'ticketsup');
- $object->label = $object->ref;
+ $morehtmlref ='
';
+ $morehtmlref.= $object->subject;
// Author
if ($object->fk_user_create > 0) {
- $object->label .= ' - ' . $langs->trans("CreatedBy") . ' ';
- $langs->load("users");
- $fuser = new User($db);
- $fuser->fetch($object->fk_user_create);
- $object->label .= $fuser->getNomUrl(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") . ')';
+ }
+ $morehtmlref.='
';
+
$linkback = '
' . $langs->trans("BackToList") . ' ';
- $object->ticketsupBannerTab('ref', '', ($user->societe_id ? 0 : 1), 'ref', 'subject', '', '', '', $morehtmlleft, $linkback, 1);
+
+ dol_banner_tab($object, 'ref', $linkback, ($user->societe_id ? 0 : 1), 'ref', 'ref', $morehtmlref);
dol_fiche_end();
diff --git a/htdocs/ticketsup/document.php b/htdocs/ticketsup/document.php
index 0f528ee17bb..a19a972c143 100644
--- a/htdocs/ticketsup/document.php
+++ b/htdocs/ticketsup/document.php
@@ -123,18 +123,29 @@ if ($object->id) {
$object->next_prev_filter = "te.fk_soc = '" . $user->societe_id . "'";
}
$head = ticketsup_prepare_head($object);
+
dol_fiche_head($head, 'tabTicketDocument', $langs->trans("Ticket"), 0, 'ticketsup');
- $object->label = $object->ref;
+
+ $morehtmlref ='
';
+ $morehtmlref.= $object->subject;
// Author
if ($object->fk_user_create > 0) {
- $object->label .= ' - ' . $langs->trans("CreatedBy") . ' ';
- $langs->load("users");
- $fuser = new User($db);
- $fuser->fetch($object->fk_user_create);
- $object->label .= $fuser->getNomUrl(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") . ')';
+ }
+ $morehtmlref.='
';
+
$linkback = '
' . $langs->trans("BackToList") . ' ';
- $object->ticketsupBannerTab('ref', '', ($user->societe_id ? 0 : 1), 'ref', 'subject', '', '', '', $morehtmlleft, $linkback);
+
+ dol_banner_tab($object, 'ref', $linkback, ($user->societe_id ? 0 : 1), 'ref', 'ref', $morehtmlref);
dol_fiche_end();
diff --git a/htdocs/ticketsup/history.php b/htdocs/ticketsup/history.php
index 6994cbeafc1..56f8e95fe0b 100644
--- a/htdocs/ticketsup/history.php
+++ b/htdocs/ticketsup/history.php
@@ -110,20 +110,29 @@ if ($action == 'view') {
$object->next_prev_filter = "te.fk_soc = '" . $user->societe_id . "'";
}
$head = ticketsup_prepare_head($object);
+
dol_fiche_head($head, 'tabTicketLogs', $langs->trans("Ticket"), 0, 'ticketsup');
- $object->label = $object->ref;
+
+ $morehtmlref ='
';
+ $morehtmlref.= $object->subject;
// Author
if ($object->fk_user_create > 0) {
- $object->label .= ' - ' . $langs->trans("CreatedBy") . ' ';
- $langs->load("users");
- $fuser = new User($db);
- $fuser->fetch($object->fk_user_create);
- $object->label .= $fuser->getNomUrl(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") . ')';
+ }
+ $morehtmlref.='
';
+
$linkback = '
' . $langs->trans("BackToList") . ' ';
- // TODO Merge this with dol_banner_tab
- $object->ticketsupBannerTab('ref', '', ($user->societe_id ? 0 : 1), 'ref', 'subject', '', '', '', $morehtmlleft, $linkback);
+ dol_banner_tab($object, 'ref', $linkback, ($user->societe_id ? 0 : 1), 'ref', 'ref', $morehtmlref);
dol_fiche_end();
diff --git a/htdocs/ticketsup/new.php b/htdocs/ticketsup/new.php
index c784d5f04ac..605db702c4a 100644
--- a/htdocs/ticketsup/new.php
+++ b/htdocs/ticketsup/new.php
@@ -38,7 +38,7 @@ $id = GETPOST('id', 'int');
$socid = GETPOST('socid', 'int');
$contactid = GETPOST('contactid', 'int');
$msg_id = GETPOST('msg_id', 'int');
-$notNotifyTiers = GETPOST("not_notify_tiers_at_create", 'alpha');
+$notifyTiers = GETPOST("notify_tiers_at_create", 'alpha');
$action = GETPOST('action', 'alpha', 3);
@@ -78,7 +78,7 @@ if ($action == 'create_ticket') {
$formticket->withfromsocid = $socid ? $socid : $user->societe_id;
$formticket->withfromcontactid = $contactid ? $contactid : '';
$formticket->withtitletopic = 1;
- $formticket->withnotnotifytiersatcreate = $notnotifytiersatcreate?1:0;
+ $formticket->withnotifytiersatcreate = ($notifyTiers?1:0);
$formticket->withusercreate = 1;
$formticket->withref = 1;
$formticket->fk_user_create = $user->id;