From d47bb95b5611161acc21bb2c38da58d95bdc377c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Salvador?= Date: Mon, 29 Jul 2013 16:37:49 +0200 Subject: [PATCH] bugfix --- htdocs/core/tpl/document_actions.tpl.php | 43 ++++++++++++------------ 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/htdocs/core/tpl/document_actions.tpl.php b/htdocs/core/tpl/document_actions.tpl.php index 576e6139639..d41df448333 100644 --- a/htdocs/core/tpl/document_actions.tpl.php +++ b/htdocs/core/tpl/document_actions.tpl.php @@ -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; + } } -?> +