From 63ea07167ca58104242f6ae4ae12e7f6f32dff05 Mon Sep 17 00:00:00 2001 From: Brad Lance Date: Wed, 26 Aug 2026 20:27:03 -0500 Subject: [PATCH] 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. --- Setup-Entity.ps1 | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/Setup-Entity.ps1 b/Setup-Entity.ps1 index eb9988c..88bf9e9 100644 --- a/Setup-Entity.ps1 +++ b/Setup-Entity.ps1 @@ -211,7 +211,7 @@ function New-Entity { $pdfPath = $null 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 - 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 } @@ -415,18 +415,16 @@ function Set-Field($object, $name, $value) { } function Show-Settings($config) { - $proto = if ($config.ftps.protocol) { $config.ftps.protocol.ToUpper() } else { "(not set)" } Write-Host "" 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 " Images to : $(Show-Value $config.ftps.tiff_path)" Write-Host " PT STMT to: $(Show-Value $config.ftps.pdf_path)" Write-Host "" Write-Host " Patient files" -ForegroundColor White 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 $pproto" + Write-Host " Server : $(Show-Value $config.sftp.host) over $(Show-Protocol $config.sftp 'sftp')" Write-Host " Login : $(Show-Value $config.sftp.username) / $(Show-Password $config.sftp.password)" Write-Host " Files to : $(Show-Value $config.sftp.patient_path)" } 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) { if ([string]::IsNullOrWhiteSpace([string]$value)) { return "(not set)" } return [string]$value