Scripts to do with adding junior and institution members
This commit is contained in:
parent
9c549579ab
commit
2657a2e9e6
8 changed files with 326 additions and 9 deletions
148
imemberentry.pl
Executable file
148
imemberentry.pl
Executable file
|
@ -0,0 +1,148 @@
|
|||
#!/usr/bin/perl
|
||||
|
||||
#script to set up screen for modification of borrower details
|
||||
#written 20/12/99 by chris@katipo.co.nz
|
||||
|
||||
use strict;
|
||||
use C4::Output;
|
||||
use CGI;
|
||||
use C4::Search;
|
||||
|
||||
|
||||
my $input = new CGI;
|
||||
my $member=$input->param('bornum');
|
||||
if ($member eq ''){
|
||||
$member=NewBorrowerNumber();
|
||||
}
|
||||
my $type=$input->param('type');
|
||||
|
||||
print $input->header;
|
||||
print startpage();
|
||||
print startmenu('member');
|
||||
my $data=borrdata('',$member);
|
||||
print <<printend
|
||||
<BLOCKQUOTE>
|
||||
|
||||
<FONT SIZE=6><em>Add New Institution</em></FONT><br>
|
||||
<form action=/cgi-bin/koha/newimember.pl method=post>
|
||||
<input type=hidden name=joining value="">
|
||||
<input type=hidden name=expiry value="">
|
||||
<input type=hidden name=type value="borrowers">
|
||||
<input type=hidden name=borrowernumber value="$member">
|
||||
<input type=hidden name=updtype value=I>
|
||||
<table border=0 cellspacing=0 cellpadding=5 >
|
||||
|
||||
|
||||
<tr valign=top><td ><input type=reset value="Clear all Fields"></td></tr><tr>
|
||||
<TR align=right><td COLSPAN=2 ALIGN=RIGHT ><font size=3 face='arial,helvetica'>
|
||||
<STRONG>Member# $member, Card Number*</STRONG> </TD><TD align=right><input type=text name=cardnumber_institution size=20 value=" "><br>
|
||||
</td></TR>
|
||||
<tr><td> </TD></TR>
|
||||
|
||||
<tr valign=top bgcolor="99cc33" ><td COLSPAN=5 background="/images/background-mem.gif">
|
||||
<B>INSTITUTION DETAILS</b></td> <td COLSPAN=2 ALIGN=RIGHT background="/images/background-mem.gif">
|
||||
|
||||
</td></tr>
|
||||
<tr valign=top bgcolor=white>
|
||||
|
||||
<td colspan=3><input type=text name=institution_name size=50 value=""></td>
|
||||
</tr>
|
||||
<tr valign=top bgcolor=white>
|
||||
|
||||
<td><FONT SIZE=2>Institution Name</FONT></td>
|
||||
</tr>
|
||||
|
||||
<tr><td> </TD></TR>
|
||||
|
||||
|
||||
<tr valign=top bgcolor="99cc33" ><td COLSPAN=5 background="/images/background-mem.gif">
|
||||
<B>INSTITUTION ADDRESS</b></td></tr>
|
||||
<tr valign=top bgcolor=white>
|
||||
<td><input type=text name=address size=40 value="">
|
||||
<td><input type=text name=city size=20 value=""></td>
|
||||
<td>
|
||||
<SELECT NAME="area" SIZE="1">
|
||||
<OPTION value=L
|
||||
|
||||
>L - Levin
|
||||
<OPTION value=F>F - Foxton
|
||||
<OPTION value=S>S - Shannon
|
||||
<OPTION value=H>H - Horowhenua
|
||||
<OPTION value=K>K - Kapiti
|
||||
<OPTION value=O>O - Out of District
|
||||
<OPTION value=X>X - Temporary Visitor
|
||||
<OPTION value=Z>Z - Interloan Libraries
|
||||
<OPTION value=V>V - Villlage</SELECT></td></tr>
|
||||
<tr valign=top bgcolor=white>
|
||||
<td ><FONT SIZE=2>Postal Address*</FONT></td>
|
||||
<td><FONT SIZE=2>Town*</FONT></td>
|
||||
<td><FONT SIZE=2>Area</FONT></td>
|
||||
</tr>
|
||||
<tr><td> </TD></TR>
|
||||
<tr valign=top bgcolor="99cc33" ><td COLSPAN=5 background="/images/background-mem.gif">
|
||||
<B>CONTACT DETAILS</b></td></tr>
|
||||
<tr valign=top bgcolor=white>
|
||||
<td COLSPAN=3 ><input type=text name=contactname size=40 value=""></td>
|
||||
</tr>
|
||||
|
||||
<tr valign=top bgcolor=white>
|
||||
<td COLSPAN=3 ><FONT SIZE=2>Contact Name*</td></tr>
|
||||
|
||||
<tr valign=top bgcolor=white>
|
||||
|
||||
<td ><input type=text name=phoneday size=20 value=""></td>
|
||||
<td><input type=text name=faxnumber size=20 value=""></td>
|
||||
<td ><input type=text name=emailaddress size=20 value=""></td></tr>
|
||||
|
||||
<tr valign=top bgcolor=white>
|
||||
|
||||
<td><FONT SIZE=2>Phone (day)</td>
|
||||
<td><FONT SIZE=2>Fax</td>
|
||||
<td><FONT SIZE=2>Email</td></tr>
|
||||
<tr><td> </TD></TR>
|
||||
|
||||
|
||||
<tr valign=top bgcolor=white>
|
||||
|
||||
|
||||
<td COLSPAN=4><textarea name=altnotes wrap=physical cols=70 rows=3></textarea></td></tr>
|
||||
</tr>
|
||||
<tr valign=top bgcolor=white>
|
||||
<td><FONT SIZE=2>Notes</font></td></tr>
|
||||
<tr><td> </TD></TR>
|
||||
|
||||
|
||||
<tr valign=top bgcolor="99cc33" >
|
||||
|
||||
<td COLSPAN=5 background="/images/background-mem.gif"><B>LIBRARY USE</B></td>
|
||||
</tr>
|
||||
|
||||
|
||||
<tr valign=top >
|
||||
|
||||
|
||||
<td COLSPAN=5><textarea name=borrowernotes wrap=physical cols=70 rows=3></textarea></td></tr>
|
||||
<tr><td> </TD></TR>
|
||||
<tr valign=top bgcolor=white>
|
||||
<td ><FONT SIZE=2>Notes</font></td>
|
||||
</tr><tr valign=top bgcolor=white>
|
||||
|
||||
|
||||
<td COLSPAN=5 align=right >
|
||||
<input type=image src="/images/modify-mem.gif" WIDTH=188 HEIGHT=44 ALT="Add New Member" border=0 ></td>
|
||||
</tr>
|
||||
</TABLE>
|
||||
</table>
|
||||
</form>
|
||||
|
||||
|
||||
|
||||
<br clear=all>
|
||||
|
||||
<p> </p>
|
||||
|
||||
|
||||
printend
|
||||
;
|
||||
print endmenu('member');
|
||||
print endpage();
|
50
insertidata.pl
Executable file
50
insertidata.pl
Executable file
|
@ -0,0 +1,50 @@
|
|||
#!/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;
|
||||
my $surname=$data{'institution_name'};
|
||||
my $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'}','$data{'cardnumber_institution'}',
|
||||
'','$data{'ethnotes'}','$data{'address'}','$data{'faxnumber'}',
|
||||
'$data{'firstname'}','$data{'altnotes'}','','$data{'contactname'}',
|
||||
'$data{'emailaddress'}',
|
||||
now(),'$data{'streetcity'}','$data{'altrelationship'}','$data{'othernames'}',
|
||||
'$data{'phoneday'}','I','$data{'city'}','$data{'area'}','$data{'phone'}',
|
||||
'$data{'borrowernotes'}','$data{'altphone'}','$surname','$data{'initials'}',
|
||||
'$data{'ethnicity'}','$data{'borrowernumber'}','','')";
|
||||
|
||||
|
||||
#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'}");
|
|
@ -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
|
||||
|
@ -74,7 +74,7 @@ if (my $data=$sth->fetchrow_hashref){
|
|||
'$data{'ethnicity'}','$bornum','$guarant','$school')";
|
||||
}
|
||||
|
||||
print $query;
|
||||
#print $query;
|
||||
my $sth2=$dbh->prepare($query);
|
||||
$sth2->execute;
|
||||
$sth2->finish;
|
||||
|
|
|
@ -49,9 +49,11 @@ for (my $i=0; $i < $count; $i++){
|
|||
}
|
||||
print mktableft;
|
||||
print <<printend
|
||||
<A HREF="/cgi-bin/koha/memberentry.pl?type=Add"><img src="/images/button-add-member.gif" WIDTH=188 HEIGHT=44 ALT="Add New Member" BORDER=0 ></a><br>
|
||||
<form action=/cgi-bin/koha/simpleredirect.pl method=post>
|
||||
<input type=image src="/images/button-add-member.gif" WIDTH=188 HEIGHT=44 ALT="Add New Member" BORDER=0 ></a><br>
|
||||
<INPUT TYPE="radio" name="chooseform" value="adult" checked>Adult
|
||||
<INPUT TYPE="radio" name="chooseform" value="organisation" >Organisation
|
||||
</form>
|
||||
printend
|
||||
;
|
||||
print endmenu('member');
|
||||
|
|
|
@ -77,7 +77,17 @@ Alternative Contact:$data->{'contactname'}<BR>
|
|||
Phone: $data->{'altphone'}<BR>
|
||||
Relationship: $data->{'altrelationship'}<BR>
|
||||
Notes: $data->{'altnotes'}<P>
|
||||
Guarantees: <A HREF=""></a><P>
|
||||
Guarantees:
|
||||
printend
|
||||
;
|
||||
my ($count,$guarantees)=findguarantees($data->{'borrowernumber'});
|
||||
for (my $i=0;$i<$count;$i++){
|
||||
print "<A HREF=\"/cgi-bin/koha/moremember.pl?bornum=$guarantees->[$i]->{'borrowernumber'}\">$guarantees->[$i]->{'cardnumber'}</a><br>";
|
||||
}
|
||||
print <<printend
|
||||
|
||||
|
||||
<P>
|
||||
|
||||
General Notes: <A HREF="popbox.html" onclick="messenger(200,250,'Form that lets you add to and delete notes.'); return false">
|
||||
$data->{'borrowernotes'}</a>
|
||||
|
|
70
newimember.pl
Executable file
70
newimember.pl
Executable file
|
@ -0,0 +1,70 @@
|
|||
#!/usr/bin/perl
|
||||
|
||||
#script to print confirmation screen, then if accepted calls itself to insert data
|
||||
|
||||
use strict;
|
||||
use C4::Output;
|
||||
use C4::Input;
|
||||
use CGI;
|
||||
use Date::Manip;
|
||||
|
||||
my %env;
|
||||
my $input = new CGI;
|
||||
#get varibale that tells us whether to show confirmation page
|
||||
#or insert data
|
||||
my $insert=$input->param('insert');
|
||||
print $input->header;
|
||||
#get rest of data
|
||||
my %data;
|
||||
my @names=$input->param;
|
||||
foreach my $key (@names){
|
||||
$data{$key}=$input->param($key);
|
||||
}
|
||||
my $ok=0;
|
||||
|
||||
my $string="The following compulsary fields have been left blank. Please push the back button
|
||||
and try again<p>";
|
||||
if ($data{'cardnumber_institution'} eq ''){
|
||||
$string.="Cardnumber<br>";
|
||||
$ok=1;
|
||||
}
|
||||
if ($data{'institution_name'} eq ''){
|
||||
$string.="Institution Name<br>";
|
||||
$ok=1;
|
||||
}
|
||||
if ($data{'address'} eq ''){
|
||||
$string.="Postal Address<br>";
|
||||
$ok=1;
|
||||
}
|
||||
if ($data{'city'} eq ''){
|
||||
$string.="City<br>";
|
||||
$ok=1;
|
||||
}
|
||||
if ($data{'contactname'} eq ''){
|
||||
$string.="Contact Name";
|
||||
$ok=1;
|
||||
}
|
||||
#print $input->Dump;
|
||||
#print $string;
|
||||
print startmenu('member');
|
||||
if ($ok ==1){
|
||||
print $string;
|
||||
} else {
|
||||
my $valid=checkdigit(\%env,$data{"cardnumber_institution"});
|
||||
if ($valid != 1){
|
||||
print "Invalid cardnumber";
|
||||
} else {
|
||||
|
||||
my @inputs;
|
||||
my $i=0;
|
||||
while (my ($key, $value) = each %data) {
|
||||
$value=~ s/\"/%22/g;
|
||||
$inputs[$i]=["hidden","$key","$value"];
|
||||
$i++;
|
||||
}
|
||||
$inputs[$i]=["submit","submit","submit"];
|
||||
print mkformnotable("/cgi-bin/koha/insertidata.pl",@inputs);
|
||||
}
|
||||
}
|
||||
print endmenu('member');
|
||||
print endpage();
|
|
@ -67,11 +67,29 @@ if ($ok == 0){
|
|||
print mkheadr(1,'Confirm Record');
|
||||
my $main="#99cc33";
|
||||
my $image="/images/background-mem.gif";
|
||||
print mktablehdr;
|
||||
print mktablerow(2,$main,bold('NEW MEMBER'),"",$image);
|
||||
print mktablerow(2,'white',bold('Membership Number'),$data{'borrowernumber'});
|
||||
print mktableft;
|
||||
|
||||
for (my $i=0;$i<3;$i++){
|
||||
if ($data{"cardnumber_child_$i"} ne ''){
|
||||
print mktablehdr;
|
||||
print mktablerow(2,$main,bold('NEW MEMBER'),"",$image);
|
||||
my $name=$data{"firstname_child_$i"}.$data{"surname_child_$i"};
|
||||
print mktablerow(2,'white',bold('Name'),$name);
|
||||
print mktablerow(2,$main,bold('MEMBERSHIP DETAILS'),"",$image);
|
||||
print mktablerow(2,'white',bold('Membership Number'),$data{"bornumber_child_$i"});
|
||||
print mktablerow(2,'white',bold('Date of Birth'),$data{"dateofbirth_child_$i"});
|
||||
my $sex;
|
||||
if ($data{"sex_child_$i"} eq 'M'){
|
||||
$sex="Male";
|
||||
} else {
|
||||
$sex="Female";
|
||||
}
|
||||
print mktablerow(2,'white',bold('Sex'),$sex);
|
||||
print mktablerow(2,'white',bold('School'),$data{"school_child_$i"});
|
||||
print mktablerow(2,'white',bold('General Notes'),$data{"altnotes_child_$i"});
|
||||
|
||||
print mktableft;
|
||||
print "<p>";
|
||||
}
|
||||
}
|
||||
my $i=0;
|
||||
my @inputs;
|
||||
while (my ($key, $value) = each %data) {
|
||||
|
|
19
simpleredirect.pl
Executable file
19
simpleredirect.pl
Executable file
|
@ -0,0 +1,19 @@
|
|||
#!/usr/bin/perl
|
||||
|
||||
#simple script to provide basic redirection
|
||||
#used by members section
|
||||
|
||||
use CGI;
|
||||
use strict;
|
||||
|
||||
my $input=new CGI;
|
||||
|
||||
my $choice=$input->param('chooseform');
|
||||
|
||||
if ($choice eq 'adult'){
|
||||
print $input->redirect("/cgi-bin/koha/memberentry.pl?type=Add");
|
||||
}
|
||||
|
||||
if ($choice eq 'organisation'){
|
||||
print $input->redirect("/cgi-bin/koha/imemberentry.pl?type=Add");
|
||||
}
|
Loading…
Reference in a new issue