summaryrefslogtreecommitdiff
path: root/httemplate
diff options
context:
space:
mode:
authorIvan Kohler <ivan@freeside.biz>2015-01-28 02:26:52 -0800
committerIvan Kohler <ivan@freeside.biz>2015-01-28 02:26:52 -0800
commit2e4fa975e054554beac71883436b143267d7aa12 (patch)
tree246c066d8497d8db3f47a809caddfbd2e67d2264 /httemplate
parentf4b7701c4c1e574ebe29e05db694d131d2799b35 (diff)
parente43f8075d053e3f1d969d8f762ab510a2de126de (diff)
Merge branch 'master' of git.freeside.biz:/home/git/freeside
Diffstat (limited to 'httemplate')
-rwxr-xr-xhttemplate/edit/part_pkg.cgi30
-rw-r--r--httemplate/edit/process/bulk-svc_phone.html2
-rw-r--r--httemplate/misc/email-customers.html3
3 files changed, 31 insertions, 4 deletions
diff --git a/httemplate/edit/part_pkg.cgi b/httemplate/edit/part_pkg.cgi
index c4db83a..1702a6d 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 5a1fbc6..db486de 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 1592630..c74c15b 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,
&>&nbsp;&lt;\
<& /elements/input-text.html,