diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php
index b2c7edf4590..2d9b44e51ae 100644
--- a/htdocs/core/lib/files.lib.php
+++ b/htdocs/core/lib/files.lib.php
@@ -1828,19 +1828,18 @@ function deleteFilesIntoDatabaseIndex($dir, $file, $mode = 'uploaded')
function dol_convert_file($fileinput, $ext = 'png', $fileoutput = '')
{
global $langs;
-
if (class_exists('Imagick'))
{
- $image=new Imagick();
+ $image=new Imagick();
try {
- $ret = $image->readImage($fileinput);
+ $ret = $image->readImage($fileinput);
} catch(Exception $e) {
- dol_syslog("Failed to read image using Imagick. Try to install package 'apt-get install ghostscript'.", LOG_WARNING);
+ dol_syslog("Failed to read image using Imagick (Try to install package 'apt-get install ghostscript'): ".$e->getMessage(), LOG_WARNING);
return 0;
}
if ($ret)
{
- $ret = $image->setImageFormat($ext);
+ $ret = $image->setImageFormat($ext);
if ($ret)
{
if (empty($fileoutput)) $fileoutput=$fileinput.".".$ext;
diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php
index f59cd82da3e..7a699ee22a4 100644
--- a/htdocs/core/lib/functions.lib.php
+++ b/htdocs/core/lib/functions.lib.php
@@ -1390,7 +1390,7 @@ function dol_banner_tab($object, $paramid, $morehtml = '', $shownav = 1, $fieldi
$fileimagebis = $file.'_preview-0.png'; // If PDF has more than one page
$relativepathimage = $relativepath.'_preview.png';
- // Si fichier PDF existe
+ // If PDF file exists
if (file_exists($file))
{
$encfile = urlencode($file);
@@ -1399,7 +1399,7 @@ function dol_banner_tab($object, $paramid, $morehtml = '', $shownav = 1, $fieldi
&& (! file_exists($fileimagebis) || (filemtime($fileimagebis) < filemtime($file)))
)
{
- if (empty($conf->global->MAIN_DISABLE_PDF_THUMBS)) // If you experienc trouble with pdf thumb generation and imagick, you can disable here.
+ if (empty($conf->global->MAIN_DISABLE_PDF_THUMBS)) // If you experience trouble with pdf thumb generation and imagick, you can disable here.
{
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
$ret = dol_convert_file($file, 'png', $fileimage);
@@ -1428,7 +1428,7 @@ function dol_banner_tab($object, $paramid, $morehtml = '', $shownav = 1, $fieldi
}
elseif (! $phototoshow)
{
- $phototoshow = $form->showphoto($modulepart, $object, 0, 0, 0, 'photoref', 'small', 1, 0, $maxvisiblephotos);
+ $phototoshow.= $form->showphoto($modulepart, $object, 0, 0, 0, 'photoref', 'small', 1, 0, $maxvisiblephotos);
}
if ($phototoshow)
@@ -1441,7 +1441,7 @@ function dol_banner_tab($object, $paramid, $morehtml = '', $shownav = 1, $fieldi
if (! $phototoshow) // Show No photo link (picto of pbject)
{
- $morehtmlleft.='
';
+ $morehtmlleft.='
';
if ($object->element == 'action')
{
$width=80;
@@ -7336,13 +7336,6 @@ function printCommonFooter($zone = 'private')
if (! empty($user->rights->debugbar->read) && is_object($debugbar))
{
$debugbar['time']->stopMeasure('pageaftermaster');
-
- /*foreach($conf->logbuffer as $logline)
- {
- //print $logline."
\n";
- //$debugbar['log']->addMessage($logline, 'ERR', false);
- }*/
-
print ''."\n";
print $debugbar->getRenderer()->render();
}
diff --git a/htdocs/debugbar/class/DataCollector/DolLogsCollector.php b/htdocs/debugbar/class/DataCollector/DolLogsCollector.php
index 889e6b3d368..8e39c68b6b7 100644
--- a/htdocs/debugbar/class/DataCollector/DolLogsCollector.php
+++ b/htdocs/debugbar/class/DataCollector/DolLogsCollector.php
@@ -203,6 +203,7 @@ class DolLogsCollector extends MessagesCollector
$class = new ReflectionClass(new LogLevel());
$levels = $class->getConstants();
$levels['ERR'] = 'error';
+ $levels['WARN'] = 'warning';
return $levels;
}
diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php
index 0636460de4c..ea2f6ca78b3 100644
--- a/htdocs/expensereport/card.php
+++ b/htdocs/expensereport/card.php
@@ -2282,10 +2282,12 @@ else
print '$(document).ready(function() {
$( ".auploadnewfilenow" ).click(function() {
jQuery(".truploadnewfilenow").toggle();
+ jQuery(".trattachnewfilenow").hide();
return false;
});
$( ".aattachtodoc" ).click(function() {
jQuery(".trattachnewfilenow").toggle();
+ jQuery(".truploadnewfilenow").hide();
return false;
});';
if (is_array(GETPOST('attachfile', 'array')) && count(GETPOST('attachfile', 'array')))
@@ -2299,14 +2301,12 @@ else
print '';
// Add line to upload new file
- print '
global->MAIN_OPTIMIZEFORTEXTBROWSER)?' style="display: none"':'').'>';
+ print '
global->MAIN_OPTIMIZEFORTEXTBROWSER)?' style="display: none"':'').'>';
print '| ';
$modulepart = 'expensereport';
$permission = $user->rights->expensereport->creer;
- $formfile=new FormFile($db);
-
// We define var to enable the feature to add prefix of uploaded files
$savingdocmask='';
if (empty($conf->global->MAIN_DISABLE_SUGGEST_REF_AS_PREFIX))
@@ -2351,7 +2351,7 @@ else
$nbLinks=Link::count($db, $object->element, $object->id);
if ($nbFiles >= 0)
{
- print ' |
global->MAIN_OPTIMIZEFORTEXTBROWSER)?' style="display: none"':'').'>';
+ print '
global->MAIN_OPTIMIZEFORTEXTBROWSER)?' style="display: none"':'').'>';
print '';
//print ''.$langs->trans("AttachTheNewLineToTheDocument").' ';
$modulepart='expensereport';$maxheightmini=48;
@@ -2372,10 +2372,18 @@ else
} else {
print '';
}
- print ' ';
+ print '';
+ print ' ?$object->entity:$conf->entity).'&file='.urlencode($relativepath.$minifile).') ';
+ print ' ';
print '';
}
- else print ' ';
+ else
+ {
+ print '';
+ //print '  ';
+ print img_mime($relativepath.$minifile);
+ print ' ';
+ }
print ' ';
$checked='';
//var_dump(GETPOST($file['relativename'])); var_dump($file['relativename']); var_dump($_FILES['userfile']['name']);
@@ -2391,7 +2399,7 @@ else
break;
}
}
- print ' '.$file['relativename'];
+ print ' '.$file['relativename'].' ';
print '';
}
print ' |
';