default to a session cookie instead of setting an explicit timeout, weird timezone...
[freeside.git] / httemplate / edit / process / deploy_zone-mobile.html
index c913c5c..9b205ab 100644 (file)
@@ -1,9 +1,30 @@
 <& elements/process.html, 
-    error_redirect => popurl(2).'deploy_zone-mobile.html?',
+    error_redirect => popurl(2).'deploy_zone-mobile.html',
     table       => 'deploy_zone',
     viewall_dir => 'browse',
-    process_o2m => 
+    precheck_callback => $precheck_callback,
+    process_o2m =>
       { 'table'  => 'deploy_zone_vertex',
                      'fields' => [qw( latitude longitude )]
       },
 &>
+<%init>
+my $precheck_callback = sub {
+  # convert the vertex list into a process_o2m-style parameter list
+  if ( $cgi->param('vertices') ) {
+    my $vertices = decode_json($cgi->param('vertices'));
+    my $i = 0;
+    foreach (@$vertices) {
+      $cgi->param("vertexnum${i}", '');
+      $cgi->param("vertexnum${i}_latitude", $_->[0]);
+      $cgi->param("vertexnum${i}_longitude", $_->[1]);
+      $i++;
+    }
+  }
+  if ( length $cgi->param('active_date') ) {
+    my $date = parse_datetime( $cgi->param('active_date') );
+    $cgi->param('active_date', $date);
+  }
+  '';
+};
+</%init>