removing useless scripts

improvements from SAN Ouest Provence :
* introducing a category_type into categories. It can be A (adult), C (children), P (Professionnal), I (institution/organisation).
* each category_type has it's own forms to create members.
* the borrowers table has been heavily modified (many fields changed), to get something more logic & readable
* reintroducing guarantor/guanrantee system that is now independant from hardcoded C/A for categories
* updating templates to fit template rules

(see mail feb, 17 on koha-devel "new features for borrowers" for more details)
This commit is contained in:
tipaul 2006-04-14 09:32:18 +00:00
parent 97182dceb2
commit 628087366b
8 changed files with 0 additions and 1024 deletions

View File

@ -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::Members;
use C4::Interface::CGI::Output;
use C4::Koha;
use HTML::Template;
use C4::Search;
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:

View File

@ -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/members/moremember.pl?bornum=$data{'borrowernumber'}");

View File

@ -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/members/moremember.pl?bornum=$data{'borrowernumber'}");

View File

@ -1,99 +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 $sth=$dbh->prepare("Select * from borrowers where borrowernumber=?");
$sth->execute($data{'bornumber_child_$i'});
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'}',sort1='$data{sort1}',sort2='$data{'sort2'}'
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,sort1,sort2)
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'}','$data{'sort1'}','$data{'sort2'}')";
}
#print $query;
my $sth2=$dbh->prepare($query);
$sth2->execute;
$sth2->finish;
$sth->finish;
}
print $input->redirect("/cgi-bin/koha/members/moremember.pl?bornum=$data{'borrowernumber'}");

View File

@ -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;

View File

@ -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 => "members/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:

View File

@ -1,152 +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 => "members/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;
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){
$template->param(cardnumber_missing => 1);
$missing=1;
if ($firstname eq ''){
$template->param(firstname_missing => 1);
$missing=1;
}
if ($surname eq ''){
$template->param(surname_missing => 1);
$missing=1;
}
if ($dob eq ''){
$template->param(dob_missing => 1);
$missing=1;
}
if ($sex eq ''){
$template->param(gender_missing => 1);
$missing=1;
}
}
} else {
if ($firstname eq ''){
$template->param(firstname_missing => 1);
$missing=1;
}
if ($surname eq ''){
$template->param(surname_missing => 1);
$missing=1;
}
if ($dob eq ''){
$template->param(dob_missing => 1);
$missing=1;
}
if ($sex eq ''){
$template->param(gender_missing => 1);
$missing=1;
}
#check cardnumber is valid
my $nounique;
if ( $data{'type'} ne "Add" ) {
$nounique = 0;
} else {
$nounique = 1;
}
my $valid=checkdigit(\%env,$number, $nounique);
if ($valid != 1){
$template->param(missing =>1);
$template->param(invalid_cardnumber => 1);
$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"};
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,
);
output_html_with_http_headers $input, $cookie, $template->output;

View File

@ -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 => "members/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;