X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fedit%2Fpart_pkg.cgi;h=80a61f813654482616e37c12c9a7167f7b4c0db8;hb=919943a3c5af718afa2eb47e9b4d9d3405f0bb73;hp=65eca6cf406254c8de542d48c0d427c79737a19d;hpb=7c370a4579d1ed8b81dba2fb5fae9978b283b49e;p=freeside.git
diff --git a/httemplate/edit/part_pkg.cgi b/httemplate/edit/part_pkg.cgi
index 65eca6cf4..80a61f813 100755
--- a/httemplate/edit/part_pkg.cgi
+++ b/httemplate/edit/part_pkg.cgi
@@ -28,7 +28,7 @@
'onsubmit' => 'confirm_submit',
- 'labels' => {
+ 'labels' => {
'pkgpart' => 'Package Definition',
'pkg' => 'Package',
%locale_field_labels,
@@ -44,12 +44,14 @@
'plan' => 'Price plan',
'disabled' => 'Disable new orders',
'disable_line_item_date_ranges' => 'Disable line item date ranges',
+ 'start_on_hold' => 'Start on hold',
'setup_cost' => 'Setup cost',
'recur_cost' => 'Recur cost',
'pay_weight' => 'Payment weight',
'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',
@@ -66,9 +68,11 @@
'svc_dst_pkgpart' => 'Include services of package',
'supp_dst_pkgpart' => 'When ordering package, also order',
'report_option' => 'Report classes',
- 'fcc_ds0s' => 'Voice-grade equivalents',
- 'fcc_voip_class' => 'Category',
'delay_start' => 'Default delay (days)',
+ 'adjourn_months' => 'Suspend the package after ',
+ 'contract_end_months' => 'Contract ends after ',
+ 'expire_months' => 'Cancel the package after ',
+ 'change_to_pkgpart'=> 'and replace it with ',
},
'fields' => [
@@ -110,6 +114,10 @@
),
{field=>'disabled', type=>$disabled_type, value=>'Y'},
{field=>'disable_line_item_date_ranges', type=>$disabled_type, value=>'Y'},
+ { field => 'start_on_hold',
+ type => 'checkbox',
+ value => 'Y'
+ },
{ type => 'tablebreak-tr-title',
value => 'Pricing', #better name?
@@ -160,6 +168,37 @@
sort $conf->config('currencies')
),
+ ( $conf->exists('part_pkg-delay_start')
+ ? ( { type => 'tablebreak-tr-title',
+ value => 'Delayed start',
+ },
+ { field => 'delay_start',
+ type => 'text', size => 6 },
+ )
+ : ()
+ ),
+
+ { type => 'tablebreak-tr-title',
+ value => 'Limited duration',
+ },
+ { field => 'adjourn_months',
+ type => 'select-months',
+ },
+ { field => 'contract_end_months',
+ type => 'select-months',
+ },
+ { field => 'expire_months',
+ type => 'select-expire_months',
+ },
+ { field => 'change_to_pkgpart',
+ type => 'select-part_pkg',
+ extra_sql => sub { $pkgpart
+ ? "AND part_pkg.pkgpart != $pkgpart"
+ : ''
+ },
+ empty_label => 'no package',
+ },
+
#price plan
#setup fee
#recurring frequency
@@ -175,21 +214,26 @@
type => 'hidden',
value => join(',', @taxproductnums),
},
- { field => 'taxproduct_select',
- type => 'selectlayers',
- options => [ '(default)', @taxproductnums ],
- curr_value => '(default)',
- labels => { ( '(default)' => '(default)' ),
- map {($_=>$usage_class{$_})}
- @taxproductnums
- },
- layer_fields => \%taxproduct_fields,
- layer_values_callback => $taxproduct_values,
- layers_only => !$taxproducts,
- cell_style => ( !$taxproducts
- ? 'display:none'
- : ''
- ),
+ #{ field => 'taxproduct_select',
+ # type => 'selectlayers',
+ # options => [ '(default)', @taxproductnums ],
+ # curr_value => '(default)',
+ # labels => { ( '(default)' => '(default)' ),
+ # map {($_=>$usage_class{$_})}
+ # @taxproductnums
+ # },
+ # layer_fields => \%taxproduct_fields,
+ # layer_values_callback => $taxproduct_values,
+ # layers_only => !$taxproducts,
+ # cell_style => ( !$taxproducts
+ # ? 'display:none'
+ # : ''
+ # ),
+ #},
+ { field => 'taxproductnum',
+ type => 'part_pkg-taxproducts',
+ include_opt_callback =>
+ sub { pkgpart => $_[0]->pkgpart },
},
{ type => 'tablebreak-tr-title',
@@ -210,21 +254,15 @@
)
),
- ( $conf->exists('part_pkg-delay_start')
- ? ( { type => 'tablebreak-tr-title',
- value => 'Delayed start',
- },
- { field => 'delay_start',
- type => 'text', size => 6 },
- )
- : ()
- ),
-
{ 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.
@@ -259,7 +297,7 @@
{ field=>'agent_pkgpartid', type=>'text', size=>21 },
{ type => 'tablebreak-tr-title',
- value => 'Line-item revenue recogition', #better name?
+ value => 'Line-item revenue recognition', #better name?
},
{ field=>'pay_weight', type=>'text', size=>6 },
{ field=>'credit_weight', type=>'text', size=>6 },
@@ -313,7 +351,7 @@
{ 'field' => 'bill_dst_pkgpart',
'type' => 'select-part_pkg',
'extra_sql' => sub { $pkgpart
- ? "AND pkgpart != $pkgpart"
+ ? "AND part_pkg.pkgpart != $pkgpart"
: ''
},
'label_callback' => sub { shift->pkg_comment_only },
@@ -340,7 +378,7 @@
'label' => 'Also include services from package: ',
'type' => 'select-part_pkg',
'extra_sql' => sub { $pkgpart
- ? "AND pkgpart != $pkgpart"
+ ? "AND part_pkg.pkgpart != $pkgpart"
: ''
},
'label_callback' => sub { shift->pkg_comment_only },
@@ -406,7 +444,7 @@ my $agent_clone_extra_sql =
' ) ';
my $conf = new FS::Conf;
-my $taxproducts = $conf->exists('enable_taxproducts');
+my $taxproducts = $conf->config('tax_data_vendor') ne '';
my $fcc_opts = $conf->exists('part_pkg-show_fcc_options');
@@ -551,6 +589,11 @@ my $error_callback = sub {
'cgiparam'
);
+ if ( $cgi->param('error') =~ / is suggested with / ) {
+ #yeah, detection is a shitty kludge, but we don't have exception objects
+ $opt->{form_init} = ' Override suggestion
';
+ }
+
};
my $new_hashref_callback = sub { { 'plan' => 'flat' }; };
@@ -644,8 +687,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');
@@ -885,6 +927,11 @@ my $javascript = <<'END';
}
}
+ function finish_edit_fcc(id) {
+ cClick();
+ show_fcc_options(id); // refresh the display
+ }
+
END
my $warning =
@@ -942,10 +989,37 @@ my $html_bottom = sub {
#$html .= '';
my $href = $plans{$layer}->{'fields'};
- my @fields = exists($plans{$layer}->{'fieldorder'})
- ? @{$plans{$layer}->{'fieldorder'}}
- : keys %{ $href };
-
+ my @fields;
+ if ( $plans{$layer}->{'fieldorder'} ) {
+ @fields = @{ $plans{$layer}->{'fieldorder'} };
+ } else {
+ warn "FS::part_pkg::$layer has no fieldorder.\n";
+ @fields = 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})) {
@@ -959,7 +1033,8 @@ my $html_bottom = sub {
next if !$display;
}
- $html .= '