Skip to content

Commit e5353f3

Browse files
committed
Merge remote-tracking branch 'origin/hotfix-18.1' into develop
2 parents 997011e + 93bd658 commit e5353f3

File tree

6 files changed

+77
-28
lines changed

6 files changed

+77
-28
lines changed

Rock/Blocks/Types/Mobile/Finance/FinancialBatchDetail.cs

Lines changed: 72 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
using Rock.Common.Mobile.Blocks.Finance.FinancialBatchDetail;
3232
using Rock.Common.Mobile.ViewModel;
3333
using Rock.Data;
34+
using Rock.Lava;
3435
using Rock.Model;
3536
using Rock.Security;
3637
using Rock.SystemGuid;
@@ -96,6 +97,26 @@ namespace Rock.Blocks.Types.Mobile.Finance
9697
Key = AttributeKeys.RequiredControlItemCount,
9798
Order = 7 )]
9899

100+
[DefinedValueField(
101+
"Currency Types",
102+
Description = "The currency type to show in the scan settings page.",
103+
DefinedTypeGuid = SystemGuid.DefinedType.FINANCIAL_CURRENCY_TYPE,
104+
IsRequired = false,
105+
AllowMultiple = true,
106+
DefaultValue = null,
107+
Key = AttributeKeys.CurrencyType,
108+
Order = 8 )]
109+
110+
[DefinedValueField(
111+
"Transaction Source",
112+
Description = "The Transaction Source to show in the scan settings page.",
113+
DefinedTypeGuid = SystemGuid.DefinedType.FINANCIAL_SOURCE_TYPE,
114+
IsRequired = false,
115+
AllowMultiple = true,
116+
DefaultValue = null,
117+
Key = AttributeKeys.TransactionSource,
118+
Order = 9 )]
119+
99120
#endregion
100121

101122
[Rock.SystemGuid.EntityTypeGuid( Rock.SystemGuid.EntityType.MOBILE_FINANCE_FINANCIAL_BATCH_DETAIL_BLOCK_TYPE )]
@@ -108,6 +129,8 @@ public class FinancialBatchDetail : RockBlockType
108129

109130
#endregion
110131

132+
#region Keys
133+
111134
/// <summary>
112135
/// Keys for the attributes used in this block.
113136
/// </summary>
@@ -147,13 +170,25 @@ private static class AttributeKeys
147170
/// The key for the Accounts Allocation Required attribute.
148171
/// </summary>
149172
public const string AccountAllocationRequired = "AccountAllocationRequired";
173+
174+
/// <summary>
175+
/// The key for the Currency Types attribute.
176+
/// </summary>
177+
public const string CurrencyType = "CurrencyTypes";
178+
179+
/// <summary>
180+
/// The key for the Transaction Source attribute.
181+
/// </summary>
182+
public const string TransactionSource = "TransactionSource";
150183
}
151184

152185
/// <summary>
153186
/// The authorization action required to reopen a batch.
154187
/// </summary>
155188
private const string AuthorizationReopenBatch = "ReopenBatch";
156189

190+
#endregion
191+
157192
#region Methods
158193

159194
private bool TryGetEntityForEditAction( string idKey, RockContext rockContext, out FinancialBatch entity, out BlockActionResult error )
@@ -756,7 +791,7 @@ public BlockActionResult ProcessImage( ProcessImageBag processImageBag )
756791
{
757792
ProcessImageAndGenerateTransaction( processImageBag, image );
758793
}
759-
catch (Exception ex)
794+
catch ( Exception ex )
760795
{
761796
ExceptionLogService.LogException( ex );
762797
// If the image could not be loaded, return an error.
@@ -802,22 +837,48 @@ public override object GetMobileConfigurationValues()
802837
{
803838
var isCheckScannerConfigured = GetAttributeValue( AttributeKeys.ApiKey ).IsNotNullOrWhiteSpace() && GetAttributeValue( AttributeKeys.EndPoint ).IsNotNullOrWhiteSpace();
804839

805-
var cashCurrencyType = DefinedValueCache.Get( SystemGuid.DefinedValue.CURRENCY_TYPE_CASH.AsGuid() );
806-
var checkCurrencyType = DefinedValueCache.Get( SystemGuid.DefinedValue.CURRENCY_TYPE_CHECK.AsGuid() );
840+
var selectedCurrencyType = GetAttributeValue( AttributeKeys.CurrencyType );
841+
var selectedTransactionSource = GetAttributeValue( AttributeKeys.TransactionSource );
807842

808-
if ( cashCurrencyType == null || checkCurrencyType == null )
843+
var currencyTypeGuids = selectedCurrencyType.SplitDelimitedValues().Select( s => s.ConvertToGuidOrThrow() ).ToList();
844+
List<ListItemViewModel> currencyType = new List<ListItemViewModel>();
845+
if ( currencyTypeGuids.Count == 0 )
809846
{
810-
throw new Exception( "Cash or currency type is not defined." );
847+
currencyType = DefinedTypeCache.Get( SystemGuid.DefinedType.FINANCIAL_CURRENCY_TYPE ).DefinedValues
848+
.Select( dv => new ListItemViewModel
849+
{
850+
Text = dv.Value,
851+
Value = dv.Guid.ToString(),
852+
} ).ToList();
853+
}
854+
else
855+
{
856+
currencyType = DefinedValueCache.GetMany( currencyTypeGuids ).Select( dv => new ListItemViewModel
857+
{
858+
Text = dv.Value,
859+
Value = dv.Guid.ToString(),
860+
} ).ToList();
811861
}
812862

813-
var transactionSources = DefinedTypeCache.Get( SystemGuid.DefinedType.FINANCIAL_SOURCE_TYPE.AsGuid() )
814-
.DefinedValues
863+
var transactionSourceGuids = selectedTransactionSource.SplitDelimitedValues().Select( s => s.ConvertToGuidOrThrow() ).ToList();
864+
List<ListItemViewModel> transactionSources = new List<ListItemViewModel>();
865+
if ( transactionSourceGuids.Count == 0 )
866+
{
867+
transactionSources = DefinedTypeCache.Get( SystemGuid.DefinedType.FINANCIAL_SOURCE_TYPE ).DefinedValues
815868
.Select( dv => new ListItemViewModel
816869
{
817870
Text = dv.Value,
818-
Value = dv.IdKey
819-
} )
820-
.ToList();
871+
Value = dv.IdKey,
872+
} ).ToList();
873+
}
874+
else
875+
{
876+
transactionSources = DefinedValueCache.GetMany( transactionSourceGuids ).Select( dv => new ListItemViewModel
877+
{
878+
Text = dv.Value,
879+
Value = dv.IdKey,
880+
} ).ToList();
881+
}
821882

822883
return new Rock.Common.Mobile.Blocks.Finance.FinancialBatchDetail.Configuration
823884
{
@@ -827,19 +888,7 @@ public override object GetMobileConfigurationValues()
827888
CheckScannerEnabled = isCheckScannerConfigured,
828889
TransactionDetailPageGuid = GetAttributeValue( AttributeKeys.DetailPage ).AsGuidOrNull(),
829890
Accounts = GetAvailableAccounts( RockContext ),
830-
CurrencyTypes = new List<ListItemViewModel>()
831-
{
832-
new ListItemViewModel
833-
{
834-
Text = cashCurrencyType.Value,
835-
Value = cashCurrencyType.Guid.ToString()
836-
},
837-
new ListItemViewModel
838-
{
839-
Text = checkCurrencyType.Value,
840-
Value = checkCurrencyType.Guid.ToString()
841-
}
842-
},
891+
CurrencyTypes = currencyType,
843892
TransactionSources = transactionSources,
844893
};
845894
}

RockWeb/Themes/Flat/Assets/Lava/GroupDetail.lava

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@
8787
<ul>
8888
{% for member in Group.Members %}
8989

90-
{% if member.GroupRole.IsLeader %}
90+
{% if member.GroupRole.IsLeader and member.GroupMemberStatus == 'Active' %}
9191
<li>
9292
{{ member.Person.FullName }} <small>({{ member.GroupRole.Name }})</small>
9393
</li>

RockWeb/Themes/Rock/Assets/Lava/GroupDetail.lava

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@
8787
<ul>
8888
{% for member in Group.Members %}
8989

90-
{% if member.GroupRole.IsLeader %}
90+
{% if member.GroupRole.IsLeader and member.GroupMemberStatus == 'Active' %}
9191
<li>
9292
{{ member.Person.FullName }} <small>({{ member.GroupRole.Name }})</small>
9393
</li>

RockWeb/Themes/RockManager/Assets/Lava/GroupDetail.lava

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@
8787
<ul>
8888
{% for member in Group.Members %}
8989

90-
{% if member.GroupRole.IsLeader %}
90+
{% if member.GroupRole.IsLeader and member.GroupMemberStatus == 'Active' %}
9191
<li>
9292
{{ member.Person.FullName }} <small>({{ member.GroupRole.Name }})</small>
9393
</li>

RockWeb/Themes/RockNextGen/Assets/Lava/GroupDetail.lava

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@
8787
<ul>
8888
{% for member in Group.Members %}
8989

90-
{% if member.GroupRole.IsLeader %}
90+
{% if member.GroupRole.IsLeader and member.GroupMemberStatus == 'Active' %}
9191
<li>
9292
{{ member.Person.FullName }} <small>({{ member.GroupRole.Name }})</small>
9393
</li>

RockWeb/Themes/Stark/Assets/Lava/GroupDetail.lava

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@
8484
<ul>
8585
{% for member in Group.Members %}
8686

87-
{% if member.GroupRole.IsLeader %}
87+
{% if member.GroupRole.IsLeader and member.GroupMemberStatus == 'Active' %}
8888
<li>
8989
{{ member.Person.FullName }} <small>({{ member.GroupRole.Name }})</small>
9090
</li>

0 commit comments

Comments
 (0)