0;
}
+sub castdate { +{"=" => {"transform" => "date", "value" => $_[0]}}; }
+
sub prepare_acqlia_search_and {
my ($acqlia) = @_;
"where" => {"-and" => [{"lineitem" => {"=" => {"+jub" => "id"}}}]}
};
+ # castdate not supported for acqlia fields: they're all type text
my ($k, $v, $fuzzy, $between, $not) = breakdown_term($unit);
my $point = $subquery->{"where"}->{"-and"};
my $term_clause;
my $result = {"+acqlia" => {"-or" => $point}};
foreach my $unit (@$acqlia) {
+ # castdate not supported for acqlia fields: they're all type text
my ($k, $v, $fuzzy, $between, $not) = breakdown_term($unit);
my $term_clause;
if ($fuzzy and not ref $v) {
$key, $term->{$key},
$term->{"__fuzzy"} ? 1 : 0,
$term->{"__between"} ? 1 : 0,
- $term->{"__not"} ? 1 : 0
+ $term->{"__not"} ? 1 : 0,
+ $term->{"__castdate"} ? 1 : 0
);
}
$outer_clause->{$conj} = [] unless $outer_clause->{$conj};
foreach my $unit (@{$terms->{$class}}) {
- my ($k, $v, $fuzzy, $between, $not) = breakdown_term($unit);
+ my ($k, $v, $fuzzy, $between, $not, $castdate) =
+ breakdown_term($unit);
+
my $term_clause;
if ($fuzzy and not ref $v) {
$term_clause = {$k => {"ilike" => "%" . $v . "%"}};
} elsif ($between and could_be_range($v)) {
$term_clause = {$k => {"between" => $v}};
} elsif (check_1d_max($v)) {
+ $v = castdate($v) if $castdate;
$term_clause = {$k => $v};
} else {
next;
+dojo.require("dojo.date.stamp");
dojo.require("openils.widget.AutoGrid");
dojo.require("openils.widget.AutoWidget");
dojo.require("openils.PermaCrud");
this._match_how(id).getValue().split(",").filter(Boolean);
var value;
- try {
- value = this.widgets[id].attr("value");
- } catch (E) {
+ if (typeof(this.widgets[id].declaredClass) != "undefined") {
+ if (this.widgets[id].declaredClass.match(/Date/)) {
+ value =
+ dojo.date.stamp.toISOString(this.widgets[id].value).
+ split("T")[0];
+ } else {
+ value = this.widgets[id].attr("value");
+ }
+ } else {
value = this.widgets[id].value;
}
if (!so[hint])
so[hint] = [];
+
var unit = {};
- match_how.forEach(function(key) { unit[key] = true; });
unit[attr] = value;
+ match_how.forEach(function(key) { unit[key] = true; });
+ if (this.terms[hint][attr].datatype == "timestamp")
+ unit.__castdate = true;
so[hint].push(unit);
}