From: Ian Walls Date: Tue, 18 Oct 2011 20:13:15 +0000 (-0400) Subject: Bug 6390 Followup: Basket's authorisedby might not be a borrowernumber X-Git-Tag: v3.08.00~498^2~138^2 X-Git-Url: http://koha-dev.rot13.org:8081/gitweb/?a=commitdiff_plain;h=58bdfdb08883eb52777321f883491eaff1493857;p=koha_gimpoz Bug 6390 Followup: Basket's authorisedby might not be a borrowernumber aqbasket.authorisedby is not foreign key constrainted to borrowers.borrowernumber, so if it's anything other than that, vendor search breaks by using an undefined value (GetMember() on an invalid borrowernumber) as a HASH ref. This patch sets the branchcode (the desired value from GetMember) to a blank value, then only changes it if GetMember is defined. In the case where the authorisedby librarian has been deleted, or the value is otherwise invalid, and AcqViewBaskets is set to 'branch', the basket will not appear except to superlibrarians Signed-off-by: Katrin Fischer Invalid borrowernumber in aqbasket.authorisedby no longer breaks search. --- diff --git a/acqui/booksellers.pl b/acqui/booksellers.pl index 2b16fe4bbc..634eb93d57 100755 --- a/acqui/booksellers.pl +++ b/acqui/booksellers.pl @@ -111,7 +111,11 @@ for my $vendor (@suppliers) { for my $basket ( @{$baskets} ) { my $authorisedby = $basket->{authorisedby}; - my $basketbranch = GetMember( borrowernumber => $authorisedby )->{branchcode}; + my $basketbranch = ''; # set a blank branch to start with + if ( GetMember( borrowernumber => $authorisedby ) ) { + # authorisedby may not be a valid borrowernumber; it's not foreign-key constrained! + $basketbranch = GetMember( borrowernumber => $authorisedby )->{branchcode}; + } if ($userenv->{'flags'} & 1 || #user is superlibrarian (haspermission( $uid, { acquisition => q{*} } ) && #user has acq permissions and