fixing permissions on scripts
[koha.git] / misc / notifys / contact_history.pl
1 #!/usr/bin/perl
2
3 # Display a history of attempts to contact this borrower
4 # regarding overdues and fines.
5 #
6 # Tony McCrae
7 # tony@katipo.co.nz     5/July/2003
8 # Copyright 2000-2002 Katipo Communications
9 #
10 # This file is part of Koha.
11 #
12 # Koha is free software; you can redistribute it and/or modify it under the
13 # terms of the GNU General Public License as published by the Free Software
14 # Foundation; either version 2 of the License, or (at your option) any later
15 # version.
16 #
17 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
18 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
19 # A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
20 #
21 # You should have received a copy of the GNU General Public License along with
22 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
23 # Suite 330, Boston, MA  02111-1307 USA
24
25 use strict;
26 use CGI;
27
28
29 use C4::Circulation;
30 use C4::Overdues;
31
32 use Data::Dumper;
33
34 my $input = new CGI;
35 my $borrowernumber = $input->param('borrowernumber');
36 my $date= $input->param('date');
37 my $edate=$input->param('edate');
38 print $input->header;
39 if ($borrowernumber) {
40         my $borrower = BorType($borrowernumber);
41         
42
43         my $querystring = "     select  date, method, address, result, message, borrowernumber
44                                         from attempted_contacts
45         where date >= ? and date < ?
46                                         ";
47         
48
49         my $dbh=C4Connect();    
50         my $sth=$dbh->prepare($querystring);
51         $sth->execute($date,$edate);
52
53         while (my $row=$sth->fetchrow_hashref()) {
54                 print "<a href=/cgi-bin/koha/moremember.pl?borrowernumber=$row->{'borrowernumber'}>Borrwer Record</a> ";
55                 if ($row->{'method'} ne 'email'){
56                     my $tidydate=$row->{'date'};
57                     $tidydate=~ s/ /%20/g;
58                     print " &nbsp; <a href=/cgi-bin/koha/printnote.pl?borrowernumber=$row->{'borrowernumber'}&date=$tidydate>Print Note</a><br>";
59                     }
60                 print $row->{'date'}."<br>\n";
61                 print $row->{'method'}."<br>\n";
62                 print $row->{'address'}."<br>\n";
63                 print $row->{'result'}."<br>\n";
64                 print $row->{'message'}."<br>\n";
65                 print "<p><p>";
66                 }
67
68         }
69
70
71