Merge remote branch 'kc/master' into new/enh/bug_5917
[koha_fer] / circ / overdue.pl
index 4257fdf..f801644 100755 (executable)
@@ -2,6 +2,7 @@
 
 
 # Copyright 2000-2002 Katipo Communications
+# Parts copyright 2010 BibLibre
 #
 # This file is part of Koha.
 #
@@ -14,9 +15,9 @@
 # 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
+# You should have received a copy of the GNU General Public License along
+# with Koha; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 
 use strict;
 use warnings;
@@ -100,7 +101,7 @@ for my $attrcode (grep { /^patron_attr_filter_/ } $input->param) {
 my $have_pattr_filter_data = keys(%cgi_attrcode_to_attrvalues) > 0;
 
 my @patron_attr_filter_loop;   # array of [ domid cgivalue ismany isclone ordinal code description repeatable authorised_value_category ]
-#my @patron_attr_order_loop;    # array of { label => $patron_attr_label, value => $patron_attr_order }
+my @patron_attr_order_loop;    # array of { label => $patron_attr_label, value => $patron_attr_order }
 
 my @sort_roots = qw(borrower title barcode date_due);
 push @sort_roots, map {$_ . " desc"} @sort_roots;
@@ -144,13 +145,13 @@ while (my $row = $sth->fetchrow_hashref) {
         };
     }
 } continue { ++$ordinal }
-#for (@patron_attr_order_loop) { $_->{selected} = 1 if $order eq $_->{value} }
+for (@patron_attr_order_loop) { $_->{selected} = 1 if $order eq $_->{value} }
 
 $template->param(ORDER_LOOP => \@order_loop);
 
 my %borrowernumber_to_attributes;    # hash of { borrowernumber => { attrcode => [ [val,display], [val,display], ... ] } }
                                      #   i.e. val differs from display when attr is an authorised value
-if (0 && @patron_attr_filter_loop) {
+if (@patron_attr_filter_loop) {
     # MAYBE FIXME: currently, *all* borrower_attributes are loaded into %borrowernumber_to_attributes
     #              then filtered and honed down to match the patron attribute filters. If this is
     #              too resource intensive, MySQL can be used to do the filtering, i.e. rewire the
@@ -200,11 +201,12 @@ if (0 && @patron_attr_filter_loop) {
 
 
 $template->param(
+    patron_attr_header_loop => [ map { { header => $_->{description} } } grep { ! $_->{isclone} } @patron_attr_filter_loop ],
     branchloop   => GetBranchesLoop($branchfilter, $onlymine),
     branchfilter => $branchfilter,
     borcatloop=> \@borcatloop,
     itemtypeloop => \@itemtypeloop,
-    patron_attr_filter_loop => \@patron_attr_filter_loop,
+    patron_attr_filter_loop => \@patron_attr_filter_loop,
     borname => $bornamefilter,
     order => $order,
     showall => $showall);
@@ -227,7 +229,15 @@ if ($noreport) {
     $bornamefilter =~s/\?/\_/g;
 
     my $strsth="SELECT date_due,
+        borrowers.title as borrowertitle,
         concat(surname,' ', firstname) as borrower, 
+        borrowers.streetnumber,
+        borrowers.streettype, 
+        borrowers.address,
+        borrowers.address2,
+        borrowers.city,
+        borrowers.zipcode,
+        borrowers.country,
         borrowers.phone,
         borrowers.email,
         issues.itemnumber,
@@ -288,7 +298,15 @@ if ($noreport) {
             borrowernumber         => $data->{borrowernumber},
             barcode                => $data->{barcode},
             itemnum                => $data->{itemnumber},
+            borrowertitle          => $data->{borrowertitle},
             name                   => $data->{borrower},
+            streetnumber           => $data->{streetnumber},                   
+            streettype             => $data->{streettype},                     
+            address                => $data->{address},                        
+            address2               => $data->{address2},                       
+            city                   => $data->{city},                   
+            zipcode                => $data->{zipcode},                        
+            country                => $data->{country},
             phone                  => $data->{phone},
             email                  => $data->{email},
             biblionumber           => $data->{biblionumber},