bug 4036: do not count item overdue if it is due today
[koha_fer] / tools / export.pl
index 8cb495f..66d1acc 100755 (executable)
@@ -47,7 +47,7 @@ my ($template, $loggedinuser, $cookie)
 
        my $limit_ind_branch=(C4::Context->preference('IndependantBranches') &&
               C4::Context->userenv &&
-              C4::Context->userenv->{flags} !=1  &&
+              C4::Context->userenv->{flags} % 2 !=1  &&
               C4::Context->userenv->{branch}?1:0);
        my $branches = GetBranches($limit_ind_branch);    
     my $branch                = $query->param("branch") || '';
@@ -80,8 +80,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 +123,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);