added warnings for missing params to MinPassiveTargetAge validator; missing params...
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 22 Jun 2010 14:51:26 +0000 (14:51 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 22 Jun 2010 14:51:26 +0000 (14:51 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@16774 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/perlmods/OpenILS/Application/Trigger/Validator.pm

index 2f35feb..206ac10 100644 (file)
@@ -29,6 +29,16 @@ sub MinPassiveTargetAge {
     my $target = $env->{target};
     my $delay_field = $env->{params}->{target_age_field} || $env->{event}->event_def->delay_field;
 
+    unless($env->{params}->{min_target_age}) {
+        $logger->warn("'min_target_age' parameter required for MinPassiveTargetAge validator");
+        return 0; # no-op false
+    }
+
+    unless($delay_field) {
+        $logger->warn("'target_age_field' parameter or delay_field required for MinPassiveTargetAge validator");
+        return 0; # no-op false
+    }
+
     my $delay_field_ts = DateTime::Format::ISO8601->new->parse_datetime(cleanse_ISO8601($target->$delay_field()));
 
     # to get the minimum time that the target must have aged to, add the min age to the delay field