summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorivan <ivan>2008-04-16 04:43:00 +0000
committerivan <ivan>2008-04-16 04:43:00 +0000
commit93ef7394a93db7b5543d60e93a074db52fa5ddfa (patch)
tree6af29d8eb8b759e0e3d767f4f7532b94a5ca7eee
parent753cda550c5e2fa3053224f92d8141975390610a (diff)
add plan & pricing to package browse...
-rwxr-xr-xhttemplate/browse/part_pkg.cgi56
-rwxr-xr-xhttemplate/edit/part_pkg.cgi3
2 files changed, 47 insertions, 12 deletions
diff --git a/httemplate/browse/part_pkg.cgi b/httemplate/browse/part_pkg.cgi
index 78cb77d..77f6261 100755
--- a/httemplate/browse/part_pkg.cgi
+++ b/httemplate/browse/part_pkg.cgi
@@ -6,7 +6,7 @@
'disabled_statuspos' => 3,
'agent_virt' => 1,
'agent_null_right' => 'Edit global package definitions',
- 'agent_pos' => 4,
+ 'agent_pos' => 5,
'query' => { 'select' => $select,
'table' => 'part_pkg',
'hashref' => {},
@@ -55,6 +55,7 @@ if ( $cgi->param('active') ) {
my $conf = new FS::Conf;
my $taxclasses = $conf->exists('enable_taxclasses');
+my $money_char = $conf->config('money_char') || '$';
my $html_init;
#unless ( $cgi->param('active') ) {
@@ -82,6 +83,49 @@ unless ( 0 ) { #already showing only one class or something?
$align .= 'l';
}
+tie my %plans, 'Tie::IxHash', %{ FS::part_pkg::plan_info() };
+
+tie my %plan_labels, 'Tie::IxHash',
+ map { $_ => ( $plans{$_}->{'shortname'} || $plans{$_}->{'name'} ) }
+ keys %plans;
+
+push @header, 'Pricing';
+$align .= 'r'; #?
+push @fields, sub {
+ my $part_pkg = shift;
+
+ [
+ [
+ { data=>$plan_labels{$part_pkg->plan},
+ align=>'center'
+ },
+ ],
+ [
+ { data=>$money_char.
+ sprintf('%.2f setup', $part_pkg->option('setup_fee') ),
+ align=>'right'
+ },
+ ],
+ [
+ { data=>( $part_pkg->freq ne '0'
+ ? $money_char.sprintf('%.2f ', $part_pkg->option('recur_fee') )
+ : ''
+ ).
+ $part_pkg->freq_pretty,
+ align=>'right'
+ },
+ ],
+ ];
+
+# $plan_labels{$part_pkg->plan}.'<BR>'.
+# $money_char.sprintf('%.2f setup<BR>', $part_pkg->option('setup_fee') ).
+# ( $part_pkg->freq ne '0'
+# ? $money_char.sprintf('%.2f ', $part_pkg->option('recur_fee') )
+# : ''
+# ).
+# $part_pkg->freq_pretty; #.'<BR>'
+};
+
#if ( $cgi->param('active') ) {
push @header, 'Customer<BR>packages';
my %col = (
@@ -131,23 +175,17 @@ unless ( 0 ) { #already showing only one class or something?
$align .= 'r';
#}
-push @header, 'Frequency';
-push @fields, sub { shift->freq_pretty; };
-$align .= 'l';
-
if ( $taxclasses ) {
push @header, 'Taxclass';
push @fields, sub { shift->taxclass() || '&nbsp;'; };
$align .= 'l';
}
-push @header, 'Plan',
- 'Data',
+push @header, 'Plan options',
'Services';
#'Service', 'Quan', 'Primary';
-push @fields, sub { shift->plan || '(legacy)' },
-
+push @fields,
sub {
my $part_pkg = shift;
if ( $part_pkg->plan ) {
diff --git a/httemplate/edit/part_pkg.cgi b/httemplate/edit/part_pkg.cgi
index bc165cf..2468f30 100755
--- a/httemplate/edit/part_pkg.cgi
+++ b/httemplate/edit/part_pkg.cgi
@@ -148,9 +148,6 @@ die "access denied"
#XXX
# - tr-part_pkg_freq: month_increments_only (from price plans)
-# - test editing
-# - write edit bits for new m2ms
-# - display add-ons in (existing) edit
# - display add-ons in browse... yeah
# -QIS- thank goodness
# - test cloning