[freeside-commits] freeside/httemplate/browse part_pkg.cgi, 1.43, 1.44

Ivan,,, ivan at wavetail.420.am
Tue Apr 15 21:43:02 PDT 2008


Update of /home/cvs/cvsroot/freeside/httemplate/browse
In directory wavetail.420.am:/tmp/cvs-serv23948/browse

Modified Files:
	part_pkg.cgi 
Log Message:
add plan & pricing to package browse...

Index: part_pkg.cgi
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/browse/part_pkg.cgi,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -d -r1.43 -r1.44
--- part_pkg.cgi	13 Jan 2008 20:38:30 -0000	1.43
+++ part_pkg.cgi	16 Apr 2008 04:43:00 -0000	1.44
@@ -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 @@
 
 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 @@
   $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 @@
   $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 ) {



More information about the freeside-commits mailing list