diff --git a/htdocs/core/lib/ticket.lib.php b/htdocs/core/lib/ticket.lib.php
index 63e9a2fc9ff..7a2a96d074a 100644
--- a/htdocs/core/lib/ticket.lib.php
+++ b/htdocs/core/lib/ticket.lib.php
@@ -819,6 +819,46 @@ function show_ticket_messaging($conf, $langs, $db, $filterobj, $objcon = '', $no
}
}
+ $documents = getTicketActionCommEcmList($actionstatic) ;
+ if(!empty($documents))
+ {
+ $footer.= '
';
+ foreach ($documents as $doc)
+ {
+ $footer.= '
';
+
+ $filePath = DOL_DATA_ROOT . '/'. $doc->filepath . '/'. $doc->filename;
+ $mime = dol_mimetype($filePath);
+ $file = $actionstatic->id.'/'.$doc->filename;
+ $thumb = $actionstatic->id.'/thumbs/'.substr($doc->filename, 0, strrpos($doc->filename,'.')).'_mini'.substr($doc->filename, strrpos($doc->filename,'.'));
+ $doclink = dol_buildpath('document.php', 1).'?modulepart=actions&attachment=0&file='.urlencode($file).'&entity='.$conf->entity;
+ $viewlink = dol_buildpath('viewimage.php', 1).'?modulepart=actions&file='.urlencode($thumb).'&entity='.$conf->entity;
+
+ $mimeAttr = ' mime="'.$mime.'" ';
+ $class = '';
+ if(in_array($mime, array('image/png', 'image/jpeg', 'application/pdf'))){
+ $class.= ' documentpreview';
+ }
+
+ $footer.= '';
+ $footer.= img_mime($filePath).' '.$doc->filename;
+ $footer.= '';
+
+ $footer.= '';
+ }
+ $footer.= '
';
+ }
+
+
+
+
+
+
+
if(!empty($footer)){
$out.='';
}
@@ -838,3 +878,32 @@ function show_ticket_messaging($conf, $langs, $db, $filterobj, $objcon = '', $no
if ($noprint) return $out;
else print $out;
}
+
+
+/**
+ * @var $object ActionComm
+ * @return array
+ */
+function getTicketActionCommEcmList($object)
+{
+ global $conf, $db;
+
+ $documents = array();
+
+ $sql = 'SELECT ecm.rowid as id, ecm.src_object_type, ecm.src_object_id, ecm.filepath, ecm.filename';
+ $sql.= ' FROM '.MAIN_DB_PREFIX.'ecm_files ecm';
+ $sql.= ' WHERE ecm.filepath = \'agenda/'.$object->id.'\'';
+ //$sql.= ' ecm.src_object_type = \''.$object->element.'\' AND ecm.src_object_id = '.$object->id; // Actually upload file doesn't add type
+ $sql.= ' ORDER BY ecm.position ASC';
+
+ $resql= $db->query($sql);
+ if ($resql) {
+ if ($db->num_rows($resql)) {
+ while ($obj = $db->fetch_object($resql)) {
+ $documents[$obj->id] = $obj;
+ }
+ }
+ }
+
+ return $documents;
+}
diff --git a/htdocs/theme/eldy/timeline.inc.php b/htdocs/theme/eldy/timeline.inc.php
index 2cb3461d713..d81ae4b8bed 100644
--- a/htdocs/theme/eldy/timeline.inc.php
+++ b/htdocs/theme/eldy/timeline.inc.php
@@ -125,7 +125,12 @@ a.timeline-btn:hover
font-weight: normal;
line-height: 1.1;
}
-.timeline > li.timeline-code-ticket_msg_private > .timeline-item > .timeline-header {
+
+.timeline > li > .timeline-item > .timeline-footer {
+ border-top: 1px solid #f4f4f4;
+}
+
+.timeline > li.timeline-code-ticket_msg_private > .timeline-item > .timeline-header, .timeline > li.timeline-code-ticket_msg_private > .timeline-item > .timeline-footer {
border-color: #ecebda;
}
@@ -195,3 +200,25 @@ a.timeline-btn:hover
background-color: #0073b7 !important;
color: #fff !important;
}
+
+.timeline-documents-container{
+
+}
+
+.timeline-documents{
+ margin-right: 5px;
+}
+
+.btn-file{
+ margin-right: 5px;
+ border: 1px solid #ddd;
+ color: #333;
+ padding: 5px 10px;
+ border-radius:1em;
+ text-decoration: none !important;
+}
+
+.btn-file:hover{
+ background-color: #ddd;
+ border: 1px solid #ddd;
+}