finish up initial work on customer view tabs (ensure links back to customer view...
[freeside.git] / httemplate / search / cust_pkg.cgi
index bd4a946..2a70280 100755 (executable)
@@ -10,6 +10,8 @@
                                      'Package',
                                      'Class',
                                      'Status',
+                                     'Setup',
+                                     'Base Recur',
                                      'Freq.',
                                      'Setup',
                                      'Last bill',
                         },
                     'classname',
                     sub { ucfirst(shift->status); },
+                    sub { sprintf( $money_char.'%.2f',
+                                   shift->part_pkg->option('setup_fee'),
+                                 );
+                        },
+                    sub { sprintf( $money_char.'%.2f',
+                                   shift->part_pkg->base_recur
+                                 );
+                        },
                     sub { #shift->part_pkg->freq_pretty;
 
                           #my $part_pkg = $part_pkg{shift->pkgpart};
                     '',
                     '',
                     '',
+                    '',
+                    '',
                     FS::UI::Web::cust_colors(),
                     '',
                   ],
-                  'style' => [ '', '', '', '', 'b', '', '', '', '', '', '', '', '', '',
+                  'style' => [ '', '', '', '', 'b', '', '', '', '', '', '', '', '', '', '', '',
                                FS::UI::Web::cust_styles() ],
                   'size'  => [ '', '', '', '', '-1' ],
-                  'align' => 'rrlcclrrrrrrrl'. FS::UI::Web::cust_aligns(). 'r',
+                  'align' => 'rrlccrrlrrrrrrrl'. FS::UI::Web::cust_aligns(). 'r',
                   'links' => [
                     $link,
                     $link,
                     '',
                     '',
                     '',
+                    '',
+                    '',
                     ( map { $_ ne 'Cust. Status' ? $clink : '' }
                           FS::UI::Web::cust_header(
                                                     $cgi->param('cust_fields')
 %>
 <%init>
 
+my $curuser = $FS::CurrentUser::CurrentUser;
+
 die "access denied"
-  unless $FS::CurrentUser::CurrentUser->access_right('List packages');
+  unless $curuser->access_right('List packages');
+
+my $conf = new FS::Conf;
+my $money_char = $conf->config('money_char') || '$';
 
 # my %part_pkg = map { $_->pkgpart => $_ } qsearch('part_pkg', {});
 
@@ -175,8 +194,17 @@ foreach my $field (qw( setup last_bill bill adjourn susp expire cancel )) {
 my $sql_query = FS::cust_pkg->search_sql(\%search_hash);
 my $count_query = delete($sql_query->{'count_query'});
 
+my $show = $curuser->default_customer_view =~ /^(jumbo|packages)$/
+             ? ''
+             : ';show=packages';
+
 my $link = sub {
-  [ "${p}view/cust_main.cgi?".shift->custnum.'#cust_pkg', 'pkgnum' ];
+  my $self = shift;
+  my $frag = 'cust_pkg'. $self->pkgnum; #hack for IE ignoring real #fragment
+  [ "${p}view/cust_main.cgi?custnum=".$self->custnum.
+                           "$show;fragment=$frag#cust_pkg",
+    'pkgnum'
+  ];
 };
 
 my $clink = sub {