Skip to content
Snippets Groups Projects
Commit d47bb95b authored by Cédric Salvador's avatar Cédric Salvador Committed by Raphaël Doursenaud
Browse files

bugfix

parent 06af0733
No related branches found
No related tags found
No related merge requests found
......@@ -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;
}
}
?>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment