Members.pm:add a field in sql request (sub getborrowercategory) to return category_type
memberentry.pl:modify call to getborrowercategory moremember.tmpl:modify condition to display "add child" option (only for adult) moremember.pl:add condition,call to getborrowercategory , change variable name
This commit is contained in:
parent
4eecf69489
commit
963c7de328
4 changed files with 19 additions and 25 deletions
|
@ -412,7 +412,7 @@ sub newmember {
|
|||
$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="
|
||||
|
@ -1162,10 +1162,10 @@ sub borrowercategories {
|
|||
|
||||
=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
|
||||
|
||||
|
@ -1174,11 +1174,11 @@ sub getborrowercategory {
|
|||
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
|
||||
|
||||
|
||||
|
|
|
@ -6,13 +6,11 @@
|
|||
<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>
|
||||
|
|
|
@ -114,7 +114,6 @@ if ($op eq 'add' or $op eq 'modify') {
|
|||
($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);
|
||||
|
@ -148,7 +147,7 @@ if ($category_type eq 'C' and $guarantorid ne '' ){
|
|||
}
|
||||
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
|
||||
) {
|
||||
|
@ -284,7 +283,7 @@ if ($delete){
|
|||
-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'});
|
||||
|
@ -467,7 +466,7 @@ if ($delete){
|
|||
initials => $data{'initials'},
|
||||
streetnumber => $data{'streetnumber'},
|
||||
streettype =>$data{'streettype'},
|
||||
address => $data{'address'},
|
||||
address => $data{'address'},
|
||||
address2 => $data{'address2'},
|
||||
city => $data{'city'},
|
||||
zipcode => $data{'zipcode'},
|
||||
|
@ -487,7 +486,7 @@ if ($delete){
|
|||
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'},
|
||||
|
|
|
@ -70,13 +70,11 @@ my ($template, $loggedinuser, $cookie)
|
|||
});
|
||||
|
||||
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'});
|
||||
|
@ -90,7 +88,7 @@ $data->{'ethnicity'} = fixEthnicity($data->{'ethnicity'});
|
|||
|
||||
$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'};
|
||||
|
@ -101,12 +99,10 @@ if ($data->{'categorycode'} eq 'C'){
|
|||
$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
|
||||
|
@ -118,9 +114,10 @@ if ($data->{'category_type'} ne 'C'){
|
|||
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'}){
|
||||
|
|
Loading…
Reference in a new issue