Fix entity name vanishing from a prompt, and report the effective protocol

Running the wizard under pwsh turned up two things review missed:

"...dated folders for $entityName?" rendered as "...dated folders for "
- ? is a legal character in an unbraced PowerShell variable name, so
  this looked up a variable called entityName? and got nothing. Braced.

The settings screen showed "over (not set)" for a config whose protocol
comes from an ftps:// prefix on the host, which is exactly the case
worth spotting. It now reports what the upload will actually use, marked
"(assumed)" when it was inferred rather than set.
This commit is contained in:
2026-08-26 20:27:03 -05:00
parent 0b6f8cb16d
commit 63ea07167c
+12 -5
View File
@@ -211,7 +211,7 @@ function New-Entity {
$pdfPath = $null $pdfPath = $null
Write-Host "Some entities get PT STMT files mixed into the same dated folder," -ForegroundColor DarkGray Write-Host "Some entities get PT STMT files mixed into the same dated folder," -ForegroundColor DarkGray
Write-Host "and those go to a different folder on the server." -ForegroundColor DarkGray Write-Host "and those go to a different folder on the server." -ForegroundColor DarkGray
if (Read-YesNo "Do PT STMT files show up in the dated folders for $entityName?" "n") { if (Read-YesNo "Do PT STMT files show up in the dated folders for ${entityName}?" "n") {
$pdfPath = Read-RemotePath "the PT STMT files" $null $pdfPath = Read-RemotePath "the PT STMT files" $null
} }
@@ -415,18 +415,16 @@ function Set-Field($object, $name, $value) {
} }
function Show-Settings($config) { function Show-Settings($config) {
$proto = if ($config.ftps.protocol) { $config.ftps.protocol.ToUpper() } else { "(not set)" }
Write-Host "" Write-Host ""
Write-Host " Daily upload" -ForegroundColor White Write-Host " Daily upload" -ForegroundColor White
Write-Host " Server : $(Show-Value $config.ftps.host) over $proto" Write-Host " Server : $(Show-Value $config.ftps.host) over $(Show-Protocol $config.ftps 'ftp')"
Write-Host " Login : $(Show-Value $config.ftps.username) / $(Show-Password $config.ftps.password)" Write-Host " Login : $(Show-Value $config.ftps.username) / $(Show-Password $config.ftps.password)"
Write-Host " Images to : $(Show-Value $config.ftps.tiff_path)" Write-Host " Images to : $(Show-Value $config.ftps.tiff_path)"
Write-Host " PT STMT to: $(Show-Value $config.ftps.pdf_path)" Write-Host " PT STMT to: $(Show-Value $config.ftps.pdf_path)"
Write-Host "" Write-Host ""
Write-Host " Patient files" -ForegroundColor White Write-Host " Patient files" -ForegroundColor White
if ($config.workflow -eq "insurance+patient") { if ($config.workflow -eq "insurance+patient") {
$pproto = if ($config.sftp.protocol) { $config.sftp.protocol.ToUpper() } else { "(not set)" } Write-Host " Server : $(Show-Value $config.sftp.host) over $(Show-Protocol $config.sftp 'sftp')"
Write-Host " Server : $(Show-Value $config.sftp.host) over $pproto"
Write-Host " Login : $(Show-Value $config.sftp.username) / $(Show-Password $config.sftp.password)" Write-Host " Login : $(Show-Value $config.sftp.username) / $(Show-Password $config.sftp.password)"
Write-Host " Files to : $(Show-Value $config.sftp.patient_path)" Write-Host " Files to : $(Show-Value $config.sftp.patient_path)"
} else { } else {
@@ -434,6 +432,15 @@ function Show-Settings($config) {
} }
} }
# Reports the protocol the upload will actually use, so a legacy config that
# only carries an "ftps://" prefix on the host doesn't read as unset.
function Show-Protocol($conn, $fallback) {
if ([string]::IsNullOrWhiteSpace([string]$conn.host)) { return "(not set)" }
$protocol = (Get-ConnProtocol $conn $fallback).ToUpper()
if ($conn.protocol) { return $protocol }
return "$protocol (assumed)"
}
function Show-Value($value) { function Show-Value($value) {
if ([string]::IsNullOrWhiteSpace([string]$value)) { return "(not set)" } if ([string]::IsNullOrWhiteSpace([string]$value)) { return "(not set)" }
return [string]$value return [string]$value