From: Lebbeous Fogle-Weekley <lebbeous@esilibrary.com> Date: Wed, 1 Feb 2012 21:58:45 +0000 (-0500) Subject: TPAC: Avoid hold placement problems à la 80d5c4a4 X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=efb83e6c54b0cbd00415b23eab0376c130953247;p=evergreen%2Fmasslnc.git TPAC: Avoid hold placement problems à la 80d5c4a4 A commit written in October and merged quickly (80d5c4a4) was designed to avoid problems with a middle layer method that sometimes returns hash refs and sometimes returns array refs. A commit written in September but not merged until January (a663dfed) affected neighboring code, but was not aware of the other code to dance around hash refs and array refs (just read the commit messages of each to see what I mean, with attention to the changes in WWW/EGCatLoader/Account.pm). Signed-off-by: Lebbeous Fogle-Weekley <lebbeous@esilibrary.com> Signed-off-by: Thomas Berezansky <tsbere@mvlc.org> --- diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm index 7b0c1a18eb..489594ce2f 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm @@ -893,15 +893,22 @@ sub attempt_hold_placement { if (ref $result eq 'HASH') { $hdata->{hold_failed_event} = $result->{last_event}; + + if ($result->{age_protected_copy}) { + $hdata->{could_override} = 1; + $hdata->{age_protect} = 1; + } else { + $hdata->{could_override} = $self->test_could_override($hdata->{hold_failed_event}); + } } elsif (ref $result eq 'ARRAY') { - $hdata->{hold_failed_event} = pop @$result; - } + $hdata->{hold_failed_event} = $result->[0]; - if($result->{age_protected_copy}) { - $hdata->{could_override} = 1; - $hdata->{age_protect} = 1; - } else { - $hdata->{could_override} = $self->test_could_override($hdata->{hold_failed_event}); + if ($result->[3]) { # age_protect_only + $hdata->{could_override} = 1; + $hdata->{age_protect} = 1; + } else { + $hdata->{could_override} = $self->test_could_override($hdata->{hold_failed_event}); + } } } }