NEW Add link to the public interface on the ticket card.

This commit is contained in:
Laurent Destailleur 2019-10-05 11:52:30 +02:00
parent 5c11a0d6cd
commit 031c5523d4
3 changed files with 47 additions and 1 deletions

View File

@ -139,6 +139,45 @@ function ticket_prepare_head($object)
return $head;
}
/**
* Return string with full Url. The file qualified is the one defined by relative path in $object->last_main_doc
*
* @param Object $object Object
* @return string Url string
*/
function showDirectPublicLink($object)
{
global $conf, $langs;
require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
$email = CMailFile::getValidAddress($object->origin_email, 2);
if ($email)
{
$url = dol_buildpath('/public/ticket/view.php', 3).'?track_id='.$object->track_id.'&email='.$email;
}
$out='';
if (empty($conf->global->TICKET_ENABLE_PUBLIC_INTERFACE))
{
$out.= '<span class="opacitymedium">'.$langs->trans("PublicInterfaceNotEnabled").'</span>';
}
else
{
$out.= img_picto('', 'object_globe.png').' '.$langs->trans("TicketPublicAccess").':<br>';
if ($url)
{
$out.= '<input type="text" id="directpubliclink" class="quatrevingtpercent" value="'.$url.'">';
$out.= ajax_autoselect("directpubliclink", 0);
}
else
{
$out.= '<span class="opacitymedium">'.$langs->trans("TicketNotCreatedFromPublicInterface").'</span>';
}
}
return $out;
}
/**
* Generate a random id
*

View File

@ -226,6 +226,8 @@ TicketConfirmChangeStatus=Confirm the status change: %s ?
TicketLogStatusChanged=Status changed: %s to %s
TicketNotNotifyTiersAtCreate=Not notify company at create
Unread=Unread
TicketNotCreatedFromPublicInterface=Not available. Ticket was not created from public interface.
PublicInterfaceNotEnabled=Public interface was not enabled
#
# Logs

View File

@ -769,7 +769,7 @@ if (empty($action) || $action == 'view' || $action == 'addlink' || $action == 'd
}
if (!empty($object->origin_email)) {
$morehtmlref .= '<br>' . $langs->trans("CreatedBy") . ' : ';
$morehtmlref .= $object->origin_email . ' <small>(' . $langs->trans("TicketEmailOriginIssuer") . ')</small>';
$morehtmlref .= dol_escape_htmltag($object->origin_email) . ' <small>(' . $langs->trans("TicketEmailOriginIssuer") . ')</small>';
}
// Thirdparty
@ -983,6 +983,7 @@ if (empty($action) || $action == 'view' || $action == 'addlink' || $action == 'd
}
print '</td>';
print '</tr>';
if (GETPOST('set', 'alpha') == 'properties' && $user->rights->ticket->write) {
print '<tr>';
// Type
@ -1212,6 +1213,10 @@ if (empty($action) || $action == 'view' || $action == 'addlink' || $action == 'd
$linktoelem = $form->showLinkToObjectBlock($object, null, array('ticket'));
$somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
// Show direct link to public interface
print '<br><!-- Link to public interface -->'."\n";
print showDirectPublicLink($object).'<br>';
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
// List of actions on element