Bug 7505 Superlibrarian can't export all biblios when IndependantBranches is enabled
authorFrédéric Demians <f.demians@tamil.fr>
Mon, 6 Feb 2012 19:00:24 +0000 (20:00 +0100)
committerPaul Poulain <paul.poulain@biblibre.com>
Fri, 10 Feb 2012 14:56:15 +0000 (15:56 +0100)
When a Koha user has superlibrarian permissions, and if
IndependantBranches is enabled, in Tools > Export bibliographic and
holdings, this user can't export all biblio records. He will just export
the biblio from the branch he belongs to.

This patch fix that.

To test:

  - Do a ALL records export as superlibrian on a multi-branches Koha instance
  - Examine the resulting MARC file with the tool of your choice (MArcEdit,
    yaz-marcdump, etc.)
  - You will see that 952/995 contains exlusively items from your branch (as
    Koha user)

Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>

tools/export.pl

index 66763d6..d3d8646 100755 (executable)
@@ -47,11 +47,12 @@ my ($template, $loggedinuser, $cookie)
 
        my $limit_ind_branch=(C4::Context->preference('IndependantBranches') &&
               C4::Context->userenv &&
-              C4::Context->userenv->{flags} % 2 !=1  &&
+              !(C4::Context->userenv->{flags} & 1) &&
               C4::Context->userenv->{branch}?1:0);
        my $branches = GetBranches($limit_ind_branch);    
     my $branch                = $query->param("branch") || '';
-       if ( C4::Context->preference("IndependantBranches") ) {
+       if ( C4::Context->preference("IndependantBranches") &&
+         !(C4::Context->userenv->{flags} & 1) ) {
        $branch = C4::Context->userenv->{'branch'};
        }