- my $authorisedby = $basket->{authorisedby};
- my $basketbranch = ''; # set a blank branch to start with
- my $member = GetMember( borrowernumber => $authorisedby );
- if ( $member ) {
- $basketbranch = $member->{branchcode};
- }
-
- if ($userenv->{'flags'} & 1 || #user is superlibrarian
- (haspermission( $uid, { acquisition => q{*} } ) && #user has acq permissions and
- ($viewbaskets eq 'all' || #user is allowed to see all baskets
- ($viewbaskets eq 'branch' && $authorisedby && $userbranch eq $basketbranch) || #basket belongs to user's branch
- ($basket->{authorisedby} && $viewbaskets eq 'user' && $authorisedby == $loggedinuser) #user created this basket
- )
- )
- ) {
+ if (CanUserManageBasket($loggedinuser, $basket, $userflags)) {
+ my $patron = Koha::Patrons->find( $basket->{authorisedby} );