" & GetString("ContentText_ErrorChkVIDViewThatVersion") & " "
End if
'Error Checking Complete
If strErrorText = "" Then
'No problem with doing the database stuff
'-----------------------------------------------
'NEW VERSION
'If V_ID is zero then it is a new version, in
'this case we insert a new record into the DB
'-----------------------------------------------
If V_ID = 0 Then
strQuery = "INSERT INTO tblCactuShopVersions ("
For numCounter = 1 to numTotalLanguages
If aryLangLiveBack(numCounter) = "y" then strQuery = strQuery & "V_Name" & CStr(numCounter) & ", V_Desc" & CStr(numCounter) & ", "
next
strQuery = strQuery & "V_CodeNumber, V_Price, V_Tax, V_Weight, V_Quantity, V_QuantityWarnLevel, V_DeliveryTime, V_DownloadInfo, V_DownloadType, V_Product, V_Live, V_OrderByValue, V_RRP) VALUES("
For numCounter = 1 to numTotalLanguages
If aryLangLiveBack(numCounter) = "y" then strQuery = strQuery & "'" & sqlsafe(V_Name(numCounter)) & "', '" & sqlsafe(V_Desc(numCounter)) & "', "
next
strQuery = strQuery & "'" &_
sqlsafe(V_CodeNumber) & "'," &_
V_Price & "," &_
V_Tax & ", " &_
V_Weight & "," &_
V_Quantity & "," &_
V_QuantityWarnLevel & "," &_
V_DeliveryTime & ",'" &_
sqlsafe(V_DownloadInfo) & "','" &_
sqlsafe(V_DownloadType) & "'," &_
V_Product & ",'" &_
V_Live & "'," &_
V_OrderByValue & "," &_
V_RRP & ")"
Call ExecuteSQL(strQuery, numCursorType, objRecordSet)
'--------------------------------------------------
'FIND ID OF NEW VERSION
'--------------------------------------------------
V_ID = objDataConn.Execute("SELECT V_ID FROM tblCactuShopVersions WHERE V_CodeNumber = '" & SQLSafe(V_CodeNumber) & "'")("V_ID")
'-----------------------------------------------
'UPDATE VERSION
'Otherwise, update the version.
'-----------------------------------------------
Else
strQuery="UPDATE tblCactuShopVersions SET "
for numCounter = 1 to numTotalLanguages
If arylangliveback(numCounter) = "y" then strQuery = strQuery & "V_Name" & CStr(numCounter) & "='" & sqlsafe(V_Name(numCounter)) & "',V_Desc" & CStr(numCounter) & "='" & sqlsafe(V_Desc(numCounter)) & "',"
next
strQuery = strQuery &_
"V_CodeNumber='" & sqlsafe(V_CodeNumber) & "'," &_
"V_Price=" & V_Price & "," &_
"V_Tax=" & V_Tax & "," &_
"V_Weight=" & V_Weight & "," &_
"V_DeliveryTime=" & V_DeliveryTime & "," &_
"V_Quantity=" & V_Quantity & "," &_
"V_QuantityWarnLevel=" & V_QuantityWarnLevel & "," &_
"V_DownLoadInfo='" & sqlsafe(V_DownLoadInfo) & "'," &_
"V_DownLoadType='" & sqlsafe(V_DownLoadType) & "'," &_
"V_Live='" & V_Live & "'," &_
"V_Product=" & V_Product & ", " &_
"V_OrderByValue=" & V_OrderByValue & ", " &_
"V_RRP=" & V_RRP & " WHERE V_ID=" & V_ID
Call ExecuteSQL(strQuery, numCursorType, objRecordSet)
End If
'Do the image management, if needed
'Use Version ID + File Extension for name to avoid overwriting pre-existing images.
Set objFileSystem = Server.CreateObject("Scripting.FileSystemObject")
If V_DeleteImage = "y" Or Uploader.Files.Exists("V_Image") Then DeleteFile Server.MapPath(Application(LICENSENUMBER & "uploadsfolder") & "images_versions/" & V_ID), Split(Application(LICENSENUMBER & "allowedimages"), ","), objFileSystem
If V_DeleteImage_Large = "y" Or Uploader.Files.Exists("V_Image_Large") Then DeleteFile Server.MapPath(Application(LICENSENUMBER & "uploadsfolder") & "images_versions_large/" & V_ID), Split(Application(LICENSENUMBER & "allowedimages"), ","), objFileSystem
If V_DeleteFile = "y" Or V_DownloadType <> "u" Or Uploader.Files.Exists("V_DownloadInfoUpload") Then DeleteFile Server.MapPath(Application(LICENSENUMBER & "uploadsfolder") & "files_versions/" & V_ID & "_" & strRandomFileName), aryDownloadExtension, objFileSystem
Set objFileSystem = Nothing
If Uploader.Files.Exists("V_DownloadInfoUpload") Then
Uploader.Files("V_DownloadInfoUpload").FileName = V_ID & "_" & strRandomFileName & "." & strUploadFileType
Uploader.Files("V_DownloadInfoUpload").SaveToDisk Server.MapPath(Application(LICENSENUMBER & "uploadsfolder") & "files_versions/")
End If
If Uploader.Files.Exists("V_Image") Then
Uploader.Files("V_Image").FileName = V_ID & "." & strFileType
Uploader.Files("V_Image").SaveToDisk Server.MapPath(Application(LICENSENUMBER & "uploadsfolder") & "images_versions/")
End If
If Uploader.Files.Exists("V_Image_Large") Then
Uploader.Files("V_Image_Large").FileName = V_ID & "." & strFileType_Large
Uploader.Files("V_Image_Large").SaveToDisk Server.MapPath(Application(LICENSENUMBER & "uploadsfolder") & "images_versions_large/")
End If
End If
End If
'-----------------------------------------------
'DECIDE WHERE TO FORWARD TO
'If this script was called from an existing
'version then forward back to that prodtype page
'otherwise go back to the back end home page.
'-----------------------------------------------
If strErrorText = "" Then
If Not PT_ID = "" Then Response.Redirect("_prodtype_back.asp?PT_ID=" & PT_ID) Else Response.Redirect("_default.asp")
Else
'Errors Occurred. Tell the user.
%>