From 89ddefe0d11c0bde1d618b3c74410c6a9dfdf3e8 Mon Sep 17 00:00:00 2001 From: Daniel Covington Date: Fri, 21 Aug 2026 09:12:48 -0400 Subject: [PATCH] Move nonprofit auth-code question from blue envelope to mailing service Blue AV Envelope (Q3) no longer asks for a nonprofit authorization code after confirming nonprofit status - it wasn't needed there. Ballot Mailing Service (Q4) gains the same follow-up instead, with an "I don't know my authorization code" checkbox that lets the applicant skip it. Adds MailingNonprofitAuthCode and MailingNonprofitAuthCodeUnknown columns to OrderDetails via migration, wired through the model, repository, answers mapper, and confirmation email by hand rather than via GenerateRepo.vbs, since regenerating would have dropped existing fixups (leading-zero-preserving text fields, nullable boolean/date guards) already baked into those files. Co-Authored-By: Claude Sonnet 5 --- app/models/OrderDetailsAnswersMapper.asp | 4 ++ app/models/OrderDetailsRepository.asp | 16 ++++---- app/models/OrderMailer.asp | 20 ++++++---- app/models/POBO_OrderDetails.asp | 36 +++++++++++++++++- app/views/Order/continue.asp | 19 +++++++--- ...add_mailing_nonprofit_auth_code_fields.asp | 38 +++++++++++++++++++ 6 files changed, 111 insertions(+), 22 deletions(-) create mode 100644 db/migrations/20260821085700_add_mailing_nonprofit_auth_code_fields.asp diff --git a/app/models/OrderDetailsAnswersMapper.asp b/app/models/OrderDetailsAnswersMapper.asp index 2c3d0f8..3d69afc 100644 --- a/app/models/OrderDetailsAnswersMapper.asp +++ b/app/models/OrderDetailsAnswersMapper.asp @@ -23,6 +23,8 @@ Function ValidateOrderDetailsAnswers(answers) RequireEnum errors, answers, "MailingPostageOption", Array("FirstClass", "NonprofitRate", "PresortStandard", "No") RequireEnum errors, answers, "MailingHasNonprofitStatus", Array("Yes", "No", "NotSure") + RequireBoolean errors, answers, "MailingNonprofitAuthCodeUnknown" + RequireBoolean errors, answers, "PurpleWantsQuote" RequireBoolean errors, answers, "PurpleWantsBlueEnvelopes" RequireBoolean errors, answers, "PurpleTrackMIBallot" @@ -81,6 +83,8 @@ Sub MapOrderDetailsAnswers(ByRef model, answers) model.MailingWantsService = DictValue(answers, "MailingWantsService") model.MailingPostageOption = DictValue(answers, "MailingPostageOption") model.MailingHasNonprofitStatus = DictValue(answers, "MailingHasNonprofitStatus") + model.MailingNonprofitAuthCode = DictValue(answers, "MailingNonprofitAuthCode") + model.MailingNonprofitAuthCodeUnknown = DictValue(answers, "MailingNonprofitAuthCodeUnknown") model.MailingEstimatedQuantity = DictValue(answers, "MailingEstimatedQuantity") model.MailingPickupDate = DictValue(answers, "MailingPickupDate") diff --git a/app/models/OrderDetailsRepository.asp b/app/models/OrderDetailsRepository.asp index 99f715b..31e9b95 100644 --- a/app/models/OrderDetailsRepository.asp +++ b/app/models/OrderDetailsRepository.asp @@ -13,7 +13,7 @@ Class OrderDetailsRepository_Class Public Function FindByID(id) - Dim sql : sql = "Select [BlueDeliveryDate], [BlueEnvelopeProvider], [BlueHasNonprofitStatus], [BlueNonprofitAuthCode], [BluePermitCity], [BluePermitClass], [BluePermitNumber], [BluePermitOwnership], [BluePrintPermit], [BluePrintReturnAddress], [BlueWantsQuote], [ContactName], [FutureVoterStickerRolls], [IVotedStickerRolls], [MailingEstimatedQuantity], [MailingHasNonprofitStatus], [MailingPickupDate], [MailingPostageOption], [MailingWantsService], [MailingWantsSorting], [Municipality], [OrderDetailID], [OrderID], [Phone], [PurpleBlueProvider], [PurpleBlueProviderOther], [PurpleColorCodingBy], [PurpleColorNames], [PurpleDeliveryDate], [PurpleEnvelopeProvider], [PurpleEnvelopeStock], [PurpleExtraEnvelopeQty], [PurplePermanentBallotListCount], [PurplePrecinctCount], [PurplePrintOption], [PurplePrintStyle], [PurpleTrackMIBallot], [PurpleWantsBlueEnvelopes], [PurpleWantsQuote], [SecrecySleevesQty], [SpecialRequests], [SubmittedAt] FROM [OrderDetails] WHERE [OrderDetailID] = ?" + Dim sql : sql = "Select [BlueDeliveryDate], [BlueEnvelopeProvider], [BlueHasNonprofitStatus], [BlueNonprofitAuthCode], [BluePermitCity], [BluePermitClass], [BluePermitNumber], [BluePermitOwnership], [BluePrintPermit], [BluePrintReturnAddress], [BlueWantsQuote], [ContactName], [FutureVoterStickerRolls], [IVotedStickerRolls], [MailingEstimatedQuantity], [MailingHasNonprofitStatus], [MailingNonprofitAuthCode], [MailingNonprofitAuthCodeUnknown], [MailingPickupDate], [MailingPostageOption], [MailingWantsService], [MailingWantsSorting], [Municipality], [OrderDetailID], [OrderID], [Phone], [PurpleBlueProvider], [PurpleBlueProviderOther], [PurpleColorCodingBy], [PurpleColorNames], [PurpleDeliveryDate], [PurpleEnvelopeProvider], [PurpleEnvelopeStock], [PurpleExtraEnvelopeQty], [PurplePermanentBallotListCount], [PurplePrecinctCount], [PurplePrintOption], [PurplePrintStyle], [PurpleTrackMIBallot], [PurpleWantsBlueEnvelopes], [PurpleWantsQuote], [SecrecySleevesQty], [SpecialRequests], [SubmittedAt] FROM [OrderDetails] WHERE [OrderDetailID] = ?" Dim rs : Set rs = DAL.Query(sql, Array(id)) If rs.EOF Then Err.Raise 1, "OrderDetailsRepository_Class", RecordNotFoundException("OrderDetailID", id) @@ -28,7 +28,7 @@ Class OrderDetailsRepository_Class End Function Public Function Find(where_kvarray, order_string_or_array) - Dim sql : sql = "Select [BlueDeliveryDate], [BlueEnvelopeProvider], [BlueHasNonprofitStatus], [BlueNonprofitAuthCode], [BluePermitCity], [BluePermitClass], [BluePermitNumber], [BluePermitOwnership], [BluePrintPermit], [BluePrintReturnAddress], [BlueWantsQuote], [ContactName], [FutureVoterStickerRolls], [IVotedStickerRolls], [MailingEstimatedQuantity], [MailingHasNonprofitStatus], [MailingPickupDate], [MailingPostageOption], [MailingWantsService], [MailingWantsSorting], [Municipality], [OrderDetailID], [OrderID], [Phone], [PurpleBlueProvider], [PurpleBlueProviderOther], [PurpleColorCodingBy], [PurpleColorNames], [PurpleDeliveryDate], [PurpleEnvelopeProvider], [PurpleEnvelopeStock], [PurpleExtraEnvelopeQty], [PurplePermanentBallotListCount], [PurplePrecinctCount], [PurplePrintOption], [PurplePrintStyle], [PurpleTrackMIBallot], [PurpleWantsBlueEnvelopes], [PurpleWantsQuote], [SecrecySleevesQty], [SpecialRequests], [SubmittedAt] FROM [OrderDetails]" + Dim sql : sql = "Select [BlueDeliveryDate], [BlueEnvelopeProvider], [BlueHasNonprofitStatus], [BlueNonprofitAuthCode], [BluePermitCity], [BluePermitClass], [BluePermitNumber], [BluePermitOwnership], [BluePrintPermit], [BluePrintReturnAddress], [BlueWantsQuote], [ContactName], [FutureVoterStickerRolls], [IVotedStickerRolls], [MailingEstimatedQuantity], [MailingHasNonprofitStatus], [MailingNonprofitAuthCode], [MailingNonprofitAuthCodeUnknown], [MailingPickupDate], [MailingPostageOption], [MailingWantsService], [MailingWantsSorting], [Municipality], [OrderDetailID], [OrderID], [Phone], [PurpleBlueProvider], [PurpleBlueProviderOther], [PurpleColorCodingBy], [PurpleColorNames], [PurpleDeliveryDate], [PurpleEnvelopeProvider], [PurpleEnvelopeStock], [PurpleExtraEnvelopeQty], [PurplePermanentBallotListCount], [PurplePrecinctCount], [PurplePrintOption], [PurplePrintStyle], [PurpleTrackMIBallot], [PurpleWantsBlueEnvelopes], [PurpleWantsQuote], [SecrecySleevesQty], [SpecialRequests], [SubmittedAt] FROM [OrderDetails]" Dim where_keys, where_values, i If Not IsEmpty(where_kvarray) Then KVUnzip where_kvarray, where_keys, where_values @@ -52,7 +52,7 @@ Class OrderDetailsRepository_Class End Function Public Function FindPaged(where_kvarray, order_string_or_array, per_page, page_num, ByRef page_count, ByRef record_count) - Dim sql : sql = "Select [BlueDeliveryDate], [BlueEnvelopeProvider], [BlueHasNonprofitStatus], [BlueNonprofitAuthCode], [BluePermitCity], [BluePermitClass], [BluePermitNumber], [BluePermitOwnership], [BluePrintPermit], [BluePrintReturnAddress], [BlueWantsQuote], [ContactName], [FutureVoterStickerRolls], [IVotedStickerRolls], [MailingEstimatedQuantity], [MailingHasNonprofitStatus], [MailingPickupDate], [MailingPostageOption], [MailingWantsService], [MailingWantsSorting], [Municipality], [OrderDetailID], [OrderID], [Phone], [PurpleBlueProvider], [PurpleBlueProviderOther], [PurpleColorCodingBy], [PurpleColorNames], [PurpleDeliveryDate], [PurpleEnvelopeProvider], [PurpleEnvelopeStock], [PurpleExtraEnvelopeQty], [PurplePermanentBallotListCount], [PurplePrecinctCount], [PurplePrintOption], [PurplePrintStyle], [PurpleTrackMIBallot], [PurpleWantsBlueEnvelopes], [PurpleWantsQuote], [SecrecySleevesQty], [SpecialRequests], [SubmittedAt] FROM [OrderDetails]" + Dim sql : sql = "Select [BlueDeliveryDate], [BlueEnvelopeProvider], [BlueHasNonprofitStatus], [BlueNonprofitAuthCode], [BluePermitCity], [BluePermitClass], [BluePermitNumber], [BluePermitOwnership], [BluePrintPermit], [BluePrintReturnAddress], [BlueWantsQuote], [ContactName], [FutureVoterStickerRolls], [IVotedStickerRolls], [MailingEstimatedQuantity], [MailingHasNonprofitStatus], [MailingNonprofitAuthCode], [MailingNonprofitAuthCodeUnknown], [MailingPickupDate], [MailingPostageOption], [MailingWantsService], [MailingWantsSorting], [Municipality], [OrderDetailID], [OrderID], [Phone], [PurpleBlueProvider], [PurpleBlueProviderOther], [PurpleColorCodingBy], [PurpleColorNames], [PurpleDeliveryDate], [PurpleEnvelopeProvider], [PurpleEnvelopeStock], [PurpleExtraEnvelopeQty], [PurplePermanentBallotListCount], [PurplePrecinctCount], [PurplePrintOption], [PurplePrintStyle], [PurpleTrackMIBallot], [PurpleWantsBlueEnvelopes], [PurpleWantsQuote], [SecrecySleevesQty], [SpecialRequests], [SubmittedAt] FROM [OrderDetails]" Dim where_keys, where_values, i If Not IsEmpty(where_kvarray) Then KVUnzip where_kvarray, where_keys, where_values @@ -77,7 +77,7 @@ Class OrderDetailsRepository_Class End Function Public Function SearchTablePaged(columns_array, search_value, order_string_or_array, per_page, page_num, ByRef page_count, ByRef record_count) - Dim sql : sql = "Select [BlueDeliveryDate], [BlueEnvelopeProvider], [BlueHasNonprofitStatus], [BlueNonprofitAuthCode], [BluePermitCity], [BluePermitClass], [BluePermitNumber], [BluePermitOwnership], [BluePrintPermit], [BluePrintReturnAddress], [BlueWantsQuote], [ContactName], [FutureVoterStickerRolls], [IVotedStickerRolls], [MailingEstimatedQuantity], [MailingHasNonprofitStatus], [MailingPickupDate], [MailingPostageOption], [MailingWantsService], [MailingWantsSorting], [Municipality], [OrderDetailID], [OrderID], [Phone], [PurpleBlueProvider], [PurpleBlueProviderOther], [PurpleColorCodingBy], [PurpleColorNames], [PurpleDeliveryDate], [PurpleEnvelopeProvider], [PurpleEnvelopeStock], [PurpleExtraEnvelopeQty], [PurplePermanentBallotListCount], [PurplePrecinctCount], [PurplePrintOption], [PurplePrintStyle], [PurpleTrackMIBallot], [PurpleWantsBlueEnvelopes], [PurpleWantsQuote], [SecrecySleevesQty], [SpecialRequests], [SubmittedAt] FROM [OrderDetails]" + Dim sql : sql = "Select [BlueDeliveryDate], [BlueEnvelopeProvider], [BlueHasNonprofitStatus], [BlueNonprofitAuthCode], [BluePermitCity], [BluePermitClass], [BluePermitNumber], [BluePermitOwnership], [BluePrintPermit], [BluePrintReturnAddress], [BlueWantsQuote], [ContactName], [FutureVoterStickerRolls], [IVotedStickerRolls], [MailingEstimatedQuantity], [MailingHasNonprofitStatus], [MailingNonprofitAuthCode], [MailingNonprofitAuthCodeUnknown], [MailingPickupDate], [MailingPostageOption], [MailingWantsService], [MailingWantsSorting], [Municipality], [OrderDetailID], [OrderID], [Phone], [PurpleBlueProvider], [PurpleBlueProviderOther], [PurpleColorCodingBy], [PurpleColorNames], [PurpleDeliveryDate], [PurpleEnvelopeProvider], [PurpleEnvelopeStock], [PurpleExtraEnvelopeQty], [PurplePermanentBallotListCount], [PurplePrecinctCount], [PurplePrintOption], [PurplePrintStyle], [PurpleTrackMIBallot], [PurpleWantsBlueEnvelopes], [PurpleWantsQuote], [SecrecySleevesQty], [SpecialRequests], [SubmittedAt] FROM [OrderDetails]" Dim i, params() If IsArray(columns_array) And UBound(columns_array) >= 0 Then sql = sql & " WHERE " @@ -112,8 +112,8 @@ Class OrderDetailsRepository_Class End Function Public Sub AddNew(ByRef model) - Dim sql : sql = "INSERT INTO [OrderDetails] ([BlueDeliveryDate], [BlueEnvelopeProvider], [BlueHasNonprofitStatus], [BlueNonprofitAuthCode], [BluePermitCity], [BluePermitClass], [BluePermitNumber], [BluePermitOwnership], [BluePrintPermit], [BluePrintReturnAddress], [BlueWantsQuote], [ContactName], [FutureVoterStickerRolls], [IVotedStickerRolls], [MailingEstimatedQuantity], [MailingHasNonprofitStatus], [MailingPickupDate], [MailingPostageOption], [MailingWantsService], [MailingWantsSorting], [Municipality], [OrderID], [Phone], [PurpleBlueProvider], [PurpleBlueProviderOther], [PurpleColorCodingBy], [PurpleColorNames], [PurpleDeliveryDate], [PurpleEnvelopeProvider], [PurpleEnvelopeStock], [PurpleExtraEnvelopeQty], [PurplePermanentBallotListCount], [PurplePrecinctCount], [PurplePrintOption], [PurplePrintStyle], [PurpleTrackMIBallot], [PurpleWantsBlueEnvelopes], [PurpleWantsQuote], [SecrecySleevesQty], [SpecialRequests], [SubmittedAt]) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)" - DAL.Execute sql, Array(model.BlueDeliveryDate, model.BlueEnvelopeProvider, model.BlueHasNonprofitStatus, model.BlueNonprofitAuthCode, model.BluePermitCity, model.BluePermitClass, model.BluePermitNumber, model.BluePermitOwnership, model.BluePrintPermit, model.BluePrintReturnAddress, model.BlueWantsQuote, model.ContactName, model.FutureVoterStickerRolls, model.IVotedStickerRolls, model.MailingEstimatedQuantity, model.MailingHasNonprofitStatus, model.MailingPickupDate, model.MailingPostageOption, model.MailingWantsService, model.MailingWantsSorting, model.Municipality, model.OrderID, model.Phone, model.PurpleBlueProvider, model.PurpleBlueProviderOther, model.PurpleColorCodingBy, model.PurpleColorNames, model.PurpleDeliveryDate, model.PurpleEnvelopeProvider, model.PurpleEnvelopeStock, model.PurpleExtraEnvelopeQty, model.PurplePermanentBallotListCount, model.PurplePrecinctCount, model.PurplePrintOption, model.PurplePrintStyle, model.PurpleTrackMIBallot, model.PurpleWantsBlueEnvelopes, model.PurpleWantsQuote, model.SecrecySleevesQty, model.SpecialRequests, model.SubmittedAt) + Dim sql : sql = "INSERT INTO [OrderDetails] ([BlueDeliveryDate], [BlueEnvelopeProvider], [BlueHasNonprofitStatus], [BlueNonprofitAuthCode], [BluePermitCity], [BluePermitClass], [BluePermitNumber], [BluePermitOwnership], [BluePrintPermit], [BluePrintReturnAddress], [BlueWantsQuote], [ContactName], [FutureVoterStickerRolls], [IVotedStickerRolls], [MailingEstimatedQuantity], [MailingHasNonprofitStatus], [MailingNonprofitAuthCode], [MailingNonprofitAuthCodeUnknown], [MailingPickupDate], [MailingPostageOption], [MailingWantsService], [MailingWantsSorting], [Municipality], [OrderID], [Phone], [PurpleBlueProvider], [PurpleBlueProviderOther], [PurpleColorCodingBy], [PurpleColorNames], [PurpleDeliveryDate], [PurpleEnvelopeProvider], [PurpleEnvelopeStock], [PurpleExtraEnvelopeQty], [PurplePermanentBallotListCount], [PurplePrecinctCount], [PurplePrintOption], [PurplePrintStyle], [PurpleTrackMIBallot], [PurpleWantsBlueEnvelopes], [PurpleWantsQuote], [SecrecySleevesQty], [SpecialRequests], [SubmittedAt]) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)" + DAL.Execute sql, Array(model.BlueDeliveryDate, model.BlueEnvelopeProvider, model.BlueHasNonprofitStatus, model.BlueNonprofitAuthCode, model.BluePermitCity, model.BluePermitClass, model.BluePermitNumber, model.BluePermitOwnership, model.BluePrintPermit, model.BluePrintReturnAddress, model.BlueWantsQuote, model.ContactName, model.FutureVoterStickerRolls, model.IVotedStickerRolls, model.MailingEstimatedQuantity, model.MailingHasNonprofitStatus, model.MailingNonprofitAuthCode, model.MailingNonprofitAuthCodeUnknown, model.MailingPickupDate, model.MailingPostageOption, model.MailingWantsService, model.MailingWantsSorting, model.Municipality, model.OrderID, model.Phone, model.PurpleBlueProvider, model.PurpleBlueProviderOther, model.PurpleColorCodingBy, model.PurpleColorNames, model.PurpleDeliveryDate, model.PurpleEnvelopeProvider, model.PurpleEnvelopeStock, model.PurpleExtraEnvelopeQty, model.PurplePermanentBallotListCount, model.PurplePrecinctCount, model.PurplePrintOption, model.PurplePrintStyle, model.PurpleTrackMIBallot, model.PurpleWantsBlueEnvelopes, model.PurpleWantsQuote, model.SecrecySleevesQty, model.SpecialRequests, model.SubmittedAt) ' Retrieve the newly inserted ID On Error Resume Next @@ -132,8 +132,8 @@ Class OrderDetailsRepository_Class End Sub Public Sub Update(model) - Dim sql : sql = "UPDATE [OrderDetails] SET [BlueDeliveryDate] = ?, [BlueEnvelopeProvider] = ?, [BlueHasNonprofitStatus] = ?, [BlueNonprofitAuthCode] = ?, [BluePermitCity] = ?, [BluePermitClass] = ?, [BluePermitNumber] = ?, [BluePermitOwnership] = ?, [BluePrintPermit] = ?, [BluePrintReturnAddress] = ?, [BlueWantsQuote] = ?, [ContactName] = ?, [FutureVoterStickerRolls] = ?, [IVotedStickerRolls] = ?, [MailingEstimatedQuantity] = ?, [MailingHasNonprofitStatus] = ?, [MailingPickupDate] = ?, [MailingPostageOption] = ?, [MailingWantsService] = ?, [MailingWantsSorting] = ?, [Municipality] = ?, [OrderID] = ?, [Phone] = ?, [PurpleBlueProvider] = ?, [PurpleBlueProviderOther] = ?, [PurpleColorCodingBy] = ?, [PurpleColorNames] = ?, [PurpleDeliveryDate] = ?, [PurpleEnvelopeProvider] = ?, [PurpleEnvelopeStock] = ?, [PurpleExtraEnvelopeQty] = ?, [PurplePermanentBallotListCount] = ?, [PurplePrecinctCount] = ?, [PurplePrintOption] = ?, [PurplePrintStyle] = ?, [PurpleTrackMIBallot] = ?, [PurpleWantsBlueEnvelopes] = ?, [PurpleWantsQuote] = ?, [SecrecySleevesQty] = ?, [SpecialRequests] = ?, [SubmittedAt] = ? WHERE [OrderDetailID] = ?" - DAL.Execute sql, Array(model.BlueDeliveryDate, model.BlueEnvelopeProvider, model.BlueHasNonprofitStatus, model.BlueNonprofitAuthCode, model.BluePermitCity, model.BluePermitClass, model.BluePermitNumber, model.BluePermitOwnership, model.BluePrintPermit, model.BluePrintReturnAddress, model.BlueWantsQuote, model.ContactName, model.FutureVoterStickerRolls, model.IVotedStickerRolls, model.MailingEstimatedQuantity, model.MailingHasNonprofitStatus, model.MailingPickupDate, model.MailingPostageOption, model.MailingWantsService, model.MailingWantsSorting, model.Municipality, model.OrderID, model.Phone, model.PurpleBlueProvider, model.PurpleBlueProviderOther, model.PurpleColorCodingBy, model.PurpleColorNames, model.PurpleDeliveryDate, model.PurpleEnvelopeProvider, model.PurpleEnvelopeStock, model.PurpleExtraEnvelopeQty, model.PurplePermanentBallotListCount, model.PurplePrecinctCount, model.PurplePrintOption, model.PurplePrintStyle, model.PurpleTrackMIBallot, model.PurpleWantsBlueEnvelopes, model.PurpleWantsQuote, model.SecrecySleevesQty, model.SpecialRequests, model.SubmittedAt, model.OrderDetailID) + Dim sql : sql = "UPDATE [OrderDetails] SET [BlueDeliveryDate] = ?, [BlueEnvelopeProvider] = ?, [BlueHasNonprofitStatus] = ?, [BlueNonprofitAuthCode] = ?, [BluePermitCity] = ?, [BluePermitClass] = ?, [BluePermitNumber] = ?, [BluePermitOwnership] = ?, [BluePrintPermit] = ?, [BluePrintReturnAddress] = ?, [BlueWantsQuote] = ?, [ContactName] = ?, [FutureVoterStickerRolls] = ?, [IVotedStickerRolls] = ?, [MailingEstimatedQuantity] = ?, [MailingHasNonprofitStatus] = ?, [MailingNonprofitAuthCode] = ?, [MailingNonprofitAuthCodeUnknown] = ?, [MailingPickupDate] = ?, [MailingPostageOption] = ?, [MailingWantsService] = ?, [MailingWantsSorting] = ?, [Municipality] = ?, [OrderID] = ?, [Phone] = ?, [PurpleBlueProvider] = ?, [PurpleBlueProviderOther] = ?, [PurpleColorCodingBy] = ?, [PurpleColorNames] = ?, [PurpleDeliveryDate] = ?, [PurpleEnvelopeProvider] = ?, [PurpleEnvelopeStock] = ?, [PurpleExtraEnvelopeQty] = ?, [PurplePermanentBallotListCount] = ?, [PurplePrecinctCount] = ?, [PurplePrintOption] = ?, [PurplePrintStyle] = ?, [PurpleTrackMIBallot] = ?, [PurpleWantsBlueEnvelopes] = ?, [PurpleWantsQuote] = ?, [SecrecySleevesQty] = ?, [SpecialRequests] = ?, [SubmittedAt] = ? WHERE [OrderDetailID] = ?" + DAL.Execute sql, Array(model.BlueDeliveryDate, model.BlueEnvelopeProvider, model.BlueHasNonprofitStatus, model.BlueNonprofitAuthCode, model.BluePermitCity, model.BluePermitClass, model.BluePermitNumber, model.BluePermitOwnership, model.BluePrintPermit, model.BluePrintReturnAddress, model.BlueWantsQuote, model.ContactName, model.FutureVoterStickerRolls, model.IVotedStickerRolls, model.MailingEstimatedQuantity, model.MailingHasNonprofitStatus, model.MailingNonprofitAuthCode, model.MailingNonprofitAuthCodeUnknown, model.MailingPickupDate, model.MailingPostageOption, model.MailingWantsService, model.MailingWantsSorting, model.Municipality, model.OrderID, model.Phone, model.PurpleBlueProvider, model.PurpleBlueProviderOther, model.PurpleColorCodingBy, model.PurpleColorNames, model.PurpleDeliveryDate, model.PurpleEnvelopeProvider, model.PurpleEnvelopeStock, model.PurpleExtraEnvelopeQty, model.PurplePermanentBallotListCount, model.PurplePrecinctCount, model.PurplePrintOption, model.PurplePrintStyle, model.PurpleTrackMIBallot, model.PurpleWantsBlueEnvelopes, model.PurpleWantsQuote, model.SecrecySleevesQty, model.SpecialRequests, model.SubmittedAt, model.OrderDetailID) End Sub Public Sub Delete(id) diff --git a/app/models/OrderMailer.asp b/app/models/OrderMailer.asp index 4747211..4d7d7f2 100644 --- a/app/models/OrderMailer.asp +++ b/app/models/OrderMailer.asp @@ -92,15 +92,10 @@ Class OrderMailer_Class End If If IsTrue(model.BlueWantsQuote) Then - ' Nonprofit status (and the auth code that follows a "Yes") is asked for either - ' permit-ownership branch. City/permit number are additionally collected for an - ' own-organization permit - a permit lookup can't be done from the nonprofit - ' authorization code alone. + ' City/permit number are collected for an own-organization permit - a permit + ' lookup can't be done from the nonprofit authorization code alone. Dim bluePermitLine bluePermitLine = "" - If CStr(model.BlueHasNonprofitStatus & "") = "Yes" Then - bluePermitLine = EmailRow("Nonprofit authorization code", model.BlueNonprofitAuthCode) - End If If LabelPermitOwnership(model.BluePermitOwnership) = "My organization's permit" Then bluePermitLine = bluePermitLine & _ EmailRow("City of permit holder", model.BluePermitCity) & _ @@ -115,9 +110,20 @@ Class OrderMailer_Class End If If IsTrue(model.MailingWantsService) Then + Dim mailingAuthCodeLine + mailingAuthCodeLine = "" + If CStr(model.MailingHasNonprofitStatus & "") = "Yes" Then + If IsTrue(model.MailingNonprofitAuthCodeUnknown) Then + mailingAuthCodeLine = EmailRow("Nonprofit authorization code", "Unknown - customer needs help") + Else + mailingAuthCodeLine = EmailRow("Nonprofit authorization code", model.MailingNonprofitAuthCode) + End If + End If + html = html & EmailSection("Ballot Mailing Service", _ EmailRow("Postage", LabelPostageOption(model.MailingPostageOption)) & _ EmailRow("Nonprofit status with USPS", LabelNonprofitStatus(model.MailingHasNonprofitStatus)) & _ + mailingAuthCodeLine & _ EmailRow("Estimated quantity", model.MailingEstimatedQuantity) & _ EmailRow("Preferred pickup date", EmailDate(model.MailingPickupDate))) End If diff --git a/app/models/POBO_OrderDetails.asp b/app/models/POBO_OrderDetails.asp index fe26f47..80500b7 100644 --- a/app/models/POBO_OrderDetails.asp +++ b/app/models/POBO_OrderDetails.asp @@ -26,6 +26,8 @@ Class POBO_OrderDetails Private pIVotedStickerRolls Private pMailingEstimatedQuantity Private pMailingHasNonprofitStatus + Private pMailingNonprofitAuthCode + Private pMailingNonprofitAuthCodeUnknown Private pMailingPickupDate Private pMailingPostageOption Private pMailingWantsService @@ -70,6 +72,8 @@ Class POBO_OrderDetails pIVotedStickerRolls = 0 pMailingEstimatedQuantity = 0 pMailingHasNonprofitStatus = Null + pMailingNonprofitAuthCode = Null + pMailingNonprofitAuthCodeUnknown = False pMailingPickupDate = Null pMailingPostageOption = Null pMailingWantsService = Null @@ -96,7 +100,7 @@ Class POBO_OrderDetails pSecrecySleevesQty = 0 pSpecialRequests = Null pSubmittedAt = #1/1/1970# - Properties = Array("BlueDeliveryDate","BlueEnvelopeProvider","BlueHasNonprofitStatus","BlueNonprofitAuthCode","BluePermitCity","BluePermitClass","BluePermitNumber","BluePermitOwnership","BluePrintPermit","BluePrintReturnAddress","BlueWantsQuote","ContactName","FutureVoterStickerRolls","IVotedStickerRolls","MailingEstimatedQuantity","MailingHasNonprofitStatus","MailingPickupDate","MailingPostageOption","MailingWantsService","MailingWantsSorting","Municipality","OrderDetailID","OrderID","Phone","PurpleBlueProvider","PurpleBlueProviderOther","PurpleColorCodingBy","PurpleColorNames","PurpleDeliveryDate","PurpleEnvelopeProvider","PurpleEnvelopeStock","PurpleExtraEnvelopeQty","PurplePermanentBallotListCount","PurplePrecinctCount","PurplePrintOption","PurplePrintStyle","PurpleTrackMIBallot","PurpleWantsBlueEnvelopes","PurpleWantsQuote","SecrecySleevesQty","SpecialRequests","SubmittedAt") + Properties = Array("BlueDeliveryDate","BlueEnvelopeProvider","BlueHasNonprofitStatus","BlueNonprofitAuthCode","BluePermitCity","BluePermitClass","BluePermitNumber","BluePermitOwnership","BluePrintPermit","BluePrintReturnAddress","BlueWantsQuote","ContactName","FutureVoterStickerRolls","IVotedStickerRolls","MailingEstimatedQuantity","MailingHasNonprofitStatus","MailingNonprofitAuthCode","MailingNonprofitAuthCodeUnknown","MailingPickupDate","MailingPostageOption","MailingWantsService","MailingWantsSorting","Municipality","OrderDetailID","OrderID","Phone","PurpleBlueProvider","PurpleBlueProviderOther","PurpleColorCodingBy","PurpleColorNames","PurpleDeliveryDate","PurpleEnvelopeProvider","PurpleEnvelopeStock","PurpleExtraEnvelopeQty","PurplePermanentBallotListCount","PurplePrecinctCount","PurplePrintOption","PurplePrintStyle","PurpleTrackMIBallot","PurpleWantsBlueEnvelopes","PurpleWantsQuote","SecrecySleevesQty","SpecialRequests","SubmittedAt") End Sub Public Property Get PrimaryKey() @@ -371,6 +375,36 @@ Class POBO_OrderDetails On Error GoTo 0 End Property + Public Property Get MailingNonprofitAuthCode() + MailingNonprofitAuthCode = pMailingNonprofitAuthCode + End Property + + Public Property Let MailingNonprofitAuthCode(val) + On Error Resume Next + pMailingNonprofitAuthCode = val ' kept as text - authorization codes may have leading zeros + If Err.Number <> 0 Then + Err.Raise Err.Number, "POBO_OrderDetails.MailingNonprofitAuthCode", "Invalid value for MailingNonprofitAuthCode: " & Err.Description + End If + On Error GoTo 0 + End Property + + Public Property Get MailingNonprofitAuthCodeUnknown() + MailingNonprofitAuthCodeUnknown = pMailingNonprofitAuthCodeUnknown + End Property + + Public Property Let MailingNonprofitAuthCodeUnknown(val) + On Error Resume Next + If IsNull(val) Then + pMailingNonprofitAuthCodeUnknown = Null + Else + pMailingNonprofitAuthCodeUnknown = CBool(val) + End If + If Err.Number <> 0 Then + Err.Raise Err.Number, "POBO_OrderDetails.MailingNonprofitAuthCodeUnknown", "Invalid value for MailingNonprofitAuthCodeUnknown: " & Err.Description + End If + On Error GoTo 0 + End Property + Public Property Get MailingPickupDate() MailingPickupDate = pMailingPickupDate End Property diff --git a/app/views/Order/continue.asp b/app/views/Order/continue.asp index 3d06750..0f27d62 100644 --- a/app/views/Order/continue.asp +++ b/app/views/Order/continue.asp @@ -246,12 +246,6 @@ { value: "Unsure", text: "Unsure (That's okay, we can help you!)" } ] }, - { - type: "text", name: "BlueNonprofitAuthCode", - title: "Please provide your nonprofit authorization code.", - visibleIf: "{BlueHasNonprofitStatus} = 'Yes'", - isRequired: true - }, { type: "text", name: "BluePermitCity", title: "City of permit holder", description: "A permit lookup can't be done from the authorization code alone, so please also provide the following information.", @@ -297,6 +291,19 @@ { value: "NotSure", text: "I'm not sure (that's okay, we can help you!)" } ] }, + { + type: "text", name: "MailingNonprofitAuthCode", + title: "Please provide your nonprofit authorization code.", + visibleIf: "{MailingHasNonprofitStatus} = 'Yes' and {MailingNonprofitAuthCodeUnknown} <> true", + isRequired: true + }, + { + type: "boolean", name: "MailingNonprofitAuthCodeUnknown", + title: "I don't know my authorization code", + renderAs: "checkbox", + visibleIf: "{MailingHasNonprofitStatus} = 'Yes'", + defaultValue: false + }, { type: "text", name: "MailingEstimatedQuantity", title: "Please provide your estimated quantity.", diff --git a/db/migrations/20260821085700_add_mailing_nonprofit_auth_code_fields.asp b/db/migrations/20260821085700_add_mailing_nonprofit_auth_code_fields.asp new file mode 100644 index 0000000..07d3e7c --- /dev/null +++ b/db/migrations/20260821085700_add_mailing_nonprofit_auth_code_fields.asp @@ -0,0 +1,38 @@ +<% +'======================================================================================================================= +' MIGRATION: add_mailing_nonprofit_auth_code_fields +'======================================================================================================================= +' This migration was auto-generated. Add your migration logic below. +' +' The migration object provides these helper methods: +' - migration.ExecuteSQL(sql) - Execute raw SQL +' - migration.CreateTable(name, columns) - Create a table +' - migration.DropTable(name) - Drop a table +' - migration.AddColumn(table, column, type) - Add a column +' - migration.DropColumn(table, column) - Drop a column +' - migration.CreateIndex(name, table, columns) - Create an index +' - migration.DropIndex(name, table) - Drop an index +' +' For complex operations, use migration.DB to access the database directly: +' migration.DB.Execute "INSERT INTO users (name) VALUES (?)", Array("John") +' + +'----------------------------------------------------------------------------------------------------------------------- +' UP - Apply the migration +'----------------------------------------------------------------------------------------------------------------------- +Sub Migration_Up(migration) + ' Ballot Mailing Service section (Q4) gains an auth-code follow-up to "Do you have + ' Nonprofit Status with the USPS?", mirroring the Blue AV Envelope section, plus an + ' "I don't know" checkbox that lets the applicant skip providing the code. + migration.AddColumn "OrderDetails", "MailingNonprofitAuthCode", "VARCHAR(100)" + migration.AddColumn "OrderDetails", "MailingNonprofitAuthCodeUnknown", "YESNO" +End Sub + +'----------------------------------------------------------------------------------------------------------------------- +' DOWN - Rollback the migration +'----------------------------------------------------------------------------------------------------------------------- +Sub Migration_Down(migration) + migration.DropColumn "OrderDetails", "MailingNonprofitAuthCodeUnknown" + migration.DropColumn "OrderDetails", "MailingNonprofitAuthCode" +End Sub +%>