Skip to content

Commit

Permalink
Use provided transactions collection on reverse ShowHistoryPage
Browse files Browse the repository at this point in the history
If a transactions collection is provided, we want to use that
collection as there could be additional limits applied to it that
using the $Object passed does not account for.
  • Loading branch information
craigkai committed Dec 9, 2024
1 parent 3fc4154 commit 6830c43
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion share/html/Elements/ShowHistoryPage
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,21 @@ my $trans_attachments = {};

$ARGS{'ReverseTxns'} ||= $DECODED_ARGS->{ReverseTxns};
if ( $ARGS{'ReverseTxns'} ) {
$Transactions = $Object->SortedTransactions($ARGS{'ReverseTxns'});
# If transactions are provided, they may have limits already applied, so we defer to
# this collection.
if ( $Transactions ) {
my @sort_fields = ref $Transactions->SortFields eq 'ARRAY'
? @{ $Transactions->SortFields }
: ( $Transactions->SortFields );

my @order_by_cols = map {
{ FIELD => $_, ORDER => $ARGS{'ReverseTxns'} }
} @sort_fields;

$Transactions->OrderByCols(@order_by_cols);
} else {
$Transactions = $Object->SortedTransactions($ARGS{'ReverseTxns'});
}
}

for my $content (@{$AttachmentContent->ItemsArrayRef()}) {
Expand Down

0 comments on commit 6830c43

Please sign in to comment.