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 $sth =
|
||||
$dbh->prepare(
|
||||
"SELECT description FROM categories WHERE categorycode = ?");
|
||||
"SELECT description,dateofbirthrequired,upperagelimit FROM categories WHERE categorycode = ?");
|
||||
$sth->execute($catcode);
|
||||
my $description = $sth->fetchrow();
|
||||
my ($description,$dateofbirthrequired,$upperagelimit) = $sth->fetchrow();
|
||||
$sth->finish();
|
||||
return $description;
|
||||
return ($description,$dateofbirthrequired,$upperagelimit);
|
||||
} # sub getborrowercategory
|
||||
|
||||
|
||||
|
||||
=head2 ethnicitycategories
|
||||
|
||||
($codes_arrayref, $labels_hashref) = ðnicitycategories();
|
||||
|
@ -1305,4 +1307,7 @@ sub add_member_orgs {
|
|||
$sth->finish();
|
||||
|
||||
} # sub add_member_orgs
|
||||
|
||||
END { } # module clean-up code here (global destructor)
|
||||
|
||||
1;
|
||||
|
|
|
@ -38,6 +38,9 @@
|
|||
<!-- TMPL_IF NAME="ERROR_login_exist" -->
|
||||
<p>login/password already exist</p>
|
||||
<!-- /TMPL_IF -->
|
||||
<!-- TMPL_IF NAME="ERROR_age_limitations" -->
|
||||
Member is too young or too old for this category
|
||||
<!-- /TMPL_IF -->
|
||||
</div>
|
||||
<!-- /TMPL_IF -->
|
||||
|
||||
|
|
|
@ -38,6 +38,9 @@
|
|||
<!-- TMPL_IF NAME="ERROR_login_exist" -->
|
||||
<p>login/password already exist</p>
|
||||
<!-- /TMPL_IF -->
|
||||
<!-- TMPL_IF NAME="ERROR_age_limitations" -->
|
||||
Member is too young or too old for this category
|
||||
<!-- /TMPL_IF -->
|
||||
</div>
|
||||
<!-- /TMPL_IF -->
|
||||
|
||||
|
|
|
@ -148,21 +148,11 @@ if ($op eq 'add' or $op eq 'modify') {
|
|||
}
|
||||
}
|
||||
if ($categorycode ne 'I') {
|
||||
# is the age of the borrower compatible with age limitations of
|
||||
# the borrower category
|
||||
my $query = '
|
||||
SELECT upperagelimit,
|
||||
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}
|
||||
) {
|
||||
my $age = get_age(format_date_in_iso($data{dateofbirth}));
|
||||
my (undef,$agelimitmin,$agelimitmax)=getborrowercategory($data{'categorycode'});
|
||||
if ($age > $agelimitmax
|
||||
or $age < $agelimitmin
|
||||
) {
|
||||
push @errors, 'ERROR_age_limitations';
|
||||
$nok = 1;
|
||||
}
|
||||
|
|
|
@ -147,7 +147,7 @@ if (C4::Context->preference("IndependantBranches")) {
|
|||
$data->{'branchname'} = &getbranchdetail($data->{'branchcode'});
|
||||
|
||||
# Converts the categorycode to the description
|
||||
$data->{'categorycode'} = &getborrowercategory($data->{'categorycode'});
|
||||
($data->{'categorycode'},undef,undef) = &getborrowercategory($data->{'categorycode'});
|
||||
|
||||
my ($numaccts,$accts,$total)=getboracctrecord('',\%bor);
|
||||
|
||||
|
|
Loading…
Reference in a new issue