From 587f0384fb03179f6b504daeada93e193d2ea27f Mon Sep 17 00:00:00 2001 From: jeff Date: Tue, 20 Mar 2007 17:03:43 +0000 Subject: ticket 1418, a tool for customer note importation --- httemplate/misc/cust_main_note-import.cgi | 200 ++++++++++++++++++++++++++++++ 1 file changed, 200 insertions(+) create mode 100644 httemplate/misc/cust_main_note-import.cgi (limited to 'httemplate/misc/cust_main_note-import.cgi') diff --git a/httemplate/misc/cust_main_note-import.cgi b/httemplate/misc/cust_main_note-import.cgi new file mode 100644 index 000000000..07b922f6c --- /dev/null +++ b/httemplate/misc/cust_main_note-import.cgi @@ -0,0 +1,200 @@ +<% include("/elements/header.html", 'Batch Customer Note Import') %> +% + +
+ + + + +<% include('/elements/xmlhttp.html', + 'url' => $p. 'misc/xmlhttp-cust_main-search.cgi', + 'subs' => [qw( custnum_search )], + ) +%> + +% my $fh = $cgi->upload('csvfile'); +% my $csv = new Text::CSV_XS; +% my $skip_fuzzies = $cgi->param('fuzzies') ? 0 : 1; +% +% if ( defined($fh) ) { + + + + + + + + +% my $agentnum => scalar($cgi->param('agentnum')), +% my $line; +% my $row = 0; +% while ( defined($line=<$fh>) ) { +% chomp $line; +% $line =~ s/^(.*)(#!).*/$1/; +% +% $csv->parse($line) or die "can't parse line: " . $csv->error_input(); +% my $custnum = 0; +% my @values = $csv->fields(); +% my $last = shift @values; +% if ($last =~ /^\s*(\d+)\s*$/ ) { +% $custnum = $1; +% $last = shift @values; +% } +% my $first = shift @values; +% my $note = join ' ', @values; +% next unless ( $last || $first || $note ); +% my @cust_main = (); +% warn "searching for: $last, $first" if ($first || $last); +% if ($custnum) { +% @cust_main = qsearch('cust_main', { 'custnum' => $custnum }); +% } else { +% @cust_main = FS::cust_main::smart_search( +% 'search' => "$last, $first", +% 'no_fuzzy_on_exact' => $skip_fuzzies, +% ) +% if ($first || $last); +% } +% + + + + + + + +% $row++; +% } +
Cust #CustomerLastFirstNote to be added
+ + + + + + + + <% $first %> + + + <% $last %> + + + <% $note %> + +
+ + + Preview mode +% } else { + No file supplied +% } + +
+ + -- cgit v1.2.1