[freeside-commits] freeside/FS/FS/part_event Condition.pm, 1.7.2.1, 1.7.2.2

Ivan,,, ivan at wavetail.420.am
Mon Apr 11 10:22:40 PDT 2011


Update of /home/cvs/cvsroot/freeside/FS/FS/part_event
In directory wavetail.420.am:/tmp/cvs-serv13545

Modified Files:
      Tag: FREESIDE_2_1_BRANCH
	Condition.pm 
Log Message:
fix times condition vs. mysql (causes billing errors even if not using), RT#10574

Index: Condition.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/part_event/Condition.pm,v
retrieving revision 1.7.2.1
retrieving revision 1.7.2.2
diff -u -w -d -r1.7.2.1 -r1.7.2.2
--- Condition.pm	24 Mar 2011 23:25:08 -0000	1.7.2.1
+++ Condition.pm	11 Apr 2011 17:22:38 -0000	1.7.2.2
@@ -145,7 +145,7 @@
 This method is used for optimizing event queries.  You may want to add indices
 for any columns referenced.  It is acceptable to return an SQL fragment which
 partially tests the condition; doing so will still reduce the number of
-records which much be returned and tested with the B<condition> method.
+records which must be returned and tested with the B<condition> method.
 
 =cut
 
@@ -457,7 +457,7 @@
 
 }
 
-=item condition_sql_option_integer
+=item condition_sql_option_integer OPTION [ DRIVER_NAME ]
 
 As I<condition_sql_option>, but cast the option value to an integer so that
 comparison to other integers is type-correct.
@@ -465,8 +465,11 @@
 =cut
 
 sub condition_sql_option_integer {
-  my ($class, $option) = @_;
-  'CAST ('.$class->condition_sql_option($option).' AS INTEGER)';
+  my ($class, $option, $driver_name) = @_;
+
+  my $integer = ($driver_name =~ /^mysql/) ? 'UNSIGNED INTEGER' : 'INTEGER';
+
+  'CAST ('. $class->condition_sql_option($option). " AS $integer )";
 }
 
 =head1 NEW CONDITION CLASSES



More information about the freeside-commits mailing list