default to a session cookie instead of setting an explicit timeout, weird timezone...
[freeside.git] / httemplate / edit / process / prospect_main.html
index 34d2642..b2ae88e 100644 (file)
@@ -1,16 +1,27 @@
 <% include('elements/process.html',
      'table'          => 'prospect_main',
+     'precheck_callback' => $precheck,
      'args_callback'  => $args_callback,
      'agent_virt'     => 1,
      'process_o2m' => {
        'table'  => 'contact',
-       'fields' => [qw( first last title comment )],
+       'fields' => \@contact_fields,
      },
      'redirect' => popurl(3). 'view/prospect_main.html?',
    )
 %>
 <%init>
 
+my $precheck = sub {
+  my $cgi = shift;
+  my $vendor = FS::Conf->new->config('tax_data_vendor');
+  if ( $vendor eq 'avalara' or $vendor eq 'suretax' ) {
+    if ( ! $cgi->param('taxstatusnum') ) {
+      return 'Tax status required';
+    }
+  }
+};
+
 my $args_callback = sub {
   my( $cgi, $object ) = @_;
 
@@ -22,7 +33,10 @@ my $args_callback = sub {
 
   my $cust_location = new FS::cust_location {
     map { $_ => scalar($cgi->param($_)) }
-        qw( address1 address2 city county state zip country )
+        qw( address1 address2 city county state zip country
+            latitude longitude
+            location_kind location_type location_number
+          )
   };
 
   $cust_location->locationnum($locationnum) unless $locationnum == -1;
@@ -31,4 +45,9 @@ my $args_callback = sub {
 
 };
 
+my @contact_fields = qw( classnum first last title comment emailaddress );
+foreach my $phone_type ( qsearch({table=>'phone_type', order_by=>'weight'}) ) {
+  push @contact_fields, 'phonetypenum'.$phone_type->phonetypenum;
+}
+
 </%init>