diff --git a/class/cron_importzugferd.class.php b/class/cron_importzugferd.class.php index 0c9262f..521acdb 100755 --- a/class/cron_importzugferd.class.php +++ b/class/cron_importzugferd.class.php @@ -598,7 +598,17 @@ class CronImportZugferd } if (is_dir($targetFolder) && is_writable($targetFolder)) { - $targetPath = $targetFolder . '/' . $prefix . date('Y-m-d_His') . '_' . basename($file); + // Originalen Dateinamen beibehalten, bei Namenskollision Zaehler anhaengen + $baseName = basename($file); + $targetPath = $targetFolder . '/' . $baseName; + if (file_exists($targetPath)) { + $pathInfo = pathinfo($baseName); + $counter = 1; + do { + $targetPath = $targetFolder . '/' . $pathInfo['filename'] . '_' . $counter . '.' . $pathInfo['extension']; + $counter++; + } while (file_exists($targetPath)); + } if (@rename($file, $targetPath)) { dol_syslog("CronImportZugferd: Moved file to: " . $targetPath, LOG_INFO);