From 20653709c081d426ec24c5c22b6021bcaad58f9a Mon Sep 17 00:00:00 2001 From: Shaun Cummings Date: Thu, 2 Nov 2023 07:46:55 -0600 Subject: [PATCH] + (Finance) Fixed an issue causing transactions entered in the Transaction Entry V2 block to overwrite existing phone numbers. (Fixes #5524) --- .../Blocks/Finance/TransactionEntryV2.ascx.cs | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/RockWeb/Blocks/Finance/TransactionEntryV2.ascx.cs b/RockWeb/Blocks/Finance/TransactionEntryV2.ascx.cs index 60bb80a54fc..e5f6b93b8cc 100644 --- a/RockWeb/Blocks/Finance/TransactionEntryV2.ascx.cs +++ b/RockWeb/Blocks/Finance/TransactionEntryV2.ascx.cs @@ -2185,7 +2185,8 @@ private bool SetInitialTargetPersonControls() acAddressIndividual.SetValues( null ); } - if ( GetAttributeValue( AttributeKey.PromptForPhone ).AsBoolean() ) + var promptForPhone = GetAttributeValue( AttributeKey.PromptForPhone ).AsBoolean(); + if ( promptForPhone ) { var personPhoneNumber = targetPerson.GetPhoneNumber( Rock.SystemGuid.DefinedValue.PERSON_PHONE_TYPE_HOME.AsGuid() ); @@ -2195,6 +2196,26 @@ private bool SetInitialTargetPersonControls() { personPhoneNumber = targetPerson.GetPhoneNumber( Rock.SystemGuid.DefinedValue.PERSON_PHONE_TYPE_MOBILE.AsGuid() ); } + + PhoneNumberBox pnbPhone = pnbPhoneIndividual; + if ( targetPerson.IsBusiness() ) + { + pnbPhone = pnbPhoneBusiness; + } + + if ( personPhoneNumber != null ) + { + if ( !personPhoneNumber.IsUnlisted ) + { + pnbPhone.CountryCode = personPhoneNumber.CountryCode; + pnbPhone.Number = personPhoneNumber.ToString(); + } + } + else + { + pnbPhone.CountryCode = PhoneNumber.DefaultCountryCode(); + pnbPhone.Number = string.Empty; + } } cblSelectBusiness.Items.Clear();