[freeside-commits] freeside/httemplate/edit part_pkg.cgi, 1.99, 1.100
Ivan,,,
ivan at wavetail.420.am
Tue Jan 20 18:02:11 PST 2009
Update of /home/cvs/cvsroot/freeside/httemplate/edit
In directory wavetail.420.am:/tmp/cvs-serv32616/httemplate/edit
Modified Files:
part_pkg.cgi
Log Message:
fix (hopefully last of the) customize package bogosity in 1.9, RT#4662
Index: part_pkg.cgi
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/edit/part_pkg.cgi,v
retrieving revision 1.99
retrieving revision 1.100
diff -u -d -r1.99 -r1.100
--- part_pkg.cgi 22 Dec 2008 21:16:55 -0000 1.99
+++ part_pkg.cgi 21 Jan 2009 02:02:08 -0000 1.100
@@ -10,6 +10,7 @@
'new_hashref_callback' => $new_hashref_callback,
'new_object_callback' => $new_object_callback,
'new_callback' => $new_callback,
+ 'clone_callback' => $clone_callback,
'edit_callback' => $edit_callback,
'error_callback' => $error_callback,
@@ -193,8 +194,6 @@
my @agent_type = ();
my %tax_override = ();
-my $clone_part_pkg = '';
-
my %taxproductnums = map { ($_->classnum => 1) }
qsearch('usage_class', { 'disabled' => '' });
@@ -227,7 +226,6 @@
$tax_override{$_} = $cgi->param('tax_override_$_')
foreach(grep { /^tax_override_(\w+)$/ } $cgi->param);
$opt->{action} = 'Custom' if $cgi->param('clone');
- $clone_part_pkg= qsearchs('part_pkg', { 'pkgpart' => $cgi->param('clone') } );
$recur_disabled = $cgi->param('freq') ? 0 : 1;
@@ -255,21 +253,9 @@
my $new_object_callback = sub {
my( $cgi, $hashref, $fields, $opt ) = @_;
- my $part_pkg = '';
- if ( $cgi->param('clone') ) {
- $opt->{action} = 'Custom';
- $clone_part_pkg = qsearchs('part_pkg', { pkgpart=>$cgi->param('clone') } );
- $part_pkg = $clone_part_pkg->clone;
- $part_pkg->disabled('Y');
- %options = $clone_part_pkg->options;
- $part_pkg->set($_ => $options{$_})
- foreach (qw( setup_fee recur_fee ));
- $recur_disabled = $part_pkg->freq ? 0 : 1;
- } else {
- $part_pkg = FS::part_pkg->new( $hashref );
- $part_pkg->set($_ => '0')
- foreach (qw( setup_fee recur_fee ));
- }
+ my $part_pkg = FS::part_pkg->new( $hashref );
+ $part_pkg->set($_ => '0')
+ foreach (qw( setup_fee recur_fee ));
$part_pkg;
@@ -313,6 +299,26 @@
};
+my $clone_callback = sub {
+ my( $cgi, $object, $fields, $opt ) = @_;
+
+ $opt->{action} = 'Custom';
+
+ #my $part_pkg = $clone_part_pkg->clone;
+ #this is all clone did anyway
+ $object->comment( '(CUSTOM) '. $object->comment )
+ unless $object->comment =~ /^\(CUSTOM\) /;
+
+ $object->disabled('Y');
+
+ %options = $object->options;
+
+ $object->set($_ => $options{$_})
+ foreach (qw( setup_fee recur_fee ));
+
+ $recur_disabled = $object->freq ? 0 : 1;
+};
+
my $m2_error_callback_maker = sub {
my $link_type = shift; #yay closures
return sub {
@@ -486,11 +492,18 @@
layer_callback => $layer_callback,
);
- include('/elements/selectlayers.html', %selectlayers, 'layers_only'=>1 ).
- '<SCRIPT TYPE="text/javascript">'.
- include('/elements/selectlayers.html', %selectlayers, 'js_only'=>1 ).
- "taxproduct_selectchanged(document.getElementById('taxproduct_select'));".
- '</SCRIPT>';
+ my $return =
+ include('/elements/selectlayers.html', %selectlayers, 'layers_only'=>1 ).
+ '<SCRIPT TYPE="text/javascript">'.
+ include('/elements/selectlayers.html', %selectlayers, 'js_only'=>1 );
+
+ $return .=
+ "taxproduct_selectchanged(document.getElementById('taxproduct_select'));\n"
+ if $taxproducts;
+
+ $return .= '</SCRIPT>';
+
+ $return;
};
More information about the freeside-commits
mailing list