From 9089d44124b314172e6f3c30215090f43c40328c Mon Sep 17 00:00:00 2001 From: Jason Stephenson Date: Thu, 18 Nov 2021 08:54:08 -0500 Subject: [PATCH] LP1902937: Use setting for guardian check Check the value of the ui.patron.edit.guardian_required_for_juv setting before requiring the guardian field for juvenile eCard registrations. We should add our own setting for this. Signed-off-by: Jason Stephenson --- .../src/perlmods/lib/OpenILS/WWW/EGCatLoader/Ecard.pm | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Ecard.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Ecard.pm index 68481c88f6..1b16c94c2c 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Ecard.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Ecard.pm @@ -465,17 +465,25 @@ sub verify_dob { return undef; } + # Check if guardian required for underage patrons. + # TODO: Add our own setting for this. + my $guardian_required = $U->ou_ancestor_setting_value( + $cgi->param('home_ou'), + 'ui.patron.edit.guardian_required_for_juv' + ); + my $comp_date = DateTime->now; $comp_date->set_hour(0); $comp_date->set_minute(0); $comp_date->set_second(0); + # The juvenile age should be configurable. $comp_date->subtract(years => 18); # juv age - if ( - $dob_date > $comp_date # less than 18 years old - && !$cgi->param('ident_value2')) { + if ($U->is_true($guardian_required) + && $dob_date > $comp_date + && !$cgi->param('guardian')) { - my $msg = "Parent/Guardian (ident_value2) is required for patrons ". + my $msg = "Parent/Guardian (guardian) is required for patrons ". "under 18 years of age. dob=$dob"; $ctx->{response}->{status} = 'INVALID_PARAMS'; push(@{$ctx->{response}->{messages}}, $msg); -- 2.11.0