[freeside-commits] freeside/httemplate/edit part_pkg.cgi, 1.122.2.3, 1.122.2.4
Ivan,,,
ivan at wavetail.420.am
Tue Jul 12 16:00:35 PDT 2011
Update of /home/cvs/cvsroot/freeside/httemplate/edit
In directory wavetail.420.am:/tmp/cvs-serv31938/httemplate/edit
Modified Files:
Tag: FREESIDE_2_1_BRANCH
part_pkg.cgi
Log Message:
fix UI for package editing w/recur_show_zero, add setup_show_zero, RT#9777
Index: part_pkg.cgi
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/edit/part_pkg.cgi,v
retrieving revision 1.122.2.3
retrieving revision 1.122.2.4
diff -u -w -d -r1.122.2.3 -r1.122.2.4
--- part_pkg.cgi 7 Jul 2011 17:00:58 -0000 1.122.2.3
+++ part_pkg.cgi 12 Jul 2011 23:00:33 -0000 1.122.2.4
@@ -45,6 +45,7 @@
'credit_weight' => 'Credit weight',
'agentnum' => 'Agent',
'setup_fee' => 'Setup fee',
+ 'setup_show_zero' => 'Show zero setup',
'recur_fee' => 'Recurring fee',
'recur_show_zero' => 'Show zero recurring',
'discountnum' => 'Offer discounts for longer terms',
@@ -102,6 +103,12 @@
},
{ field => 'setup_fee',
type => 'money',
+ onchange => 'setup_changed',
+ },
+ { field => 'setup_show_zero',
+ type => 'checkbox',
+ value => 'Y',
+ disabled => sub { $setup_show_zero_disabled },
},
{ field => 'freq',
type => 'part_pkg_freq',
@@ -334,6 +341,7 @@
my %options = ();
my $recur_disabled = 1;
+my $setup_show_zero_disabled = 0;
my $recur_show_zero_disabled = 1;
my $pkgpart = '';
@@ -345,10 +353,12 @@
$opt->{action} = 'Custom' if $cgi->param('pkgnum');
+ $setup_show_zero_disabled = ($cgi->param('setup_fee') > 0) ? 1 : 0;
+
$recur_disabled = $cgi->param('freq') ? 0 : 1;
$recur_show_zero_disabled =
$cgi->param('freq')
- ? $cgi->param('recur_fee') ? 0 : 1
+ ? $cgi->param('recur_fee') > 0 ? 1 : 0
: 1;
foreach ($cgi->param) {
@@ -394,8 +404,15 @@
my $edit_callback = sub {
my( $cgi, $object, $fields, $opt ) = @_;
+ $setup_show_zero_disabled = ($object->option('setup_fee') > 0) ? 1 : 0;
+
$recur_disabled = $object->freq ? 0 : 1;
+ $recur_show_zero_disabled =
+ $object->freq
+ ? $object->option('recur_fee') > 0 ? 1 : 0
+ : 1;
+
(@agent_type) =
map {$_->typenum} qsearch('type_pkgs', { 'pkgpart' => $object->pkgpart } );
@@ -422,7 +439,7 @@
%options = $object->options;
- $object->set($_ => $object->option($_))
+ $object->set($_ => $object->option($_, 1))
foreach (qw( setup_fee recur_fee disable_line_item_date_ranges ));
$pkgpart = $object->pkgpart;
@@ -531,15 +548,24 @@
} else {
what.form.recur_fee.disabled = false;
what.form.recur_fee.style.backgroundColor = '#ffffff';
- what.form.recur_show_zero.disabled = false;
+ recur_changed( what.form.recur_fee );
//what.form.recur_show_zero.style.backgroundColor= '#ffffff';
}
}
+ function setup_changed(what) {
+ var setup = what.value;
+ if ( parseFloat(setup) == 0 ) {
+ what.form.setup_show_zero.disabled = false;
+ } else {
+ what.form.setup_show_zero.disabled = true;
+ }
+ }
+
function recur_changed(what) {
var recur = what.value;
- if ( recur == 0 ) {
+ if ( parseFloat(recur) == 0 ) {
what.form.recur_show_zero.disabled = false;
} else {
what.form.recur_show_zero.disabled = true;
More information about the freeside-commits
mailing list