column => { transform => count => colname => 'id' },
alias => '::PARAM3',
},
+ { relation=> 'circ-id-mb',
+ column => { transform => sum => colname => 'amount' },
+ alias => 'total bills',
+ },
],
from => {
table => 'action.circulation',
alias => 'circ-checkin_lib-aou',
key => 'id',
},
+ 'id-billings' => {
+ table => 'money.billing',
+ alias => 'circ-id-mb',
+ key => 'xact',
+ },
},
},
where => [
column => { transform => month_trunc => colname => 'checkin_time' },
condition => { 'in' => '::PARAM2' },
},
+ { relation => 'circ-id-mb',
+ column => 'voided',
+ condition => { '=' => '::PARAM7' },
+ },
],
having => [
{ relation => 'circ',
PARAM4 => 'Checkin Date',
PARAM5 => [{ transform => 'Bare', params => [10] },{ transform => 'Bare', params => [100] }],
PARAM6 => [ 1, 4 ],
+ PARAM7 => 'f',
};
my $r = OpenILS::Reporter::SQLBuilder->new;
my $self = shift;
my $val = shift;
- if ($val =~ /^::(.+)$/o) {
+ if (defined($val) && $val =~ /^::(.+)$/o) {
$val = $self->get_param($1);
}
- $val =~ s/\\/\\\\/go if (!ref($val));
- $val =~ s/"/\\"/go if (!ref($val));
+ if (defined($val) && !ref($val)) {
+ $val =~ s/\\/\\\\/go;
+ $val =~ s/"/\\"/go;
+ }
+
return $val;
}
} else {
$self->{_transform} = 'GenericTransform';
}
- } else {
+ } elsif( defined($col_data) ) {
$self->{_transform} = 'Bare';
$self->{params} = $col_data;
+ } else {
+ $self->{_transform} = 'NULL';
}
+
return $self;
}
#-------------------------------------------------------------------------------------------------
+package OpenILS::Reporter::SQLBuilder::Input::Transform::NULL;
+
+sub toSQL {
+ return "NULL";
+}
+
+
+#-------------------------------------------------------------------------------------------------
package OpenILS::Reporter::SQLBuilder::Input::Transform::Bare;
sub toSQL {
} else {
$self->{_transform} = 'GenericTransform';
}
- } else {
+ } elsif( defined($self->{_column}) ) {
$self->{_transform} = 'Bare';
+ } else {
+ $self->{_transform} = 'NULL';
}