[Koha-cvs] CVS: koha/members deletemem.pl,NONE,1.1 imemberentry.pl,NONE,1.1 insertdata.pl,NONE,1.1 insertidata.pl,NONE,1.1 insertjdata.pl,NONE,1.1 jmemberentry.pl,NONE,1.1 memberentry.pl,NONE,1.1 member-flags.pl,NONE,1.1 member-password.pl,NONE,1.1 member.pl,NONE,1.1 members-home.pl,NONE,1.1 moremember.pl,NONE,1.1 newimember.pl,NONE,1.1 newjmember.pl,NONE,1.1 newmember.pl,NONE,1.1
Paul POULAIN
tipaul at users.sourceforge.net
Wed Mar 10 16:13:48 CET 2004
- Previous message: [Koha-cvs] CVS: koha/members - New directory
- Next message: [Koha-cvs] CVS: koha/koha-tmpl/intranet-tmpl/default/en/members imemberentry.tmpl,1.7,1.8 jmemberentry.tmpl,1.10,1.11 memberentry.tmpl,1.24,1.25 members-home.tmpl,1.7,1.8 member.tmpl,1.9,1.10 moremember.tmpl,1.26,1.27
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/koha/koha/members
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15867/members
Added Files:
deletemem.pl imemberentry.pl insertdata.pl insertidata.pl
insertjdata.pl jmemberentry.pl memberentry.pl member-flags.pl
member-password.pl member.pl members-home.pl moremember.pl
newimember.pl newjmember.pl newmember.pl
Log Message:
moving members related scripts to "members" directory
--- NEW FILE ---
#!/usr/bin/perl
# $Id: deletemem.pl,v 1.1 2004/03/10 15:13:45 tipaul Exp $
#script to delete items
#written 2/5/00
#by chris at katipo.co.nz
# Copyright 2000-2002 Katipo Communications
#
# This file is part of Koha.
#
# Koha is free software; you can redistribute it and/or modify it under the
# terms of the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option) any later
# version.
#
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
# Suite 330, Boston, MA 02111-1307 USA
use strict;
use CGI;
use C4::Context;
use C4::Search;
use C4::Output;
use C4::Circulation::Circ2;
#use C4::Acquisitions;
use C4::Auth;
my $input = new CGI;
my $flagsrequired;
$flagsrequired->{borrower}=1;
my ($loggedinuser, $cookie, $sessionID) = checkauth($input, 0, $flagsrequired);
#print $input->header;
my $member=$input->param('member');
my %env;
$env{'nottodayissues'}=1;
my %member2;
$member2{'borrowernumber'}=$member;
my $issues=currentissues(\%env,\%member2);
my $i=0;
foreach (sort keys %$issues) {
$i++;
}
my ($bor,$flags)=getpatroninformation(\%env, $member,'');
my $dbh = C4::Context->dbh;
my $sth=$dbh->prepare("Select * from borrowers where guarantor=?");
$sth->execute($member);
my $data=$sth->fetchrow_hashref;
$sth->finish;
if ($i > 0 || $flags->{'CHARGES'} ne '' || $data ne ''){
print $input->header;
print "<table border=1>";
if ($i > 0){
print "<TR><TD>Items on Issue</td><td align=right>$i</td></tr>";
}
if ($flags->{'CHARGES'} ne ''){
print "<TR><TD>Charges</td><td>$flags->{'CHARGES'}->{'message'}</tr>";
}
if ($data ne ''){
print "<TR><TD>Guarantees</td></tr>";
}
print "</table>";
} else {
delmember($member);
print $input->redirect("/cgi-bin/koha/members-home.pl");
}
sub delmember{
my ($member)=@_;
my $dbh = C4::Context->dbh;
my $sth=$dbh->prepare("Select * from borrowers where borrowernumber=?");
$sth->execute($member);
my @data=$sth->fetchrow_array;
$sth->finish;
$sth=$dbh->prepare("Insert into deletedborrowers values (".("?,"x(scalar(@data)-1))."?)");
$sth->execute(@data);
$sth->finish;
$sth=$dbh->prepare("Delete from borrowers where borrowernumber=?");
$sth->execute($member);
$sth->finish;
$sth=$dbh->prepare("Delete from reserves where borrowernumber=?");
$sth->execute($member);
$sth->finish;
}
--- NEW FILE ---
#!/usr/bin/perl
# NOTE: standard 8-space tabs here
#script to set up screen for modification of borrower details
#written 20/12/99 by chris at katipo.co.nz
# Copyright 2000-2002 Katipo Communications
#
# This file is part of Koha.
#
# Koha is free software; you can redistribute it and/or modify it under the
# terms of the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option) any later
# version.
#
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
# Suite 330, Boston, MA 02111-1307 USA
use strict;
use C4::Auth;
use C4::Output;
use CGI;
use C4::Search;
use C4::Interface::CGI::Output;
use C4::Koha;
use HTML::Template;
use C4::Members;
use C4::Date;
my $input = new CGI;
my ($template, $loggedinuser, $cookie)
= get_template_and_user({template_name => "members/imemberentry.tmpl",
query => $input,
type => "intranet",
authnotrequired => 0,
flagsrequired => {borrowers => 1},
debug => 1,
});
my $member=$input->param('bornum');
if ($member eq ''){
$member=NewBorrowerNumber();
}
my $type=$input->param('type');
my $data=borrdata('',$member);
my $cardnumber=C4::Members::fixup_cardnumber($data->{'cardnumber'});
my @branches;
my @select_branch;
my %select_branches;
my $branches=getbranches();
foreach my $branch (keys %$branches) {
push @select_branch, $branch;
$select_branches{$branch} = $branches->{$branch}->{'branchname'};
}
my $CGIbranch=CGI::scrolling_list( -name => 'branchcode',
-id => 'branchcode',
-values => \@select_branch,
-default => $data->{'branchcode'},
-labels => \%select_branches,
-size => 1,
-multiple => 0 );
$template->param(member => $member,
member => $member,
address => $data->{'streetaddress'},
firstname => $data->{'firstname'},
surname => $data->{'surname'},
othernames => $data->{'othernames'},
streetaddress => $data->{'streetaddress'},
streetcity => $data->{'streetcity'},
zipcode => $data->{'zipcode'},
homezipcode => $data->{'homezipcode'},
city => $data->{'city'},
phone => $data->{'phone'},
phoneday => $data->{'phoneday'},
faxnumber => $data->{'faxnumber'},
emailaddress => $data->{'emailaddress'},
textmessaging => $data->{'textmessaging'},
contactname => $data->{'contactname'},
altphone => $data->{'altphone'},
altnotes => $data->{'altnotes'},
borrowernotes => $data->{'borrowernotes'},
"title_".$data->{'title'} => " SELECTED ",
dateenrolled => $data->{'dateenrolled'},
expiry => $data->{'expiry'},
cardnumber => $cardnumber,
dateofbirth => $data->{'dateofbirth'},
dateformat => display_date_format(),
cardnumber_institution => $cardnumber,
CGIbranch => $CGIbranch);
output_html_with_http_headers $input, $cookie, $template->output;
# Local Variables:
# tab-width: 8
# End:
--- NEW FILE ---
#!/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 at katipo.co.nz
# Copyright 2000-2002 Katipo Communications
#
# This file is part of Koha.
#
# Koha is free software; you can redistribute it and/or modify it under the
# terms of the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option) any later
# version.
#
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
# Suite 330, Boston, MA 02111-1307 USA
use CGI;
use C4::Context;
use C4::Input;
use C4::Search;
use Date::Manip;
use C4::Date;
use strict;
my $input= new CGI;
#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);
$data{$key}=~ s/\'/\\\'/g;
$data{$key}=~ s/\"/\\\"/g;
}
my $dbh = C4::Context->dbh;
my $query="Select * from borrowers where borrowernumber=?";
my $sth=$dbh->prepare($query);
$sth->execute($data{'borrowernumber'});
if (my $data2=$sth->fetchrow_hashref){
$data{'dateofbirth'}=format_date_in_iso($data{'dateofbirth'});
$data{'joining'}=format_date_in_iso($data{'joining'});
$data{'expiry'}=format_date_in_iso($data{'expiry'});
$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'}',physstreet='$data{'streetaddress'}',ethnicity='$data{'ethnicity'}',
gonenoaddress='$data{'gna'}',lost='$data{'lost'}',debarred='$data{'debarred'}',
textmessaging='$data{'textmessaging'}', branchcode = '$data{'branchcode'}',
zipcode = '$data{'zipcode'}',homezipcode='$data{'homezipcode'}'
where borrowernumber=$data{'borrowernumber'}";
}else{
$data{'dateofbirth'}=format_date_in_iso($data{'dateofbirth'});
$data{'joining'}=format_date_in_iso($data{'joining'});
$data{'expiry'}=format_date_in_iso($data{'expiry'});
$data{'borrowernumber'}=NewBorrowerNumber();
$query="insert into borrowers (title,expiry,cardnumber,sex,ethnotes,streetaddress,faxnumber,
firstname,altnotes,dateofbirth,contactname,emailaddress,textmessaging,dateenrolled,streetcity,
altrelationship,othernames,phoneday,categorycode,city,area,phone,borrowernotes,altphone,surname,
initials,ethnicity,physstreet,branchcode,zipcode,homezipcode) values ('$data{'title'}','$data{'expiry'}','$data{'cardnumber'}',
'$data{'sex'}','$data{'ethnotes'}','$data{'address'}','$data{'faxnumber'}',
'$data{'firstname'}','$data{'altnotes'}','$data{'dateofbirth'}','$data{'contactname'}','$data{'emailaddress'}','$data{'textmessaging'}',
'$data{'joining'}','$data{'streetcity'}','$data{'altrelationship'}','$data{'othernames'}',
'$data{'phoneday'}','$data{'categorycode'}','$data{'city'}','$data{'area'}','$data{'phone'}',
'$data{'borrowernotes'}','$data{'altphone'}','$data{'surname'}','$data{'initials'}',
'$data{'ethnicity'}','$data{'streetaddress'}','$data{'branchcode'}','$data{'zipcode'}','$data{'homezipcode'}')";
}
# ok if its an adult (type) it may have borrowers that depend on it as a guarantor
# so when we update information for an adult we should check for guarantees and update the relevant part
# of their records, ie addresses and phone numbers
if ($data{'categorycode'} eq 'A' || $data{'categorycode'} eq 'W'){
# is adult check guarantees;
my ($count,$guarantees)=findguarantees($data{'borrowernumber'});
for (my $i=0;$i<$count;$i++){
# FIXME
# It looks like the $i is only being returned to handle walking through
# the array, which is probably better done as a foreach loop.
#
my $guaquery="update borrowers set streetaddress='$data{'address'}',faxnumber='$data{'faxnumber'}',
streetcity='$data{'streetcity'}',phoneday='$data{'phoneday'}',city='$data{'city'}',area='$data{'area'}',phone='$data{'phone'}'
,streetaddress='$data{'address'}'
where borrowernumber='$guarantees->[$i]->{'borrowernumber'}'";
my $sth3=$dbh->prepare($guaquery);
$sth3->execute;
$sth3->finish;
}
}
my $sth2=$dbh->prepare($query);
$sth2->execute;
$sth2->finish;
$sth->finish;
print $input->redirect("/cgi-bin/koha/moremember.pl?bornum=$data{'borrowernumber'}");
--- NEW FILE ---
#!/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 at katipo.co.nz
# Copyright 2000-2002 Katipo Communications
#
# This file is part of Koha.
#
# Koha is free software; you can redistribute it and/or modify it under the
# terms of the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option) any later
# version.
#
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
# Suite 330, Boston, MA 02111-1307 USA
use CGI;
use C4::Context;
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;
my $sth2;
foreach my $key (@names){
$data{$key}=$input->param($key);
}
my $dbh = C4::Context->dbh;
my $sth=$dbh->prepare("Select * from borrowers where borrowernumber=?");
$sth->execute($data{'borrowernumber'});
if (my $data2=$sth->fetchrow_hashref){
$sth2=$dbh->prepare("update borrowers set title=?,expiry=?,
cardnumber=?,sex=?,ethnotes=?,
streetaddress=?,faxnumber=?,firstname=?,
altnotes=?,dateofbirth=?,contactname=?,
emailaddress=?,dateenrolled=?,streetcity=?,
altrelationship=?,othernames=?,phoneday=?,
city=?,area=?,phone=?,
borrowernotes=?,altphone=?,surname=?,
initials=?,physstreet=?,ethnicity=?,
gonenoaddress=?,lost=?,debarred=?,
textmessaging=?, branchcode = ?,
zipcode = ?,homezipcode=?
where borrowernumber=?");
$sth2->execute($data{'title'},$data{'expiry'},
$data{'cardnumber_institution'},$data{'sex'},$data{'ethnicnotes'},
$data{'address'},$data{'faxnumber'},$data{'firstname'},
$data{'altnotes'},$data{'dateofbirth'},$data{'contactname'},
$data{'emailaddress'},$data{'joining'},$data{'streetcity'},
$data{'altrelationship'},$data{'othernames'},$data{'phoneday'},
$data{'city'},$data{'area'},$data{'phone'},
$data{'borrowernotes'},$data{'altphone'},$data{'institution_name'},
$data{'initials'},$data{'streetaddress'},$data{'ethnicity'},
$data{'gna'},$data{'lost'},$data{'debarred'},
$data{'textmessaging'},$data{'branchcode'},
$data{'zipcode'},$data{'homezipcode'},
$data{'borrowernumber'});
} else {
my $surname=$data{'institution_name'};
# note for code reading : 5 on each line
$sth2=$dbh->prepare("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, branchcode,
zipcode, homezipcode)
values ( ?,?,?,?,?,
?,?,?,?,?,
?,?,now(),?,?,
?,?,?,?,?,
?,?,?,?,?,
?,?,?,?,?,
?,?
)");
$sth2->execute('', $data{'expiry'}, $data{'cardnumber_institution'}, '', $data{'ethnotes'},
$data{'address'}, $data{'faxnumber'}, $surname, $data{'altnotes'}, '',
$data{'contactname'},$data{'emailaddress'}, $data{'streetcity'}, $data{'altrelationship'}, # only 4 because of now()
$data{'othernames'}, $data{'phoneday'}, 'I', $data{'city'}, $data{'area'},
''.$data{'phone'}, $data{'borrowernotes'}, $data{'altphone'}, $surname, ''.$data{'initials'},
$data{'ethnicity'}, $data{'borrowernumber'}, '', '', $data{'branchcode'},
$data{'zipcode'}, $data{'homezipcode'});
}
$sth2->finish;
$sth->finish;
print $input->redirect("/cgi-bin/koha/moremember.pl?bornum=$data{'borrowernumber'}");
--- NEW FILE ---
#!/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 at katipo.co.nz
# Copyright 2000-2002 Katipo Communications
#
# This file is part of Koha.
#
# Koha is free software; you can redistribute it and/or modify it under the
# terms of the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option) any later
# version.
#
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
# Suite 330, Boston, MA 02111-1307 USA
use CGI;
use C4::Context;
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 = C4::Context->dbh;
my $query;
for (my $i=0;$i<1;$i++){
my $x = "cardnumber_child_$i";
my $sth=$dbh->prepare("Select * from borrowers where borrowernumber=?");
$sth->execute($x);
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{'streetaddress'}',ethnicity='$data{'ethnicity'}',physstreet='$data{'physstreet'}'
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,physstreet)
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','$data{'physstreet'}')";
}
#print $query;
my $sth2=$dbh->prepare($query);
$sth2->execute;
$sth2->finish;
$sth->finish;
}
print $input->redirect("/cgi-bin/koha/moremember.pl?bornum=$data{'borrowernumber'}");
--- NEW FILE ---
#!/usr/bin/perl
#script to set up screen for modification of borrower details
#written 20/12/99 by chris at katipo.co.nz
# Copyright 2000-2002 Katipo Communications
#
# This file is part of Koha.
#
# Koha is free software; you can redistribute it and/or modify it under the
# terms of the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option) any later
# version.
#
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
# Suite 330, Boston, MA 02111-1307 USA
use strict;
use C4::Auth;
use C4::Output;
use CGI;
use C4::Search;
use HTML::Template;
use C4::Interface::CGI::Output;
use C4::Date;
use C4::Members;
my $input = new CGI;
my ($template, $loggedinuser, $cookie)
= get_template_and_user({template_name => "members/jmemberentry.tmpl",
query => $input,
type => "intranet",
authnotrequired => 0,
flagsrequired => {borrowers => 1},
debug => 1,
});
my $member=$input->param('bornum');
if ($member eq ''){
$member=NewBorrowerNumber();
}
my $type=$input->param('type');
my $data=borrdata('',$member);
my @titles = ('Miss', 'Mrs', 'Ms', 'Mr', 'Dr', 'Sir');
# FIXME - Assumes English. This ought to be made part of i18n.
my @titledata;
while (@titles) {
my $title = shift @titles;
my %row = ('title' => $title);
if ($data->{'title'} eq $title) {
$row{'selected'}=' selected';
} else {
$row{'selected'}='';
}
push(@titledata, \%row);
}
# get the data for children
my $cmember1=NewBorrowerNumber();
my @cmemdata;
for (my $i=0;$i<1;$i++){
my %row;
$row{'cmember'}=$cmember1+$i;
$row{'i'}=$i;
$row{'count'}=$i+1;
push(@cmemdata, \%row);
}
my $jcardnumber=C4::Members::fixup_cardnumber("");
$template->param( member => $member,
firstname => $data->{'firstname'},
surname => $data->{'surname'},
cardnumber => $data->{'cardnumber'},
jcardnumber => $jcardnumber,
area => $data->{'area'},
city => $data->{'city'},
physstreet => $data->{'physstreet'},
streetaddress => $data->{'streetaddress'},
streetcity => $data->{'streetcity'},
phone => $data->{'phone'},
phoneday => $data->{'phoneday'},
faxnumber => $data->{'faxnumber'},
emailaddress => $data->{'emailaddress'},
contactname => $data->{'contactname'},
altphone => $data->{'altphone'},
dateformat => display_date_format(),
titleloop => \@titledata,
cmemloop => \@cmemdata );
output_html_with_http_headers $input, $cookie, $template->output;
--- NEW FILE ---
#!/usr/bin/perl
# NOTE: This file uses standard 8-space tabs
# DO NOT SET TAB SIZE TO 4
# $Id: memberentry.pl,v 1.1 2004/03/10 15:13:45 tipaul Exp $
#script to set up screen for modification of borrower details
#written 20/12/99 by chris at katipo.co.nz
# Copyright 2000-2002 Katipo Communications
#
# This file is part of Koha.
#
# Koha is free software; you can redistribute it and/or modify it under the
# terms of the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option) any later
# version.
#
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
# Suite 330, Boston, MA 02111-1307 USA
use strict;
use C4::Auth;
use C4::Context;
use C4::Output;
use C4::Interface::CGI::Output;
use CGI;
use C4::Search;
use C4::Members;
use C4::Koha;
use HTML::Template;
use Date::Manip;
use C4::Date;
my $input = new CGI;
my ($template, $loggedinuser, $cookie)
= get_template_and_user({template_name => "members/memberentry.tmpl",
query => $input,
type => "intranet",
authnotrequired => 0,
flagsrequired => {borrowers => 1},
debug => 1,
});
my $member=$input->param('bornum');
# if ($member eq ''){
# $member=NewBorrowerNumber();
# }
my $type=$input->param('type') || '';
my $modify=$input->param('modify');
my $delete=$input->param('delete');
if ($delete){
print $input->redirect("/cgi-bin/koha/deletemem.pl?member=$member");
} else { # this else goes down the whole script
if ($type eq 'Add'){
$template->param( addAction => 1);
} else {
$template->param( addAction =>0);
}
my $data=borrdata('',$member);
if ($type eq 'Add'){
$template->param( updtype => 'I');
} else {
$template->param( updtype => 'M');
}
my $cardnumber=C4::Members::fixup_cardnumber($data->{'cardnumber'});
if ($data->{'sex'} eq 'F'){
$template->param(female => 1);
}
my ($categories,$labels)=ethnicitycategories();
my $ethnicitycategoriescount=$#{$categories};
my $ethcatpopup;
if ($ethnicitycategoriescount>=0) {
$ethcatpopup = CGI::popup_menu(-name=>'ethnicity',
-id => 'ethnicity',
-values=>$categories,
-default=>$data->{'ethnicity'},
-labels=>$labels);
$template->param(ethcatpopup => $ethcatpopup); # bad style, has to be fixed
}
($categories,$labels)=borrowercategories();
my $catcodepopup = CGI::popup_menu(-name=>'categorycode',
-id => 'categorycode',
-values=>$categories,
-default=>$data->{'categorycode'},
-labels=>$labels);
my @relationships = ('workplace', 'relative','friend', 'neighbour');
my @relshipdata;
while (@relationships) {
my $relship = shift @relationships;
my %row = ('relationship' => $relship);
if ($data->{'altrelationship'} eq $relship) {
$row{'selected'}=' selected';
} else {
$row{'selected'}='';
}
push(@relshipdata, \%row);
}
# %flags: keys=$data-keys, datas=[formname, HTML-explanation]
my %flags = ('gonenoaddress' => ['gna', 'Gone no address'],
'lost' => ['lost', 'Lost'],
'debarred' => ['debarred', 'Debarred']);
my @flagdata;
foreach (keys(%flags)) {
my $key = $_;
my %row = ('key' => $key,
'name' => $flags{$key}[0],
'html' => $flags{$key}[1]);
if ($data->{$key}) {
$row{'yes'}=' checked';
$row{'no'}='';
} else {
$row{'yes'}='';
$row{'no'}=' checked';
}
push(@flagdata, \%row);
}
if ($modify){
$template->param( modify => 1 );
}
#Convert dateofbirth to correct format
$data->{'dateofbirth'} = format_date($data->{'dateofbirth'});
my @branches;
my @select_branch;
my %select_branches;
my $branches=getbranches();
foreach my $branch (keys %$branches) {
push @select_branch, $branch;
$select_branches{$branch} = $branches->{$branch}->{'branchname'};
}
my $CGIbranch=CGI::scrolling_list( -name => 'branchcode',
-id => 'branchcode',
-values => \@select_branch,
-default => $data->{'branchcode'},
-labels => \%select_branches,
-size => 1,
-multiple => 0 );
$template->param( type => $type,
member => $member,
address => $data->{'streetaddress'},
firstname => $data->{'firstname'},
surname => $data->{'surname'},
othernames => $data->{'othernames'},
initials => $data->{'initials'},
ethcatpopup => $ethcatpopup,
catcodepopup => $catcodepopup,
streetaddress => $data->{'physstreet'},
zipcode => $data->{'zipcode'},
streetcity => $data->{'streetcity'},
homezipcode => $data->{'homezipcode'},
city => $data->{'city'},
phone => $data->{'phone'},
phoneday => $data->{'phoneday'},
faxnumber => $data->{'faxnumber'},
emailaddress => $data->{'emailaddress'},
textmessaging => $data->{'textmessaging'},
contactname => $data->{'contactname'},
altphone => $data->{'altphone'},
altnotes => $data->{'altnotes'},
borrowernotes => $data->{'borrowernotes'},
flagloop => \@flagdata,
relshiploop => \@relshipdata,
"title_".$data->{'title'} => " SELECTED ",
dateenrolled => $data->{'dateenrolled'},
expiry => $data->{'expiry'},
cardnumber => $cardnumber,
dateofbirth => $data->{'dateofbirth'},
dateformat => display_date_format(),
modify => $modify,
CGIbranch => $CGIbranch);
output_html_with_http_headers $input, $cookie, $template->output;
}
# Local Variables:
# tab-width: 8
# End:
--- NEW FILE ---
#!/usr/bin/perl
# script to edit a member's flags
# Written by Steve Tonnesen
# July 26, 2002 (my birthday!)
use strict;
use C4::Search;
use CGI;
use C4::Output;
use C4::Auth;
use C4::Context;
use C4::Circulation::Circ2;
#use C4::Acquisitions;
use HTML::Template;
use C4::Interface::CGI::Output;
my $input = new CGI;
my $flagsrequired;
$flagsrequired->{borrowers}=1;
$flagsrequired->{permissions}=1;
my ($template, $loggedinuser, $cookie)
= get_template_and_user({template_name => "members/member-flags.tmpl",
query => $input,
type => "intranet",
authnotrequired => 0,
flagsrequired => {borrowers => 1},
debug => 1,
});
my $member=$input->param('member');
my %env;
$env{'nottodayissues'}=1;
my %member2;
$member2{'borrowernumber'}=$member;
my $issues=currentissues(\%env,\%member2);
my $i=0;
foreach (sort keys %$issues) {
$i++;
}
if ($input->param('newflags')) {
my $dbh=C4::Context->dbh();
my $flags=0;
foreach ($input->param) {
if (/flag-(\d+)/) {
my $flag=$1;
$flags=$flags+2**$flag;
}
}
my $sth=$dbh->prepare("update borrowers set flags=? where borrowernumber=?");
$sth->execute($flags, $member);
print $input->redirect("/cgi-bin/koha/moremember.pl?bornum=$member");
} else {
my ($bor,$flags,$accessflags)=getpatroninformation(\%env, $member,'');
my $dbh=C4::Context->dbh();
my $sth=$dbh->prepare("select bit,flag,flagdesc from userflags order by bit");
$sth->execute;
my @loop;
while (my ($bit, $flag, $flagdesc) = $sth->fetchrow) {
my $checked='';
if ($accessflags->{$flag}) {
$checked='checked';
}
my %row = ( bit => $bit,
flag => $flag,
checked => $checked,
flagdesc => $flagdesc );
push @loop, \%row;
}
$template->param(member => $member,
surname => $bor->{'surname'},
firstname => $bor->{'firstname'},
loop => \@loop);
output_html_with_http_headers $input, $cookie, $template->output;
}
--- NEW FILE ---
#!/usr/bin/perl
#script to set the password, and optionally a userid, for a borrower
#written 2/5/00
#by chris at katipo.co.nz
#converted to using templates 3/16/03 by mwhansen at hmc.edu
use strict;
use C4::Auth;
use C4::Output;
use C4::Interface::CGI::Output;
use C4::Search;
use C4::Context;
use C4::Circulation::Circ2;
use CGI;
use HTML::Template;
use Digest::MD5 qw(md5_base64);
my $input = new CGI;
my $theme = $input->param('theme') || "default";
# only used if allowthemeoverride is set
my ($template, $loggedinuser, $cookie)
= get_template_and_user({template_name => "members/member-password.tmpl",
query => $input,
type => "intranet",
authnotrequired => 0,
flagsrequired => {borrowers => 1},
debug => 1,
});
my $flagsrequired;
$flagsrequired->{borrowers}=1;
my ($loggedinuser, $cookie, $sessionID) = checkauth($input, 0, $flagsrequired);
my $member=$input->param('member');
my %env;
$env{'nottodayissues'}=1;
my %member2;
$member2{'borrowernumber'}=$member;
my $issues=currentissues(\%env,\%member2);
my $i=0;
foreach (sort keys %$issues) {
$i++;
}
my ($bor,$flags)=getpatroninformation(\%env, $member,'');
my $newpassword = $input->param('newpassword');
if ( $newpassword ) {
my $digest=md5_base64($input->param('newpassword'));
my $uid = $input->param('newuserid');
my $dbh=C4::Context->dbh;
#Make sure the userid chosen is unique and not theirs if non-empty. If it is not,
#Then we need to tell the user and have them create a new one.
my $sth2=$dbh->prepare("select * from borrowers where userid=? and borrowernumber != ?");
$sth2->execute($uid,$member);
if ( ($uid ne '') && ($sth2->fetchrow) ) {
#The userid exists so we should display a warning.
my $warn = 1;
$template->param( warn => $warn,
othernames => $bor->{'othernames'},
surname => $bor->{'surname'},
firstname => $bor->{'firstname'},
userid => $bor->{'userid'},
defaultnewpassword => $newpassword );
} else {
#Everything is good so we can update the information.
my $sth=$dbh->prepare("update borrowers set userid=?, password=? where borrowernumber=?");
$sth->execute($uid, $digest, $member);
$template->param(newpassword => $newpassword);
}
} else {
my $userid = $bor->{'userid'};
my $chars='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
my $length=int(rand(2))+4;
my $defaultnewpassword='';
for (my $i=0; $i<$length; $i++) {
$defaultnewpassword.=substr($chars, int(rand(length($chars))),1);
}
$template->param( othernames => $bor->{'othernames'},
surname => $bor->{'surname'},
firstname => $bor->{'firstname'},
userid => $bor->{'userid'},
defaultnewpassword => $defaultnewpassword );
}
$template->param( member => $member );
output_html_with_http_headers $input, $cookie, $template->output;
--- NEW FILE ---
#!/usr/bin/perl
# $Id: member.pl,v 1.1 2004/03/10 15:13:45 tipaul Exp $
#script to do a borrower enquiery/brin up borrower details etc
#written 20/12/99 by chris at katipo.co.nz
# Copyright 2000-2002 Katipo Communications
#
# This file is part of Koha.
#
# Koha is free software; you can redistribute it and/or modify it under the
# terms of the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option) any later
# version.
#
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
# Suite 330, Boston, MA 02111-1307 USA
use strict;
use C4::Auth;
use C4::Output;
use C4::Interface::CGI::Output;
use CGI;
use C4::Search;
use HTML::Template;
my $input = new CGI;
my $theme = $input->param('theme') || "default";
# only used if allowthemeoverride is set
#my %tmpldata = pathtotemplate ( template => 'member.tmpl', theme => $theme, language => 'fi' );
# FIXME - Error-checking
#my $template = HTML::Template->new( filename => $tmpldata{'path'},
# die_on_bad_params => 0,
# loop_context_vars => 1 );
my ($template, $loggedinuser, $cookie)
= get_template_and_user({template_name => "members/member.tmpl",
query => $input,
type => "intranet",
authnotrequired => 0,
flagsrequired => {borrowers => 1},
debug => 1,
});
my $member=$input->param('member');
my $env;
my ($count,$results);
if(length($member) == 1)
{
($count,$results)=BornameSearch($env,$member,"simple");
}
else
{
($count,$results)=BornameSearch($env,$member,"advanced");
}
my @resultsdata;
my $background = 0;
for (my $i=0; $i < $count; $i++){
#find out stats
my ($od,$issue,$fines)=borrdata2($env,$results->[$i]{'borrowernumber'});
my %row = (
background => $background,
borrowernumber => $results->[$i]{'borrowernumber'},
cardnumber => $results->[$i]{'cardnumber'},
surname => $results->[$i]{'surname'},
firstname => $results->[$i]{'firstname'},
categorycode => $results->[$i]{'categorycode'},
streetaddress => $results->[$i]{'streetaddress'},
city => $results->[$i]{'city'},
odissue => "$od/$issue",
fines => $fines,
borrowernotes => $results->[$i]{'borrowernotes'});
if ( $background ) { $background = 0; } else {$background = 1; }
push(@resultsdata, \%row);
}
$template->param(
member => $member,
resultsloop => \@resultsdata );
output_html_with_http_headers $input, $cookie, $template->output;
--- NEW FILE ---
#!/usr/bin/perl
use strict;
use CGI;
use C4::Auth;
use C4::Output;
use C4::Interface::CGI::Output;
use C4::Context;
use HTML::Template;
my $query = new CGI;
my ($template, $loggedinuser, $cookie)
= get_template_and_user({template_name => "members/members-home.tmpl",
query => $query,
type => "intranet",
authnotrequired => 0,
flagsrequired => {borrowers => 1},
debug => 1,
});
output_html_with_http_headers $query, $cookie, $template->output;
--- NEW FILE ---
#!/usr/bin/perl
# $Id: moremember.pl,v 1.1 2004/03/10 15:13:45 tipaul Exp $
# script to do a borrower enquiry/bring up borrower details etc
# Displays all the details about a borrower
# written 20/12/99 by chris at katipo.co.nz
# last modified 21/1/2000 by chris at katipo.co.nz
# modified 31/1/2001 by chris at katipo.co.nz
# to not allow items on request to be renewed
#
# needs html removed and to use the C4::Output more, but its tricky
#
# Copyright 2000-2002 Katipo Communications
#
# This file is part of Koha.
#
# Koha is free software; you can redistribute it and/or modify it under the
# terms of the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option) any later
# version.
#
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
# Suite 330, Boston, MA 02111-1307 USA
use strict;
use C4::Auth;
use C4::Context;
use C4::Output;
use C4::Interface::CGI::Output;
use C4::Interface::CGI::Template;
use CGI;
use C4::Search;
use Date::Manip;
use C4::Date;
use C4::Reserves2;
use C4::Circulation::Renewals2;
use C4::Circulation::Circ2;
use C4::Koha;
use HTML::Template;
my $dbh = C4::Context->dbh;
my $input = new CGI;
my ($template, $loggedinuser, $cookie)
= get_template_and_user({template_name => "members/moremember.tmpl",
query => $input,
type => "intranet",
authnotrequired => 0,
flagsrequired => {borrowers => 1},
debug => 1,
});
my $bornum=$input->param('bornum');
#start the page and read in includes
my $data=borrdata('',$bornum);
$template->param($data->{'categorycode'} => 1); # in template <TMPL_IF name="I"> => instutitional (A for Adult & C for children)
$data->{'dateenrolled'} = format_date($data->{'dateenrolled'});
$data->{'expiry'} = format_date($data->{'expiry'});
$data->{'dateofbirth'} = format_date($data->{'dateofbirth'});
$data->{'IS_ADULT'} = ($data->{'categorycode'} ne 'I');
$data->{'ethnicity'} = fixEthnicity($data->{'ethnicity'});
$data->{&expand_sex_into_predicate($data->{'sex'})} = 1;
if ($data->{'categorycode'} eq 'C'){
my $data2=borrdata('',$data->{'guarantor'});
$data->{'streetaddress'}=$data2->{'streetaddress'};
$data->{'city'}=$data2->{'city'};
$data->{'physstreet'}=$data2->{'physstreet'};
$data->{'streetcity'}=$data2->{'streetcity'};
$data->{'phone'}=$data2->{'phone'};
$data->{'phoneday'}=$data2->{'phoneday'};
$data->{'zipcode'} = $data2->{'zipcode'};
}
if ($data->{'ethnicity'} || $data->{'ethnotes'}) {
$template->param(printethnicityline => 1);
}
if ($data->{'categorycode'} ne 'C'){
$template->param(isguarantee => 1);
# FIXME
# It looks like the $i is only being returned to handle walking through
# the array, which is probably better done as a foreach loop.
#
my ($count,$guarantees)=findguarantees($data->{'borrowernumber'});
my @guaranteedata;
for (my $i=0;$i<$count;$i++){
push (@guaranteedata, {borrowernumber => $guarantees->[$i]->{'borrowernumber'},
cardnumber => $guarantees->[$i]->{'cardnumber'},
name => $guarantees->[$i]->{'firstname'} . " " . $guarantees->[$i]->{'surname'}});
}
$template->param(guaranteeloop => \@guaranteedata);
} else {
my ($guarantor)=findguarantor($data->{'borrowernumber'});
unless ($guarantor->{'borrowernumber'} == 0){
$template->param(guarantorborrowernumber => $guarantor->{'borrowernumber'}, guarantorcardnumber => $guarantor->{'cardnumber'});
}
}
my %bor;
$bor{'borrowernumber'}=$bornum;
# Converts the branchcode to the branch name
$data->{'branchcode'} = &getbranchname($data->{'branchcode'});
# Converts the categorycode to the description
$data->{'categorycode'} = &getborrowercategory($data->{'categorycode'});
my ($numaccts,$accts,$total)=getboracctrecord('',\%bor);
my ($count,$issue)=borrissues($bornum);
my $today=ParseDate('today');
my @issuedata;
for (my $i=0;$i<$count;$i++){
my $datedue=ParseDate($issue->[$i]{'date_due'});
$issue->[$i]{'date_due'} = format_date($issue->[$i]{'date_due'});
my %row = %{$issue->[$i]};
if ($datedue < $today){
$row{'red'}=1; #print "<font color=red>";
}
#find the charge for an item
# FIXME - This is expecting
# &C4::Circulation::Renewals2::calc_charges, but it's getting
# &C4::Circulation::Circ2::calc_charges, which only returns one
# element, so itemtype isn't being set.
# But &C4::Circulation::Renewals2::calc_charges doesn't appear to
# return the correct item type either (or a properly-formatted
# charge, for that matter).
my ($charge,$itemtype)=calc_charges(undef,$dbh,$issue->[$i]{'itemnumber'},$bornum);
$row{'itemtype'}=&ItemType($itemtype);
$row{'charge'}=$charge;
#check item is not reserved
my ($restype,$reserves)=CheckReserves($issue->[$i]{'itemnumber'});
if ($restype){
print "<TD><a href=/cgi-bin/koha/request.pl?bib=$issue->[$i]{'biblionumber'}>On Request - no renewals</a></td></tr>";
# } elsif ($issue->[$i]->{'renewals'} > 0) {
# print "<TD>Previously Renewed - no renewals</td></tr>";
} else {
$row{'norenew'}=0;
}
push (@issuedata, \%row);
}
my ($rescount,$reserves)=FindReserves('',$bornum); #From C4::Reserves2
my @reservedata;
foreach my $reserveline (@$reserves) {
$reserveline->{'reservedate2'} = format_date($reserveline->{'reservedate'});
my $restitle;
my %row = %$reserveline;
if ($reserveline->{'constrainttype'} eq 'o'){
$restitle=getreservetitle($reserveline->{'biblionumber'},$reserveline->{'borrowernumber'},$reserveline->{'reservedate'},$reserveline->{'rtimestamp'});
%row = (%row , %$restitle) if $restitle;
}
push (@reservedata, \%row);
}
$template->param($data);
$template->param(
bornum => $bornum,
totaldue =>$total,
issueloop => \@issuedata,
reserveloop => \@reservedata);
output_html_with_http_headers $input, $cookie, $template->output;
--- NEW FILE ---
#!/usr/bin/perl
# Note: This file now uses standard 8-space tabs
# $Id: newimember.pl,v 1.1 2004/03/10 15:13:45 tipaul Exp $
#script to print confirmation screen,
#then if accepted calls itself to insert data
#modified 2002/12/16 by hdl at ifrance.com : Templating
#the "parent" is imemberentry.pl
# Copyright 2000-2003 Katipo Communications
#
# This file is part of Koha.
#
# Koha is free software; you can redistribute it and/or modify it under the
# terms of the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option) any later
# version.
#
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
# Suite 330, Boston, MA 02111-1307 USA
use strict;
use C4::Output;
use C4::Input;
use C4::Auth;
use C4::Interface::CGI::Output;
use C4::Members;
use CGI;
use Date::Manip;
use HTML::Template;
my %env;
my $input = new CGI;
#get varibale that tells us whether to show confirmation page
#or insert data
my $insert=$input->param('insert');
my ($template, $loggedinuser, $cookie) = get_template_and_user({
template_name => "newimember.tmpl",
query => $input,
type => "intranet",
authnotrequired => 0,
flagsrequired => {borrowers => 1},
debug => 1,
});
#get rest of data
my %data;
my @names=$input->param;
foreach my $key (@names){
$data{$key}=$input->param($key);
}
my $missing=0;
my $string="The following compulsary fields have been left blank. Please push the back button
and try again<p>";
if ($data{'cardnumber_institution'} !~ /\S/){
$string.="Cardnumber<br>";
$missing=1;
}
if ($data{'institution_name'} !~ /\S/){
$string.="Institution Name<br>";
$missing=1;
}
if ($data{'address'} !~ /\S/){
$string.="Postal Address<br>";
$missing=1;
}
if ($data{'city'} !~ /\S/){
$string.="City<br>";
$missing=1;
}
if ($data{'contactname'} !~ /\S/){
$string.="Contact Name";
$missing=1;
}
$template->param( missingloop => ($missing==1));
$template->param( string => $string);
if ($missing !=1) {
$data{'cardnumber_institution'} = C4::Members::fixup_cardnumber
($data{'cardnumber_institution'});
#check cardnumber is valid
my $nounique;
if ( $data{'type'} ne "Add" ) {
$nounique = 0;
} else {
$nounique = 1;
}
my $valid=checkdigit(\%env,$data{'cardnumber'}, $nounique);
$template->param( invalid => ($valid !=1));
if ($valid) {
my @inputs;
while (my ($key, $value) = each %data) {
push(@inputs, { 'key' => $key,
'value' => CGI::escapeHTML($value) });
}
$template->param(institution_name => $data{institution_name},
bornum => $data{'borrowernumber'},
cardnumber_institution => $data{'cardnumber_institution'},
memcat => $data{'categorycode'},
branchcode => $data{'branchcode'},
sex => $data{sex},
postal => $data{postal},
home => $data{home},
zipcode => $data{'zipcode'},
homezipcode => $data{'homezipcode'},
phone => $data{'phone'},
phoneday => $data{'phoneday'},
faxnumber => $data{'faxnumber'},
emailaddress => $data{'emailaddress'},
textmessaging => $data{'textmessaging'},
contactname => $data{'contactname'},
altphone => $data{'altphone'},
altrelationship => $data{'altrelationship'},
altnotes => $data{'altnotes'},
bornotes => $data{'borrowernotes'},
inputsloop => \@inputs);
}
}
output_html_with_http_headers $input, $cookie, $template->output;
# Local Variables:
# tab-width: 8
# End:
--- NEW FILE ---
#!/usr/bin/perl
# $Id: newjmember.pl,v 1.1 2004/03/10 15:13:45 tipaul Exp $
#script to print confirmation screen, then if accepted calls itself to insert data
# FIXME - Yes, but what does it _do_?
# 2002/12/18 hdl at ifrance.comTemplating
# Copyright 2000-2002 Katipo Communications
#
# This file is part of Koha.
#
# Koha is free software; you can redistribute it and/or modify it under the
# terms of the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option) any later
# version.
#
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
# Suite 330, Boston, MA 02111-1307 USA
use strict;
use C4::Auth;
use C4::Context;
use C4::Output;
use C4::Input;
use C4::Interface::CGI::Output;
use C4::Interface::CGI::Template;
use C4::Koha;
use CGI;
use Date::Manip;
use HTML::Template;
my %env;
my $input = new CGI;
#get varibale that tells us whether to show confirmation page
#or insert data
my $insert=$input->param('insert');
my ($template, $loggedinuser, $cookie)
= get_template_and_user({template_name => "newjmember.tmpl",
query => $input,
type => "intranet",
authnotrequired => 0,
flagsrequired => {borrowers => 1},
debug => 1,
});
#get rest of data
my %data;
my @names=$input->param;
foreach my $key (@names){
$data{$key}=$input->param($key);
}
my $missing=0;
my $string="The following compulsary fields have been left blank. Please push the back button
and try again<p>";
for (my $i=0;$i<3;$i++){
my $number=$data{"cardnumber_child_$i"};
my $firstname=$data{"firstname_child_$i"};
my $surname=$data{"surname_child_$i"};
my $dob=$data{"dateofbirth_child_$i"};
my $sex=$data{"sex_child_$i"};
if ($number eq ''){
if ($i == 0){
$string.=" Cardnumber<br>";
$missing=1;
}
} else {
if ($firstname eq ''){
$string.=" Given Names<br>";
$missing=1;
}
if ($surname eq ''){
$string.=" Surname<br>";
$missing=1;
}
if ($dob eq ''){
$string.=" Date Of Birth<br>";
$missing=1;
}
if ($sex eq ''){
$string.=" Gender <br>";
$missing=1;
}
#check cardnumber is valid
my $nounique;
if ( $data{'type'} ne "Add" ) {
$nounique = 0;
} else {
$nounique = 1;
}
my $valid=checkdigit(\%env,$data{'cardnumber'}, $nounique);
if ($valid != 1){
$string.=" Invalid Cardnumber $number<br>";
$missing=1;
}
}
}
my @identsloop;
for (my $i=0;$i<3;$i++){
my %ident;
# $ident{'main'}=$main;
# $ident{'image'}=$image;
$ident{'cardchild'}=($data{"cardnumber_child_$i"} ne '');
if ($data{"cardnumber_child_$i"} ne ''){
my $name=$data{"firstname_child_$i"} . " " . $data{"surname_child_$i"};
$ident{'name'}=$name;
$ident{'bornum'}=$data{"bornumber_child_$i"};
$ident{'dob'}=$data{"dateofbirth_child_$i"};
($data{"sex_child_$i"} eq 'M') ? ($ident{'sex'}="Male") : ($ident{'sex'}="Female") ;
$ident{'school'}=$data{"school_child_$i"};
$ident{'notes'}=$data{"altnotes_child_$i"};
push(@identsloop, \%ident);
}
}
my @inputsloop;
while (my ($key, $value) = each %data) {
$value=~ s/\"/%22/g;
my %line;
$line{'key'}=$key;
$line{'value'}=$value;
push(@inputsloop, \%line);
}
# FIXME IF main and image are not fetched by HTML::TEMPLATE get them into identsloop
$template->param( NOK => ($missing==1),
identsloop => \@identsloop,
inputsloop => \@inputsloop,
string => $string);
output_html_with_http_headers $input, $cookie, $template->output;
--- NEW FILE ---
#!/usr/bin/perl
# $Id: newmember.pl,v 1.1 2004/03/10 15:13:45 tipaul Exp $
#script to print confirmation screen, then if accepted calls itself to insert data
# FIXME - Yes, but what does it _do_?
# 2002/12/18 hdl at ifrance.com templating
# 2003/01/20 acli at ada.dhs.org XXX it seems to do the following:
# * "insert" seems to do nothing; in 1.2.2 the script just returns a blank
# page (with the headers etc.) if "insert" has anything in it
# * $ok has the opposite meaning of what one expects; $ok == 1 means "not ok"
# * if ($ok == 0) considers the "ok" case; it displays a confirmation page
# for the user to "click to confirm that everything is entered correctly"
# * The "else" case for ($ok == 0) handles the "not ok" case; $string is the
# error message to display
# FIXME - What is the correct value of "flagsrequired"?
# Copyright 2000-2002 Katipo Communications
#
# This file is part of Koha.
#
# Koha is free software; you can redistribute it and/or modify it under the
# terms of the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option) any later
# version.
#
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
# Suite 330, Boston, MA 02111-1307 USA
use strict;
use C4::Auth;
use C4::Input;
use C4::Interface::CGI::Output;
use CGI;
use Date::Manip;
use HTML::Template;
use C4::Date;
my %env;
my $input = new CGI;
#get rest of data
my %data;
my @names=$input->param;
foreach my $key (@names){
$data{$key}=$input->param($key);
}
my ($template, $borrowernumber, $cookie)
= get_template_and_user({template_name => "newmember.tmpl",
query => $input,
type => "intranet",
authnotrequired => 0,
flagsrequired => {parameters => 1},
});
#Get the database handle
my $dbh = C4::Context->dbh;
# Check that all compulsary fields are entered
# If everything is ok, set $ok = 0
# Otherwise set $ok = 1 and $string to the error message to display.
my $ok=0;
my $string = "The following compulsary fields have been left blank. "
. "Please push the back button and try again<p>";
my @errors;
if ($data{'cardnumber'} eq ''){
push @errors,"cardnumber";
$ok=1;
} else {
#check cardnumber is valid
my $nounique;
if ( $data{'type'} eq "Add" ) {
$nounique = 0;
} else {
$nounique = 1;
}
my $valid=checkdigit(\%env,$data{'cardnumber'}, $nounique);
if ($valid != 1){
$ok=1;
push @errors, "invalid_cardnumber";
}
}
if ($data{'sex'} eq ''){
push @errors, "gender";
$ok=1;
}
if ($data{'firstname'} eq ''){
push @errors,"firstname";
$ok=1;
}
if ($data{'surname'} eq ''){
push @errors,"surname";
$ok=1;
}
if ($data{'address'} eq ''){
push @errors, "address";
$ok=1;
}
if ($data{'city'} eq ''){
push @errors, "city";
$ok=1;
}
# Pass the ok/not ok status and the error message to the template
$template->param( OK=> ($ok==0));
foreach my $error (@errors) {
$template->param( $error => 1);
}
# If things are ok, display the confirmation page
if ($ok == 0) {
my $name=$data{'title'}." ";
if ($data{'othernames'} ne ''){
$name.=$data{'othernames'}." ";
} else {
$name.=$data{'firstname'}." ";
}
$name.="$data{'surname'} ( $data{'firstname'}, $data{'initials'})";
my $sex;
if ($data{'sex'} eq 'M'){
$sex=1;
} else {
$sex=0;
}
if ($data{'joining'} eq ''){
$data{'joining'}=ParseDate('today');
$data{'joining'}=format_date($data{'joining'});
}
if ($data{'expiry'} eq ''){
my $get_enrolmentperiod = $dbh->prepare(q{SELECT enrolmentperiod FROM categories WHERE categorycode = ?});
$get_enrolmentperiod->execute($data{'categorycode'});
my ( $period ) = $get_enrolmentperiod->fetchrow;
if ( ($period) && ($period != 1))
{
$data{'expiry'}=ParseDate("in $period years");
$data{'expiry'}=format_date($data{'expiry'});
}
else
{
$data{'expiry'}=ParseDate('in 1 year');
$data{'expiry'}=format_date($data{'expiry'});
}
}
my $ethnic=$data{'ethnicity'}." ".$data{'ethnicnotes'};
my $postal=$data{'address'}."<br>".$data{'city'};
my $home;
if ($data{'streetaddress'} ne ''){
$home=$data{'streetaddress'}."<br>".$data{'streetcity'};
} else {
$home=$postal;
}
my @inputsloop;
while (my ($key, $value) = each %data) {
$value=~ s/\"/%22/g;
my %line;
$line{'key'}=$key;
$line{'value'}=$value;
push(@inputsloop, \%line);
}
#Get the fee
my $sth = $dbh->prepare("SELECT enrolmentfee FROM categories WHERE categorycode = ?");
$sth->execute($data{'categorycode'});
my ($fee) = $sth->fetchrow;
$sth->finish;
$template->param(name => $name,
bornum => $data{'borrowernumber'},
cardnum => $data{'cardnumber'},
memcat => $data{'categorycode'},
fee => $fee,
joindate => format_date($data{'joining'}),
expdate => format_date($data{'expiry'}),
branchcode => $data{'branchcode'},
ethnic => $ethnic,
dob => format_date($data{'dateofbirth'}),
sex => $sex,
postal => $postal,
home => $home,
zipcode => $data{'zipcode'},
homezipcode => $data{'homezipcode'},
phone => $data{'phone'},
phoneday => $data{'phoneday'},
faxnumber => $data{'faxnumber'},
emailaddress => $data{'emailaddress'},
textmessaging => $data{'textmessaging'},
contactname => $data{'contactname'},
altphone => $data{'altphone'},
altrelationship => $data{'altrelationship'},
altnotes => $data{'altnotes'},
bornotes => $data{'borrowernotes'},
inputsloop => \@inputsloop);
# If things are not ok, display the error message
} else {
# Nothing to do; the "OK" and "string" variables have already been set
;
}
output_html_with_http_headers $input, $cookie, $template->output;
- Previous message: [Koha-cvs] CVS: koha/members - New directory
- Next message: [Koha-cvs] CVS: koha/koha-tmpl/intranet-tmpl/default/en/members imemberentry.tmpl,1.7,1.8 jmemberentry.tmpl,1.10,1.11 memberentry.tmpl,1.24,1.25 members-home.tmpl,1.7,1.8 member.tmpl,1.9,1.10 moremember.tmpl,1.26,1.27
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Koha-cvs
mailing list