my $conj = $is_and ? "-and" : "-or";
my $outer_clause = {};
- foreach my $class (qw/acqpo acqpl acqinv jub acqlid/) {
+ foreach my $class (qw/acqpo acqpl acqinv jub acqlid acqlisum/) {
next if not exists $terms->{$class};
$outer_clause->{$conj} = [] unless $outer_clause->{$conj};
} elsif ($between and could_be_range($v)) {
$term_clause = {$k => {"between" => $v}};
} elsif (check_1d_max($v)) {
- $v = castdate($v, $gte, $lte) if $castdate;
+ if ($castdate) {
+ $v = castdate($v, $gte, $lte) if $castdate;
+ } elsif ($gte or $lte) {
+ my $op = $gte ? '>=' : '<=';
+ $v = {$op => $v};
+ }
$term_clause = {$k => $v};
} else {
next;
} else {
$graft_map{$class} = $query->{from}{$core}{$class} ||= {};
$graft_map{$class}{type} = $join_type;
+
+ # without this, the SQL attempts to join on
+ # jub.order_summary, which is a virtual field.
+ $graft_map{$class}{field} = 'lineitem' if $class eq 'acqlisum';
}
}