hold off until 1.7.2
[freeside.git] / httemplate / edit / process / part_pkg.cgi
index 204c751..55e7e05 100755 (executable)
 %  $cgi->param($_, '') unless defined $cgi->param($_);
 %}
 %
+%my @agents;
+%foreach ($cgi->param('agent_type')) {
+%  /^(\d+)$/;
+%  push @agents, $1 if $1;
+%}
+%
 %my $new = new FS::part_pkg ( {
 %  map {
 %    $_ => scalar($cgi->param($_));
 %  $pkgpart = $new->pkgpart;
 %}
 %
+%unless (1 || $error) { # after 1.7.2
+%  my $error = $new->process_m2m(
+%    'link_table'   => 'type_pkgs',
+%    'target_table' => 'agent_type',
+%    'params'       => \@agents,
+%  );
+%}
 %if ( $error ) {
 %  $cgi->param('error', $error );
 %  print $cgi->redirect(popurl(2). "part_pkg.cgi?". $cgi->query_string );