From f19e5e86f4c4221359dd70d346220969ea438e6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Salvador?= Date: Tue, 30 Jul 2013 17:07:02 +0200 Subject: [PATCH] don't try to create a link when the link input field is empty --- htdocs/core/tpl/document_actions.tpl.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/htdocs/core/tpl/document_actions.tpl.php b/htdocs/core/tpl/document_actions.tpl.php index bd26e13672d..8ae243e47d3 100644 --- a/htdocs/core/tpl/document_actions.tpl.php +++ b/htdocs/core/tpl/document_actions.tpl.php @@ -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); } }