bugfix
This commit is contained in:
parent
06af0733e9
commit
d47bb95b56
@ -2,34 +2,35 @@
|
||||
// Envoi fichier
|
||||
if (GETPOST('sendit') && ! empty($conf->global->MAIN_UPLOAD_DOC))
|
||||
{
|
||||
if ($object->id)
|
||||
{
|
||||
dol_add_file_process($upload_dir,0,1,'userfile');
|
||||
}
|
||||
}
|
||||
//test code for the link feature, need to mutualize it to avoid copy/paste on every document page
|
||||
elseif (GETPOST('linkit') && ! empty($conf->global->MAIN_UPLOAD_DOC)) {
|
||||
if ($object->id) {
|
||||
if ($object->id)
|
||||
{
|
||||
dol_add_file_process($upload_dir,0,1,'userfile');
|
||||
}
|
||||
} elseif (GETPOST('linkit') && ! empty($conf->global->MAIN_UPLOAD_DOC)) {
|
||||
if ($object->id) {
|
||||
$link = GETPOST('link', 'alpha');
|
||||
if (!strpos(substr($link, 0, 7), 'http://') && !strpos(substr($link, 0, 8), 'https://')) {
|
||||
if (substr($link, 0, 7) != 'http://' && substr($link, 0, 8) != 'https://') {
|
||||
$link = 'http://' . $link;
|
||||
}
|
||||
dol_add_file_process($upload_dir,0,1,'userfile', $link);
|
||||
}
|
||||
dol_add_file_process($upload_dir,0,1,'userfile', $link);
|
||||
}
|
||||
}
|
||||
|
||||
// Delete file
|
||||
if ($action == 'confirm_deletefile' && $confirm == 'yes')
|
||||
{
|
||||
if ($object->id)
|
||||
{
|
||||
$file = $upload_dir . "/" . GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
|
||||
if ($object->id)
|
||||
{
|
||||
$file = $upload_dir . "/" . GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
|
||||
|
||||
$ret=dol_delete_file($file,0,0,0,$object);
|
||||
if ($ret) setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile')));
|
||||
else setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors');
|
||||
header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id);
|
||||
exit;
|
||||
}
|
||||
$ret = dol_delete_file($file,0,0,0,$object);
|
||||
if ($ret) {
|
||||
setEventMessage($langs->trans("FileWasRemoved", GETPOST('urlfile')));
|
||||
} else {
|
||||
setEventMessage($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), 'errors');
|
||||
}
|
||||
header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user