use base qw( Exporter );
use strict;
+use charnames ':full';
use vars qw( $AUTOLOAD
%virtual_fields_cache %fk_method_cache $fk_table_cache
$money_char $lat_lower $lon_upper
#my $job = $param->{job};
my $line;
my $imported = 0;
+ my $unique_skip = 0; #lines skipped because they're already in the system
my( $last, $min_sec ) = ( time, 5 ); #progressbar foo
while (1) {
}
last if exists( $param->{skiprow} );
}
+ $unique_skip++ if $param->{unique_skip}; #line is already in the system
next if exists( $param->{skiprow} );
if ( $preinsert_callback ) {
unless ( $imported || $param->{empty_ok} ) {
$dbh->rollback if $oldAutoCommit;
- return "Empty file!";
+ # freeside-cdr-conexiant-import is sensitive to the text of this message
+ return $unique_skip ? "All records in file were previously imported" : "Empty file!";
}
$dbh->commit or die $dbh->errstr if $oldAutoCommit;
my $coord = $self->getfield($field);
my $neg = $coord =~ s/^(-)//;
+ # ignore degree symbol at the end,
+ # but not otherwise supporting degree/minutes/seconds symbols
+ $coord =~ s/\N{DEGREE SIGN}\s*$//;
+
my ($d, $m, $s) = (0, 0, 0);
if (
}
+=item trim_whitespace FIELD[, FIELD ... ]
+
+Strip leading and trailing spaces from the value in the named FIELD(s).
+
+=cut
+
+sub trim_whitespace {
+ my $self = shift;
+ foreach my $field (@_) {
+ my $value = $self->get($field);
+ $value =~ s/^\s+//;
+ $value =~ s/\s+$//;
+ $self->set($field, $value);
+ }
+}
+
=item fields [ TABLE ]
This is a wrapper for real_fields. Code that called