summaryrefslogtreecommitdiff
path: root/httemplate
diff options
context:
space:
mode:
authorjeff <jeff>2007-10-13 17:33:48 +0000
committerjeff <jeff>2007-10-13 17:33:48 +0000
commitd6dbf288fd8ea42ebd5171d80817356248cf22ce (patch)
tree1da868d48566ad845e91d2946072a3d4118e79b6 /httemplate
parent3c7c890883896cb8796b742880a1af637fbd46c8 (diff)
correct agent_defaultpkg handling
Diffstat (limited to 'httemplate')
-rwxr-xr-xhttemplate/edit/part_pkg.cgi4
-rwxr-xr-xhttemplate/edit/process/part_pkg.cgi9
2 files changed, 10 insertions, 3 deletions
diff --git a/httemplate/edit/part_pkg.cgi b/httemplate/edit/part_pkg.cgi
index 98ce71a28..7c6115423 100755
--- a/httemplate/edit/part_pkg.cgi
+++ b/httemplate/edit/part_pkg.cgi
@@ -162,7 +162,7 @@ Line-item revenue recognition
</TD><TD VALIGN="top">
-% if ( $cgi->param('clone') ) {
+% if ( $cgi->param('clone') || $conf->exists('agent_defaultpkg') ) {
<INPUT TYPE="hidden" NAME="agent_type" VALUE="">
@@ -178,7 +178,7 @@ Line-item revenue recognition
'table' => 'agent_type',
'name_col' => 'atype',
'value' => \@agent_type,
- 'empty_label' => '(none)',
+ 'empty_label' => 'select agent types',
'element_etc' => 'multiple size="10"',
)
%>
diff --git a/httemplate/edit/process/part_pkg.cgi b/httemplate/edit/process/part_pkg.cgi
index fd7b17567..5d9c2355b 100755
--- a/httemplate/edit/process/part_pkg.cgi
+++ b/httemplate/edit/process/part_pkg.cgi
@@ -1,6 +1,7 @@
%
%
%my $dbh = dbh;
+%my $conf = new FS::Conf;
%
%my $pkgpart = $cgi->param('pkgpart');
%
@@ -42,6 +43,9 @@
% } fields('part_pkg')
%} );
%
+%my $oldAutoCommit = $FS::UID::AutoCommit;
+%local $FS::UID::AutoCommit = 0;
+%
%my %pkg_svc = map { $_ => scalar($cgi->param("pkg_svc$_")) }
% map { $_->svcpart }
% qsearch('part_svc', {} );
@@ -71,7 +75,7 @@
% $pkgpart = $new->pkgpart;
%}
%
-%unless ($error) {
+%unless ( $error || $conf->exists('agent_defaultpkg') ) {
% my $error = $new->process_m2m(
% 'link_table' => 'type_pkgs',
% 'target_table' => 'agent_type',
@@ -79,11 +83,14 @@
% );
%}
%if ( $error ) {
+% $dbh->rollback if $oldAutoCommit;
% $cgi->param('error', $error );
% print $cgi->redirect(popurl(2). "part_pkg.cgi?". $cgi->query_string );
%} elsif ( $custnum ) {
+% $dbh->commit or die $dbh->errstr if $oldAutoCommit;
% print $cgi->redirect(popurl(3). "view/cust_main.cgi?$custnum");
%} else {
+% $dbh->commit or die $dbh->errstr if $oldAutoCommit;
% print $cgi->redirect(popurl(3). "browse/part_pkg.cgi");
%}
%