X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;ds=sidebyside;f=httemplate%2Fedit%2Fprocess%2Felements%2Fprocess.html;h=59ad35ee459cb440acc7d3521aa97bd5d1124ac9;hb=2c757d7db4cb6a7b9655de13206fcc84fb7ce61f;hp=52c876720c6e79bbb6b8bcf03a7e3a7a28a6a92d;hpb=600a0939e7e7e589dae4f4f5bfef3650728940b7;p=freeside.git diff --git a/httemplate/edit/process/elements/process.html b/httemplate/edit/process/elements/process.html index 52c876720..59ad35ee4 100644 --- a/httemplate/edit/process/elements/process.html +++ b/httemplate/edit/process/elements/process.html @@ -2,9 +2,21 @@ # options example... # + ### + ##req + ## # 'table' => + # # #? 'primary_key' => #required when the dbdef doesn't know...??? # #? 'fields' => [] + # + ### + ##opt + ### + # 'viewall_dir' => '', #'search' or 'browse', defaults to 'search' + # 'process_m2m' => { 'link_table' => 'link_table_name', + # 'target_table' => 'target_table_name', + # }. my(%opt) = @_; @@ -30,17 +42,24 @@ if ( $pkeyvalue ) { $error = $new->replace($old); } else { - warn $new; $error = $new->insert; - warn $error; $pkeyvalue = $new->getfield($pkey); } + if ( !$error && $opt{'process_m2m'} ) { + $error = $new->process_m2m( %{ $opt{'process_m2m'} }, + 'params' => scalar($cgi->Vars), + ); + } + if ( $error ) { $cgi->param('error', $error); print $cgi->redirect(popurl(2). "$table.html?". $cgi->query_string ); } else { - print $cgi->redirect(popurl(3). "search/$table.html"); + print $cgi->redirect( popurl(3). + ( $opt{'viewall_dir'} || 'search' ). + "/$table.html" + ); } %>