projects
/
freeside.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
add custnum to phone_shellcommands export, RT#23062
[freeside.git]
/
FS
/
FS
/
Record.pm
diff --git
a/FS/FS/Record.pm
b/FS/FS/Record.pm
index
42af68c
..
3886c33
100644
(file)
--- a/
FS/FS/Record.pm
+++ b/
FS/FS/Record.pm
@@
-18,7
+18,7
@@
use Text::CSV_XS;
use File::Slurp qw( slurp );
use DBI qw(:sql_types);
use DBIx::DBSchema 0.38;
use File::Slurp qw( slurp );
use DBI qw(:sql_types);
use DBIx::DBSchema 0.38;
-use FS::UID qw(dbh
getotaker
datasrc driver_name);
+use FS::UID qw(dbh datasrc driver_name);
use FS::CurrentUser;
use FS::Schema qw(dbdef);
use FS::SearchCache;
use FS::CurrentUser;
use FS::Schema qw(dbdef);
use FS::SearchCache;
@@
-458,7
+458,13
@@
sub qsearch {
# grep defined( $record->{$_} ) && $record->{$_} ne '', @fields
# ) or croak "Error executing \"$statement\": ". $sth->errstr;
# grep defined( $record->{$_} ) && $record->{$_} ne '', @fields
# ) or croak "Error executing \"$statement\": ". $sth->errstr;
- $sth->execute or croak "Error executing \"$statement\": ". $sth->errstr;
+ my $ok = $sth->execute;
+ if (!$ok) {
+ my $error = "Error executing \"$statement\"";
+ $error .= ' (' . join(', ', map {"'$_'"} @value) . ')' if @value;
+ $error .= ': '. $sth->errstr;
+ croak $error;
+ }
my $table = $stable[0];
my $pkey = '';
my $table = $stable[0];
my $pkey = '';
@@
-1691,7
+1697,7
@@
sub batch_import {
my $data = slurp($file);
my $asn_output = $parser->decode( $data )
my $data = slurp($file);
my $asn_output = $parser->decode( $data )
- or
die
"No ". $asn_format->{'macro'}. " found\n";
+ or
return
"No ". $asn_format->{'macro'}. " found\n";
$asn_header_buffer = &{ $asn_format->{'header_buffer'} }( $asn_output );
$asn_header_buffer = &{ $asn_format->{'header_buffer'} }( $asn_output );
@@
-1788,6
+1794,8
@@
sub batch_import {
last unless scalar(@buffer);
my $row = shift @buffer;
last unless scalar(@buffer);
my $row = shift @buffer;
+ &{ $asn_format->{row_callback} }( $row, $asn_header_buffer )
+ if $asn_format->{row_callback};
foreach my $key ( keys %{ $asn_format->{map} } ) {
$hash{$key} = &{ $asn_format->{map}{$key} }( $row, $asn_header_buffer );
}
foreach my $key ( keys %{ $asn_format->{map} } ) {
$hash{$key} = &{ $asn_format->{map}{$key} }( $row, $asn_header_buffer );
}
@@
-1873,7
+1881,7
@@
sub batch_import {
return "Empty file!";
}
return "Empty file!";
}
- $dbh->commit or die $dbh->errstr if $oldAutoCommit;
;
+ $dbh->commit or die $dbh->errstr if $oldAutoCommit;
''; #no error
''; #no error
@@
-1901,7
+1909,11
@@
sub _h_statement {
"INSERT INTO h_". $self->table. " ( ".
join(', ', qw(history_date history_user history_action), @fields ).
") VALUES (".
"INSERT INTO h_". $self->table. " ( ".
join(', ', qw(history_date history_user history_action), @fields ).
") VALUES (".
- join(', ', $time, dbh->quote(getotaker()), dbh->quote($action), @values).
+ join(', ', $time,
+ dbh->quote( $FS::CurrentUser::CurrentUser->username ),
+ dbh->quote($action),
+ @values
+ ).
")"
;
}
")"
;
}
@@
-1932,11
+1944,6
@@
sub unique {
#warn "field $field is tainted" if is_tainted($field);
my($counter) = new File::CounterFile "$table.$field",0;
#warn "field $field is tainted" if is_tainted($field);
my($counter) = new File::CounterFile "$table.$field",0;
-# hack for web demo
-# getotaker() =~ /^([\w\-]{1,16})$/ or die "Illegal CGI REMOTE_USER!";
-# my($user)=$1;
-# my($counter) = new File::CounterFile "$user/$table.$field",0;
-# endhack
my $index = $counter->inc;
$index = $counter->inc while qsearchs($table, { $field=>$index } );
my $index = $counter->inc;
$index = $counter->inc while qsearchs($table, { $field=>$index } );