},
{
+ 'key' => 'cust_main-custom_content',
+ 'section' => 'UI',
+ 'description' => 'As an alternative to cust_main-custom_link (leave it blank), the contant to display on this customer page, one item per line. Available iems are: small_custview, birthdate, spouse_birthdate, svc_acct, svc_phone and svc_external.',
+ 'type' => 'textarea',
+ },
+
+ {
'key' => 'cust_main-custom_title',
'section' => 'UI',
'description' => 'Title for the "Custom" tab in the View Customer page.',
}
if ( $opt{'svcdb'} ) {
$search{addl_from} = ' LEFT JOIN part_svc USING ( svcpart ) ';
- $search{hashref}->{svcdb} = $opt{'svcdb'};
+ $search{extra_sql} = ' AND svcdb = '. dbh->quote( $opt{'svcdb'} );
}
cluck "cust_pkg->cust_svc called" if $DEBUG > 2;
% }
% if ( $view eq 'custom' ) {
+% if ( $conf->config('cust_main-custom_link') ) {
<& cust_main/custom.html, $cust_main &>
+% } elsif ( $conf->config('cust_main-custom_content') ) {
+ <& cust_main/custom_content.html, $cust_main &>
+% #} else {
+% # warn "custom view without cust_main-custom_link or -custom_content?";
+% }
% }
</DIV>
$views{emt('Change History')} = 'change_history'
if $curuser->access_right('View customer history');
$views{$conf->config('cust_main-custom_title') || emt('Custom')} = 'custom'
- if $conf->config('cust_main-custom_link');
+ if $conf->config('cust_main-custom_link')
+ || $conf->config('cust_main-custom_content');
$views{emt('Jumbo')} = 'jumbo';
my %viewname = reverse %views;
--- /dev/null
+<TABLE CLASS="fsinnerbox">
+ <& /elements/tr-td-label.html, 'label' => mt('Date of Birth') &>
+ <TD BGCOLOR="#ffffff"><% $dt ? $dt->strftime($date_format) : '' %></TD>
+</TR>
+</TABLE>
+<%init>
+my($cust_main) = @_;
+my $conf = new FS::Conf;
+my $date_format = ($conf->config('date_format') || "%m/%d/%Y");
+my $dt = $cust_main->birthdate ne ''
+ ? DateTime->from_epoch( 'epoch' => $cust_main->birthdate,
+ 'time_zone' =>'floating',
+ )
+ : '';
+</%init>
--- /dev/null
+<& /elements/small_custview.html, $cust_main &>
+<%init>
+
+my($cust_main) = @_;
+
+my $conf = new FS::Conf;
+
+</%init>
--- /dev/null
+<TABLE CLASS="fsinnerbox">
+ <& /elements/tr-td-label.html, 'label' => mt('Spouse Date of Birth') &>
+ <TD BGCOLOR="#ffffff"><% $dt ? $dt->strftime($date_format) : '' %></TD>
+</TR>
+</TABLE>
+<%init>
+my($cust_main) = @_;
+my $conf = new FS::Conf;
+my $date_format = ($conf->config('date_format') || "%m/%d/%Y");
+my $dt = $cust_main->spouse_birthdate ne ''
+ ? DateTime->from_epoch( 'epoch' => $cust_main->spouse_birthdate,
+ 'time_zone' =>'floating',
+ )
+ : '';
+</%init>
--- /dev/null
+% foreach my $cust_svc (@cust_svc) {
+% my $svc_x = $cust_svc->svc_x;
+% #warn $svc_x;
+<TABLE CLASS="fsinnerbox">
+% foreach my $field ( grep $svc_x->$_(), @{ $opt{fields} } ) {
+ <& /elements/tr-td-label.html, 'label' => $labels{$field} &>
+ <TD BGCOLOR="#ffffff"><% $svc_x->$field() |h %></TD>
+ </TR>
+% }
+</TABLE>
+% }
+<%init>
+my($cust_main, %opt) = @_;
+
+my $table = $opt{table};
+warn $table;
+my @cust_svc = ();
+foreach my $cust_pkg (
+ grep {warn $_->num_cust_svc( 'svcdb'=>$table ); $_->num_cust_svc( 'svcdb'=>$table ); }
+ $cust_main->all_pkgs
+) {
+ my @wtf = $cust_pkg->cust_svc( 'svcdb'=>$table );
+ warn scalar(@wtf);
+ push @cust_svc, $cust_pkg->cust_svc( 'svcdb'=>$table );
+}
+
+my %labels;
+if ( UNIVERSAL::can("FS::$table", 'table_info') ) {
+# $opt{'name'} = "FS::$table"->table_info->{'name'};
+
+ my $fields = "FS::$table"->table_info->{'fields'};
+ %labels = map { $_ => ( ref($fields->{$_})
+ ? $fields->{$_}{'label'}
+ : $fields->{$_}
+ );
+ }
+ keys %$fields;
+}
+
+</%init>
--- /dev/null
+<& svc_Common.html, $cust_main,
+ 'table' => 'svc_acct',
+ 'fields' => [qw( username _password )],
+&>
+<%init>
+my($cust_main) = @_;
+</%init>
--- /dev/null
+<& svc_Common.html, $cust_main,
+ 'table' => 'svc_hardware',
+ 'fields' => [qw( ip_addr hw_addr serial )],
+&>
+<%init>
+my($cust_main) = @_;
+</%init>
--- /dev/null
+<& svc_Common.html, $cust_main,
+ 'table' => 'svc_phone',
+ 'fields' => [qw( phonenum )],
+&>
+<%init>
+my($cust_main) = @_;
+</%init>