X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=httemplate%2Fview%2Fcust_main.cgi;h=c49efa653f47fd7b6eb67b71dd111eecb98f23a7;hp=b17c9277ad788dc9d1448db3ec90207ba24abc24;hb=789c34c5251f4b831a7cb27bd2a9af700ccf2ced;hpb=c00273147a2d400779fcdaf34f171b2180faa453 diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi index b17c9277a..c49efa653 100755 --- a/httemplate/view/cust_main.cgi +++ b/httemplate/view/cust_main.cgi @@ -1,45 +1,26 @@ + <% -# - -use strict; -use vars qw ( $cgi $query $custnum $cust_main $hashref $agent $referral - @packages $package @history @bills $bill @credits $credit - $balance $item @agents @referrals @invoicing_list $n1 $conf - $signupurl ); -use CGI; -use CGI::Carp qw(fatalsToBrowser); -use Date::Format; -use FS::UID qw(cgisuidsetup); -use FS::Record qw(qsearchs qsearch); -use FS::CGI qw(header menubar popurl table itable ntable); -use FS::cust_credit; -use FS::cust_pay; -use FS::cust_bill; -use FS::part_pkg; -use FS::cust_pkg; -use FS::part_referral; -use FS::agent; -use FS::cust_main; -use FS::cust_refund; -use FS::cust_bill_pay; -use FS::cust_credit_bill; - -$cgi = new CGI; -&cgisuidsetup($cgi); - -$conf = new FS::Conf; + +my $conf = new FS::Conf; + +#false laziness with view/cust_pkg.cgi, but i'm trying to make that go away so +my %uiview = (); +my %uiadd = (); +foreach my $part_svc ( qsearch('part_svc',{}) ) { + $uiview{$part_svc->svcpart} = popurl(2). "view/". $part_svc->svcdb . ".cgi"; + $uiadd{$part_svc->svcpart}= popurl(2). "edit/". $part_svc->svcdb . ".cgi"; +} print header("Customer View", menubar( 'Main Menu' => popurl(2) )); die "No customer specified (bad URL)!" unless $cgi->keywords; -($query) = $cgi->keywords; # needs parens with my, ->keywords returns array +my($query) = $cgi->keywords; # needs parens with my, ->keywords returns array $query =~ /^(\d+)$/; -$custnum = $1; -$cust_main = qsearchs('cust_main',{'custnum'=>$custnum}); +my $custnum = $1; +my $cust_main = qsearchs('cust_main',{'custnum'=>$custnum}); die "Customer not found!" unless $cust_main; -$hashref = $cust_main->hashref; print qq!Edit this customer!; @@ -76,8 +57,12 @@ print ''; 'Contact name', '', $cust_main->last, ', ', $cust_main->first, - 'SS#', - $cust_main->ss || ' ', '', + ''; +print 'SS#', + $cust_main->ss || ' ', '' + if $conf->exists('show_ss'); + +print '', 'Company', $cust_main->company, '', @@ -98,9 +83,13 @@ print ''; $cust_main->country, '', ; - print 'Day Phone', + my $daytime_label = FS::Msgcat::_gettext('daytime') || 'Day Phone'; + my $night_label = FS::Msgcat::_gettext('night') || 'Night Phone'; + print ''. $daytime_label. + '', $cust_main->daytime || ' ', '', - 'Night Phone', + ''. $night_label. + '', $cust_main->night || ' ', '', 'Fax', $cust_main->fax || ' ', '', @@ -137,10 +126,10 @@ print ''; $cust_main->get("${pre}country"), '', ; - print 'Day Phone', + print ''. $daytime_label. '', '', $cust_main->get("${pre}daytime") || ' ', '', - 'Night Phone'. + ''. $night_label. ''. '', $cust_main->get("${pre}night") || ' ', '', 'Fax', @@ -159,7 +148,8 @@ print ''; $custnum, '', ; - @agents = qsearch( 'agent', {} ); + my @agents = qsearch( 'agent', {} ); + my $agent; unless ( scalar(@agents) == 1 ) { $agent = qsearchs('agent',{ 'agentnum' => $cust_main->agentnum } ); print 'Agent', @@ -167,12 +157,12 @@ print ''; } else { $agent = $agents[0]; } - @referrals = qsearch( 'part_referral', {} ); + my @referrals = qsearch( 'part_referral', {} ); unless ( scalar(@referrals) == 1 ) { my $referral = qsearchs('part_referral', { 'refnum' => $cust_main->refnum } ); - print 'Referral', + print 'Advertising source', $referral->refnum, ": ", $referral->referral, ''; } print 'Order taker', @@ -202,7 +192,9 @@ print ''; print '
'; - @invoicing_list = $cust_main->invoicing_list; +if ( $conf->config('payby-default') ne 'HIDE' ) { + + my @invoicing_list = $cust_main->invoicing_list; print "Billing information (", qq!!, "Bill now)", &ntable("#cccccc"), "", &ntable("#cccccc",2), @@ -219,14 +211,33 @@ print '
'; ; if ( $cust_main->payby eq 'CARD' ) { + my $payinfo = $cust_main->payinfo; + $payinfo = 'x'x(length($payinfo)-4). substr($payinfo,(length($payinfo)-4)); print 'Credit card', 'Card number', - $cust_main->payinfo, '', + $payinfo, '', 'Expiration', $cust_main->paydate, '', 'Name on card', $cust_main->payname, '' ; + } elsif ( $cust_main->payby eq 'CHEK' ) { + my( $account, $aba ) = split('@', $cust_main->payinfo ); + print 'Electronic check', + 'Account number', + $account, '', + 'ABA/Routing code', + $aba, '', + 'Bank name', + $cust_main->payname, '' + ; + } elsif ( $cust_main->payby eq 'LECB' ) { + $cust_main->payinfo =~ /^(\d{3})(\d{3})(\d{4})$/; + my $payinfo = "$1-$2-$3"; + print 'Phone bill billing', + 'Phone number', + $payinfo, '', + ; } elsif ( $cust_main->payby eq 'BILL' ) { print 'Billing'; print 'P.O. ', @@ -248,14 +259,17 @@ print '
'; print ""; +} + print ''; if ( defined $cust_main->dbdef_table->column('comments') && $cust_main->comments ) { - print "
Comments", &ntable("#cccccc"), "", - &ntable("#cccccc",2), - '
', $cust_main->comments,
+  print "
Comments". &ntable("#cccccc"). "". + &ntable("#cccccc",2). + '
'.
+        encode_entities($cust_main->comments).
         '
'; } @@ -268,13 +282,58 @@ print '
'. foreach my $type_pkgs ( qsearch('type_pkgs',{'typenum'=> $agent->typenum }) ) { my $pkgpart = $type_pkgs->pkgpart; - my $part_pkg = qsearchs('part_pkg', { 'pkgpart' => $pkgpart } ) - or do { warn "unknown type_pkgs.pkgpart $pkgpart"; next; }; +# my $part_pkg = qsearchs('part_pkg', { 'pkgpart' => $pkgpart } ) +# or do { warn "unknown type_pkgs.pkgpart $pkgpart"; next; }; + my $part_pkg = + qsearchs('part_pkg', { 'pkgpart' => $pkgpart, 'disabled' => '' } ) + or next; print qq!