diff options
| author | ivan <ivan> | 2010-04-27 08:52:41 +0000 | 
|---|---|---|
| committer | ivan <ivan> | 2010-04-27 08:52:41 +0000 | 
| commit | 2e7196e70c3fc040a51aa5ce1549f6885ac9d01d (patch) | |
| tree | 47f1012c10d94744b63899c60b3074e5102c8d48 /httemplate/edit/process/elements/process.html | |
| parent | 602de8c00152d68fddfc14d6f7b65f76315bb3f3 (diff) | |
backport o2m_ and colspan from 2.1 process.html
Diffstat (limited to 'httemplate/edit/process/elements/process.html')
| -rw-r--r-- | httemplate/edit/process/elements/process.html | 53 | 
1 files changed, 47 insertions, 6 deletions
| diff --git a/httemplate/edit/process/elements/process.html b/httemplate/edit/process/elements/process.html index 5befdd337..87cadb774 100644 --- a/httemplate/edit/process/elements/process.html +++ b/httemplate/edit/process/elements/process.html @@ -56,13 +56,17 @@ Example:                         }, +   'process_o2m' => { 'table' => table_name', +                      'num_col' => 'column', #if column name is different in +                                             #link_table than source_table  +                    },     #checks CGI params and whatever else before much else runs     #return an error string or empty for no error     'precheck_callback' => sub { my( $cgi ) = @_; },     #supplies arguments to insert() and replace() -   # for use with tables that are FS::option_Common +   # for use with tables that are FS::option_Common (among other things)     'args_callback' => sub { my( $cgi, $object ) = @_; },     'debug' => 1, #turns on debugging output @@ -186,11 +190,26 @@ if ($old && exists($opt{'copy_on_empty'})) {  }  if ( $opt{'agent_virt'} ) { -  die "illegal agentnum" -    unless $curuser->agentnums_href->{$new->agentnum} -        or $opt{'agent_null_right'} -           && ! $new->agentnum -           && $curuser->access_right($opt{'agent_null_right'}); + +  if ( ! $new->agentnum +       && (    ! $opt{'agent_null_right'} +            || ! $curuser->access_right($opt{'agent_null_right'}) +          ) +     ) +  { + +    $error ||= 'Select an agent'; + +  } else { + +    die "illegal agentnum" +      unless $curuser->agentnums_href->{$new->agentnum} +          or $opt{'agent_null_right'} +             && ! $new->agentnum +             && $curuser->access_right($opt{'agent_null_right'}); + +  } +  }  $error ||= $new->check; @@ -255,6 +274,28 @@ if ( !$error && $opt{'process_m2name'} ) {  } +if ( !$error && $opt{'process_o2m'} ) { + +  my @process_o2m = ref($opt{'process_o2m'}) eq 'ARRAY' +                         ? @{ $opt{'process_o2m'} } +                         :  ( $opt{'process_o2m'} ); + + +  foreach my $process_o2m (@process_o2m) { + +    if ( $opt{'debug'} ) { +      warn "$me processing o2m:\n". Dumper( %{ $process_o2m }, +                                               'params' => scalar($cgi->Vars), +                                             ); +    } + +    $error = $new->process_o2m( %{ $process_o2m }, +                                   'params' => scalar($cgi->Vars), +                                 ); +  } + +} +  if ( $error ) {    $cgi->param('error', $error); | 
