Ensure the list of hold targets is in the same order as the user data
array provided by the caller for printing the holds receipt. This
allows the UI to pass the hold status (queue pos, ready-for-pickup) and
have the values link to the correct hold when compiling the print
template.
Signed-off-by: Bill Erickson <berickxx@gmail.com>
return undef unless @$targets;
+ # KCLS JBAS-2169 -- Alternate fix for LP#1370694
+ # Sort targets to match target-id order provided by the caller.
+ # This guarantees correct user-data / target linking for active
+ # (i.e. print) hooks.
+ my @tmp;
+ for my $id (@$target_ids) {
+ # circ/hold/usr all have an "id" field.
+ my ($target) = grep {$_->id == $id} @$targets;
+ push(@tmp, $target);
+ }
+ $targets = \@tmp;
+
if ($hook eq 'email.selfcheck.checkout') {
# KCLS JBAS-1728
# Avoid firing passive email events here. Create the events,