This commit is contained in:
Laurent Destailleur 2021-06-19 19:12:57 +02:00
parent 6911cc93d1
commit 94ab340bba
2 changed files with 823 additions and 814 deletions

View File

@ -1438,8 +1438,7 @@ if ($action == 'create') {
print '</div>'; print '</div>';
print '</form>'; print '</form>';
} else { } elseif ($id > 0 || $ref) {
if ($id > 0 || $ref) {
$result = $object->fetch($id, $ref); $result = $object->fetch($id, $ref);
$res = $object->fetch_optionals(); $res = $object->fetch_optionals();
@ -2380,8 +2379,8 @@ if ($action == 'create') {
print '</script>'."\n"; print '</script>'."\n";
print '</td></tr>'; print '</td></tr>';
include DOL_DOCUMENT_ROOT.'/expensereport/tpl/expensereport_addfile.tpl.php';
include DOL_DOCUMENT_ROOT.'/expensereport/tpl/expensereport_linktofile.tpl.php'; include DOL_DOCUMENT_ROOT.'/expensereport/tpl/expensereport_linktofile.tpl.php';
include DOL_DOCUMENT_ROOT.'/expensereport/tpl/expensereport_addfile.tpl.php';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td></td>'; print '<td></td>';
@ -2505,7 +2504,11 @@ if ($action == 'create') {
} else { } else {
dol_print_error($db); dol_print_error($db);
} }
} } else {
print 'Record not found';
llxFooter();
exit(1);
} }
/* /*

View File

@ -18,6 +18,7 @@ if (empty($conf->global->EXPENSEREPORT_DISABLE_ATTACHMENT_ON_LINES)) {
$modulepart = 'expensereport'; $maxheightmini = 48; $modulepart = 'expensereport'; $maxheightmini = 48;
$relativepath = (!empty($object->ref) ?dol_sanitizeFileName($object->ref) : '').'/'; $relativepath = (!empty($object->ref) ?dol_sanitizeFileName($object->ref) : '').'/';
$filei = 0; $filei = 0;
// Loop on each attached file
foreach ($arrayoffiles as $file) { foreach ($arrayoffiles as $file) {
$urlforhref = array(); $urlforhref = array();
$filei++; $filei++;
@ -77,7 +78,7 @@ if (empty($conf->global->EXPENSEREPORT_DISABLE_ATTACHMENT_ON_LINES)) {
} }
if (empty($urlforhref) || empty($thumbshown)) { if (empty($urlforhref) || empty($thumbshown)) {
print '<a href="#" class="aphoto" target="_blank">'; print '<span href="" class="aphoto" target="_blank">';
} else { } else {
print '<a href="'.$urlforhref['url'].'" class="'.$urlforhref['css'].'" target="'.$urlforhref['target'].'" mime="'.$urlforhref['mime'].'">'; print '<a href="'.$urlforhref['url'].'" class="'.$urlforhref['css'].'" target="'.$urlforhref['target'].'" mime="'.$urlforhref['mime'].'">';
} }
@ -85,7 +86,12 @@ if (empty($conf->global->EXPENSEREPORT_DISABLE_ATTACHMENT_ON_LINES)) {
print $thumbshown ? $thumbshown : img_mime($minifile); print $thumbshown ? $thumbshown : img_mime($minifile);
print '</div></a>'; print '</div>';
if (empty($urlforhref) || empty($thumbshown)) {
print '</span>';
} else {
print '</a>';
}
} }
print '<br>'; print '<br>';
$checked = ''; $checked = '';
@ -106,7 +112,7 @@ if (empty($conf->global->EXPENSEREPORT_DISABLE_ATTACHMENT_ON_LINES)) {
if (!empty($filenamelinked) && $filenamelinked == $file['relativename']) { if (!empty($filenamelinked) && $filenamelinked == $file['relativename']) {
$checked = ' checked'; $checked = ' checked';
} }
print '<div class="margintoponly maxwidth150"><input type="checkbox"'.$checked.' id="radio'.$filei.'" name="attachfile[]" class="checkboxattachfile" value="'.$file['relativename'].'">'; print '<div class="margintoponly minwidth150 maxwidth150"><input type="checkbox"'.$checked.' id="radio'.$filei.'" name="attachfile[]" class="checkboxattachfile" value="'.$file['relativename'].'">';
print '<label class="wordbreak checkboxattachfilelabel" for="radio'.$filei.'"> '.$file['relativename'].'</label>'; print '<label class="wordbreak checkboxattachfilelabel" for="radio'.$filei.'"> '.$file['relativename'].'</label>';
print '</div>'; print '</div>';