summaryrefslogtreecommitdiff
path: root/FS/FS/part_event
diff options
context:
space:
mode:
authorivan <ivan>2010-03-30 02:04:01 +0000
committerivan <ivan>2010-03-30 02:04:01 +0000
commit8e0d6410715c534f2994167c83e319a625b2ee0d (patch)
tree73d3200187a0313e24a5b12580e8c206e95df6fc /FS/FS/part_event
parentc1e2f536974812f05b8d3534ad2bf9c9ba40c24d (diff)
fixes for MySQL CAST drain bramage
Diffstat (limited to 'FS/FS/part_event')
-rw-r--r--FS/FS/part_event/Condition/balance.pm2
-rw-r--r--FS/FS/part_event/Condition/balance_age.pm2
-rw-r--r--FS/FS/part_event/Condition/balance_under.pm2
-rw-r--r--FS/FS/part_event/Condition/cust_bill_has_service.pm6
-rw-r--r--FS/FS/part_event/Condition/cust_bill_owed.pm2
-rw-r--r--FS/FS/part_event/Condition/cust_bill_owed_under.pm2
6 files changed, 9 insertions, 7 deletions
diff --git a/FS/FS/part_event/Condition/balance.pm b/FS/FS/part_event/Condition/balance.pm
index 65670c0..3b8854a 100644
--- a/FS/FS/part_event/Condition/balance.pm
+++ b/FS/FS/part_event/Condition/balance.pm
@@ -40,7 +40,7 @@ sub condition_sql {
my $balance_sql = FS::cust_main->balance_sql;
- "$balance_sql > CAST( $over AS numeric )";
+ "$balance_sql > CAST( $over AS DECIMAL(10,2) )";
}
diff --git a/FS/FS/part_event/Condition/balance_age.pm b/FS/FS/part_event/Condition/balance_age.pm
index f1a9707..fc34612 100644
--- a/FS/FS/part_event/Condition/balance_age.pm
+++ b/FS/FS/part_event/Condition/balance_age.pm
@@ -38,7 +38,7 @@ sub condition_sql {
my $balance_sql = FS::cust_main->balance_date_sql( $age );
- "$balance_sql > CAST( $over AS numeric )";
+ "$balance_sql > CAST( $over AS DECIMAL(10,2) )";
}
sub order_sql {
diff --git a/FS/FS/part_event/Condition/balance_under.pm b/FS/FS/part_event/Condition/balance_under.pm
index 9c71590..2002c70 100644
--- a/FS/FS/part_event/Condition/balance_under.pm
+++ b/FS/FS/part_event/Condition/balance_under.pm
@@ -34,7 +34,7 @@ sub condition_sql {
my $balance_sql = FS::cust_main->balance_sql;
- "$balance_sql <= CAST( $under AS numeric )";
+ "$balance_sql <= CAST( $under AS DECIMAL(10,2) )";
}
diff --git a/FS/FS/part_event/Condition/cust_bill_has_service.pm b/FS/FS/part_event/Condition/cust_bill_has_service.pm
index 91d75dd..d85af26 100644
--- a/FS/FS/part_event/Condition/cust_bill_has_service.pm
+++ b/FS/FS/part_event/Condition/cust_bill_has_service.pm
@@ -38,14 +38,16 @@ sub condition {
}
sub condition_sql {
- my( $class, $table ) = @_;
+ my( $class, $table, %opt ) = @_;
+
+ my $integer = $opt{'driver_name'} =~ /^mysql/ ? 'UNSIGNED INTEGER' : 'INTEGER';
my $servicenum = $class->condition_sql_option('has_service');
my $sql = qq| 0 < ( SELECT COUNT(cs.svcpart)
FROM cust_bill_pkg cbp, cust_svc cs
WHERE cbp.invnum = cust_bill.invnum
AND cs.pkgnum = cbp.pkgnum
- AND cs.svcpart = CAST( $servicenum AS integer )
+ AND cs.svcpart = CAST( $servicenum AS $integer )
)
|;
return $sql;
diff --git a/FS/FS/part_event/Condition/cust_bill_owed.pm b/FS/FS/part_event/Condition/cust_bill_owed.pm
index 0fd9922..d8c77c7 100644
--- a/FS/FS/part_event/Condition/cust_bill_owed.pm
+++ b/FS/FS/part_event/Condition/cust_bill_owed.pm
@@ -48,7 +48,7 @@ sub condition_sql {
my $owed_sql = FS::cust_bill->owed_sql;
- "$owed_sql > CAST( $over AS numeric )";
+ "$owed_sql > CAST( $over AS DECIMAL(10,2) )";
}
1;
diff --git a/FS/FS/part_event/Condition/cust_bill_owed_under.pm b/FS/FS/part_event/Condition/cust_bill_owed_under.pm
index a0bf92f..4eb6439 100644
--- a/FS/FS/part_event/Condition/cust_bill_owed_under.pm
+++ b/FS/FS/part_event/Condition/cust_bill_owed_under.pm
@@ -43,7 +43,7 @@ sub condition_sql {
my $owed_sql = FS::cust_bill->owed_sql;
- "$owed_sql <= CAST( $under AS numeric )";
+ "$owed_sql <= CAST( $under AS DECIMAL(10,2) )";
}
1;