Cron-Import: Originale Dateinamen beim Archivieren beibehalten
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
a2c492d833
commit
59ce17b7b5
1 changed files with 11 additions and 1 deletions
|
|
@ -598,7 +598,17 @@ class CronImportZugferd
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_dir($targetFolder) && is_writable($targetFolder)) {
|
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)) {
|
if (@rename($file, $targetPath)) {
|
||||||
dol_syslog("CronImportZugferd: Moved file to: " . $targetPath, LOG_INFO);
|
dol_syslog("CronImportZugferd: Moved file to: " . $targetPath, LOG_INFO);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue