summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Kohler <ivan@freeside.biz>2015-06-13 15:48:48 -0700
committerIvan Kohler <ivan@freeside.biz>2015-06-13 15:48:48 -0700
commit269b47e6843f31a1b35f82635ed9be1d31e5275f (patch)
tree513af273c5e5b02b2b601fd0b46c51edb91c0ce0
parent2b6b494ee014b68d94b56ac01e71ead0dc16f9b4 (diff)
parenteb6536b41456955fc425dba2e156a996e8fe2837 (diff)
Merge branch 'FREESIDE_3_BRANCH' of git.freeside.biz:/home/git/freeside into FREESIDE_3_BRANCH
-rw-r--r--FS/FS/ClientAPI/MyAccount.pm46
-rw-r--r--FS/FS/part_pkg_link.pm3
-rw-r--r--debian/control2
-rw-r--r--fs_selfservice/FS-SelfService/cgi/invoices.html26
-rw-r--r--fs_selfservice/FS-SelfService/cgi/myaccount.html28
5 files changed, 65 insertions, 40 deletions
diff --git a/FS/FS/ClientAPI/MyAccount.pm b/FS/FS/ClientAPI/MyAccount.pm
index fee59bd55..11523013c 100644
--- a/FS/FS/ClientAPI/MyAccount.pm
+++ b/FS/FS/ClientAPI/MyAccount.pm
@@ -444,11 +444,13 @@ sub customer_info {
if ( $session->{'pkgnum'} ) {
#XXX open invoices in the pkg-balances case
} else {
+ $return{'money_char'} = $conf->config("money_char") || '$';
my @open = map {
{
- invnum => $_->invnum,
- date => time2str("%b %o, %Y", $_->_date),
- owed => $_->owed,
+ invnum => $_->invnum,
+ date => time2str("%b %o, %Y", $_->_date),
+ owed => $_->owed,
+ charged => $_->charged,
};
} $cust_main->open_cust_bill;
$return{open_invoices} = \@open;
@@ -1555,25 +1557,31 @@ sub list_invoices {
my @cust_bill = grep ! $_->hide, $cust_main->cust_bill;
my $balance = 0;
+ my $invoices = [
+ map {
+ #not super efficient, we also run cust_bill_pay/cust_credited inside owed
+ my @payments_and_credits = sort {$b->_date <=> $a->_date} ($_->cust_bill_pay,$_->cust_credited);
+ my $owed = $_->owed;
+ $balance += $owed;
+ +{ 'invnum' => $_->invnum,
+ '_date' => $_->_date,
+ 'date' => time2str("%b %o, %Y", $_->_date),
+ 'date_short' => time2str("%m-%d-%Y", $_->_date),
+ 'previous' => sprintf('%.2f', ($_->previous)[0]),
+ 'charged' => sprintf('%.2f', $_->charged),
+ 'owed' => sprintf('%.2f', $owed),
+ 'balance' => sprintf('%.2f', $balance),
+ 'lastpay' => @payments_and_credits
+ ? time2str("%b %o, %Y", $payments_and_credits[0]->_date)
+ : '',
+ }
+ } @cust_bill
+ ];
return { 'error' => '',
'balance' => $cust_main->balance,
- 'invoices' => [
- map {
- my $owed = $_->owed;
- $balance += $owed;
- +{ 'invnum' => $_->invnum,
- '_date' => $_->_date,
- 'date' => time2str("%b %o, %Y", $_->_date),
- 'date_short' => time2str("%m-%d-%Y", $_->_date),
- 'previous' => sprintf('%.2f', ($_->previous)[0]),
- 'charged' => sprintf('%.2f', $_->charged),
- 'owed' => sprintf('%.2f', $owed),
- 'balance' => sprintf('%.2f', $balance),
- }
- }
- @cust_bill
- ],
+ 'money_char' => $conf->config("money_char") || '$',
+ 'invoices' => $invoices,
'legacy_invoices' => [
map {
+{ 'legacyinvnum' => $_->legacyinvnum,
diff --git a/FS/FS/part_pkg_link.pm b/FS/FS/part_pkg_link.pm
index 8e43d155e..ce071ef17 100644
--- a/FS/FS/part_pkg_link.pm
+++ b/FS/FS/part_pkg_link.pm
@@ -130,6 +130,7 @@ sub insert {
return $error if $error;
}
+ $dbh->commit if $oldAutoCommit;
return;
}
@@ -166,7 +167,7 @@ sub delete {
$dbh->rollback if $oldAutoCommit;
return $error;
}
- $dbh->commit;
+ $dbh->commit if $oldAutoCommit;
return;
}
diff --git a/debian/control b/debian/control
index 7a6bb08fd..986178a16 100644
--- a/debian/control
+++ b/debian/control
@@ -21,7 +21,7 @@ Description: Billing and trouble ticketing for service providers
Package: freeside-lib
Architecture: all
-Depends: gnupg,ghostscript,gsfonts,gzip,latex-xcolor,libbusiness-creditcard-perl,libcache-cache-perl,libcache-simple-timedexpiry-perl,libchart-perl,libclass-container-perl,libclass-data-inheritable-perl,libclass-returnvalue-perl,libcolor-scheme-perl,libcompress-zlib-perl,libconvert-binhex-perl,libcrypt-passwdmd5-perl,libcrypt-ssleay-perl,libcss-squish-perl,libdate-manip-perl,libdbd-mysql-perl,libdbd-pg-perl,libdbi-perl,libdbix-dbschema-perl,libdbix-searchbuilder-perl,libdevel-stacktrace-perl,libdevel-symdump-perl,liberror-perl,libexcel-writer-xlsx-perl,libexception-class-perl,libfile-counterfile-perl,libfile-rsync-perl,libfont-afm-perl,libfreezethaw-perl,libfrontier-rpc-perl,libgd-gd2-perl,libgd-graph-perl,libhtml-format-perl,libhtml-mason-perl,libhtml-parser-perl,libhtml-scrubber-perl,libhtml-tagset-perl,libhtml-tree-perl,libhtml-widgets-selectlayers-perl,libio-stringy-perl,libipc-run-perl,libipc-run3-perl,libipc-sharelite-perl,libjavascript-rpc-perl,libjson-perl,liblingua-en-inflect-perl,liblingua-en-nameparse-perl,liblocale-gettext-perl,liblocale-maketext-fuzzy-perl,liblocale-maketext-lexicon-perl,liblocale-subcountry-perl,liblog-dispatch-perl,libmailtools-perl,libmime-tools-perl,libmodule-versions-report-perl,libnet-daemon-perl,libnet-ping-external-perl,libnet-scp-perl,libnet-ssh-perl,libnet-whois-raw-perl,libnetaddr-ip-perl,libnumber-format-perl,libpam-modules,libpam-runtime,libpaper-utils,libparams-validate-perl,libparse-recdescent-perl,libpg-perl,libregexp-common-perl,libspreadsheet-writeexcel-perl,libstring-approx-perl,libstring-shellquote-perl,libterm-readkey-perl,libtest-inline-perl,libtext-autoformat-perl,libtext-charwidth-perl,libtext-csv-perl,libtext-iconv-perl,libtext-quoted-perl,libtext-reform-perl,libtext-template-perl,libtext-wrapi18n-perl,libtext-wrapper-perl,libtie-ixhash-perl,libtime-duration-perl,libtime-modules-perl,libtimedate-perl,libtree-simple-perl,libuniversal-require-perl,liburi-perl,libwant-perl,libwww-perl,libxml-parser-perl,libyaml-perl,lmodern,locales,lpr,mime-support,ntp,ntpdate,perl,perl-base,perl-modules,postgresql,postgresql-client,psutils,rsync,openssh-client,texlive,texlive-latex-extra,texinfo,ttf-bitstream-vera,ttf-dustin,libdatetime-perl,libdatetime-format-strptime-perl,libfile-slurp-perl,libspreadsheet-parseexcel-perl,libauthen-passphrase-perl,libnet-domain-tld-perl,libbusiness-us-usps-webtools-perl,libxml-simple-perl,libemail-sender-perl,libemail-sender-transport-smtp-tls-perl,libemail-sender-perl,libemail-sender-transport-smtp-tls-perl,libhtml-defang-perl,libdatetime-format-natural-perl,libcgi-pm-perl,libfile-sharedir-perl,libmodule-versions-report-perl,libtext-wikiformat-perl,libnet-server-perl,libhttp-server-simple-perl,libhtml-rewriteattributes-perl,libmime-types-perl,libperlio-eol-perl,libgnupg-interface-perl,libdata-ical-perl,libcalendar-simple-perl,libdatetime-set-perl,libhook-lexwrap-perl,libhttp-server-simple-mason-perl,libxml-rss-perl,libipc-run-safehandles-perl,libpoe-perl,libsoap-lite-perl,libhtml-tableextract-perl,libhtml-element-extended-perl,libcam-pdf-perl,libnet-openssh-perl,libgd-barcode-perl,sam2p,libsys-sigaction-perl,libgeo-googleearth-pluggable-perl,libgeo-coder-googlev3-perl,libnet-snmp-perl,libcrypt-openssl-rsa-perl,libregexp-common-perl,libnet-cidr-perl,libregexp-ipv6-perl,libhtml-quoted-perl,libtext-password-pronounceable-perl,libconvert-color-perl,liburi-perl,libhtml-rewriteattributes-perl,libregexp-common-net-cidr-perl,liblog-dispatch-perl,libdbix-searchbuilder-perl,libencode-perl,libhtml-mason-psgihandler-perl,libdate-simple-perl,libsnmp-perl,libemail-valid-perl,libio-string-perl,libnet-smtp-ssl-perl,libgeo-coder-googlev3-perl,libcam-pdf-perl,libnet-openssh-perl,libhtml-quoted-perl,libregexp-ipv6-perl,libregexp-common-net-cidr-perl,libencode-perl,libexcel-writer-xlsx-perl,libgeo-googleearth-pluggable-perl,libhtml-mason-psgihandler-perl,libdate-simple-perl,libsnmp-perl,libemail-valid-perl,libparse-fixedlength-perl,libregexp-common-net-cidr-perl,libio-string-perl,libnet-mac-vendor-perl,libnet-https-any-perl
+Depends: gnupg,ghostscript,gsfonts,gzip,latex-xcolor,libbusiness-creditcard-perl,libcache-cache-perl,libcache-simple-timedexpiry-perl,libchart-perl,libclass-container-perl,libclass-data-inheritable-perl,libclass-returnvalue-perl,libcolor-scheme-perl,libcompress-zlib-perl,libconvert-binhex-perl,libcrypt-passwdmd5-perl,libcrypt-ssleay-perl,libcss-squish-perl,libdate-manip-perl,libdbd-mysql-perl,libdbd-pg-perl,libdbi-perl,libdbix-dbschema-perl,libdbix-searchbuilder-perl,libdevel-stacktrace-perl,libdevel-symdump-perl,liberror-perl,libexcel-writer-xlsx-perl,libexception-class-perl,libfile-counterfile-perl,libfile-rsync-perl,libfont-afm-perl,libfreezethaw-perl,libfrontier-rpc-perl,libgd-gd2-perl,libgd-graph-perl,libhtml-format-perl,libhtml-mason-perl,libhtml-parser-perl,libhtml-scrubber-perl,libhtml-tagset-perl,libhtml-tree-perl,libhtml-widgets-selectlayers-perl,libio-stringy-perl,libipc-run-perl,libipc-run3-perl,libipc-sharelite-perl,libjavascript-rpc-perl,libjson-perl,liblingua-en-inflect-perl,liblingua-en-nameparse-perl,liblocale-gettext-perl,liblocale-maketext-fuzzy-perl,liblocale-maketext-lexicon-perl,liblocale-subcountry-perl,liblog-dispatch-perl,libmailtools-perl,libmime-tools-perl,libmodule-versions-report-perl,libnet-daemon-perl,libnet-ping-external-perl,libnet-scp-perl,libnet-ssh-perl,libnet-whois-raw-perl,libnetaddr-ip-perl,libnumber-format-perl,libpam-modules,libpam-runtime,libpaper-utils,libparams-validate-perl,libparse-recdescent-perl,libpg-perl,libregexp-common-perl,libspreadsheet-writeexcel-perl,libstring-approx-perl,libstring-shellquote-perl,libterm-readkey-perl,libtest-inline-perl,libtext-autoformat-perl,libtext-charwidth-perl,libtext-csv-perl,libtext-iconv-perl,libtext-quoted-perl,libtext-reform-perl,libtext-template-perl,libtext-wrapi18n-perl,libtext-wrapper-perl,libtie-ixhash-perl,libtime-duration-perl,libtime-modules-perl,libtimedate-perl,libtree-simple-perl,libuniversal-require-perl,liburi-perl,libwant-perl,libwww-perl,libxml-parser-perl,libyaml-perl,lmodern,locales,lpr,mime-support,ntp,ntpdate,perl,perl-base,perl-modules,postgresql,postgresql-client,psutils,rsync,openssh-client,texlive,texlive-latex-extra,texinfo,ttf-bitstream-vera,fonts-dustin,libdatetime-perl,libdatetime-format-strptime-perl,libfile-slurp-perl,libspreadsheet-parseexcel-perl,libauthen-passphrase-perl,libnet-domain-tld-perl,libbusiness-us-usps-webtools-perl,libxml-simple-perl,libemail-sender-perl,libemail-sender-transport-smtp-tls-perl,libemail-sender-perl,libemail-sender-transport-smtp-tls-perl,libhtml-defang-perl,libdatetime-format-natural-perl,libcgi-pm-perl,libfile-sharedir-perl,libmodule-versions-report-perl,libtext-wikiformat-perl,libnet-server-perl,libhttp-server-simple-perl,libhtml-rewriteattributes-perl,libmime-types-perl,libperlio-eol-perl,libgnupg-interface-perl,libdata-ical-perl,libcalendar-simple-perl,libdatetime-set-perl,libhook-lexwrap-perl,libhttp-server-simple-mason-perl,libxml-rss-perl,libipc-run-safehandles-perl,libpoe-perl,libsoap-lite-perl,libhtml-tableextract-perl,libhtml-element-extended-perl,libcam-pdf-perl,libnet-openssh-perl,libgd-barcode-perl,sam2p,libsys-sigaction-perl,libgeo-googleearth-pluggable-perl,libgeo-coder-googlev3-perl,libnet-snmp-perl,libcrypt-openssl-rsa-perl,libregexp-common-perl,libnet-cidr-perl,libregexp-ipv6-perl,libhtml-quoted-perl,libtext-password-pronounceable-perl,libconvert-color-perl,liburi-perl,libhtml-rewriteattributes-perl,libregexp-common-net-cidr-perl,liblog-dispatch-perl,libdbix-searchbuilder-perl,libencode-perl,libhtml-mason-psgihandler-perl,libdate-simple-perl,libsnmp-perl,libemail-valid-perl,libio-string-perl,libnet-smtp-ssl-perl,libgeo-coder-googlev3-perl,libcam-pdf-perl,libnet-openssh-perl,libhtml-quoted-perl,libregexp-ipv6-perl,libregexp-common-net-cidr-perl,libencode-perl,libexcel-writer-xlsx-perl,libgeo-googleearth-pluggable-perl,libhtml-mason-psgihandler-perl,libdate-simple-perl,libsnmp-perl,libemail-valid-perl,libparse-fixedlength-perl,libregexp-common-net-cidr-perl,libio-string-perl,libnet-mac-vendor-perl,libnet-https-any-perl
Suggests: libbusiness-onlinepayment-perl
Description: Libraries for Freeside billing and trouble ticketing
Freeside is a web-based billing and trouble ticketing application.
diff --git a/fs_selfservice/FS-SelfService/cgi/invoices.html b/fs_selfservice/FS-SelfService/cgi/invoices.html
index 752805123..ffc44ec85 100644
--- a/fs_selfservice/FS-SelfService/cgi/invoices.html
+++ b/fs_selfservice/FS-SelfService/cgi/invoices.html
@@ -3,24 +3,34 @@
<%=
if ( @invoices ) {
- $OUT .= '<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=2 BGCOLOR="#eeeeee">'.
- '<TR><TH BGCOLOR="#ff6666" COLSPAN=4>All Invoices</TH></TR>';
- my $col1 = "ffffff";
- my $col2 = "dddddd";
+ my $th = q!<TH STYLE="background: #ff9999; text-align: left; padding: .1em .5em;">!;
+ my $thr = q!<TH STYLE="background: #ff9999; text-align: right; padding: .1em .5em;">!;
+ $OUT .= '<TABLE STYLE="border: 0;" CELLSPACING="0">'.
+ '<TR>'.$th.'Invoice #</TH>'.$th.'Date</TH>'.$thr.'Charges</TH>'
+ .$th.'Date Paid</TH>'.$thr.'Owed</TH></TR>';
+ my $col1 = "#ffffff";
+ my $col2 = "#dddddd";
my $col = $col1;
foreach my $invoice ( @invoices ) {
- my $td = qq!<TD BGCOLOR="#$col">!;
+ my $td = qq!<TD STYLE="background: $col; padding: .1em .5em;">!;
+ my $tdr = qq!<TD STYLE="background: $col; padding: .1em .5em; text-align: right;">!;
my $a=qq!<A HREF="${url}view_invoice;invnum=!. $invoice->{'invnum'}. '">';
$OUT .=
- "<TR>$td${a}Invoice #". $invoice->{'invnum'}. "</A></TD>$td&nbsp;</TD>".
- "$td$a". $invoice->{'date'}. "</A></TD>$td</TD>".
+ "<TR>".
+ $td . $a . $invoice->{'invnum'}. "</A></TD>" .
+ $td . $a . $invoice->{'date'} . "</A></TD>" .
+ $tdr . $a . $money_char . $invoice->{'charged'} . "</A></TD>" .
+ $td . $a . $invoice->{'lastpay'} . "</A></TD>" .
+ $tdr . $a . $money_char . $invoice->{'owed'} . "</A></TD>" .
'</TR>';
$col = $col eq $col1 ? $col2 : $col1;
}
+ my $tht = '<TH COLSPAN="4" STYLE="background: #ff9999; padding: .1em .5em; text-align: right;">';
+ $OUT .= '<TR>'.$tht.'BALANCE DUE</TH>'.$tht.$money_char.$balance.'</TH></TR>';
$OUT .= '</TABLE><BR>';
} else {
- $OUT .= 'You have no invoices.<BR><BR>';
+ $OUT .= '<P>You have no invoices.</P>';
}
%>
diff --git a/fs_selfservice/FS-SelfService/cgi/myaccount.html b/fs_selfservice/FS-SelfService/cgi/myaccount.html
index 66e2c692e..309021a87 100644
--- a/fs_selfservice/FS-SelfService/cgi/myaccount.html
+++ b/fs_selfservice/FS-SelfService/cgi/myaccount.html
@@ -28,28 +28,34 @@ Hello <%= $name %>!<BR><BR>
} %>
<%=
if ( @open_invoices ) {
- $OUT .= '<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=2 BGCOLOR="#eeeeee">'.
- '<TR><TH BGCOLOR="#ff6666" COLSPAN=5>Open Invoices</TH></TR>';
- my $link = qq!<A HREF="<%= $url %>myaccount!;
- my $col1 = $stripe1_bgcolor || '#ffffff';
- my $col2 = $stripe2_bgcolor || '#dddddd';
+ my $th = q!<TH STYLE="background: #ff9999; text-align: left; padding: .1em .5em;">!;
+ my $thr = q!<TH STYLE="background: #ff9999; text-align: right; padding: .1em .5em;">!;
+ $OUT .= '<TABLE STYLE="border: 0;" CELLSPACING="0">'.
+ '<TR><TH BGCOLOR="#ff6666" COLSPAN="4">Open Invoices</TH></TR>'.
+ '<TR>'.$th.'Invoice #</TH>'.$th.'Date</TH>'.$thr.'Charges</TH>'
+ .$thr.'Owed</TH></TR>';
+ my $col1 = "#ffffff";
+ my $col2 = "#dddddd";
my $col = $col1;
foreach my $invoice ( @open_invoices ) {
- my $td = qq!<TD BGCOLOR="$col">!;
+ my $td = qq!<TD STYLE="background: $col; padding: .1em .5em;">!;
+ my $tdr = qq!<TD STYLE="background: $col; padding: .1em .5em; text-align: right;">!;
my $a=qq!<A HREF="${url}view_invoice;invnum=!. $invoice->{'invnum'}. '">';
$OUT .=
- "<TR>$td${a}Invoice #". $invoice->{'invnum'}. "</A></TD>$td</TD>".
- "$td$a". $invoice->{'date'}. "</A></TD>$td</TD>".
- qq!<TD BGCOLOR="$col" ALIGN="right">$a\$!. $invoice->{'owed'}.
- '</A></TD>'.
+ "<TR>".
+ $td . $a . $invoice->{'invnum'}. "</A></TD>" .
+ $td . $a . $invoice->{'date'} . "</A></TD>" .
+ $tdr . $a . $money_char . $invoice->{'charged'} . "</A></TD>" .
+ $tdr . $a . $money_char . $invoice->{'owed'} . "</A></TD>" .
'</TR>';
$col = $col eq $col1 ? $col2 : $col1;
}
$OUT .= '</TABLE><BR>';
} else {
- $OUT .= 'You have no outstanding invoices.<BR><BR>';
+ $OUT .= '<P>You have no outstanding invoices.</P>';
}
+
%>
<%=