projects
/
freeside.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
89c484c
)
make sure zip is required for canada, also use CURRVAL() function instead of pg_oid_s...
author
ivan
<ivan>
Tue, 6 Dec 2005 22:25:56 +0000
(22:25 +0000)
committer
ivan
<ivan>
Tue, 6 Dec 2005 22:25:56 +0000
(22:25 +0000)
FS/FS/Record.pm
patch
|
blob
|
history
diff --git
a/FS/FS/Record.pm
b/FS/FS/Record.pm
index
2d91758
..
2110004
100644
(file)
--- a/
FS/FS/Record.pm
+++ b/
FS/FS/Record.pm
@@
-750,13
+750,15
@@
sub insert {
warn "[debug]$me retreiving sequence from database\n" if $DEBUG;
if ( driver_name eq 'Pg' ) {
warn "[debug]$me retreiving sequence from database\n" if $DEBUG;
if ( driver_name eq 'Pg' ) {
- my $oid = $sth->{'pg_oid_status'};
- my $i_sql = "SELECT $primary_key FROM $table WHERE oid = ?";
+ #my $oid = $sth->{'pg_oid_status'};
+ #my $i_sql = "SELECT $primary_key FROM $table WHERE oid = ?";
+ my $i_sql = "SELECT currval('${table}_${primary_key}_seq')";
my $i_sth = dbh->prepare($i_sql) or do {
dbh->rollback if $FS::UID::AutoCommit;
return dbh->errstr;
};
my $i_sth = dbh->prepare($i_sql) or do {
dbh->rollback if $FS::UID::AutoCommit;
return dbh->errstr;
};
- $i_sth->execute($oid) or do {
+ #$i_sth->execute($oid) or do {
+ $i_sth->execute() or do {
dbh->rollback if $FS::UID::AutoCommit;
return $i_sth->errstr;
};
dbh->rollback if $FS::UID::AutoCommit;
return $i_sth->errstr;
};
@@
-1471,6
+1473,8
@@
Check/untaint zip codes.
=cut
=cut
+my @zip_reqd_countries = qw( CA ); #US implicit...
+
sub ut_zip {
my( $self, $field, $country ) = @_;
if ( $country eq 'US' ) {
sub ut_zip {
my( $self, $field, $country ) = @_;
if ( $country eq 'US' ) {
@@
-1479,7
+1483,10
@@
sub ut_zip {
$self->getfield($field);
$self->setfield($field,$1);
} else {
$self->getfield($field);
$self->setfield($field,$1);
} else {
- if ( $self->getfield($field) =~ /^\s*$/ ) {
+ if ( $self->getfield($field) =~ /^\s*$/
+ && ( !$country || ! grep { $_ eq $country } @zip_reqd_countries )
+ )
+ {
$self->setfield($field,'');
} else {
$self->getfield($field) =~ /^\s*(\w[\w\-\s]{2,8}\w)\s*$/
$self->setfield($field,'');
} else {
$self->getfield($field) =~ /^\s*(\w[\w\-\s]{2,8}\w)\s*$/