moving members related scripts to "members" directory
authortipaul <tipaul>
Wed, 10 Mar 2004 15:10:45 +0000 (15:10 +0000)
committertipaul <tipaul>
Wed, 10 Mar 2004 15:10:45 +0000 (15:10 +0000)
40 files changed:
deletemem.pl [deleted file]
imemberentry.pl [deleted file]
insertdata.pl [deleted file]
insertidata.pl [deleted file]
insertjdata.pl [deleted file]
jmemberentry.pl [deleted file]
koha-tmpl/intranet-tmpl/default/en/members/imemberentry.tmpl
koha-tmpl/intranet-tmpl/default/en/members/jmemberentry.tmpl
koha-tmpl/intranet-tmpl/default/en/members/member-flags.tmpl [new file with mode: 0644]
koha-tmpl/intranet-tmpl/default/en/members/member.tmpl
koha-tmpl/intranet-tmpl/default/en/members/memberentry.tmpl
koha-tmpl/intranet-tmpl/default/en/members/members-home.tmpl
koha-tmpl/intranet-tmpl/default/en/members/moremember.tmpl
koha-tmpl/intranet-tmpl/default/en/members/newimember.tmpl [new file with mode: 0644]
koha-tmpl/intranet-tmpl/default/en/members/newjmember.tmpl [new file with mode: 0644]
koha-tmpl/intranet-tmpl/default/en/members/newmember.tmpl [new file with mode: 0644]
member-flags.pl [deleted file]
member-password.pl [deleted file]
member.pl [deleted file]
memberentry.pl [deleted file]
members-home.pl [deleted file]
members/deletemem.pl [new file with mode: 0755]
members/imemberentry.pl [new file with mode: 0755]
members/insertdata.pl [new file with mode: 0755]
members/insertidata.pl [new file with mode: 0755]
members/insertjdata.pl [new file with mode: 0755]
members/jmemberentry.pl [new file with mode: 0755]
members/member-flags.pl [new file with mode: 0755]
members/member-password.pl [new file with mode: 0755]
members/member.pl [new file with mode: 0755]
members/memberentry.pl [new file with mode: 0755]
members/members-home.pl [new file with mode: 0755]
members/moremember.pl [new file with mode: 0755]
members/newimember.pl [new file with mode: 0755]
members/newjmember.pl [new file with mode: 0755]
members/newmember.pl [new file with mode: 0755]
moremember.pl [deleted file]
newimember.pl [deleted file]
newjmember.pl [deleted file]
newmember.pl [deleted file]

diff --git a/deletemem.pl b/deletemem.pl
deleted file mode 100755 (executable)
index 5d7746a..0000000
+++ /dev/null
@@ -1,100 +0,0 @@
-#!/usr/bin/perl
-
-# $Id$
-
-#script to delete items
-#written 2/5/00
-#by chris@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;
-}
diff --git a/imemberentry.pl b/imemberentry.pl
deleted file mode 100755 (executable)
index 0e99229..0000000
+++ /dev/null
@@ -1,107 +0,0 @@
-#!/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@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:
diff --git a/insertdata.pl b/insertdata.pl
deleted file mode 100755 (executable)
index 78223bf..0000000
+++ /dev/null
@@ -1,111 +0,0 @@
-#!/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
-
-
-# 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'}");
diff --git a/insertidata.pl b/insertidata.pl
deleted file mode 100755 (executable)
index 771331e..0000000
+++ /dev/null
@@ -1,107 +0,0 @@
-#!/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
-
-
-# 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'}");
diff --git a/insertjdata.pl b/insertjdata.pl
deleted file mode 100755 (executable)
index bace33b..0000000
+++ /dev/null
@@ -1,100 +0,0 @@
-#!/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
-
-
-# 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'}");
diff --git a/jmemberentry.pl b/jmemberentry.pl
deleted file mode 100755 (executable)
index 921ce69..0000000
+++ /dev/null
@@ -1,101 +0,0 @@
-#!/usr/bin/perl
-
-#script to set up screen for modification of borrower details
-#written 20/12/99 by chris@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;
index 66b1250..df1164c 100644 (file)
@@ -6,7 +6,7 @@
 <!-- TMPL_ELSE -->
        <h1>Add new Institution</h1><br>
 <!-- /TMPL_IF -->
-<form action=/cgi-bin/koha/newimember.pl method=post>
+<form action=/cgi-bin/koha/members/newimember.pl method=post>
   <input type=hidden name=joining value="">
   <input type=hidden name=expiry value="">
   <input type=hidden name=type value="borrowers">
index a6f9338..681737f 100644 (file)
@@ -1,7 +1,7 @@
 <!-- TMPL_INCLUDE NAME="members-top.inc" -->
 
 <h1>Add New Junior Member </h1><br>
-<form action=/cgi-bin/koha/newjmember.pl method=post>
+<form action=/cgi-bin/koha/members/newjmember.pl method=post>
        <!--<input type=hidden name=joining value="">
        <input type=hidden name=expiry value="">
        <input type=hidden name=type value="borrowers">-->
diff --git a/koha-tmpl/intranet-tmpl/default/en/members/member-flags.tmpl b/koha-tmpl/intranet-tmpl/default/en/members/member-flags.tmpl
new file mode 100644 (file)
index 0000000..a72e61c
--- /dev/null
@@ -0,0 +1,28 @@
+<!-- TMPL_INCLUDE NAME="members-top.inc" -->
+
+<h2><!-- TMPL_VAR NAME=surname -->, <!-- TMPL_VAR NAME=firstname --></h2>
+<form method=post action="/cgi-bin/koha/members/member-flags.pl">
+       <input type=hidden name=member value=<!-- TMPL_VAR NAME=member -->>
+       <input type=hidden name=newflags value=1>
+       <table border=1>
+       <tr><th background=/koha/images/background-mem.gif colspan=3>FLAGS</th></tr>
+       <!-- TMPL_LOOP NAME=loop -->
+               <tr>
+                       <td>
+                               <input type=checkbox name="flag-<!-- TMPL_VAR NAME=bit -->" <!-- TMPL_VAR NAME=checked -->>
+                       </td>
+                       <td>
+                               <!-- TMPL_VAR NAME=flag -->
+                       </td>
+                       <td>
+                               <!-- TMPL_VAR NAME=flagdesc -->
+                       </td>
+               </tr>
+       <!-- /TMPL_LOOP -->
+       </table>
+
+       <p>
+       <input type=submit value="Set Flags" class="button">
+</form>
+
+<!-- TMPL_INCLUDE NAME="members-bottom.inc" -->
index 61474ae..2a3a5d1 100644 (file)
@@ -4,7 +4,7 @@
 
 <h1>Member Search</h1><br>
 
-<form action="/cgi-bin/koha/member.pl" method=post>
+<form action="/cgi-bin/koha/members/member.pl" method=post>
   <input type=text name="member" value="<!-- TMPL_VAR NAME=member -->">
   <input type=reset name="reset" value="clr">
 </form>
@@ -29,7 +29,7 @@ You Searched for <!-- TMPL_VAR NAME=member --><p>
     <TR bgcolor=white>
     <!-- /TMPL_IF -->
       <td><!-- TMPL_VAR NAME=cardnumber --></td>
-      <td><a href="/cgi-bin/koha/moremember.pl?bornum=<!-- TMPL_VAR NAME=borrowernumber -->"><!-- TMPL_VAR NAME=surname --></td>
+      <td><a href="/cgi-bin/koha/members/moremember.pl?bornum=<!-- TMPL_VAR NAME=borrowernumber -->"><!-- TMPL_VAR NAME=surname --></td>
       <td><!-- TMPL_VAR NAME=firstname --></a></td>
       <td><!-- TMPL_VAR NAME=categorycode --></td>
       <td><!-- TMPL_VAR NAME=streetaddress --> <!-- TMPL_VAR NAME=city --></td>
@@ -40,7 +40,7 @@ You Searched for <!-- TMPL_VAR NAME=member --><p>
   <!-- /TMPL_LOOP -->
 </table>
 
-<form action=/cgi-bin/koha/simpleredirect.pl method=post>
+<form action=/cgi-bin/koha/members/simpleredirect.pl method=post>
 <input type=submit class="button" value="Add member" title="Add member" alt="Add member">
 <INPUT TYPE="radio" name="chooseform" value="adult" checked>Adult
 <INPUT TYPE="radio" name="chooseform" value="organisation" >Organisation
index 460208f..3993e9d 100644 (file)
@@ -11,7 +11,7 @@
 <!-- /TMPL_IF -->
 <br>
 
-<form action=/cgi-bin/koha/newmember.pl method=post>
+<form action=/cgi-bin/koha/members/newmember.pl method=post>
        <input type=hidden name=joining value="<!-- TMPL_VAR NAME=dateenrolled -->">
        <input type=hidden name=expiry value="<!-- TMPL_VAR NAME=expiry -->">
        <input type=hidden name=type value="borrowers">
index abf1f55..340f717 100644 (file)
@@ -5,7 +5,8 @@
 
 <table border=1 cellspacing=0 cellpadding=10 height="100" >
 <tr VALIGN=TOP  >
-<td  bgcolor="99cc33" background="<!-- TMPL_VAR name="themelang" -->/images/background-mem.gif"><FORM ACTION="/cgi-bin/koha/member.pl" method=post><FONT SIZE=4>
+<td  bgcolor="99cc33" background="<!-- TMPL_VAR name="themelang" -->/images/background-mem.gif">
+<FORM ACTION="/cgi-bin/koha/members/member.pl" method=post><FONT SIZE=4>
 <b>Member Search</B>
 </FONT>
 <INPUT TYPE="text" size=50 name=member >
 <P>
 
 <table border=1 cellspacing=0 cellpadding=10 height="100" >
-<tr VALIGN=TOP  >
-<td  bgcolor="99cc33" background="<!-- TMPL_VAR name="themelang" -->/images/background-mem.gif"><FONT SIZE=4>
-<b>Browse Members</B> 
-</FONT>
-</td></form><tr>
-<TR VALIGN=TOP>
-<TD><CENTER><B>
-<A HREF="/cgi-bin/koha/member.pl?member=a">A</a> ||
-<A HREF="/cgi-bin/koha/member.pl?member=b">B</a> ||
-<A HREF="/cgi-bin/koha/member.pl?member=c">C</a> ||
-<A HREF="/cgi-bin/koha/member.pl?member=d">D</a> ||
-<A HREF="/cgi-bin/koha/member.pl?member=e">E</a> ||
-<A HREF="/cgi-bin/koha/member.pl?member=f">F</a> ||
-<A HREF="/cgi-bin/koha/member.pl?member=g">G</a> ||
-<A HREF="/cgi-bin/koha/member.pl?member=h">H</a> ||
-<A HREF="/cgi-bin/koha/member.pl?member=i">I</a> ||
-<A HREF="/cgi-bin/koha/member.pl?member=j">J</a> ||
-<A HREF="/cgi-bin/koha/member.pl?member=k">K</a> ||
-<A HREF="/cgi-bin/koha/member.pl?member=l">L</a> ||
-<A HREF="/cgi-bin/koha/member.pl?member=m">M</a> ||
-<A HREF="/cgi-bin/koha/member.pl?member=n">N</a> ||
-<A HREF="/cgi-bin/koha/member.pl?member=o">O</a> ||
-<A HREF="/cgi-bin/koha/member.pl?member=p">P</a> ||
-<A HREF="/cgi-bin/koha/member.pl?member=q">Q</a> ||
-<A HREF="/cgi-bin/koha/member.pl?member=r">R</a> ||
-<A HREF="/cgi-bin/koha/member.pl?member=s">S</a> ||
-<A HREF="/cgi-bin/koha/member.pl?member=t">T</a> ||
-<A HREF="/cgi-bin/koha/member.pl?member=u">U</a> ||
-<A HREF="/cgi-bin/koha/member.pl?member=v">V</a> ||
-<A HREF="/cgi-bin/koha/member.pl?member=w">W</a> ||
-<A HREF="/cgi-bin/koha/member.pl?member=x">X</a> ||
-<A HREF="/cgi-bin/koha/member.pl?member=y">Y</a> ||
-<A HREF="/cgi-bin/koha/member.pl?member=z">Z</a>
-
-</B>
-</TD></TR></TABLE>
-
-<P>
+       <tr VALIGN=TOP  >
+               <td  bgcolor="99cc33" background="<!-- TMPL_VAR name="themelang" -->/images/background-mem.gif">
+                       <FONT SIZE=4><b>Browse Members</B></FONT>
+               </td>
+       </tr>
+       <TR VALIGN=TOP>
+               <TD>
+                       <CENTER><B>
+                       <A HREF="/cgi-bin/koha/members/member.pl?member=a">A</a> ||
+                       <A HREF="/cgi-bin/koha/members/member.pl?member=b">B</a> ||
+                       <A HREF="/cgi-bin/koha/members/member.pl?member=c">C</a> ||
+                       <A HREF="/cgi-bin/koha/members/member.pl?member=d">D</a> ||
+                       <A HREF="/cgi-bin/koha/members/member.pl?member=e">E</a> ||
+                       <A HREF="/cgi-bin/koha/members/member.pl?member=f">F</a> ||
+                       <A HREF="/cgi-bin/koha/members/member.pl?member=g">G</a> ||
+                       <A HREF="/cgi-bin/koha/members/member.pl?member=h">H</a> ||
+                       <A HREF="/cgi-bin/koha/members/member.pl?member=i">I</a> ||
+                       <A HREF="/cgi-bin/koha/members/member.pl?member=j">J</a> ||
+                       <A HREF="/cgi-bin/koha/members/member.pl?member=k">K</a> ||
+                       <A HREF="/cgi-bin/koha/members/member.pl?member=l">L</a> ||
+                       <A HREF="/cgi-bin/koha/members/member.pl?member=m">M</a> ||
+                       <A HREF="/cgi-bin/koha/members/member.pl?member=n">N</a> ||
+                       <A HREF="/cgi-bin/koha/members/member.pl?member=o">O</a> ||
+                       <A HREF="/cgi-bin/koha/members/member.pl?member=p">P</a> ||
+                       <A HREF="/cgi-bin/koha/members/member.pl?member=q">Q</a> ||
+                       <A HREF="/cgi-bin/koha/members/member.pl?member=r">R</a> ||
+                       <A HREF="/cgi-bin/koha/members/member.pl?member=s">S</a> ||
+                       <A HREF="/cgi-bin/koha/members/member.pl?member=t">T</a> ||
+                       <A HREF="/cgi-bin/koha/members/member.pl?member=u">U</a> ||
+                       <A HREF="/cgi-bin/koha/members/member.pl?member=v">V</a> ||
+                       <A HREF="/cgi-bin/koha/members/member.pl?member=w">W</a> ||
+                       <A HREF="/cgi-bin/koha/members/member.pl?member=x">X</a> ||
+                       <A HREF="/cgi-bin/koha/members/member.pl?member=y">Y</a> ||
+                       <A HREF="/cgi-bin/koha/members/member.pl?member=z">Z</a>
+                       </B>
+               </TD>
+       </TR>
+</TABLE>
 <!-- TMPL_INCLUDE NAME="members-bottom.inc" -->
index 3fd9a7d..0941480 100644 (file)
@@ -58,7 +58,7 @@
                </font>
                <!-- TMPL_IF name="IS_ADULT" -->
                        <p align=right>
-                       <form action=/cgi-bin/koha/jmemberentry.pl method=post>
+                       <form action=/cgi-bin/koha/members/jmemberentry.pl method=post>
                                <INPUT TYPE="submit" name="submit" VALUE="Add Child" class="button" alt="Add Child">
                                <input type=hidden name=type value=Add>
                                <input type=hidden name=bornum value="<!-- TMPL_VAR NAME=borrowernumber -->">
                <!-- /TMPL_IF -->
                <br>
                <!-- TMPL_IF name="I" -->
-                       <form action=/cgi-bin/koha/imemberentry.pl method=post>
+                       <form action=/cgi-bin/koha/members/imemberentry.pl method=post>
                                <input type=hidden name=bornum value="<!-- TMPL_VAR NAME="bornum" -->">
                                <INPUT TYPE=submit class="button" value="Modify">
                        </form>
                <!-- TMPL_ELSE -->
-                       <form action=/cgi-bin/koha/memberentry.pl method=post>
+                       <form action=/cgi-bin/koha/members/memberentry.pl method=post>
                                <input type=hidden name=bornum value="<!-- TMPL_VAR NAME="bornum" -->">
                                <INPUT TYPE=submit class="button" name="modify" value="Modify">
                        </form>
                         <input type=hidden name=member value="<!-- TMPL_VAR NAME="bornum" -->">
                        <INPUT TYPE=submit class="button" value="Delete">
                </form>
-               <form action=/cgi-bin/koha/member-password.pl method=post>
+               <form action=/cgi-bin/koha/members/member-password.pl method=post>
                        <input type=hidden name=member value=<!-- TMPL_VAR NAME=bornum -->>
                        <input type=submit class="button" value="Change Password">
                </form>
-               <form action=/cgi-bin/koha/member-flags.pl method=post>
+               <form action=/cgi-bin/koha/members/member-flags.pl method=post>
                        <input type=hidden name=member value=<!-- TMPL_VAR NAME=bornum -->>
                        <input type=submit class="button" value="Modify User Flags">
                </form>
 function confirm_deletion() {
        var is_confirmed = confirm('do you confirm deletetion ?');
        if (is_confirmed) {
-               window.location="/cgi-bin/koha/deletemem.pl?member=<!-- TMPL_VAR NAME="bornum" -->";
+               window.location="/cgi-bin/koha/members/deletemem.pl?member=<!-- TMPL_VAR NAME="bornum" -->";
        }
 }
 </script>
diff --git a/koha-tmpl/intranet-tmpl/default/en/members/newimember.tmpl b/koha-tmpl/intranet-tmpl/default/en/members/newimember.tmpl
new file mode 100644 (file)
index 0000000..eb72fc6
--- /dev/null
@@ -0,0 +1,180 @@
+<!-- TMPL_INCLUDE NAME="members-top.inc" -->
+
+<!-- TMPL_IF NAME="missingloop" -->
+       <!-- TMPL_VAR Name="string" -->
+<!-- TMPL_ELSE -->
+       <!-- TMPL_IF NAME=invalid -->
+               Invalid cardnumber.<p>
+       <!-- TMPL_ELSE -->
+       <H1> Confirm Record </H1>
+       <table border=0 cellspacing=0 cellpadding=5>
+               <tr valign=top bgcolor="<!-- TMPL_VAR Name="main" -->" >
+                       <td colspan=2 background="<!-- TMPL_VAR name="themelang" -->/images/background-mem.gif">
+                               <B> NEW MEMBER </B>
+                       </td>
+               </tr>
+               <tr valign=top bgcolor="white" >
+                       <td>
+                               <B>Name</B>
+                       </td>
+                       <td>
+                               <!-- TMPL_VAR Name="institution_name" -->
+                       </td>
+               </tr>
+               <tr valign=top bgcolor="<!-- TMPL_VAR Name="main" -->" >
+                       <td colspan=2 background="<!-- TMPL_VAR name="themelang" -->/images/background-mem.gif">
+                               <B> MEMBERSHIP DETAILS </B>
+                       </td>
+               </tr>
+               <tr valign=top bgcolor="white" >
+                       <td>
+                               <B>Membership Number</B>
+                       </td>
+                       <td>
+                               <!-- TMPL_VAR Name="bornum" -->
+                       </td>
+               </tr>
+               <tr valign=top bgcolor="white" >
+                       <td>
+                               <B>Card number</B>
+                       </td>
+                       <td>
+                               <!-- TMPL_VAR Name="cardnumber_institution" -->
+                       </td>
+               </tr>
+               <tr valign=top bgcolor="white" >
+                       <td>
+                               <B>Joining Branch</B>
+                       </td>
+                       <td>
+                               <!-- TMPL_VAR Name="branchcode" -->
+                       </td>
+               </tr>
+               <tr valign=top bgcolor="<!-- TMPL_VAR Name="main" -->" >
+                       <td colspan=2 background="<!-- TMPL_VAR name="themelang" -->/images/background-mem.gif">
+                               <B>MEMBER ADDRESS</B>
+                       </td>
+               </tr>
+               <tr valign=top bgcolor="white" >
+                       <td>
+                               <B>Postal Address</B>
+                       </td>
+                       <td>
+                               <!-- TMPL_VAR Name="postal" -->
+                       </td>
+               </tr>
+               <tr valign=top bgcolor="white" >
+                       <td>
+                               <B>Home Address</B>
+                       </td>
+                       <td>
+                               <!-- TMPL_VAR Name="home" -->
+                       </td>
+               </tr>
+               <tr valign=top bgcolor="<!-- TMPL_VAR Name="main" -->" >
+                       <td colspan=2 background="<!-- TMPL_VAR name="themelang" -->/images/background-mem.gif">
+                               <B>MEMBER CONTACT DETAIL</B>
+                       </td>
+               </tr>
+               <tr valign=top bgcolor="white" >
+                       <td>
+                               <B>Phone (Home)</B>
+                       </td>
+                       <td>
+                               <!-- TMPL_VAR Name="phone" -->
+                       </td>
+               </tr>
+               <tr valign=top bgcolor="white" >
+                       <td>
+                               <B>Phone (Daytime)</B>
+                       </td>
+                       <td>
+                               <!-- TMPL_VAR Name="phoneday" -->
+                       </td>
+               </tr>
+               <tr valign=top bgcolor="white" >
+                       <td>
+                               <B>Fax</B>
+                       </td>
+                       <td>
+                               <!-- TMPL_VAR Name="faxnumber" -->
+                       </td>
+               </tr>
+               <tr valign=top bgcolor="white" >
+                       <td>
+                               <B>E-mail</B>
+                       </td>
+                       <td>
+                               <!-- TMPL_VAR Name="emailaddress" -->
+                       </td>
+               </tr>
+                <tr valign=top bgcolor="white" >
+                        <td>
+                                <B>Text messaging</B>
+                       </td>
+                       <td>
+                               <!-- TMPL_VAR NAME=textmessaging -->
+                       </td>
+               </tr>
+               <tr valign=top bgcolor="<!-- TMPL_VAR Name="main" -->" >
+                       <td colspan=2 background="<!-- TMPL_VAR name="themelang" -->/images/background-mem.gif">
+                               <B>ALTERNATIVE CONTACT DETAIL</B>
+                       </td>
+               </tr>
+               <tr valign=top bgcolor="white" >
+                       <td>
+                               <B>Name</B>
+                       </td>
+                       <td>
+                               <!-- TMPL_VAR Name="contactname" -->
+                       </td>
+               </tr>
+               <tr valign=top bgcolor="white" >
+                       <td>
+                               <B>Phone</B>
+                       </td>
+                       <td>
+                               <!-- TMPL_VAR Name="altphone" -->
+                       </td>
+               </tr>
+               <tr valign=top bgcolor="white" >
+                       <td>
+                               <B>Relationship</B>
+                       </td>
+                       <td>
+                               <!-- TMPL_VAR Name="altrelationship" -->
+                       </td>
+               </tr>
+               <tr valign=top bgcolor="white" >
+                       <td>
+                               <B>Notes</B>
+                       </td>
+                       <td>
+                               <!-- TMPL_VAR Name="altnotes" -->
+                       </td>
+               </tr>
+               <tr valign=top bgcolor="<!-- TMPL_VAR Name="main" -->" >
+                       <td colspan=2 background="<!-- TMPL_VAR name="themelang" -->/images/background-mem.gif">
+                               <B>NOTES</B>
+                       </td>
+               </tr>
+               <tr valign=top bgcolor="white" >
+                       <td>
+                               <B>General Notes</B>
+                       </td>
+                       <td>
+                               <!-- TMPL_VAR Name="bornotes" -->
+                       </td>
+               </tr>
+               </TABLE><p>
+               Valid values. click OK to confirm this new borrower
+               <form action="/cgi-bin/koha/members/insertidata.pl" method=post>
+                       <!-- TMPL_LOOP NAME=inputsloop -->
+                               <input type=hidden name="<!-- TMPL_VAR NAME="key" -->" value="<!-- TMPL_VAR NAME="value" -->">
+                       <!-- /TMPL_LOOP -->
+                       <input type=submit name=submit value=OK>
+               </form>
+       <!-- /TMPL_IF -->
+<!-- /TMPL_IF -->
+
+<!-- TMPL_INCLUDE NAME="members-bottom.inc" -->
diff --git a/koha-tmpl/intranet-tmpl/default/en/members/newjmember.tmpl b/koha-tmpl/intranet-tmpl/default/en/members/newjmember.tmpl
new file mode 100644 (file)
index 0000000..3496d2a
--- /dev/null
@@ -0,0 +1,85 @@
+<!-- TMPL_INCLUDE Name="members-top.inc" -->
+
+<!-- TMPL_IF Name="NOK" -->
+       <!-- TMPL_VAR Name="string" -->
+<!-- TMPL_ELSE -->
+       <H1> Confirm Record </H1>
+       <!-- TMPL_LOOP Name="identsloop" -->
+               <!-- TMPL_IF Name="cardchild" -->
+                       <table border=0 cellspacing=0 cellpadding=5>
+                               <tr valign=top bgcolor="<!-- TMPL_VAR Name="main" -->" >
+                                       <td background="<!-- TMPL_VAR Name="image" -->">
+                                       <B> NEW MEMBER </B>
+                                       </td>
+                                       <td>
+                                       &nbsp;
+                                       </td>
+                               </tr>
+                               <tr valign=top bgcolor="white" >
+                                       <td>
+                                       <B>Name</B>
+                                       </td>
+                                       <td>
+                                       <!-- TMPL_VAR Name="name" -->
+                                       </td>
+                               </tr>
+                               <tr valign=top bgcolor="<!-- TMPL_VAR Name="main" -->" >
+                                       <td background="<!-- TMPL_VAR Name="image" -->">
+                                       <B> MEMBERSHIP DETAILS </B>
+                                       </td>
+                                       <td>
+                                       &nbsp;
+                                       </td>
+                               </tr>
+                               <tr valign=top bgcolor="white" >
+                                       <td>
+                                       <B>Membership Number</B>
+                                       </td>
+                                       <td>
+                                       <!-- TMPL_VAR Name="bornum" -->
+                                       </td>
+                               </tr>
+                               <tr valign=top bgcolor="white" >
+                                       <td>
+                                       <B>Date of birth</B>
+                                       </td>
+                                       <td>
+                                       <!-- TMPL_VAR Name="dob" -->
+                                       </td>
+                               </tr>
+                               <tr valign=top bgcolor="white" >
+                                       <td>
+                                       <B>Sex</B>
+                                       </td>
+                                       <td>
+                                       <!-- TMPL_VAR Name="sex" -->
+                                       </td>
+                               </tr>
+                               <tr valign=top bgcolor="white" >
+                                       <td>
+                                       <B>School</B>
+                                       </td>
+                                       <td>
+                                       <!-- TMPL_VAR Name="school" -->
+                                       </td>
+                               </tr>
+                               <tr valign=top bgcolor="white" >
+                                       <td>
+                                       <B>General Notes</B>
+                                       </td>
+                                       <td>
+                                       <!-- TMPL_VAR Name="notes" -->
+                                       </td>
+                               </tr>
+                       </TABLE><p>
+               <!-- /TMPL_IF -->
+  <!-- /TMPL_LOOP -->
+       <form action="/cgi-bin/koha/members/insertjdata.pl" method=post>
+               <!-- TMPL_LOOP NAME=inputsloop -->
+                       <input type=hidden name="<!-- TMPL_VAR NAME="key" -->" value="<!-- TMPL_VAR NAME="value" -->">
+               <!-- /TMPL_LOOP -->
+               <input type=submit name=submit value=submit>
+       </form>
+<!-- /TMPL_IF -->
+
+<!-- TMPL_INCLUDE Name="members-bottom.inc" -->
diff --git a/koha-tmpl/intranet-tmpl/default/en/members/newmember.tmpl b/koha-tmpl/intranet-tmpl/default/en/members/newmember.tmpl
new file mode 100644 (file)
index 0000000..043cc16
--- /dev/null
@@ -0,0 +1,255 @@
+<!-- TMPL_INCLUDE Name="members-top.inc" -->
+
+<!-- TMPL_IF Name="OK" -->
+       <H1> Confirm Record </H1>
+       <table border=0 cellspacing=0 cellpadding=5>
+               <tr valign=top bgcolor="<!-- TMPL_VAR Name="main" -->" >
+                       <td colspan=2 background="<!-- TMPL_VAR name="themelang" -->/images/background-mem.gif">
+                               <B> NEW MEMBER </B>
+                       </td>
+               </tr>
+               <tr valign=top bgcolor="white" >
+                       <td>
+                               <B>Name</B>
+                       </td>
+                       <td>
+                               <!-- TMPL_VAR Name="name" -->
+                       </td>
+               </tr>
+               <tr valign=top bgcolor="<!-- TMPL_VAR Name="main" -->" >
+                       <td colspan=2 background="<!-- TMPL_VAR name="themelang" -->/images/background-mem.gif">
+                               <B> MEMBERSHIP DETAILS </B>
+                       </td>
+               </tr>
+               <tr valign=top bgcolor="white" >
+                       <td>
+                               <B>Membership Number</B>
+                       </td>
+                       <td>
+                               <!-- TMPL_VAR Name="bornum" -->
+                       </td>
+               </tr>
+               <tr valign=top bgcolor="white" >
+                       <td>
+                               <B>Card number</B>
+                       </td>
+                       <td>
+                               <!-- TMPL_VAR Name="cardnum" -->
+                       </td>
+               </tr>
+               <tr valign=top bgcolor="white" >
+                       <td>
+                               <B>Membership Category</B>
+                       </td>
+                       <td>
+                               <!-- TMPL_VAR Name="memcat" -->
+                       </td>
+               </tr>
+               <tr valign=top bgcolor="white" >
+                       <td>
+                               <B>Fee</B>
+                       </td>
+                       <td>
+                               <!-- TMPL_VAR Name="fee" -->
+                       </td>
+               </tr>
+               <tr valign=top bgcolor="white" >
+                       <td>
+                               <B>Joining Date</B>
+                       </td>
+                       <td>
+                               <!-- TMPL_VAR Name="joindate" -->
+                       </td>
+               </tr>
+               <tr valign=top bgcolor="white" >
+                       <td>
+                               <B>Expiry Date</B>
+                       </td>
+                       <td>
+                               <!-- TMPL_VAR Name="expdate" -->
+                       </td>
+               </tr>
+               <tr valign=top bgcolor="white" >
+                       <td>
+                               <B>Joining Branch</B>
+                       </td>
+                       <td>
+                               <!-- TMPL_VAR Name="branchcode" -->
+                       </td>
+               </tr>
+               <tr valign=top bgcolor="<!-- TMPL_VAR Name="main" -->" >
+                       <td colspan=2 background="<!-- TMPL_VAR name="themelang" -->/images/background-mem.gif">
+                               <B>PERSONAL DETAILS</B>
+                       </td>
+               </tr>
+               <tr valign=top bgcolor="white" >
+                       <td>
+                               <B>Date of birth</B>
+                       </td>
+                       <td>
+                               <!-- TMPL_VAR Name="dob" -->
+                       </td>
+               </tr>
+               <tr valign=top bgcolor="white" >
+                       <td>
+                               <B>Sex</B>
+                       </td>
+                       <td>
+                               <!-- TMPL_IF Name="sex" -->
+                                       Male
+                               <!-- TMPL_ELSE -->
+                                       Female
+                               <!-- /TMPL_IF -->
+                       </td>
+               </tr>
+               <tr valign=top bgcolor="<!-- TMPL_VAR Name="main" -->" >
+                       <td colspan=2 background="<!-- TMPL_VAR name="themelang" -->/images/background-mem.gif">
+                               <B>MEMBER ADDRESS</B>
+                       </td>
+               </tr>
+               <tr valign=top bgcolor="white" >
+                       <td>
+                               <B>Postal Address</B>
+                       </td>
+                       <td>
+                               <!-- TMPL_VAR Name="postal" -->
+                       </td>
+               </tr>
+               <tr valign=top bgcolor="white" >
+                       <td>
+                               <B>Home Address</B>
+                       </td>
+                       <td>
+                               <!-- TMPL_VAR Name="home" -->
+                       </td>
+               </tr>
+               <tr valign=top bgcolor="<!-- TMPL_VAR Name="main" -->" >
+                       <td colspan=2 background="<!-- TMPL_VAR name="themelang" -->/images/background-mem.gif">
+                               <B>MEMBER CONTACT DETAIL</B>
+                       </td>
+               </tr>
+               <tr valign=top bgcolor="white" >
+                       <td>
+                               <B>Phone home</B>
+                       </td>
+                       <td>
+                               <!-- TMPL_VAR Name="phone" -->
+                       </td>
+               </tr>
+               <tr valign=top bgcolor="white" >
+                       <td>
+                               <B>Phone daytime</B>
+                       </td>
+                       <td>
+                               <!-- TMPL_VAR Name="phoneday" -->
+                       </td>
+               </tr>
+               <tr valign=top bgcolor="white" >
+                       <td>
+                               <B>Fax</B>
+                       </td>
+                       <td>
+                               <!-- TMPL_VAR Name="faxnumber" -->
+                       </td>
+               </tr>
+               <tr valign=top bgcolor="white" >
+                       <td>
+                               <B>E-mail</B>
+                       </td>
+                       <td>
+                               <!-- TMPL_VAR Name="emailaddress" -->
+                       </td>
+               </tr>
+                <tr valign=top bgcolor="white" >
+                        <td>
+                                <B>Text messaging</B>
+                       </td>
+                       <td>
+                               <!-- TMPL_VAR NAME=textmessaging -->
+                       </td>
+               </tr>
+               <tr valign=top bgcolor="<!-- TMPL_VAR Name="main" -->" >
+                       <td colspan=2 background="<!-- TMPL_VAR name="themelang" -->/images/background-mem.gif">
+                               <B>ALTERNATIVE CONTACT DETAIL</B>
+                       </td>
+               </tr>
+               <tr valign=top bgcolor="white" >
+                       <td>
+                               <B>Name</B>
+                       </td>
+                       <td>
+                               <!-- TMPL_VAR Name="contactname" -->
+                       </td>
+               </tr>
+               <tr valign=top bgcolor="white" >
+                       <td>
+                               <B>Phone</B>
+                       </td>
+                       <td>
+                               <!-- TMPL_VAR Name="altphone" -->
+                       </td>
+               </tr>
+               <tr valign=top bgcolor="white" >
+                       <td>
+                               <B>Relationship</B>
+                       </td>
+                       <td>
+                               <!-- TMPL_VAR Name="altrelationship" -->
+                       </td>
+               </tr>
+               <tr valign=top bgcolor="white" >
+                       <td>
+                               <B>Notes</B>
+                       </td>
+                       <td>
+                               <!-- TMPL_VAR Name="altnotes" -->
+                       </td>
+               </tr>
+               <tr valign=top bgcolor="<!-- TMPL_VAR Name="main" -->" >
+                       <td colspan=2 background="<!-- TMPL_VAR name="themelang" -->/images/background-mem.gif">
+                               <B>NOTES</B>
+                       </td>
+               </tr>
+               <tr valign=top bgcolor="white" >
+                       <td>
+                               <B>General Notes</B>
+                       </td>
+                       <td>
+                               <!-- TMPL_VAR Name="bornotes" -->
+                       </td>
+               </tr>
+               </TABLE><p>
+               <form action="/cgi-bin/koha/members/insertdata.pl" method=post>
+                       <!-- TMPL_LOOP NAME=inputsloop -->
+                               <input type=hidden name="<!-- TMPL_VAR NAME="key" -->" value="<!-- TMPL_VAR NAME="value" -->">
+                       <!-- /TMPL_LOOP -->
+                       <input type=submit name=submit value=Submit>
+               </form>
+<!-- TMPL_ELSE -->
+       <h1>ERROR</H1>
+       <p>The following fields have a forbidden value. Please push the back button and try again : </p>
+       <!-- TMPL_IF name="cardnumber" -->
+               Card number<br/>
+       <!-- /TMPL_IF -->
+       <!-- TMPL_IF name="invalid_cardnumber" -->
+               Invalid cardnumber<br/>
+       <!-- /TMPL_IF -->
+       <!-- TMPL_IF name="gender" -->
+               Gender<br/>
+       <!-- /TMPL_IF -->
+       <!-- TMPL_IF name="firstname" -->
+               Given Names<br/>
+       <!-- /TMPL_IF -->
+       <!-- TMPL_IF name="surname" -->
+               Surname<br/>
+       <!-- /TMPL_IF -->
+       <!-- TMPL_IF name="address" -->
+               Postal Street Address<br/>
+       <!-- /TMPL_IF -->
+       <!-- TMPL_IF name="city" -->
+               Postal city<br/>
+       <!-- /TMPL_IF -->
+<!-- /TMPL_IF -->
+
+
+<!-- TMPL_INCLUDE Name="members-bottom.inc" -->
diff --git a/member-flags.pl b/member-flags.pl
deleted file mode 100755 (executable)
index f3c1b96..0000000
+++ /dev/null
@@ -1,86 +0,0 @@
-#!/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 => "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;
-
-}
diff --git a/member-password.pl b/member-password.pl
deleted file mode 100755 (executable)
index 1d3a539..0000000
+++ /dev/null
@@ -1,96 +0,0 @@
-#!/usr/bin/perl
-#script to set the password, and optionally a userid, for a borrower
-#written 2/5/00
-#by chris@katipo.co.nz
-#converted to using templates 3/16/03 by mwhansen@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;
diff --git a/member.pl b/member.pl
deleted file mode 100755 (executable)
index 409fe66..0000000
--- a/member.pl
+++ /dev/null
@@ -1,94 +0,0 @@
-#!/usr/bin/perl
-
-# $Id$
-
-#script to do a borrower enquiery/brin up borrower details etc
-#written 20/12/99 by chris@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;
diff --git a/memberentry.pl b/memberentry.pl
deleted file mode 100755 (executable)
index 21b0b3d..0000000
+++ /dev/null
@@ -1,194 +0,0 @@
-#!/usr/bin/perl
-# NOTE: This file uses standard 8-space tabs
-#       DO NOT SET TAB SIZE TO 4
-
-# $Id$
-
-#script to set up screen for modification of borrower details
-#written 20/12/99 by chris@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:
diff --git a/members-home.pl b/members-home.pl
deleted file mode 100755 (executable)
index b2730e0..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-#!/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;
diff --git a/members/deletemem.pl b/members/deletemem.pl
new file mode 100755 (executable)
index 0000000..5d7746a
--- /dev/null
@@ -0,0 +1,100 @@
+#!/usr/bin/perl
+
+# $Id$
+
+#script to delete items
+#written 2/5/00
+#by chris@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;
+}
diff --git a/members/imemberentry.pl b/members/imemberentry.pl
new file mode 100755 (executable)
index 0000000..0e99229
--- /dev/null
@@ -0,0 +1,107 @@
+#!/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@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:
diff --git a/members/insertdata.pl b/members/insertdata.pl
new file mode 100755 (executable)
index 0000000..78223bf
--- /dev/null
@@ -0,0 +1,111 @@
+#!/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
+
+
+# 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'}");
diff --git a/members/insertidata.pl b/members/insertidata.pl
new file mode 100755 (executable)
index 0000000..771331e
--- /dev/null
@@ -0,0 +1,107 @@
+#!/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
+
+
+# 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'}");
diff --git a/members/insertjdata.pl b/members/insertjdata.pl
new file mode 100755 (executable)
index 0000000..bace33b
--- /dev/null
@@ -0,0 +1,100 @@
+#!/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
+
+
+# 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'}");
diff --git a/members/jmemberentry.pl b/members/jmemberentry.pl
new file mode 100755 (executable)
index 0000000..921ce69
--- /dev/null
@@ -0,0 +1,101 @@
+#!/usr/bin/perl
+
+#script to set up screen for modification of borrower details
+#written 20/12/99 by chris@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;
diff --git a/members/member-flags.pl b/members/member-flags.pl
new file mode 100755 (executable)
index 0000000..8522f3e
--- /dev/null
@@ -0,0 +1,86 @@
+#!/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;
+
+}
diff --git a/members/member-password.pl b/members/member-password.pl
new file mode 100755 (executable)
index 0000000..1d3a539
--- /dev/null
@@ -0,0 +1,96 @@
+#!/usr/bin/perl
+#script to set the password, and optionally a userid, for a borrower
+#written 2/5/00
+#by chris@katipo.co.nz
+#converted to using templates 3/16/03 by mwhansen@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;
diff --git a/members/member.pl b/members/member.pl
new file mode 100755 (executable)
index 0000000..409fe66
--- /dev/null
@@ -0,0 +1,94 @@
+#!/usr/bin/perl
+
+# $Id$
+
+#script to do a borrower enquiery/brin up borrower details etc
+#written 20/12/99 by chris@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;
diff --git a/members/memberentry.pl b/members/memberentry.pl
new file mode 100755 (executable)
index 0000000..21b0b3d
--- /dev/null
@@ -0,0 +1,194 @@
+#!/usr/bin/perl
+# NOTE: This file uses standard 8-space tabs
+#       DO NOT SET TAB SIZE TO 4
+
+# $Id$
+
+#script to set up screen for modification of borrower details
+#written 20/12/99 by chris@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:
diff --git a/members/members-home.pl b/members/members-home.pl
new file mode 100755 (executable)
index 0000000..b2730e0
--- /dev/null
@@ -0,0 +1,21 @@
+#!/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;
diff --git a/members/moremember.pl b/members/moremember.pl
new file mode 100755 (executable)
index 0000000..958e434
--- /dev/null
@@ -0,0 +1,183 @@
+#!/usr/bin/perl
+
+# $Id$
+
+# script to do a borrower enquiry/bring up borrower details etc
+# Displays all the details about a borrower
+# written 20/12/99 by chris@katipo.co.nz
+# last modified 21/1/2000 by chris@katipo.co.nz
+# modified 31/1/2001 by chris@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;
diff --git a/members/newimember.pl b/members/newimember.pl
new file mode 100755 (executable)
index 0000000..cef87c8
--- /dev/null
@@ -0,0 +1,137 @@
+#!/usr/bin/perl
+# Note: This file now uses standard 8-space tabs
+
+# $Id$
+
+#script to print confirmation screen,
+#then if accepted calls itself to insert data
+#modified 2002/12/16 by hdl@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:
diff --git a/members/newjmember.pl b/members/newjmember.pl
new file mode 100755 (executable)
index 0000000..2fd584d
--- /dev/null
@@ -0,0 +1,137 @@
+#!/usr/bin/perl
+
+# $Id$
+
+#script to print confirmation screen, then if accepted calls itself to insert data
+# FIXME - Yes, but what does it _do_?
+# 2002/12/18 hdl@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;
diff --git a/members/newmember.pl b/members/newmember.pl
new file mode 100755 (executable)
index 0000000..01aafd4
--- /dev/null
@@ -0,0 +1,210 @@
+#!/usr/bin/perl
+
+# $Id$
+
+#script to print confirmation screen, then if accepted calls itself to insert data
+# FIXME - Yes, but what does it _do_?
+# 2002/12/18 hdl@ifrance.com templating
+
+# 2003/01/20 acli@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;
+
+
diff --git a/moremember.pl b/moremember.pl
deleted file mode 100755 (executable)
index 958e434..0000000
+++ /dev/null
@@ -1,183 +0,0 @@
-#!/usr/bin/perl
-
-# $Id$
-
-# script to do a borrower enquiry/bring up borrower details etc
-# Displays all the details about a borrower
-# written 20/12/99 by chris@katipo.co.nz
-# last modified 21/1/2000 by chris@katipo.co.nz
-# modified 31/1/2001 by chris@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;
diff --git a/newimember.pl b/newimember.pl
deleted file mode 100755 (executable)
index cef87c8..0000000
+++ /dev/null
@@ -1,137 +0,0 @@
-#!/usr/bin/perl
-# Note: This file now uses standard 8-space tabs
-
-# $Id$
-
-#script to print confirmation screen,
-#then if accepted calls itself to insert data
-#modified 2002/12/16 by hdl@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:
diff --git a/newjmember.pl b/newjmember.pl
deleted file mode 100755 (executable)
index 2fd584d..0000000
+++ /dev/null
@@ -1,137 +0,0 @@
-#!/usr/bin/perl
-
-# $Id$
-
-#script to print confirmation screen, then if accepted calls itself to insert data
-# FIXME - Yes, but what does it _do_?
-# 2002/12/18 hdl@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;
diff --git a/newmember.pl b/newmember.pl
deleted file mode 100755 (executable)
index 01aafd4..0000000
+++ /dev/null
@@ -1,210 +0,0 @@
-#!/usr/bin/perl
-
-# $Id$
-
-#script to print confirmation screen, then if accepted calls itself to insert data
-# FIXME - Yes, but what does it _do_?
-# 2002/12/18 hdl@ifrance.com templating
-
-# 2003/01/20 acli@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;
-
-