From 59ce17b7b5468816af44887060f0a879383bec47 Mon Sep 17 00:00:00 2001 From: data Date: Mon, 23 Feb 2026 19:25:38 +0100 Subject: [PATCH] Cron-Import: Originale Dateinamen beim Archivieren beibehalten Co-Authored-By: Claude Opus 4.6 --- class/cron_importzugferd.class.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) 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);