Members.pm: modify getborrowercategory function to return dateofbirthrequired and upperagelimit
memberentryC and P : add error message ERROR_age_limitations memberentry.pl : replace sql request by function getborrowercategory for return upperagelimit and dateofbirthrequired moremember.pl: modify call to function getborrowercategory
This commit is contained in:
parent
c80648938c
commit
5bdce695b9
5 changed files with 20 additions and 19 deletions
|
@ -1174,13 +1174,15 @@ sub getborrowercategory {
|
||||||
my $dbh = C4::Context->dbh;
|
my $dbh = C4::Context->dbh;
|
||||||
my $sth =
|
my $sth =
|
||||||
$dbh->prepare(
|
$dbh->prepare(
|
||||||
"SELECT description FROM categories WHERE categorycode = ?");
|
"SELECT description,dateofbirthrequired,upperagelimit FROM categories WHERE categorycode = ?");
|
||||||
$sth->execute($catcode);
|
$sth->execute($catcode);
|
||||||
my $description = $sth->fetchrow();
|
my ($description,$dateofbirthrequired,$upperagelimit) = $sth->fetchrow();
|
||||||
$sth->finish();
|
$sth->finish();
|
||||||
return $description;
|
return ($description,$dateofbirthrequired,$upperagelimit);
|
||||||
} # sub getborrowercategory
|
} # sub getborrowercategory
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
=head2 ethnicitycategories
|
=head2 ethnicitycategories
|
||||||
|
|
||||||
($codes_arrayref, $labels_hashref) = ðnicitycategories();
|
($codes_arrayref, $labels_hashref) = ðnicitycategories();
|
||||||
|
@ -1305,4 +1307,7 @@ sub add_member_orgs {
|
||||||
$sth->finish();
|
$sth->finish();
|
||||||
|
|
||||||
} # sub add_member_orgs
|
} # sub add_member_orgs
|
||||||
|
|
||||||
|
END { } # module clean-up code here (global destructor)
|
||||||
|
|
||||||
1;
|
1;
|
||||||
|
|
|
@ -38,6 +38,9 @@
|
||||||
<!-- TMPL_IF NAME="ERROR_login_exist" -->
|
<!-- TMPL_IF NAME="ERROR_login_exist" -->
|
||||||
<p>login/password already exist</p>
|
<p>login/password already exist</p>
|
||||||
<!-- /TMPL_IF -->
|
<!-- /TMPL_IF -->
|
||||||
|
<!-- TMPL_IF NAME="ERROR_age_limitations" -->
|
||||||
|
Member is too young or too old for this category
|
||||||
|
<!-- /TMPL_IF -->
|
||||||
</div>
|
</div>
|
||||||
<!-- /TMPL_IF -->
|
<!-- /TMPL_IF -->
|
||||||
|
|
||||||
|
|
|
@ -38,6 +38,9 @@
|
||||||
<!-- TMPL_IF NAME="ERROR_login_exist" -->
|
<!-- TMPL_IF NAME="ERROR_login_exist" -->
|
||||||
<p>login/password already exist</p>
|
<p>login/password already exist</p>
|
||||||
<!-- /TMPL_IF -->
|
<!-- /TMPL_IF -->
|
||||||
|
<!-- TMPL_IF NAME="ERROR_age_limitations" -->
|
||||||
|
Member is too young or too old for this category
|
||||||
|
<!-- /TMPL_IF -->
|
||||||
</div>
|
</div>
|
||||||
<!-- /TMPL_IF -->
|
<!-- /TMPL_IF -->
|
||||||
|
|
||||||
|
|
|
@ -148,21 +148,11 @@ if ($op eq 'add' or $op eq 'modify') {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($categorycode ne 'I') {
|
if ($categorycode ne 'I') {
|
||||||
# is the age of the borrower compatible with age limitations of
|
my $age = get_age(format_date_in_iso($data{dateofbirth}));
|
||||||
# the borrower category
|
my (undef,$agelimitmin,$agelimitmax)=getborrowercategory($data{'categorycode'});
|
||||||
my $query = '
|
if ($age > $agelimitmax
|
||||||
SELECT upperagelimit,
|
or $age < $agelimitmin
|
||||||
dateofbirthrequired
|
) {
|
||||||
FROM categories
|
|
||||||
WHERE categorycode = ?
|
|
||||||
';
|
|
||||||
my $sth=$dbh->prepare($query);
|
|
||||||
$sth->execute($categorycode);
|
|
||||||
my $category_info = $sth->fetchrow_hashref;
|
|
||||||
my $age = get_age(format_date_in_iso($data{dateofbirth}));
|
|
||||||
if ($age > $category_info->{upperagelimit}
|
|
||||||
or $age < $category_info->{dateofbirthrequired}
|
|
||||||
) {
|
|
||||||
push @errors, 'ERROR_age_limitations';
|
push @errors, 'ERROR_age_limitations';
|
||||||
$nok = 1;
|
$nok = 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -147,7 +147,7 @@ if (C4::Context->preference("IndependantBranches")) {
|
||||||
$data->{'branchname'} = &getbranchdetail($data->{'branchcode'});
|
$data->{'branchname'} = &getbranchdetail($data->{'branchcode'});
|
||||||
|
|
||||||
# Converts the categorycode to the description
|
# Converts the categorycode to the description
|
||||||
$data->{'categorycode'} = &getborrowercategory($data->{'categorycode'});
|
($data->{'categorycode'},undef,undef) = &getborrowercategory($data->{'categorycode'});
|
||||||
|
|
||||||
my ($numaccts,$accts,$total)=getboracctrecord('',\%bor);
|
my ($numaccts,$accts,$total)=getboracctrecord('',\%bor);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue