X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fedit%2Fpart_pkg.cgi;h=778a0265e023e872b9a7440e5ff3f97810437703;hb=315ffb86414145b95f2541db8f9d89c1f7e71e3f;hp=cc5606e5406a251f3c9e265f21d307c62884e6f9;hpb=edea94b6bd41a3fceac47267a3df3dc7fcf7c565;p=freeside.git
diff --git a/httemplate/edit/part_pkg.cgi b/httemplate/edit/part_pkg.cgi
index cc5606e54..778a0265e 100755
--- a/httemplate/edit/part_pkg.cgi
+++ b/httemplate/edit/part_pkg.cgi
@@ -51,6 +51,7 @@
'credit_weight' => 'Credit weight',
'agent_pkgpartid' => 'External ID',
'agentnum' => 'Agent',
+ 'agent_type' => ' ', #just its title headingn is fine
'setup_fee' => 'Setup fee',
'setup_show_zero' => 'Show zero setup',
'recur_fee' => 'Recurring fee',
@@ -227,9 +228,13 @@
{ type => 'columnnext' },
- { field => 'agent_type',
- type => 'select-agent_types',
- disabled => ! $acl_edit_global,
+ {type=>'justtitle', value=>'Agent (reseller) types' },
+
+ { field => 'agent_type',
+ type => 'select-agent_type',
+ disabled => ! $acl_edit_global,
+ element_etc => 'size="10"',
+ multiple => '1', #cause edit.html is dum
curr_value_callback => sub {
my($cgi, $object, $field) = @_;
#in the other callbacks..? hmm.
@@ -649,8 +654,7 @@ my $new_callback = sub {
my $conf = new FS::Conf;
if ( $conf->exists('agent_defaultpkg') ) {
- #my @all_agent_types = map {$_->typenum} qsearch('agent_type',{});
- @agent_type = map {$_->typenum} qsearch('agent_type',{});
+ @agent_type = map {$_->typenum} qsearch('agent_type', { 'disabled'=>'' });
}
$options{'suspend_bill'}=1 if $conf->exists('part_pkg-default_suspend_bill');
@@ -890,6 +894,11 @@ my $javascript = <<'END';
}
}
+ function finish_edit_fcc(id) {
+ cClick();
+ show_fcc_options(id); // refresh the display
+ }
+
END
my $warning =
@@ -950,7 +959,21 @@ 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 @suspend_credit_type_conf = qsearch('conf', { 'name' => 'suspend_credit_type' } );
+ return 1 if (exists($suspend_credit_type_conf[0]) && $suspend_credit_type_conf[0]->{Hash}{value});
+ return 0;
+ }
+ }
+ };
+
foreach my $field ( grep $_ !~ /^(setup|recur)_fee$/, @fields ) {
if(!exists($href->{$field})) {
@@ -972,7 +995,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!N/A!;
+
+ } elsif ( ! exists($href->{$field}{'type'}) ) {
$html .= qq!