Browse Source

Work on accounts web interface

master
olwen 22 years ago
parent
commit
53df3d6031
  1. 25
      C4/Output.pm
  2. 30
      C4/Search.pm
  3. 9
      addborrower.pl

25
C4/Output.pm

@ -12,7 +12,8 @@ $VERSION = 0.01;
@ISA = qw(Exporter);
@EXPORT = qw(&startpage &endpage &mktablehdr &mktableft &mktablerow &mklink
&startmenu &endmenu &mkheadr &center &endcenter &mkform &mkform2 &bold);
&startmenu &endmenu &mkheadr &center &endcenter &mkform &mkform2 &bold
&gotopage);
%EXPORT_TAGS = ( ); # eg: TAG => [ qw!name1 name2! ],
# your exported package globals go here,
@ -54,21 +55,29 @@ sub startpage{
return($string);
}
sub gotopage{
my ($target) = @_;
print "<br>goto target = $target<br>";
my $string = "<META HTTP-EQUIV=Refresh CONTENT=\"0;URL=http:$target\">";
return $string;
}
sub startmenu{
my ($type)=@_;
if ($type eq 'issue'){
open (FILE,'/usr/local/www/hdl/htdocs/includes/issues-top.inc');
if ($type eq 'issue') {
open (FILE,'/usr/local/www/hdl/htdocs/includes/issues-top.inc');
} else {
open (FILE,'/usr/local/www/hdl/htdocs/includes/cat-top.inc');
}
my @string=<FILE>;
close FILE;
my $count=@string;
# $string[$count]="<BLOCKQUOTE>";
# $string[$count]="<BLOCKQUOTE>";
return @string;
}
sub endmenu{
my ($type)=@_;
if ($type eq 'issue'){
@ -92,7 +101,11 @@ sub mktablerow {
my $i=0;
my $string="<tr valign=top bgcolor=$colour>";
while ($i <$cols){
$string=$string."<td>$data[$i]</td>";
if ($data[$i] eq "") {
$string=$string."<td>&nbsp;</td>";
} else {
$string=$string."<td>$data[$i]</td>";
}
$i++;
}
$string=$string."</tr>\n";

30
C4/Search.pm

@ -15,7 +15,7 @@ $VERSION = 0.01;
@ISA = qw(Exporter);
@EXPORT = qw(&CatSearch &BornameSearch &ItemInfo &KeywordSearch &subsearch
&itemdata &bibdata &GetItems &borrdata);
&itemdata &bibdata &GetItems &borrdata &getacctlist);
%EXPORT_TAGS = ( ); # eg: TAG => [ qw!name1 name2! ],
# your exported package globals go here,
@ -355,7 +355,7 @@ sub BornameSearch {
or lower(firstname) like '%$searchstring%'
or lower(othernames) like '%$searchstring%'
order by lower(surname),lower(firstname)";
#print $query,"\n";
print $query,"\n";
my $sth=$dbh->prepare($query);
$sth->execute;
my @results;
@ -375,7 +375,7 @@ sub borrdata {
$cardnumber = uc $cardnumber;
my $dbh=C4Connect;
my $query="Select * from borrowers where cardnumber='$cardnumber'";
# print $query;
#print $query;
my $sth=$dbh->prepare($query);
$sth->execute;
my $data=$sth->fetchrow_hashref;
@ -384,7 +384,29 @@ sub borrdata {
return($data);
}
sub getacctlist {
my ($env,$params) = @_;
my $dbh=C4Connect;
my @acctlines;
my $numlines;
my $query = "Select borrowernumber, date, amount, description,
dispute, accounttype, amountoutstanding, barcode, title
from accountlines,items,biblio
where borrowernumber=$params->{'borrowernumber'}
and accountlines.itemnumber = items.itemnumber
and items.biblionumber = biblio.biblionumber
and accountlines.amountoutstanding<>0";
my $sth=$dbh->prepare($query);
$sth->execute;
my $total=0;
while (my $data=$sth->fetchrow_hashref){
$acctlines[$numlines] = $data;
$numlines++;
$total = $total+ $data->{'amountoutstanding'};
}
return ($numlines,\@acctlines,$total);
}
END { } # module clean-up code here (global destructor)

9
addborrower.pl

@ -10,7 +10,6 @@ use C4::Output;
use C4::Input;
use C4::Database;
use C4::Search;
my $input = new CGI;
print $input->header;
my $data;
@ -19,7 +18,13 @@ my $bcnt;
my $results;
my $cardnumber;
my $action=$input->param('act');
$action="M";
my $target=$input->param('target');
if ($action eq "") {
$action="M";
}
if ($target eq "") {
$target = "addborrower.pl";
}
if ($action eq "M") {
$cardnumber=$input->param('item');
$cardnumber =uc $cardnumber;

Loading…
Cancel
Save