Bug Fixing : export would export no biblios when
authorHenri-Damien LAURENT <henridamien.laurent@biblibre.com>
Tue, 28 Oct 2008 12:11:16 +0000 (13:11 +0100)
committerHenri-Damien LAURENT <henridamien.laurent@biblibre.com>
Mon, 24 Nov 2008 17:08:45 +0000 (18:08 +0100)
IndependantBranches set and user is kohaadmin
I think we can escape defaulting to the userenv Branch with
restricting the list to the user branch

Signed-off-by: Henri-Damien LAURENT <henridamien.laurent@biblibre.com>
tools/export.pl

index b0cf6be..573859a 100755 (executable)
@@ -51,9 +51,6 @@ my ($template, $loggedinuser, $cookie)
               C4::Context->userenv->{branch}?1:0);
        my $branches = GetBranches($limit_ind_branch);    
     my $branch                = $query->param("branch");
-       if ( C4::Context->preference("IndependantBranches") ) {
-       $branch = C4::Context->userenv->{'branch'};
-       }
 
 if ($op eq "export") {
     binmode(STDOUT,":utf8");
@@ -80,8 +77,8 @@ if ($op eq "export") {
         ($itemtype && C4::Context->preference('item-level_itypes'));
     my $query = $items_filter ?
         "SELECT DISTINCT biblioitems.biblionumber
-         FROM biblioitems,items
-         WHERE biblioitems.biblionumber=items.biblionumber "
+         FROM biblioitems JOIN items
+         USING (biblionumber) WHERE 1"
         :
         "SELECT biblioitems.biblionumber FROM biblioitems WHERE biblionumber >0 ";
                   
@@ -123,6 +120,7 @@ if ($op eq "export") {
         $query .= (C4::Context->preference('item-level_itypes')) ? " AND items.itype = ? " : " AND biblioitems.itemtype = ?";
         push @sql_params, $itemtype;
     }
+    warn "$query, @sql_params";
     my $sth = $dbh->prepare($query);
     $sth->execute(@sql_params);