Merge branch 'master' of git.evergreen-ils.org:Evergreen into template-toolkit-opac...
authorBill Erickson <berick@esilibrary.com>
Sun, 11 Sep 2011 22:15:28 +0000 (18:15 -0400)
committerBill Erickson <berick@esilibrary.com>
Sun, 11 Sep 2011 22:15:28 +0000 (18:15 -0400)
1  2 
Open-ILS/src/perlmods/lib/OpenILS/Application/Actor.pm

@@@ -1820,31 -1820,39 +1820,31 @@@ __PACKAGE__->register_method
  );
        
  sub hold_request_count {
 -      my( $self, $client, $login_session, $userid ) = @_;
 -
 -      my( $user_obj, $target, $evt ) = $apputils->checkses_requestor(
 -              $login_session, $userid, 'VIEW_HOLD' );
 -      return $evt if $evt;
 -      
 -
 -      my $holds = $apputils->simple_scalar_request(
 -                      "open-ils.cstore",
 -                      "open-ils.cstore.direct.action.hold_request.search.atomic",
 -                      { 
 -                              usr => $userid,
 -                              fulfillment_time => {"=" => undef },
 -                              cancel_time => undef,
 -                      }
 -      );
 +      my( $self, $client, $authtoken, $user_id ) = @_;
 +    my $e = new_editor(authtoken => $authtoken);
 +    return $e->event unless $e->checkauth;
  
 -      my @ready;
 -      for my $h (@$holds) {
 -              next unless $h->capture_time and $h->current_copy;
 +    $user_id = $e->requestor->id unless defined $user_id;
  
 -              my $copy = $apputils->simple_scalar_request(
 -                      "open-ils.cstore",
 -                      "open-ils.cstore.direct.asset.copy.retrieve",
 -                      $h->current_copy
 -              );
 +    if($e->requestor->id ne $user_id) {
 +        my $user = $e->retrieve_actor_user($user_id);
 +        return $e->event unless $e->allowed('VIEW_HOLD', $user->home_ou);
 +    }
  
 -              if ($copy and $copy->status == 8) {
 -                      push @ready, $h;
 -              }
 -      }
 +    my $holds = $e->json_query({
 +        select => {ahr => ['shelf_time']},
 +        from => 'ahr',
 +        where => {
 +            usr => $user_id,
 +            fulfillment_time => {"=" => undef },
 +            cancel_time => undef,
 +        }
 +    });
  
 -      return { total => scalar(@$holds), ready => scalar(@ready) };
 +      return { 
 +        total => scalar(@$holds), 
 +        ready => scalar(grep { $_->{shelf_time} } @$holds) 
 +    };
  }
  
  __PACKAGE__->register_method(
@@@ -2916,7 -2924,7 +2916,7 @@@ sub new_flesh_user 
                          {stop_date => undef},
                          {stop_date => {'>' => 'now'}}
                      ],
-                     org_unit => $U->get_org_ancestors($e->requestor->ws_ou)
+                     org_unit => $U->get_org_full_path($e->requestor->ws_ou)
                  },
                  {   flesh => 1,
                      flesh_fields => {ausp => ['standing_penalty']}