FCLT#78633 Map eerst aanmaken en bes-photo's individueel verplaatsen en unieke filename garanderen

svn path=/Website/trunk/; revision=60748
This commit is contained in:
2023-06-13 10:37:08 +00:00
parent 54ae1ed554
commit a52f97c4ea

View File

@@ -202,11 +202,29 @@ function upgrade20232()
if (subFolder.Name.match(/\d+$/) === null) {
continue;
}
try {
fso.MoveFile(subFolder + "/*", besPhotoPath);
} catch (e) {
__DoLog("ERROR moving " + subFolder + "/*" + " -> " + besPhotoPath, "#FF0000");
__DoLog(e);
var oldBesPhotoPath = Server.MapPath(S("bes_image_path") + subFolder.Name);
var oldBesPhotoFolder = fso.GetFolder(oldBesPhotoPath);
var fc2 = new Enumerator(oldBesPhotoFolder.files);
for (; !fc2.atEnd(); fc2.moveNext()) {
try {
var photo = fc2.item();
var orgPhotoName = photo.Name;
var newPhotoName = uniqueFileName(besPhotoPath, orgPhotoName);
fso.MoveFile(oldBesPhotoPath + "/" + orgPhotoName, besPhotoPath + "/" + newPhotoName);
if (orgPhotoName != newPhotoName) {
var bes_disc_key = parseInt(subFolder.Name, 10);
var sql = "UPDATE bes_srtdeel bsd"
+ " SET bsd.bes_srtdeel_image = " + safe.quoted_sql(newPhotoName)
+ " WHERE bsd.bes_srtgroep_key IN (SELECT bsg.bes_srtgroep_key"
+ " FROM bes_srtgroep bsg"
+ " WHERE bsg.ins_discipline_key = " + bes_disc_key + ")"
+ " AND bsd.bes_srtdeel_image = " + safe.quoted_sql(orgPhotoName);
Oracle.Execute(sql);
}
} catch (e) {
__DoLog("ERROR moving " + oldBesPhotoPath + "/" + orgPhotoName + " -> " + besPhotoPath + "/" + newPhotoName, "#FF0000");
__DoLog(e.description);
}
}
}
}
@@ -241,6 +259,9 @@ function upgrade20232()
+ " WHERE fac_bijlagen_verwijder IS NULL"
+ " AND fac_bijlagen_kenmerk_key = " + fac_bijlagen_kenmerk_key;
oRs = Oracle.Execute(sql);
if (!oRs.EoF && !fso.FolderExists(bldPhotoPath)) {
fso.CreateFolder(bldPhotoPath);
}
while (!oRs.EoF) {
var dir = oRs("fac_bijlagen_disk_directory").Value;
var fileName = oRs("fac_bijlagen_filename").Value;