don t display the 1 in location column if there is only 1 item : it's useless & confu...
[koha.git] / misc / notifys / printnote.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 lib ('/usr/local/koha/intranet/modules');
26 use strict;
27 use CGI;
28
29
30 use C4::Circulation;
31 use C4::Overdues;
32
33 my $input = new CGI;
34 my $borrowernumber = $input->param('borrowernumber');
35 my $date= $input->param('date');
36 print $input->header;
37 if ($borrowernumber) {
38         my $borrower = BorType($borrowernumber);
39         my $dbh=C4Connect();    
40         my $querystring = "select * from borrowers where borrowernumber = ?";
41         my $sth=$dbh->prepare($querystring);
42         $sth->execute($borrowernumber);    
43        my $row=$sth->fetchrow_hashref();
44 #     print "<body background=/images/letterhead.jpg> <p> <p> <p>";
45     print "
46   <html>
47   <head>
48   <title></title>
49   <style type=\"text/css\">
50   body {
51       padding:0
52         margin:0
53         }
54 .content {
55     padding-left:30px;
56     padding-right:20px
57       }
58
59 @ media print {
60     .content {
61         padding-left:20px;
62         padding-right:20px
63           }
64     }
65 </style>
66   </head>
67   <body>";
68     print "<img src=\"/images/letterhead.jpg\"><br>";
69     print "<p> &nbsp; <p> &nbsp; <p>\n ";
70     print "<div class=\"content\">$row->{'firstname'} $row->{'surname'}<br>
71     $row->{'streetaddress'}<br>
72     $row->{'city'}<p> &nbsp; <p>";
73         $sth->finish();
74
75         $querystring = "        select  date, method, address, result, message, borrowernumber
76                                         from attempted_contacts
77         where date = ? and borrowernumber= ?
78                                         ";
79         
80
81         
82         $sth=$dbh->prepare($querystring);
83         $sth->execute($date,$borrowernumber);
84
85         $row=$sth->fetchrow_hashref();
86 #               print $row->{'date'}."<br>\n";
87 #               print $row->{'method'}."<br>\n";
88 #               print $row->{'address'}."<br>\n";
89 #               print $row->{'result'}."<br>\n";
90                 print $row->{'message'}."<br>\n";
91                 print "<p><p>";
92
93 #print $querystring,$date,$borrowernumber;
94         }
95
96
97