Bug 26265: (QA follow-up) Remove g option from regex, add few dirs
[koha-equinox.git] / offline_circ / download.pl
index 95c2aea..386faeb 100755 (executable)
@@ -4,22 +4,21 @@
 #
 # This file is part of Koha.
 #
-# Koha is free software; you can redistribute it and/or modify it under the
-# terms of the GNU General Public License as published by the Free Software
-# Foundation; either version 3 of the License, or (at your option) any later
-# version.
+# Koha is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
 #
-# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
-# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
-# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along with
-# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
-# Suite 330, Boston, MA  02111-1307 USA
+# Koha is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
 #
+# You should have received a copy of the GNU General Public License
+# along with Koha; if not, see <http://www.gnu.org/licenses>.
 
 use Modern::Perl;
-use CGI;
+use CGI qw ( -utf8 );
 use JSON;
 use C4::Auth;
 use C4::Output;
@@ -27,8 +26,7 @@ use C4::Context;
 use C4::Koha;
 
 my $query = new CGI;
-my ( $template, $loggedinuser, $cookie, $flags ) =
-  checkauth( $query, undef, { circulate => "circulate_remaining_permissions" },
+checkauth( $query, undef, { circulate => "circulate_remaining_permissions" },
     "intranet" );
 
 my $page     = $query->param('page') || 0;
@@ -39,7 +37,8 @@ my $patrons_query = q{SELECT
     borrowers.borrowernumber, cardnumber, surname, firstname, title,
     othernames, initials, streetnumber, streettype, address, address2, city,
     state, zipcode, country, email, phone, mobile, fax, dateofbirth, branchcode,
-    categorycode, dateenrolled, dateexpiry, gonenoaddress, lost, debarred,
+    categorycode, dateenrolled, dateexpiry, COALESCE(gonenoaddress, 0) AS gonenoaddress,
+    COALESCE(lost, 0) AS lost, debarred,
     debarredcomment, SUM(accountlines.amountoutstanding) AS fine
     FROM borrowers
     LEFT JOIN accountlines ON borrowers.borrowernumber=accountlines.borrowernumber