Преглед на файлове

Script to insert data about junior/children into members table

master
chris преди 24 години
родител
ревизия
aab4522837
  1. 2
      C4/Input.pm
  2. 11
      C4/InterfaceCDK.pm
  3. 5
      C4/Reserves2.pm
  4. 9
      C4/Search.pm
  5. 84
      insertjdata.pl
  6. 3
      moremember.pl
  7. 4
      request.pl
  8. 38
      stats.pl
  9. 15
      telnet/borrwraper.pl
  10. 4
      telnet/startint.pl

2
C4/Input.pm

@ -74,7 +74,7 @@ sub checkdigit {
my $temp1 = $weightings[$i-1];
my $temp2 = substr($infl,$i,1);
$sum = $sum + ($temp1*$temp2);
# print "$sum $temp1 $temp2<br>";
# print "$sum $temp1 $temp2<br>";
$i++;
}
my $rem = ($sum%11);

11
C4/InterfaceCDK.pm

@ -175,8 +175,8 @@ sub debug_msg {
my ($env,$text)=@_;
if ($env->{'telnet'} eq "Y") {
popupLabel (["Debug </R>$text"]);
} else {
print "****DEBUG $text****";
# } else {
# print "****DEBUG $text****";
}
return();
}
@ -600,7 +600,9 @@ sub borrbind {
sub preborr {
my ($input,$env, $entry) = @_;
if ($env->{"bcard"} ne "") {
# error_msg($env,"hi there");
if ($input eq $lastval) {
# error_msg($env,"its a ctrl-r");
borfill($env,$entry);
return 0;
}
@ -611,12 +613,13 @@ sub preborr {
sub borfill {
my ($env,$entry) = @_;
#debug_msg("","hi there");
error_msg($env,"in borfill: $env->{'bcard'}");
my $lastborr = $env->{"bcard"};
my $i = 1;
$entry->inject('Input'=>$lastborr);
while ($i < 9) {
$entry->inject('Input'=>substr($lastborr,$i,1));
# my $temp=substr($lastborr,$i,1);
# $entry->inject('Input'=>$temp);
$i++;
}

5
C4/Reserves2.pm

@ -268,12 +268,13 @@ sub updatereserves{
}
sub getreservetitle {
my ($biblio,$bor,$date)=@_;
my ($biblio,$bor,$date,$timestamp)=@_;
my $dbh=C4Connect;
my $query="Select * from reserveconstraints,biblioitems where
reserveconstraints.biblioitemnumber=biblioitems.biblioitemnumber
and reserveconstraints.biblionumber=$biblio and reserveconstraints.borrowernumber
= $bor and reserveconstraints.reservedate='$date'";
= $bor and reserveconstraints.reservedate='$date' and
reserveconstraints.timestamp=$timestamp";
my $sth=$dbh->prepare($query);
$sth->execute;
my $data=$sth->fetchrow_hashref;

9
C4/Search.pm

@ -327,11 +327,12 @@ sub CatSearch {
my $count=@key;
my $i=1;
$query="select count(*) from
biblio,biblioitems
biblio,biblioitems
left join additionalauthors on biblio.biblionumber=additionalauthors.biblionumber
where biblioitems.biblionumber=biblio.biblionumber
and
and biblio.author ne '' and
((biblio.author like '$key[0]%' or biblio.author like '% $key[0]%'
)";
)";
while ($i < $count){
$query=$query." and (biblio.author like '$key[$i]%' or biblio.author like '% $key[$i]%'
)";
@ -476,7 +477,7 @@ sub CatSearch {
$sth1->finish;
}
}
#print $query;
print $query;
my $sth=$dbh->prepare($query);

84
insertjdata.pl

@ -0,0 +1,84 @@
#!/usr/bin/perl
#script to enter borrower data into the data base
#needs to be moved into a perl module
# written 9/11/99 by chris@katipo.co.nz
use CGI;
use C4::Database;
use C4::Input;
use Date::Manip;
use strict;
my $input= new CGI;
print $input->header;
#print $input->Dump;
#get all the data into a hash
my @names=$input->param;
my %data;
my $keyfld;
my $keyval;
my $problems;
my $env;
foreach my $key (@names){
$data{$key}=$input->param($key);
}
my $dbh=C4Connect;
for (my $i=0;$i<3;$i++){
my $query="Select * from borrowers where borrowernumber=$data{'bornumber_child_$i'}";
my $sth=$dbh->prepare($query);
$sth->execute;
if (my $data=$sth->fetchrow_hashref){
$query="update borrowers set title='$data{'title'}',expiry='$data{'expiry'}',
cardnumber='$data{'cardnumber'}',sex='$data{'sex'}',ethnotes='$data{'ethnicnotes'}',
streetaddress='$data{'address'}',faxnumber='$data{'faxnumber'}',firstname='$data{'firstname'}',
altnotes='$data{'altnotes'}',dateofbirth='$data{'dateofbirth'}',contactname='$data{'contactname'}',
emailaddress='$data{'emailaddress'}',dateenrolled='$data{'joining'}',streetcity='$data{'streetcity'}',
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{'address'}',ethnicity='$data{'ethnicity'}'
where borrowernumber=$data{'borrowernumber'}";
# print $query;
}elsif ($data{"cardnumber_child_$i"} ne ''){
my $dob=$data{"dateofbirth_child_$i"};
$dob=ParseDate($dob);
$dob=UnixDate($dob,'%Y-%m-%d');
$data{'joining'}=ParseDate("today");
$data{'joining'}=UnixDate($data{'joining'},'%Y-%m-%d');
my $cardnumber=$data{"cardnumber_child_$i"};
my $bornum=$data{"bornumber_child_$i"};
my $firstname=$data{"firstname_child_$i"};
my $surname=$data{"surname_child_$i"};
my $school=$data{"school_child_$i"};
my $guarant=$data{'borrowernumber'};
my $notes=$data{"altnotes_child_$i"};
my $sex=$data{"sex_child_$i"};
$data{'contactname'}=$data{'firstname_guardian'}." ".$data{'surname_guardian'};
$data{'altrelationship'}="Guarantor";
$data{'altphone'}=$data{'phone'};
$query="insert into borrowers (title,expiry,cardnumber,sex,ethnotes,streetaddress,faxnumber,
firstname,altnotes,dateofbirth,contactname,emailaddress,dateenrolled,streetcity,
altrelationship,othernames,phoneday,categorycode,city,area,phone,borrowernotes,altphone,surname,
initials,ethnicity,borrowernumber,guarantor,school)
values ('','$data{'expiry'}',
'$cardnumber',
'$sex','$data{'ethnotes'}','$data{'address'}','$data{'faxnumber'}',
'$firstname','$data{'altnotes'}','$dob','$data{'contactname'}','$data{'emailaddress'}',
'$data{'joining'}','$data{'streetcity'}','$data{'altrelationship'}','$data{'othernames'}',
'$data{'phoneday'}','C','$data{'city'}','$data{'area'}','$data{'phone'}',
'$notes','$data{'altphone'}','$surname','$data{'initials'}',
'$data{'ethnicity'}','$bornum','$guarant','$school')";
}
print $query;
my $sth2=$dbh->prepare($query);
$sth2->execute;
$sth2->finish;
$sth->finish;
}
$dbh->disconnect;
print $input->redirect("/cgi-bin/koha/moremember.pl?bornum=$data{'borrowernumber'}");

3
moremember.pl

@ -43,7 +43,7 @@ if ($data->{'ethnicity'}eq 'asian'){
print <<printend
<FONT SIZE=6><em>$data->{'firstname'} $data->{'surname'}</em></FONT><P>
<p>
<form action=/cgi-bin/koha/wmemberentry.pl method=post>
<form action=/cgi-bin/koha/jmemberentry.pl method=post>
<TABLE CELLSPACING=0 CELLPADDING=5 border=1 align=left width=270>
<TR VALIGN=TOP>
<td bgcolor="99cc33" background="/images/background-mem.gif"><B>MEMBERSHIP RECORD</TD></TR>
@ -51,6 +51,7 @@ print <<printend
<TD>
<p align=right><INPUT TYPE="image" name="submit" VALUE="add-child" height=42 WIDTH=120 BORDER=0 src="/images/add-child.gif">
<input type=hidden name=type value=Add>
<input type=hidden name=bornum value=$data->{'borrowernumber'}>
</form>
</P><br>
<FONT SIZE=2 face="arial, helvetica">$data->{'title'} $data->{'othernames'} $data->{'surname'} ($data->{'firstname'}, $data->{'initials'})<p>

4
request.pl

@ -161,10 +161,12 @@ my $bor=$reserves->[$i]{'borrowernumber'};
my @temp=split('-',$reserves->[$i]{'reservedate'});
$date="$temp[2]/$temp[1]/$temp[0]";
my $type=$reserves->[$i]{'constrainttype'};
#print "test";
if ($type eq 'a'){
$type='Next Available';
} elsif ($type eq 'o'){
my $res=getreservetitle($reserves->[$i]{'biblionumber'},$reserves->[$i]{'borrowernumber'},$reserves->[$i]{'reservedate'});
# print "test";
my $res=getreservetitle($reserves->[$i]{'biblionumber'},$reserves->[$i]{'borrowernumber'},$reserves->[$i]{'reservedate'},$reserves->[$i]{'timestamp'});
$type="This type only $res->{'volumeddesc'} $res->{'itemtype'}";
# my @data=ItemInfo(\$blah,$reserves->[$i]{'borrowernumber'});

38
stats.pl

@ -50,13 +50,13 @@ for (my $i=0;$i<$count;$i++){
my $time="$hour:$min:$sec";
$payments[$i]{'amount'}*=-1;
$total+=$payments[$i]{'amount'};
my @charges=getcharges($payments[$i]{'borrowernumber'},$payments[$i]{'timestamp'});
my $count=@charges;
for (my $i2=0;$i2<$count;$i2++){
print mktablerow(6,'red',$charges[$i2]->{'description'},$charges[$i2]->{'accounttype'},
'',
$charges[$i2]->{'amount'},$charges[$i2]->{'amountoutstanding'});
}
# my @charges=getcharges($payments[$i]{'borrowernumber'},$payments[$i]{'timestamp'});
# my $count=@charges;
# for (my $i2=0;$i2<$count;$i2++){
# print mktablerow(6,'red',$charges[$i2]->{'description'},$charges[$i2]->{'accounttype'},
# '',
# $charges[$i2]->{'amount'},$charges[$i2]->{'amountoutstanding'});
# }
my $time2="$payments[$i]{'date'} $time";
my $branch=Getpaidbranch($time2);
@ -68,18 +68,18 @@ print mktableft;
print endcenter;
print "<p><b>$total</b>";
my $issues=Count('issue','C',$date,$date2);
print "<p>Issues Levin: $issues";
$issues=Count('issue','F',$date,$date2);
print "<br>Issues Foxton: $issues";
$issues=Count('issue','S',$date,$date2);
print "<br>Issues Shannon: $issues";
my $returns=Count('return','C',$date,$date2);
print "<p>Returns Levin: $returns";
$returns=Count('return','F',$date,$date2);
print "<br>Returns Foxton: $returns";
$returns=Count('return','S',$date,$date2);
print "<br>Returns Shannon: $returns";
#my $issues=Count('issue','C',$date,$date2);
#print "<p>Issues Levin: $issues";
#$issues=Count('issue','F',$date,$date2);
#print "<br>Issues Foxton: $issues";
#$issues=Count('issue','S',$date,$date2);
#print "<br>Issues Shannon: $issues";
#my $returns=Count('return','C',$date,$date2);
#print "<p>Returns Levin: $returns";
#$returns=Count('return','F',$date,$date2);
#print "<br>Returns Foxton: $returns";
#$returns=Count('return','S',$date,$date2);
#print "<br>Returns Shannon: $returns";
print endmenu('report');
print endpage;

15
telnet/borrwraper.pl

@ -10,11 +10,12 @@ use C4::Circulation::Borrower;
# my @args=('issuewrapper.pl',"$env{'branchcode'}","$env{'usercode'}","$env{'telnet'}","$env{'queue'}","$env{'printtype'}");
my %env = (
branchcode => $ARGV[0], usercode => $ARGV[1], proccode => "lgon", borrowernumber => "",
logintime => "", lasttime => "", tempuser => "", debug => "9",
telnet => $ARGV[2], queue => $ARGV[3], printtype => $ARGV[4], brdata => $ARGV[5]
logintime => "", lasttime => $ARGV[6], tempuser => "", debug => "9",
telnet => $ARGV[2], queue => $ARGV[3], printtype => $ARGV[4], brdata => $ARGV[5], bcard=>$ARGV[7]
);
my ($env) = \%env;
startint();
startint();
helptext('');
my $done;
my ($items,$items2,$amountdue);
@ -24,10 +25,10 @@ $done = "Issues";
my $i=0;
my $dbh=&C4Connect;
my ($bornum,$issuesallowed,$borrower,$reason,$amountdue) = C4::Circulation::Borrower::findborrower($env,$dbh);
my $time=localtime(time);
open (FILE,">>/tmp/$<_$ARGV[6]");
print FILE "borrower found $bornum";
close FILE;
# my $time=localtime(time);
# open (FILE,">>/tmp/$<_$ARGV[6]");
# print FILE "borrower found $bornum";
# close FILE;
$env->{'loanlength'}="";
if ($reason ne "") {
$done = $reason;

4
telnet/startint.pl

@ -46,14 +46,14 @@ while ($donext ne 'Quit') {
$data = $donext;
}
if ($data eq 'Issues') {
my @args=('issuewrapper.pl',"$env{'branchcode'}","$env{'usercode'}","$env{'telnet'}","$env{'queue'}","$env{'printtype'}","$env{'brdata'}",$$);
my @args=('issuewrapper.pl',"$env{'branchcode'}","$env{'usercode'}","$env{'telnet'}","$env{'queue'}","$env{'printtype'}","$env{'brdata'}","$env{'lasttime'}");
open (FILE,">>/tmp/$<_$$");
my $time=localtime(time);
print FILE "Start issues $time \n";
close FILE;
system(@args);
} elsif ($data eq 'Returns') {
my @args=('returnswrapper.pl',"$env{'branchcode'}","$env{'usercode'}","$env{'telnet'}","$env{'queue'}","$env{'printtype'}","$env{'brdata'}",$$);
my @args=('returnswrapper.pl',"$env{'branchcode'}","$env{'usercode'}","$env{'telnet'}","$env{'queue'}","$env{'printtype'}","$env{'brdata'}");
open (FILE,">>/tmp/$<_$$");
my $time=localtime(time);
print FILE "Start returns $time \n";

Зареждане…
Отказ
Запис