49
|
1 package Form::Filter::Depends;
|
|
2 use base qw(Form::Filter);
|
|
3
|
|
4 use Common;
|
|
5
|
|
6 BEGIN {
|
|
7 DeclareProperty Fields => ACCESS_READ;
|
|
8 }
|
|
9
|
|
10 sub SUPPORTED_CONTEXT { Form::Filter::CTX_SINGLE | Form::Filter::CTX_SET }
|
|
11
|
|
12 sub CTOR {
|
|
13 my ($this,$name,$message,@fields) = @_;
|
|
14
|
|
15 $this->SUPER::CTOR($name,$message);
|
|
16 $this->{$Fields} = \@fields;
|
|
17 }
|
|
18
|
|
19 sub Invoke {
|
|
20 my ($this,$object,$context,$schemaTarget) = @_;
|
|
21
|
|
22 foreach my $field (@{$this->{$Fields}}) {
|
|
23 my $objProv = $object->Navigate($object->Form->MakeItemId($field,$object->Parent));
|
|
24
|
|
25 if ( not $objProv or $objProv->isEmpty ) {
|
|
26 return new Form::FilterResult(State => Form::FilterResult::STATE_STOP);
|
|
27 }
|
|
28
|
|
29 }
|
|
30
|
|
31 return new Form::FilterResult(State => Form::FilterResult::STATE_SUCCESS_STAY);
|
|
32 }
|
|
33
|
|
34 1;
|