[freeside-commits] freeside/httemplate/edit part_pkg.cgi, 1.111.2.5, 1.111.2.6
Ivan,,,
ivan at wavetail.420.am
Sun Oct 10 13:52:40 PDT 2010
Update of /home/cvs/cvsroot/freeside/httemplate/edit
In directory wavetail.420.am:/tmp/cvs-serv8596/httemplate/edit
Modified Files:
Tag: FREESIDE_1_9_BRANCH
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.111.2.5
retrieving revision 1.111.2.6
diff -u -w -d -r1.111.2.5 -r1.111.2.6
--- part_pkg.cgi 22 May 2010 19:49:20 -0000 1.111.2.5
+++ part_pkg.cgi 10 Oct 2010 20:52:38 -0000 1.111.2.6
@@ -194,6 +194,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',
@@ -216,6 +220,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',
@@ -292,6 +300,8 @@
my %options = ();
my $recur_disabled = 1;
+my $pkgpart = '';
+
my $error_callback = sub {
my($cgi, $object, $fields, $opt ) = @_;
@@ -325,6 +335,8 @@
$object->set($_ => scalar($cgi->param($_)) )
foreach (qw( setup_fee recur_fee ));
+ $pkgpart = $object->pkgpart;
+
};
my $new_hashref_callback = sub { { 'plan' => 'flat' }; };
@@ -374,6 +386,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