X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fedit%2Fprocess%2Felements%2Fprocess.html;h=60aaf749a3391d15551ca3597462b4c0d7e0ef33;hb=310427abc396e793a887b467c51964efb22424a1;hp=698540b795ae821655148f4a1c302165baa30bab;hpb=f25c596ba479c7c5cebcfd4447bb0db9c70a1e06;p=freeside.git diff --git a/httemplate/edit/process/elements/process.html b/httemplate/edit/process/elements/process.html index 698540b79..60aaf749a 100644 --- a/httemplate/edit/process/elements/process.html +++ b/httemplate/edit/process/elements/process.html @@ -62,6 +62,8 @@ Example: 'fields' => [qw( fieldname fieldname2 )], }, + 'process_locale' => 'fieldname', # update entries in the _msgcat table + 'process_upload' => { 'process' => 'misc/mytable-import.html', # fields to pass to the back end job, besides the @@ -77,6 +79,9 @@ Example: #return an error string or empty for no error 'precheck_callback' => sub { my( $cgi ) = @_; }, + #after the new object is created + 'post_new_object_callback' => sub { my( $cgi, $object ) = @_; }, + #after everything's inserted 'noerror_callback' => sub { my( $cgi, $object ) = @_; }, @@ -157,7 +162,28 @@ process(); <& /elements/footer.html &> -%} elsif ( $opt{'popup_reload'} ) { +% } elsif ( $opt{'progress_init'} ) { +% # some false laziness with the above +% my ($form_name, $job_fields) = @{ $opt{'progress_init'} }; +
+ +% foreach my $field (@$job_fields) { +% next if $field eq $pkey; + +% } +<& /elements/progress-init.html, + @{ $opt{'progress_init'} } +&> + +
+ +<& /elements/footer.html &> + +% } elsif ( $opt{'popup_reload'} ) { <% include('/elements/header-popup.html', $opt{'popup_reload'} ) %> @@ -219,7 +245,7 @@ my %hash = my @values = ( 1 ); if ( $bfield ) { @values = $cgi->param($bfield); - warn join(',', @values); + #warn join(',', @values); } my @uploaded_files; @@ -246,6 +272,10 @@ foreach my $value ( @values ) { } } + if ( $opt{'post_new_object_callback'} ) { + &{ $opt{'post_new_object_callback'} }( $cgi, $new ); + } + if ( $opt{'agent_virt'} ) { if ( ! $new->agentnum @@ -308,7 +338,7 @@ foreach my $value ( @values ) { warn "$me processing m2m:\n". Dumper( %$process_m2m ) if $opt{'debug'}; - $error = $new->process_m2m( %$process_m2m ); + $error ||= $new->process_m2m( %$process_m2m ); } } @@ -335,12 +365,21 @@ foreach my $value ( @values ) { } - if ( !$error && $opt{'process_o2m'} ) { - - my @process_o2m = ref($opt{'process_o2m'}) eq 'ARRAY' - ? @{ $opt{'process_o2m'} } - : ( $opt{'process_o2m'} ); + my @process_o2m; + if ( $opt{'process_o2m'} ) { + @process_o2m = ref($opt{'process_o2m'}) eq 'ARRAY' + ? @{ $opt{'process_o2m'} } + : ( $opt{'process_o2m'} ); + } + if ( $opt{'process_locale'} ) { + push @process_o2m, + { + 'table' => $table . '_msgcat', + 'fields' => [ 'locale', $opt{'process_locale'} ], + }; + } + if ( !$error ) { foreach my $process_o2m (@process_o2m) { @@ -350,7 +389,7 @@ foreach my $value ( @values ) { ); } - $error = $new->process_o2m( %{ $process_o2m }, + $error ||= $new->process_o2m( %{ $process_o2m }, 'params' => scalar($cgi->Vars), ); }