[freeside-commits] freeside/httemplate/edit part_pkg.cgi, 1.120, 1.121
Ivan,,,
ivan at wavetail.420.am
Sun Oct 10 13:52:39 PDT 2010
Update of /home/cvs/cvsroot/freeside/httemplate/edit
In directory wavetail.420.am:/tmp/cvs-serv8587/httemplate/edit
Modified Files:
part_pkg.cgi
Log Message:
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)
Index: part_pkg.cgi
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/edit/part_pkg.cgi,v
retrieving revision 1.120
retrieving revision 1.121
diff -u -w -d -r1.120 -r1.121
--- part_pkg.cgi 22 Sep 2010 19:16:19 -0000 1.120
+++ part_pkg.cgi 10 Oct 2010 20:52:37 -0000 1.121
@@ -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 %options = ();
my $recur_disabled = 1;
+my $pkgpart = '';
+
my $error_callback = sub {
my($cgi, $object, $fields, $opt ) = @_;
@@ -350,6 +360,8 @@
$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 @@
$object->set($_ => $object->option($_))
foreach (qw( setup_fee recur_fee ));
+ $pkgpart = $object->pkgpart;
+
};
my $new_callback = sub {
More information about the freeside-commits
mailing list