diff --git a/ChangeLog b/ChangeLog index c05e9a929d1..db0f8ab8240 100644 --- a/ChangeLog +++ b/ChangeLog @@ -23,6 +23,7 @@ For users: to define default language for document generation. - New: Can reopen a closed supplier invoice. - New: Move permission "see hidden categories" into "see hidden products/services". +- New: Can delete several files at once in FTP module. - Fix: Format number was wrong for ar_AR language. - Fix: Can change password if has only permission change password. - Fix: Project PDF document show the tasks. diff --git a/htdocs/ftp/index.php b/htdocs/ftp/index.php index 29af4fdc935..d19cd5b48b9 100644 --- a/htdocs/ftp/index.php +++ b/htdocs/ftp/index.php @@ -194,6 +194,57 @@ if ($_REQUEST['action'] == 'confirm_deletefile' && $_REQUEST['confirm'] == 'yes' } } +// Delete several lines at once +if ($_POST["const"] && $_POST["delete"] && $_POST["delete"] == $langs->trans("Delete")) +{ + // set up a connection or die + if (! $conn_id) + { + $newsectioniso=utf8_decode($section); + $resultarray=dol_ftp_connect($ftp_server, $ftp_port, $ftp_user, $ftp_password, $newsectioniso); + $conn_id=$resultarray['conn_id']; + $ok=$resultarray['ok']; + $mesg=$resultarray['mesg']; + } + + if ($conn_id && $ok && ! $mesg) + { + foreach($_POST["const"] as $const) + { + if ($const["check"]) // Is checkbox checked + { + // Remote file + $file=$const["file"]; + $section=$const["section"]; + $remotefile=$section.(preg_match('@[\\\/]$@',$section)?'':'/').$file; + $newremotefileiso=utf8_decode($remotefile); + + //print "x".$newremotefileiso; + dol_syslog("ftp/index.php ftp_delete ".$newremotefileiso); + $result=@ftp_delete($conn_id, $newremotefileiso); + if ($result) + { + $mesg .= '