[freeside-commits] freeside/FS/FS Record.pm,1.150,1.151
Ivan,,,
ivan at wavetail.420.am
Wed Apr 16 14:10:50 PDT 2008
Update of /home/cvs/cvsroot/freeside/FS/FS
In directory wavetail.420.am:/tmp/cvs-serv17484
Modified Files:
Record.pm
Log Message:
be more forgiving about numeric things padded with leading/trailing space
Index: Record.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/Record.pm,v
retrieving revision 1.150
retrieving revision 1.151
diff -u -d -r1.150 -r1.151
--- Record.pm 14 Apr 2008 13:42:25 -0000 1.150
+++ Record.pm 16 Apr 2008 21:10:46 -0000 1.151
@@ -1351,10 +1351,10 @@
sub ut_float {
my($self,$field)=@_ ;
- ($self->getfield($field) =~ /^(\d+\.\d+)$/ ||
- $self->getfield($field) =~ /^(\d+)$/ ||
- $self->getfield($field) =~ /^(\d+\.\d+e\d+)$/ ||
- $self->getfield($field) =~ /^(\d+e\d+)$/)
+ ($self->getfield($field) =~ /^\s*(\d+\.\d+)\s*$/ ||
+ $self->getfield($field) =~ /^\s*(\d+)\s*$/ ||
+ $self->getfield($field) =~ /^\s*(\d+\.\d+e\d+)\s*$/ ||
+ $self->getfield($field) =~ /^\s*(\d+e\d+)\s*$/)
or return "Illegal or empty (float) $field: ". $self->getfield($field);
$self->setfield($field,$1);
'';
@@ -1387,10 +1387,10 @@
sub ut_sfloat {
my($self,$field)=@_ ;
- ($self->getfield($field) =~ /^(-?\d+\.\d+)$/ ||
- $self->getfield($field) =~ /^(-?\d+)$/ ||
- $self->getfield($field) =~ /^(-?\d+\.\d+[eE]-?\d+)$/ ||
- $self->getfield($field) =~ /^(-?\d+[eE]-?\d+)$/)
+ ($self->getfield($field) =~ /^\s*(-?\d+\.\d+)\s*$/ ||
+ $self->getfield($field) =~ /^\s*(-?\d+)\s*$/ ||
+ $self->getfield($field) =~ /^\s*(-?\d+\.\d+[eE]-?\d+)\s*$/ ||
+ $self->getfield($field) =~ /^\s*(-?\d+[eE]-?\d+)\s*$/)
or return "Illegal or empty (float) $field: ". $self->getfield($field);
$self->setfield($field,$1);
'';
@@ -1421,7 +1421,7 @@
sub ut_snumber {
my($self, $field) = @_;
- $self->getfield($field) =~ /^(-?)\s*(\d+)$/
+ $self->getfield($field) =~ /^\s*(-?)\s*(\d+)\s*$/
or return "Illegal or empty (numeric) $field: ". $self->getfield($field);
$self->setfield($field, "$1$2");
'';
@@ -1436,7 +1436,7 @@
sub ut_snumbern {
my($self, $field) = @_;
- $self->getfield($field) =~ /^(-?)\s*(\d*)$/
+ $self->getfield($field) =~ /^\s*(-?)\s*(\d*)\s*$/
or return "Illegal (numeric) $field: ". $self->getfield($field);
if ($1) {
return "Illegal (numeric) $field: ". $self->getfield($field)
@@ -1455,7 +1455,7 @@
sub ut_number {
my($self,$field)=@_;
- $self->getfield($field) =~ /^(\d+)$/
+ $self->getfield($field) =~ /^\s*(\d+)\s*$/
or return "Illegal or empty (numeric) $field: ". $self->getfield($field);
$self->setfield($field,$1);
'';
@@ -1470,7 +1470,7 @@
sub ut_numbern {
my($self,$field)=@_;
- $self->getfield($field) =~ /^(\d*)$/
+ $self->getfield($field) =~ /^\s*(\d*)\s*$/
or return "Illegal (numeric) $field: ". $self->getfield($field);
$self->setfield($field,$1);
'';
@@ -1486,7 +1486,7 @@
sub ut_money {
my($self,$field)=@_;
$self->setfield($field, 0) if $self->getfield($field) eq '';
- $self->getfield($field) =~ /^(\-)? ?(\d*)(\.\d{2})?$/
+ $self->getfield($field) =~ /^\s*(\-)?\s*(\d*)(\.\d{2})?\s*$/
or return "Illegal (money) $field: ". $self->getfield($field);
#$self->setfield($field, "$1$2$3" || 0);
$self->setfield($field, ( ($1||''). ($2||''). ($3||'') ) || 0);
More information about the freeside-commits
mailing list