LP#1194860: You have permission to override some of the failed holds. appearing when...
authorBlake Henderson <blake@mobiusconsortium.org>
Mon, 8 Dec 2014 21:52:15 +0000 (15:52 -0600)
committerBen Shum <bshum@biblio.org>
Thu, 11 Jun 2015 01:05:46 +0000 (21:05 -0400)
A quick value check before assigning the override variable.
This should eliminate the OPAC showing the override option
for those who do not have the permission.

Signed-off-by: Blake Henderson <blake@mobiusconsortium.org>
Signed-off-by: Liam Whalen <liam.whalen@bc.libraries.coop>
Signed-off-by: Ben Shum <bshum@biblio.org>
Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm

index 97364ed..3dae3bf 100644 (file)
@@ -1275,7 +1275,10 @@ sub attempt_hold_placement {
                         $hdata->{hold_failed_event} = $result->{last_event};
 
                         if ($result->{age_protected_copy}) {
-                            $hdata->{could_override} = 1;
+                            my %temp = %{$hdata->{hold_failed_event}};
+                            my $theTextcode = $temp{"textcode"};
+                            $theTextcode.=".override";
+                            $hdata->{could_override} = $self->editor->allowed( $theTextcode );
                             $hdata->{age_protect} = 1;
                         } else {
                             $hdata->{could_override} = $result->{place_unfillable} || 
@@ -1285,7 +1288,10 @@ sub attempt_hold_placement {
                         $hdata->{hold_failed_event} = $result->[0];
 
                         if ($result->[3]) { # age_protect_only
-                            $hdata->{could_override} = 1;
+                            my %temp = %{$hdata->{hold_failed_event}};
+                            my $theTextcode = $temp{"textcode"};
+                            $theTextcode.=".override";
+                            $hdata->{could_override} = $self->editor->allowed( $theTextcode );
                             $hdata->{age_protect} = 1;
                         } else {
                             $hdata->{could_override} = $result->[4] || # place_unfillable