X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fview%2Fcust_main.cgi;h=8123b2f8270816d2a1556783db4b450bcb703c2d;hb=f3212b82d6d54500bbe31c02c8ffa456f018a067;hp=f1afdb5701a1062924627da32a1135a1283b7f81;hpb=69ecd0e15d3de36b56ad133d5ae57dcddc53c63e;p=freeside.git
diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi
index f1afdb570..8123b2f82 100755
--- a/httemplate/view/cust_main.cgi
+++ b/httemplate/view/cust_main.cgi
@@ -76,7 +76,7 @@ print '
';
print "Billing address", &ntable("#cccccc"), " | ",
&ntable("#cccccc",2),
- ' |
Contact name | ',
+ '
Contact name | ',
'',
$cust_main->last, ', ', $cust_main->first,
' | ';
@@ -105,8 +105,8 @@ print '
',
$cust_main->country,
'',
;
- my $daytime_label = FS::Msgcat::_gettext('daytime') || 'Day Phone';
- my $night_label = FS::Msgcat::_gettext('night') || 'Night 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 || ' ', ' |
',
@@ -166,7 +166,7 @@ print '';
print '';
print &ntable("#cccccc"), " | ", &ntable("#cccccc",2),
- ' |
Customer number | ',
+ ' |
Customer number | ',
$custnum, ' |
',
;
@@ -184,13 +184,13 @@ print '';
my $referral = qsearchs('part_referral', {
'refnum' => $cust_main->refnum
} );
- print ' | Advertising source | ',
+ print ' |
Advertising source | ',
$referral->refnum, ": ", $referral->referral, ' |
';
}
print 'Order taker | ',
$cust_main->otaker, ' |
';
- print 'Referring Customer | ';
+ print ' |
Referring Customer | ';
my $referring_cust_main = '';
if ( $cust_main->referral_custnum
&& ( $referring_cust_main =
@@ -220,22 +220,22 @@ if ( $conf->config('payby-default') ne 'HIDE' ) {
print "Billing information (",
qq!!, "Bill now)",
&ntable("#cccccc"), " |
", &ntable("#cccccc",2),
- ' |
Tax exempt | ',
+ ' |
Tax exempt | ',
$cust_main->tax ? 'yes' : 'no',
' |
',
- 'Postal invoices | ',
+ ' |
Postal invoices | ',
( grep { $_ eq 'POST' } @invoicing_list ) ? 'yes' : 'no',
' |
',
- 'Email invoices | ',
+ ' |
Email invoices | ',
join(', ', grep { $_ ne 'POST' } @invoicing_list ) || 'no',
' |
',
- 'Billing type | ',
+ ' |
Billing type | ',
;
if ( $cust_main->payby eq 'CARD' || $cust_main->payby eq 'DCRD' ) {
my $payinfo = $cust_main->payinfo;
$payinfo = 'x'x(length($payinfo)-4). substr($payinfo,(length($payinfo)-4));
- print 'Credit card ',
+ print 'Credit card ',
( $cust_main->payby eq 'CARD' ? '(automatic)' : '(on-demand)' ),
' |
',
'Card number | ',
@@ -247,7 +247,7 @@ if ( $conf->config('payby-default') ne 'HIDE' ) {
;
} elsif ( $cust_main->payby eq 'CHEK' || $cust_main->payby eq 'DCHK') {
my( $account, $aba ) = split('@', $cust_main->payinfo );
- print 'Electronic check',
+ print 'Electronic check ',
( $cust_main->payby eq 'CHEK' ? '(automatic)' : '(on-demand)' ),
' |
',
'Account number | ',
@@ -260,7 +260,7 @@ if ( $conf->config('payby-default') ne 'HIDE' ) {
} elsif ( $cust_main->payby eq 'LECB' ) {
$cust_main->payinfo =~ /^(\d{3})(\d{3})(\d{4})$/;
my $payinfo = "$1-$2-$3";
- print 'Phone bill billing |
',
+ print 'Phone bill billing',
'Phone number | ',
$payinfo, ' |
',
;
@@ -276,7 +276,7 @@ if ( $conf->config('payby-default') ne 'HIDE' ) {
;
} elsif ( $cust_main->payby eq 'COMP' ) {
print 'Complimentary',
- 'Authorized by | ',
+ ' |
Authorized by | ',
$cust_main->payinfo, ' |
',
'Expiration | ',
$cust_main->paydate, ' |
',
@@ -412,14 +412,17 @@ foreach my $pkg (sort pkgsort_pkgnum_cancel @$packages) {
sub freq {
+ #false laziness w/edit/part_pkg.cgi
my %freq = ( #move this
- 1 => 'monthly',
- 2 => 'bi-monthly',
- 3 => 'quarterly',
- 6 => 'semi-annually',
- 12 => 'annually',
- 24 => 'bi-annually',
- 36 => 'tri-annually',
+ '1d' => 'daily',
+ '1w' => 'weekly',
+ '2w' => 'biweekly (every 2 weeks)',
+ '1' => 'monthly',
+ '2' => 'bimonthly (every 2 months)',
+ '3' => 'quarterly (every 3 months)',
+ '6' => 'semiannually (every 6 months)',
+ '12' => 'annually',
+ '24' => 'biannually (every 2 years)',
);
my $freq = shift;
@@ -551,6 +554,11 @@ function cust_pay_unapply_areyousure(href) {
== true)
window.location.href = href;
}
+function cust_credit_areyousure(href) {
+ if (confirm("Are you sure you want to delete this credit?")
+ == true)
+ window.location.href = href;
+}
END
@@ -625,9 +633,13 @@ if ( $conf->config('payby-default') ne 'HIDE' ) {
$cust_credit->reason,
time2str("%D", $cust_credit_bill->_date),
);
+ my $delete =
+ $cust_credit->closed !~ /^Y/i && $conf->exists('deletecredits')
+ ? qq! (delete)!
+ : '';
push @history,
"$date\tCredit #$crednum: $reason
".
- "(applied to invoice #$invnum on $app_date)\t\t\t$amount\t";
+ "(applied to invoice #$invnum on $app_date)$delete\t\t\t$amount\t";
}
}
@@ -793,8 +805,8 @@ sub get_packages {
$pkg{expire} = $cust_pkg->getfield('expire');
$pkg{cancel} = $cust_pkg->getfield('cancel');
- $pkg{svcparts} = [];
-
+ my %svcparts = ();
+
foreach my $pkg_svc (
qsearch('pkg_svc', { 'pkgpart' => $part_pkg->pkgpart })
) {
@@ -811,29 +823,44 @@ sub get_packages {
$svcpart->{count} = 0;
$svcpart->{services} = [];
-
- foreach my $cust_svc (
- qsearch( 'cust_svc', {
- 'pkgnum' => $cust_pkg->pkgnum,
- 'svcpart' => $part_svc->svcpart,
- }
- )
- ) {
-
- my $svc = {};
- $svc->{svcnum} = $cust_svc->svcnum;
- $svc->{label} = ($cust_svc->label)[1];
-
- push @{$svcpart->{services}}, $svc;
-
- $svcpart->{count}++;
-
- }
-
- push @{$pkg{svcparts}}, $svcpart;
-
+
+ $svcparts{$svcpart->{svcpart}} = $svcpart;
+
}
-
+
+ foreach my $cust_svc (
+ qsearch( 'cust_svc', {
+ 'pkgnum' => $cust_pkg->pkgnum,
+ #'svcpart' => $part_svc->svcpart,
+ }
+ )
+ ) {
+
+ warn "svcnum ". $cust_svc->svcnum. " / svcpart ". $cust_svc->svcpart. "\n";
+ my $svc = {
+ 'svcnum' => $cust_svc->svcnum,
+ 'label' => ($cust_svc->label)[1],
+ };
+
+ #false laziness with above, to catch extraneous services. whole
+ #damn thing should be OO...
+ my $svcpart = ( $svcparts{$cust_svc->svcpart} ||= {
+ 'svcpart' => $cust_svc->svcpart,
+ 'svc' => $cust_svc->part_svc->svc,
+ 'svcdb' => $cust_svc->part_svc->svcdb,
+ 'quantity' => 0,
+ 'count' => 0,
+ 'services' => [],
+ } );
+
+ push @{$svcpart->{services}}, $svc;
+
+ $svcpart->{count}++;
+
+ }
+
+ $pkg{svcparts} = [ values %svcparts ];
+
push @packages, \%pkg;
}