X-Git-Url: http://koha-dev.rot13.org:8081/gitweb/?a=blobdiff_plain;f=serials%2Fmember-search.pl;h=4fa88a0c05a53a7c08068e48a3a58e1ceb7b0a3f;hb=9da4c80b0149a88c14316099515ede2ebdaf7646;hp=f18c2f30c87a5d30ccc02bfee7f9022d13004552;hpb=b3feb54ee073b99565a4e25fd397ff6ed5a0dc78;p=koha_fer diff --git a/serials/member-search.pl b/serials/member-search.pl index f18c2f30c8..4fa88a0c05 100755 --- a/serials/member-search.pl +++ b/serials/member-search.pl @@ -1,5 +1,7 @@ #!/usr/bin/perl +# Parts copyright Catalyst IT 2010 +# # This file is part of Koha. # # Koha is free software; you can redistribute it and/or modify it under the @@ -80,10 +82,13 @@ if (defined $member) { my ($count,$results); -if (C4::Context->preference("IndependantBranches")){ - if (C4::Context->userenv && C4::Context->userenv->{flags} % 2 !=1 && C4::Context->userenv->{'branch'}){ - $$patron{branchcode}=C4::Context->userenv->{'branch'} unless (C4::Context->userenv->{'branch'} eq "insecure"); - } +if ( C4::Context->preference("IndependentBranches") ) { + if ( C4::Context->userenv + && !C4::Context->IsSuperLibrarian() + && C4::Context->userenv->{'branch'} ) + { + $$patron{branchcode} = C4::Context->userenv->{'branch'}; + } } $$patron{firstname}.="\%" if ($$patron{firstname}); $$patron{surname}.="\%" if ($$patron{surname}); @@ -110,18 +115,20 @@ my @resultsdata; $to=($count>$to?$to:$count); my $index=$from; foreach my $borrower(@$results[$from..$to-1]){ - #find out stats - - $$borrower{'dateexpiry'}= C4::Dates->new($$borrower{'dateexpiry'},'iso')->output('syspref'); - - my %row = ( - count => $index++, - %$borrower, - %{$categories_dislay{$$borrower{categorycode}}}, - ); - push(@resultsdata, \%row); + # find out stats + $borrower->{'dateexpiry'}= C4::Dates->new($borrower->{'dateexpiry'},'iso')->output('syspref'); + if ($categories_dislay{$borrower->{'categorycode'}}){ + my %row = ( + count => $index++, + %$borrower, + %{$categories_dislay{$$borrower{categorycode}}}, + ); + push(@resultsdata, \%row); + } + else { + warn $borrower->{'cardnumber'} ." has a bad category code of " . $borrower->{'categorycode'} ."\n"; + } } - if ($$patron{branchcode}){ foreach my $branch (grep{$_->{value} eq $$patron{branchcode}}@$branches){ $$branch{selected}=1;