$data{'dateofbirth'} = format_date_in_iso( $data{'dateofbirth'} );
$data{'dateenrolled'} = format_date_in_iso( $data{'dateenrolled'} );
$data{'dateexpiry'} = format_date_in_iso( $data{'dateexpiry'} );
- my $query =
+ my $query =
"insert into borrowers set cardnumber="
. $dbh->quote( $data{'cardnumber'} )
. ",surname="
=head2 getborrowercategory
- $description = &getborrowercategory($categorycode);
+ $description,$dateofbirthrequired,$upperagelimit,$category_type = &getborrowercategory($categorycode);
Given the borrower's category code, the function returns the corresponding
-description for a comprehensive information display.
+description , dateofbirthrequired , upperagelimit and category type for a comprehensive information display.
=cut
my $dbh = C4::Context->dbh;
my $sth =
$dbh->prepare(
- "SELECT description,dateofbirthrequired,upperagelimit FROM categories WHERE categorycode = ?");
+ "SELECT description,dateofbirthrequired,upperagelimit,category_type FROM categories WHERE categorycode = ?");
$sth->execute($catcode);
- my ($description,$dateofbirthrequired,$upperagelimit) = $sth->fetchrow();
+ my ($description,$dateofbirthrequired,$upperagelimit,$category_type) = $sth->fetchrow();
$sth->finish();
- return ($description,$dateofbirthrequired,$upperagelimit);
+ return ($description,$dateofbirthrequired,$upperagelimit,$category_type);
} # sub getborrowercategory
<h1><!-- TMPL_VAR NAME="firstname" --> <!-- TMPL_VAR NAME="surname" --> (<!-- TMPL_VAR NAME="cardnumber" -->)</h1>
<ul>
- <!-- TMPL_UNLESS name="guarantorborrowernumber" -->
+ <!-- TMPL_IF name="adultborrower" -->
<a href="/cgi-bin/koha/members/memberentry.pl?op=add&guarantorid=<!-- TMPL_VAR NAME="borrowernumber" -->&category_type=C">Add child</a>
- <!-- /TMPL_UNLESS -->
- <a href="/cgi-bin/koha/members/memberentry.pl?op=modify&borrowernumber=<!-- TMPL_VAR NAME="bornum" -->&category_type=<!-- TMPL_VAR NAME="category_type"-->">
-
- Edit this Record
- </a>
+ <!-- /TMPL_IF -->
+
+ <a href="/cgi-bin/koha/members/memberentry.pl?op=modify&borrowernumber=<!-- TMPL_VAR NAME="bornum" -->&category_type=<!-- TMPL_VAR NAME="category_type"-->">Edit this Record</a>
<a href="/cgi-bin/koha/members/member-password.pl?member=<!-- TMPL_VAR NAME=bornum -->">
Change Member's Password
</a>
($check_categorytype,undef)=getcategorytype($check_category);
}
-
#recover all data from guarantor address phone ,fax...
if ($category_type eq 'C' and $guarantorid ne '' ){
my $guarantordata=getguarantordata($guarantorid);
}
if ($categorycode ne 'I') {
my $age = get_age(format_date_in_iso($data{dateofbirth}));
- my (undef,$agelimitmin,$agelimitmax)=getborrowercategory($data{'categorycode'});
+ my (undef,$agelimitmin,$agelimitmax,undef)=getborrowercategory($data{'categorycode'});
if ($age > $agelimitmax
or $age < $agelimitmin
) {
-default=>$default_category,
-labels=>$labels);
#test in city
- $select_city=getidcity($data{'city'}) if ($guarantorid ne '');
+ $select_city=getidcity($data{'city'}) if ($guarantorid ne '0');
($default_city=$select_city) if ($step eq 0);
if ($select_city eq '' ){
my $selectcity=&getidcity($data{'city'});
initials => $data{'initials'},
streetnumber => $data{'streetnumber'},
streettype =>$data{'streettype'},
- address => $data{'address'},
+ address => $data{'address'},
address2 => $data{'address2'},
city => $data{'city'},
zipcode => $data{'zipcode'},
catcodepopup => $catcodepopup,
categorycode => $data{'categorycode'},
dateenrolled => format_date($data{'dateenrolled'}),
- dateexpiry => format_date($data{'dateexpiry'}),
+ dateexpiry => format_date($data{'dateexpiry'}),
debarred => $data{'debarred'},
gonenoaddress => $data{'gonenoaddress'},
lost => $data{'lost'},
});
my $bornum=$input->param('bornum');
-
#start the page and read in includes
-
my $data=borrdata('',$bornum);
+my (undef,undef,undef,$category_type)=getborrowercategory($data->{'categorycode'});
$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->{'dateexpiry'} = format_date($data->{'dateexpiry'});
$data->{'dateofbirth'} = format_date($data->{'dateofbirth'});
$data->{&expand_sex_into_predicate($data->{'sex'})} = 1;
-if ($data->{'categorycode'} eq 'C'){
+if ($category_type eq 'C' and $data->{'guarantorid'} ne '0' ){
my $data2=borrdata('',$data->{'guarantorid'});
$data->{'address'}=$data2->{'address'};
$data->{'city'}=$data2->{'city'};
$data->{'zipcode'} = $data2->{'zipcode'};
}
-
if ($data->{'ethnicity'} || $data->{'ethnotes'}) {
$template->param(printethnicityline => 1);
}
-
-if ($data->{'category_type'} ne 'C'){
+if ($category_type ne 'C'){
$template->param(isguarantee => 1);
# FIXME
# It looks like the $i is only being returned to handle walking through
push (@guaranteedata, {borrowernumber => $guarantees->[$i]->{'borrowernumber'},
cardnumber => $guarantees->[$i]->{'cardnumber'},
name => $guarantees->[$i]->{'firstname'} . " " . $guarantees->[$i]->{'surname'}});
+ warn"le type de categorie ".$category_type."voila ";
}
$template->param(guaranteeloop => \@guaranteedata);
-
+ ($template->param(adultborrower=>1)) if ($category_type eq 'A');
} else {
my ($guarantorid)=findguarantor($data->{guarantorid});
if ($guarantorid->{'borrowernumber'}){