Skip to content

Commit

Permalink
+ (Finance) Fixed issue with Batch Detail page where the Transaction …
Browse files Browse the repository at this point in the history
…List block was not updated to reflect the Batch status after an update. (Fixes #5601)
  • Loading branch information
Kwame-Agyei committed Nov 28, 2023
1 parent b6bd571 commit e3e7a21
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
17 changes: 17 additions & 0 deletions Rock.Blocks/Finance/FinancialBatchDetail.cs
Original file line number Diff line number Diff line change
Expand Up @@ -531,6 +531,7 @@ public BlockActionResult Save( DetailBlockBox<FinancialBatchBag, FinancialBatchD
}

var isNew = entity.Id == 0;
var isStatusChanged = box.Entity.Status != entity.Status;

var changes = new History.HistoryChangeList();
if ( isNew )
Expand Down Expand Up @@ -585,6 +586,22 @@ public BlockActionResult Save( DetailBlockBox<FinancialBatchBag, FinancialBatchD
} ) );
}

/**
* 11/18/2023 - KA
* If the status has been updated return current page url to trigger
* a page refresh on the client. The Batch Detail block is typically
* used with the Transaction List block and an update may be required
* to reflect the change in the batch's status. This will required some
* refactoring once Obsidian blocks can signal each other.
*/
if ( isStatusChanged )
{
return ActionOk( this.GetCurrentPageUrl( new Dictionary<string, string>
{
[PageParameterKey.BatchId] = entity.IdKey
} ) );
}

// Ensure navigation properties will work now.
entity = entityService.Get( entity.Id );

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@

return true;
}
else if (result.statusCode === 201 && typeof result.data === "string") {
else if ((result.statusCode === 201 || result.statusCode === 200) && typeof result.data === "string") {
return result.data;
}
}
Expand Down

0 comments on commit e3e7a21

Please sign in to comment.