diff options
Diffstat (limited to 'httemplate')
-rwxr-xr-x | httemplate/edit/part_pkg.cgi | 30 | ||||
-rw-r--r-- | httemplate/edit/process/bulk-svc_phone.html | 2 | ||||
-rw-r--r-- | httemplate/misc/email-customers.html | 3 |
3 files changed, 31 insertions, 4 deletions
diff --git a/httemplate/edit/part_pkg.cgi b/httemplate/edit/part_pkg.cgi index c4db83aee..1702a6dc7 100755 --- a/httemplate/edit/part_pkg.cgi +++ b/httemplate/edit/part_pkg.cgi @@ -959,7 +959,30 @@ my $html_bottom = sub { my @fields = exists($plans{$layer}->{'fieldorder'}) ? @{$plans{$layer}->{'fieldorder'}} : keys %{ $href }; - + + # hash of dependencies for each of the Pricing Plan fields. + # make sure NOT to use double-quotes inside the 'msg' value. + my $dependencies = { + 'unused_credit_suspend' => { + 'msg' => q|You must set the 'suspend_credit_type' option in Configuration->Settings to gain access to this option.|, + 'are_met' => sub{ + my $conf = new FS::conf; + my @conf_info = qsearch('conf', { 'name' => 'suspend_credit_type' } ); + return 1 if (exists($conf_info[0]) && $conf_info[0]->{Hash}{value}); + return 0; + } + }, + 'unused_credit_cancel' => { + 'msg' => q|You must set the 'cancel_credit_type' option in Configuration->Settings to gain access to this option.|, + 'are_met' => sub{ + my $conf = new FS::conf; + my @conf_info = qsearch('conf', { 'name' => 'cancel_credit_type' } ); + return 1 if (exists($conf_info[0]) && $conf_info[0]->{Hash}{value}); + return 0; + } + } + }; + foreach my $field ( grep $_ !~ /^(setup|recur)_fee$/, @fields ) { if(!exists($href->{$field})) { @@ -981,7 +1004,10 @@ my $html_bottom = sub { #XXX these should use elements/ fields... (or this whole thing should #just use layer_fields instead of layer_callback) - if ( ! exists($href->{$field}{'type'}) ) { + if (exists($dependencies->{$field}) && !$dependencies->{$field}{'are_met'}()) { + $html .= q!<span title="!.$dependencies->{$field}{'msg'}.q!">N/A</span>!; + + } elsif ( ! exists($href->{$field}{'type'}) ) { $html .= qq!<INPUT TYPE="text" NAME="${layer}__$field" VALUE="!. ( exists($options{$field}) diff --git a/httemplate/edit/process/bulk-svc_phone.html b/httemplate/edit/process/bulk-svc_phone.html index 5a1fbc647..db486de76 100644 --- a/httemplate/edit/process/bulk-svc_phone.html +++ b/httemplate/edit/process/bulk-svc_phone.html @@ -25,7 +25,7 @@ my $num_avail = $1; errorpage("There are only $num_avail available") if $end - $start + 1 > $num_avail; -foreach my $phonenum ( $start .. $end ) { +foreach my $phonenum ( "$start" .. "$end" ) { my $svc_phone = new FS::svc_phone { 'phonenum' => $phonenum, diff --git a/httemplate/misc/email-customers.html b/httemplate/misc/email-customers.html index 15926308e..c74c15b1e 100644 --- a/httemplate/misc/email-customers.html +++ b/httemplate/misc/email-customers.html @@ -103,7 +103,8 @@ Template: <& /elements/tr-td-label.html, 'label' => 'From:' &> <TD><& /elements/input-text.html, 'field' => 'from_name', - 'value' => $conf->config('company_name', $agent_virt_agentnum), #? + 'value' => $conf->config('invoice_from_name', $agent_virt_agentnum) || + $conf->config('company_name', $agent_virt_agentnum), #? 'size' => 20, &> <\ <& /elements/input-text.html, |