This commit is contained in:
chris 2000-01-11 04:13:53 +00:00
parent 6514ec4e62
commit 7c574243b8
8 changed files with 94 additions and 24 deletions

View file

@ -17,7 +17,7 @@ $VERSION = 0.01;
@EXPORT = qw(&CatSearch &BornameSearch &ItemInfo &KeywordSearch &subsearch
&itemdata &bibdata &GetItems &borrdata &getacctlist &itemnodata &itemcount
&OpacSearch &borrdata2 &NewBorrowerNumber &bibitemdata &borrissues
&getboracctrecord &ItemType &itemissues);
&getboracctrecord &ItemType &itemissues &FrontSearch);
%EXPORT_TAGS = ( ); # eg: TAG => [ qw!name1 name2! ],
# your exported package globals go here,
@ -104,25 +104,78 @@ sub OpacSearch {
return($count,@results);
}
sub KeywordSearch {
sub FrontSearch {
my ($env,$type,$search,$num,$offset)=@_;
my $dbh = &C4Connect;
$search->{'keyword'}=~ s/ +$//;
$search->{'keyword'}=~ s/'/\\'/;
my @key=split(' ',$search->{'keyword'});
$search->{'front'}=~ s/ +$//;
$search->{'front'}=~ s/'/\\'/;
my @key=split(' ',$search->{'front'});
my $count=@key;
my $i=1;
my @results;
my $query ="Select * from catalogueentry where entrytype is not NULL and
entrytype<>'a' and entrytype <>'ad' and entrytype<>'aa' and ((catalogueentry
like '$key[0]%' or catalogueentry like '% $key[0]%')
my $query ="Select * from biblio,bibliosubtitle where
biblio.biblionumber=bibliosubtitle.biblionumber and
((title like '$key[0]%' or title like '% $key[0]%'
or subtitle like '$key[0]%' or subtitle like '% $key[0]%'
or author like '$key[0]%' or author like '% $key[0]%')";
while ($i < $count){
$query=$query." and (catalogueentry like '$key[$i]%' or catalogueentry like '% $key[$i]%')";
$query=$query." and (title like '%$key[$i]%' or subtitle like '%$key[$i]%')";
$i++;
}
my $sth=$dbh->execute;
$query=$query.") group by biblio.biblionumber order by author,title";
print $query;
my $sth=$dbh->prepare($query);
$sth->execute;
$i=0;
while (my $data=$sth->fetchrow_hashref){
$results[$i]="$data->{'author'}\t$data->{'title'}\t$data->{'biblionumber'}\t$data->{'copyrightdate'}";
# print $results[$i];
$i++;
}
$sth->finish;
$sth=$dbh->prepare("Select biblionumber from bibliosubject where subject
like '%$search->{'keyword'}%'");
$sth->execute;
while (my $data=$sth->fetchrow_hashref){
my $sth2=$dbh->prepare("Select * from biblio where
biblionumber=$data->{'biblionumber'}");
$sth2->execute;
while (my $data2=$sth2->fetchrow_hashref){
$results[$i]="$data2->{'author'}\t$data2->{'title'}\t$data2->{'biblionumber'}\t$data->{'copyrightdate'}";
# print $results[$i];
$i++;
}
$sth2->finish;
}
my $i2=1;
@results=sort @results;
my @res;
my $count=@results;
$i=1;
$res[0]=$results[0];
while ($i2 < $count){
if ($results[$i2] ne $res[$i-1]){
$res[$i]=$results[$i2];
$i++;
}
$i2++;
}
$i2=0;
my @res2;
$count=@res;
while ($i2 < $num && $i2 < $count){
$res2[$i2]=$res[$i2+$offset];
# print $res2[$i2];
$i2++;
}
$sth->finish;
$dbh->disconnect;
return($i,@res2);
}
sub KeywordSearch {
my ($env,$type,$search,$num,$offset)=@_;
@ -135,7 +188,7 @@ sub KeywordSearch {
my @results;
my $query ="Select * from biblio,bibliosubtitle where
biblio.biblionumber=bibliosubtitle.biblionumber and
((title like '%$key[0]%' or subtitle like '%$key[0]%' or seriestitle)";
((title like '%$key[0]%' or subtitle like '%$key[0]%')";
while ($i < $count){
$query=$query." and (title like '%$key[$i]%' or subtitle like '%$key[$i]%')";
$i++;

View file

@ -37,7 +37,7 @@ while (my $data=$sth->fetchrow_hashref){
#update borrowers corresponding
#update categories
# my $temp=substr($data->{'categorycode'},0,1);
$query="update borrowers set area='H' where categorycode='$data->{'categorycode'}'";
$query="update borrowers set area='V' where categorycode='$data->{'categorycode'}'";
my $sth2=$dbh->prepare($query);
$sth2->execute;
$sth2->finish;

View file

@ -11,7 +11,7 @@ use Date::Manip;
use strict;
my $input= new CGI;
print $input->header;
#print $input->header;
#print $input->dump;
#get all the data into a hash
@ -37,9 +37,9 @@ if (my $data=$sth->fetchrow_hashref){
altrelationship='$data{'altrelationship'}',othernames='$data{'othernames'}',phoneday='$data{'phoneday'}',
categorycode='$data{'categorycode'}',city='$data{'city'}',area='$data{'area'}',phone='$data{'phone'}',
borrowernotes='$data{'borrowernotes'}',altphone='$data{'altphone'}',surname='$data{'surname'}',
initials='$data{'initials'}',streetaddress='$data{'streetaddress'}',ethnicity='$data{'ethnicity'}'
initials='$data{'initials'}',streetaddress='$data{'address'}',ethnicity='$data{'ethnicity'}'
where borrowernumber=$data{'borrowernumber'}";
print $query;
# print $query;
my $sth2=$dbh->prepare($query);
$sth2->execute;
$sth2->finish;

View file

@ -11,7 +11,7 @@ use C4::Search;
my $input = new CGI;
my $member=$input->param('member');
$member=~ s/\,//g;
print $input->header;
#start the page and read in includes
print startpage();

View file

@ -106,7 +106,7 @@ print <<printend
<tr VALIGN=TOP >
<TD colspan=3 align=right>
<nobr>
<a href=/cgi-bin/koha/accounts.pl?bornum=$bornum><img height=42 WIDTH=187 BORDER=0 src="/images/view-account.gif"></a>
<a href=/cgi-bin/koha/boraccount.pl?bornum=$bornum><img height=42 WIDTH=187 BORDER=0 src="/images/view-account.gif"></a>
<a href=/cgi-bin/koha/pay.pl?bornum=$bornum><img height=42 WIDTH=187 BORDER=0 src="/images/pay-fines.gif"></a></nobr>
</td>

1
pay.pl
View file

@ -56,6 +56,7 @@ print <<printend
<input type=radio name=payfine$i value=wo>Writeoff
<input type=hidden name=itemnumber$i value=$accts->[$i]{'itemnumber'}>
<input type=hidden name=accounttype$i value=$accts->[$i]{'accounttype'}>
<input type=hidden name=amount$i value=$accts->[$i]{'amount'}>
<input type=hidden name=bornum value=$bornum>
<input type=hidden name=accountno$i value=$accts->[$i]{'accountno'}>
</td>

View file

@ -33,6 +33,7 @@ my $title=$input->param('title');
$search{'title'}=$title;
my $keyword=$input->param('keyword');
$search{'keyword'}=$keyword;
$search{'front'}=$input->param('front');
my $author=$input->param('author');
$search{'author'}=$author;
my $subject=$input->param('subject');
@ -73,7 +74,9 @@ if ($itemnumber ne '' || $isbn ne ''){
if ($keyword ne ''){
# print "hey";
($count,@results)=&KeywordSearch(\$blah,'intra',\%search,$num,$offset);
} else {
} elsif ($search{'front'} ne '') {
($count,@results)&FrontSearch(\$blah,'intra',\%search,$num,$offset);
}else {
($count,@results)=&CatSearch(\$blah,'loose',\%search,$num,$offset);
# print "hey";
}

View file

@ -27,19 +27,20 @@ while ( my ($key, $value) = each %inp){
# print $key,$value;
my $accounttype=$input->param("accounttype$value");
my $itemno=$input->param("itemnumber$value");
my $amount=$input->param("amount$value");
if ($accounttype eq 'Res'){
my $accountno=$input->param("accountno$value");
writeoff($bornum,$accountno,$itemno,$accounttype);
writeoff($bornum,$accountno,$itemno,$accounttype,$amount);
} else {
writeoff($bornum,'',$itemno,$accounttype);
writeoff($bornum,'',$itemno,$accounttype,$amount);
}
}
#print $input->header;
print $input->redirect("/cgi-bin/koha/pay.pl?bornum=$bornum");
#needs to be shifted to a module when time permits
sub writeoff{
my ($bornum,$accountnum,$itemnum,$accounttype)=@_;
my ($bornum,$accountnum,$itemnum,$accounttype,$amount)=@_;
my $dbh=C4Connect;
my $query="Update accountlines set amountoutstanding=0 where ";
if ($accounttype eq 'Res'){
@ -51,5 +52,17 @@ sub writeoff{
# print $query;
$sth->execute;
$sth->finish;
$query="select max(accountno) from accountlines";
$sth=$dbh->prepare($query);
$sth->execute;
my $account=$sth->fetchrow_hashref;
$sth->finish;
$account->{'max(accountno)'}++;
$query="insert into accountlines (borrowernumber,accountno,itemnumber,date,amount,description,accounttype)
values ('$bornum','$account->{'max(accountno)'}','$itemnum',now(),'$amount','Writeoff','W')";
$sth=$dbh->prepare($query);
$sth->execute;
$sth->finish;
# print $query;
$dbh->disconnect;
}