i18n, RT#12515
[freeside.git] / httemplate / edit / process / elements / process.html
index 87cadb7..f7558e8 100644 (file)
@@ -2,7 +2,7 @@
 
 Example:
 
include( 'elements/process.html',
<& elements/process.html,
 
    ###
    # required
@@ -65,6 +65,9 @@ Example:
    #return an error string or empty for no error
    'precheck_callback' => sub { my( $cgi ) = @_; },
 
+   #after everything's inserted
+   'noerror_callback' => sub { my( $cgi, $object ) = @_; },
+
    #supplies arguments to insert() and replace()
    # for use with tables that are FS::option_Common (among other things)
    'args_callback' => sub { my( $cgi, $object ) = @_; },
@@ -75,7 +78,7 @@ Example:
    'agent_virt'       => 1,
    'agent_null_right' => 'Access Right Name',
 
- )
+ &>
 
 </%doc>
 %if ( $error ) {
@@ -130,9 +133,11 @@ Example:
 %  } else { 
 %
 %    my $ext = $opt{'viewall_ext'} || 'html';
+%    my $viewall_dir = $opt{'viewall_dir'} || 'search';
+%    my $viewall_url = $opt{'viewall_url'} || ($viewall_dir . "/$table.$ext");
 %
-<% $cgi->redirect( popurl(3). ($opt{viewall_dir}||'search'). "/$table.$ext" ) %>
-%
+%#<% $cgi->redirect( popurl(3). ($opt{viewall_dir}||'search'). "/$table.$ext" ) %>
+<% $cgi->redirect( popurl(3) . $viewall_url ) %>
 %  }
 %
 %}
@@ -204,6 +209,7 @@ if ( $opt{'agent_virt'} ) {
 
     die "illegal agentnum"
       unless $curuser->agentnums_href->{$new->agentnum}
+          or $curuser->access_right('View customers of all agents')
           or $opt{'agent_null_right'}
              && ! $new->agentnum
              && $curuser->access_right($opt{'agent_null_right'});
@@ -298,12 +304,20 @@ if ( !$error && $opt{'process_o2m'} ) {
 
 
 if ( $error ) {
+
   $cgi->param('error', $error);
   if ( $opt{'clear_on_error'} && scalar(@{$opt{'clear_on_error'}}) ) {
     foreach my $field (@{$opt{'clear_on_error'}}) {
       $cgi->param($field, '')
     }
   }
+
+} else {
+
+  if ( $opt{'noerror_callback'} ) {
+    &{ $opt{'noerror_callback'} }( $cgi, $new );
+  }
+
 }
 
 </%init>