1 <% include("/elements/header.html", 'Upload business card' ) %>
4 <FONT SIZE="+1" COLOR="#ff0000">Error: <% $error %></FONT>
8 <FORM ACTION="prospect_main.html" METHOD="POST">
9 <INPUT TYPE="hidden" NAME="session" VALUE="<% $session %>">
14 % foreach my $line ( @lines ) {
17 <INPUT TYPE="hidden" NAME="val<%$num%>" VALUE="<% $line |h %>">
18 <SELECT NAME="sel<%$num%>">
20 <OPTION VALUE="name">Name
21 <OPTION VALUE="contactnum0_title">Title
22 <OPTION VALUE="company">Company
23 <OPTION VALUE="contactnum0_emailaddress">Email
24 <OPTION VALUE="address1">Address (1)
25 <OPTION VALUE="address2">Address (2)
26 <OPTION VALUE="city_state_zip">City, State, Zip
27 % my @phone_types = qsearch({table=>'phone_type',order_by=>'weight'});
28 % foreach my $phone_type ( @phone_types ) {
29 % next if $phone_type->typename eq 'Home';
30 <OPTION VALUE="contactnum0_phonetypenum<% $phone_type->phonetypenum %>"><% $phone_type->typename |h %> phone
32 <OPTION VALUE="contactnum0_comment">Comment
39 <TD ROWSPAN="9999"><IMG SRC="<%$p%>view/image.cgi?type=png;prefname=bizcard<%$session%>" WIDTH=604 HEIGHT=328></IMG></TD>
49 <INPUT TYPE="submit" VALUE="Create prospect">
52 <% include('/elements/footer.html') %>
55 my $fh = $cgi->upload('card');
63 my $logo_data = <$fh>;
65 $session = int(rand(4294967296)); #XXX
66 my $pref = new FS::access_user_pref({
67 'usernum' => $FS::CurrentUser::CurrentUser->usernum,
68 'prefname' => "bizcard$session",
69 'prefvalue' => encode_base64($logo_data),
70 'expiration' => time + 3600, #1h? 1m?
72 my $pref_error = $pref->insert;
74 die "FATAL: couldn't set preview cookie: $pref_error\n";
77 @lines = eval { ocr_image($logo_data); };
78 $error = $@ if $error;
82 $error = 'No file uploaded';