From fceea3d2e12537ccb540a2a950a5ada22f73b7bf Mon Sep 17 00:00:00 2001 From: Mike Rylander Date: Tue, 25 Jun 2013 07:44:22 -0400 Subject: [PATCH] Only attempt to map copies once per hold The development of Calculated Proximity Adjustment (CPA) for 2.4 added a "prox" column to action.hold_copy_map (ahcm) to store on variant of copy proximity. That value is calculated at the same time that certain other data structures are set up, and is conceptually tied to them, so the resulting combined data set is used to insert values into the ahcm. However, user configuration can cause that data set to contain non-unique values, where the data structure used previous to CPA was guaranteed to be unique. This lack of uniqueness would then violate a constraint on the achm table. This commit restores the required uniqueness for the purpose of creating the ahcm rows. Signed-off-by: Mike Rylander Signed-off-by: Lebbeous Fogle-Weekley --- .../lib/OpenILS/Application/Storage/Publisher/action.pm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/action.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/action.pm index 240e2ab0f6..9c06c6274e 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/action.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/action.pm @@ -1542,7 +1542,8 @@ sub new_hold_copy_targeter { my $prox_list = create_prox_list( $self, $pu_lib, $all_copies, $hold ); $log->debug( "\tMapping ".scalar(@$all_copies)." potential copies for hold ".$hold->id); for my $prox ( keys %$prox_list ) { - action::hold_copy_map->create( { proximity => $prox, hold => $hold->id, target_copy => $_->id } ) for (@{$$prox_list{$prox}}); + action::hold_copy_map->create( { proximity => $prox, hold => $hold->id, target_copy => $_ } ) + for keys( %{{ map { $_->id => 1 } @{$$prox_list{$prox}} }} ); } #$client->status( new OpenSRF::DomainObject::oilsContinueStatus ); -- 2.43.2