don't try to create a link when the link input field is empty

This commit is contained in:
Cédric Salvador 2013-07-30 17:07:02 +02:00 committed by Raphaël Doursenaud
parent ce19b6da5c
commit f19e5e86f4

View File

@ -7,10 +7,12 @@ if (GETPOST('sendit') && ! empty($conf->global->MAIN_UPLOAD_DOC)) {
} elseif (GETPOST('linkit') && ! empty($conf->global->MAIN_UPLOAD_DOC)) {
if ($object->id) {
$link = GETPOST('link', 'alpha');
if (substr($link, 0, 7) != 'http://' && substr($link, 0, 8) != 'https://') {
$link = 'http://' . $link;
if ($link) {
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);
}
}