diff --git a/htdocs/core/class/html.formticketsup.class.php b/htdocs/core/class/html.formticketsup.class.php index 1570cb34883..3310b83eb09 100644 --- a/htdocs/core/class/html.formticketsup.class.php +++ b/htdocs/core/class/html.formticketsup.class.php @@ -178,7 +178,7 @@ class FormTicketsup // altairis: force company and contact id for external user if (empty($user->socid)) { // Company - print '' . $langs->trans("Thirdparty") . ''; + print '' . $langs->trans("ThirdParty") . ''; $events = array(); $events[] = array('method' => 'getContacts', 'url' => dol_buildpath('/core/ajax/contacts.php', 1), 'htmlname' => 'contactid', 'params' => array('add-customer-contact' => 'disabled')); print $form->select_company($this->withfromsocid, 'socid', '', 1, 1, '', $events); @@ -297,8 +297,8 @@ class FormTicketsup print ''; // Notify thirdparty at creation - print ''; - print 'withnotnotifytiersatcreate?'':' checked="checked"').'>'; + print ''; + print 'withnotifytiersatcreate?' checked="checked"':'').'>'; print ''; // TITLE diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index f4759240cd5..2177559c0ab 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -1340,6 +1340,25 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r //} } } + elseif ($object->element == 'ticketsup') + { + $width=80; $cssclass='photoref'; + $showimage=$object->is_photo_available($conf->ticketsup->dir_output.'/'.$object->track_id); + $maxvisiblephotos=(isset($conf->global->TICKETSUP_MAX_VISIBLE_PHOTO)?$conf->global->TICKETSUP_MAX_VISIBLE_PHOTO:2); + if ($conf->browser->phone) $maxvisiblephotos=1; + if ($showimage) $morehtmlleft.='
'.$object->show_photos($conf->ticketsup->dir_output,'small',$maxvisiblephotos,0,0,0,$width,0).'
'; + else + { + if (!empty($conf->global->TICKETSUP_NODISPLAYIFNOPHOTO)) { + $nophoto=''; + $morehtmlleft.='
'; + } + //elseif ($conf->browser->layout != 'phone') { // Show no photo link + $nophoto='/public/theme/common/nophoto.png'; + $morehtmlleft.='
No photo
'; + //} + } + } else { if ($showimage) @@ -3063,7 +3082,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ $pictowithoutext = preg_replace('/(\.png|\.gif|\.svg)$/', '', $picto); //if (in_array($picto, array('switch_off', 'switch_on', 'off', 'on'))) - if (in_array($pictowithoutext, array('delete', 'edit', 'off', 'on', 'resize', 'switch_off', 'switch_on', 'unlink', 'uparrow'))) + if (in_array($pictowithoutext, array('delete', 'edit', 'off', 'on', 'printer', 'resize', 'switch_off', 'switch_on', 'unlink', 'uparrow'))) { $fakey = $pictowithoutext; $facolor=''; $fasize=''; if ($pictowithoutext == 'switch_off') { $fakey = 'fa-toggle-off'; $facolor='#999'; $fasize='2em'; } @@ -3072,6 +3091,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ elseif ($pictowithoutext == 'on') { $fakey = 'fa-check-square-o'; $fasize='1.3em'; } elseif ($pictowithoutext == 'delete') { $fakey = 'fa-trash'; $facolor='#444'; } elseif ($pictowithoutext == 'edit') { $fakey = 'fa-pencil'; $facolor='#444'; } + elseif ($pictowithoutext == 'printer') { $fakey = 'fa-print'; $fasize='1.2em'; $facolor='#444'; } elseif ($pictowithoutext == 'resize') { $fakey = 'fa-crop'; $facolor='#444'; } elseif ($pictowithoutext == 'uparrow') { $fakey = 'fa-mail-forward'; $facolor='#555'; } elseif ($pictowithoutext == 'unlink') { $fakey = 'fa-chain-broken'; $facolor='#555'; } diff --git a/htdocs/ticketsup/card.php b/htdocs/ticketsup/card.php index 759f87f3b0c..55ebed62c7d 100644 --- a/htdocs/ticketsup/card.php +++ b/htdocs/ticketsup/card.php @@ -203,6 +203,7 @@ if ($action == 'view' || $action == 'add_message' || $action == 'close' || $acti } elseif ($socid > 0) { $object->fetch_thirdparty(); $head = societe_prepare_head($object->thirdparty); + dol_fiche_head($head, 'ticketsup', $langs->trans("ThirdParty"), 0, 'company'); dol_banner_tab($object->thirdparty, 'socid', '', ($user->societe_id ? 0 : 1), 'rowid', 'nom'); dol_fiche_end(); @@ -218,22 +219,26 @@ if ($action == 'view' || $action == 'add_message' || $action == 'close' || $acti dol_fiche_head($head, 'tabTicketsup', $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") . ' '; + $morehtmlref .= '
' . $langs->trans("CreatedBy") . ' '; $langs->load("users"); $fuser = new User($db); $fuser->fetch($object->fk_user_create); - $object->label .= $fuser->getNomUrl(0); + $morehtmlref .= $fuser->getNomUrl(0); } if (!empty($object->origin_email)) { - $object->label .= ' - ' . $langs->trans("CreatedBy") . ' '; - $object->label .= $object->origin_email . ' (' . $langs->trans("TicketEmailOriginIssuer") . ')'; + $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); print '
'; 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 .= '
No photo
'; - } - $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;