X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fedit%2Fprocess%2Felements%2Fprocess.html;h=d29ffcfe53df8e5011df0575815e5d6b0cd9e719;hb=6626dc2a13c809092aa539c5a72bc72a0c56afdc;hp=19d3fbef1e2d1e87bcac85757b0dbd7dbee9a310;hpb=9509e5bfb7f9331303153cac24d7bfecbe2ea9f1;p=freeside.git diff --git a/httemplate/edit/process/elements/process.html b/httemplate/edit/process/elements/process.html index 19d3fbef1..d29ffcfe5 100644 --- a/httemplate/edit/process/elements/process.html +++ b/httemplate/edit/process/elements/process.html @@ -17,9 +17,11 @@ Example: # optional ### - 'viewall_dir' => '', #'search' or 'browse', defaults to 'search' + 'viewall_dir' => '', #'search' or 'browse', defaults to 'search' OR - 'redirect' => 'view/table.cgi?', # value of primary key is appended + 'redirect' => 'view/table.cgi?', # value of primary key is appended + OR + 'popup_reload' => 'Momentary success message', #will reload parent window 'error_redirect' => popurl(2).'edit/table.cgi?', #query string appended @@ -60,6 +62,54 @@ Example: ) +%if ( $error ) { +% +% my $edit_ext = $opt{'edit_ext'} || 'html'; +% my $url = $opt{'error_redirect'} || popurl(2)."$table.$edit_ext"; +% if ( length($cgi->query_string) > 1920 ) { #stupid IE 2083 URL limit +% +% my $session = int(rand(4294967296)); #XXX +% my $pref = new FS::access_user_pref({ +% 'usernum' => $FS::CurrentUser::CurrentUser->usernum, +% 'prefname' => "redirect$session", +% 'prefvalue' => $cgi->query_string, +% 'expiration' => time + 3600, #1h? 1m? +% }); +% my $pref_error = $pref->insert; +% if ( $pref_error ) { +% die "FATAL: couldn't even set redirect cookie: $pref_error". +% " attempting to set redirect$session to ". $cgi->query_string."\n"; +% } +% +<% $cgi->redirect("$url?redirect=$session") %> +% +% } else { +% +<% $cgi->redirect("$url?". $cgi->query_string ) %> +% +% } +% +% #different ways of handling success +% +%} elsif ( $opt{'popup_reload'} ) { + + <% include('/elements/header-popup.html', $opt{'popup_reload'} ) %> + + + + + + +%} elsif ( $opt{'redirect'} ) { +% +<% $cgi->redirect( $opt{'redirect'}. $pkeyvalue ) %> +% +%} else { +% +<% $cgi->redirect( popurl(3). ($opt{viewall_dir}||'search'). "/$table.html" ) %> +%} <%once> my $me = 'process.html:'; @@ -95,7 +145,11 @@ if ( $pkeyvalue ) { }); } -my %hash = map { $_ => scalar($cgi->param($_)) } @$fields; +my %hash = + map { my @entry = ( $_ => $cgi->param($_) ); + $opt{'value_callback'} ? ( $_ => &{ $opt{'value_callback'} }( @entry )) + : ( @entry ) + } @$fields; my $new = $class->new( \%hash ); @@ -162,7 +216,6 @@ if ( !$error && $opt{'process_m2name'} ) { ); } -# XXX print?!?! if ( $error ) { $cgi->param('error', $error); @@ -171,33 +224,6 @@ if ( $error ) { $cgi->param($field, '') } } - my $edit_ext = $opt{'edit_ext'} || 'html'; - my $url = $opt{'error_redirect'} || popurl(2)."$table.$edit_ext"; - if ( length($cgi->query_string) > 1920 ) { #stupid IE 2083 URL limit - - my $session = int(rand(4294967296)); #XXX - my $pref = new FS::access_user_pref({ - 'usernum' => $FS::CurrentUser::CurrentUser->usernum, - 'prefname' => "redirect$session", - 'prefvalue' => $cgi->query_string, - 'expiration' => time + 3600, #1h? 1m? - }); - my $pref_error = $pref->insert; - if ( $pref_error ) { - die "FATAL: couldn't even set redirect cookie: $pref_error". - " attempting to set redirect$session to ". $cgi->query_string."\n"; - } - print $cgi->redirect("$url?redirect=$session"); - } else { - print $cgi->redirect("$url?". $cgi->query_string ); - } -} elsif ( $opt{'redirect'} ) { - print $cgi->redirect( $opt{'redirect'}. $pkeyvalue ); -} else { - print $cgi->redirect( popurl(3). - ( $opt{'viewall_dir'} || 'search' ). - "/$table.html" - ); }