summaryrefslogtreecommitdiff
path: root/httemplate/edit/part_pkg.cgi
diff options
context:
space:
mode:
authorivan <ivan>2010-10-10 20:52:37 +0000
committerivan <ivan>2010-10-10 20:52:37 +0000
commit7430f21fafadacc4e28078f0273b5e3aeb131800 (patch)
tree314b8194fb73ada145c26c247dddc2756a41e8f7 /httemplate/edit/part_pkg.cgi
parentdefa6c82c0fbc69b06c97d229caad39248a01c1c (diff)
simple protection against selecting and using package add-ons that point to the same package. (still need to detect and break more complex self-referential loops)
Diffstat (limited to 'httemplate/edit/part_pkg.cgi')
-rwxr-xr-xhttemplate/edit/part_pkg.cgi14
1 files changed, 14 insertions, 0 deletions
diff --git a/httemplate/edit/part_pkg.cgi b/httemplate/edit/part_pkg.cgi
index 9144c4995..79dfa6afa 100755
--- a/httemplate/edit/part_pkg.cgi
+++ b/httemplate/edit/part_pkg.cgi
@@ -219,6 +219,10 @@
},
{ 'field' => 'bill_dst_pkgpart',
'type' => 'select-part_pkg',
+ 'extra_sql' => sub { $pkgpart
+ ? "AND pkgpart != $pkgpart"
+ : ''
+ },
'm2_label' => 'Include line item(s) from package',
'm2m_method' => 'bill_part_pkg_link',
'm2m_dstcol' => 'dst_pkgpart',
@@ -241,6 +245,10 @@
{ 'field' => 'svc_dst_pkgpart',
'label' => 'Also include services from package: ',
'type' => 'select-part_pkg',
+ 'extra_sql' => sub { $pkgpart
+ ? "AND pkgpart != $pkgpart"
+ : ''
+ },
'm2_label' => 'Include services of package: ',
'm2m_method' => 'svc_part_pkg_link',
'm2m_dstcol' => 'dst_pkgpart',
@@ -317,6 +325,8 @@ my @taxproductnums = ( qw( setup recur ), sort (keys %taxproductnums) );
my %options = ();
my $recur_disabled = 1;
+my $pkgpart = '';
+
my $error_callback = sub {
my($cgi, $object, $fields, $opt ) = @_;
@@ -350,6 +360,8 @@ my $error_callback = sub {
$object->set($_ => scalar($cgi->param($_)) )
foreach (qw( setup_fee recur_fee ));
+ $pkgpart = $object->pkgpart;
+
};
my $new_hashref_callback = sub { { 'plan' => 'flat' }; };
@@ -399,6 +411,8 @@ my $edit_callback = sub {
$object->set($_ => $object->option($_))
foreach (qw( setup_fee recur_fee ));
+ $pkgpart = $object->pkgpart;
+
};
my $new_callback = sub {