fix date fields in svc_circuit, related to #30380
authorMark Wells <mark@freeside.biz>
Wed, 31 Dec 2014 23:04:48 +0000 (15:04 -0800)
committerMark Wells <mark@freeside.biz>
Wed, 31 Dec 2014 23:04:48 +0000 (15:04 -0800)
httemplate/edit/process/svc_circuit.html
httemplate/view/svc_circuit.html

index d28f913..27f43db 100644 (file)
@@ -2,10 +2,22 @@
     table       => 'svc_circuit',
     edit_ext    => 'html',
     redirect    => popurl(3)."view/svc_circuit.html?",
+    precheck_callback => $precheck,
 &>
 <%init>
 
 die "access denied"
   unless $FS::CurrentUser::CurrentUser->access_right('Provision customer service'); #something else more specific?
 
+my $precheck = sub {
+  my $cgi = shift;
+  foreach ('desired_due_date', 'due_date') {
+    if ( length $cgi->param($_) ) {
+      my $date = parse_datetime( $cgi->param($_) );
+      $cgi->param($_, $date);
+    }
+  }
+  return;
+};
+
 </%init>
index c8d5d23..42bfc4b 100644 (file)
@@ -53,10 +53,10 @@ my @fields = (
     table     => 'circuit_termination',
     name_col  => 'termination',
   },
-  qw( vendor_qual_id vendor_order_id vendor_order_type vendor_order_status
-      desired_due_date due_date
-      endpoint_ip_addr
-  ),
+  qw( vendor_qual_id vendor_order_id vendor_order_type vendor_order_status ),
+  { field     => 'desired_due_date', type => 'date' },
+  { field     => 'due_date', type => 'date' },
+  'endpoint_ip_addr',
   { field     => 'endpoint_mac_addr', type => 'mac_addr' },
 );