diff options
author | mark <mark> | 2012-02-01 05:30:16 +0000 |
---|---|---|
committer | mark <mark> | 2012-02-01 05:30:16 +0000 |
commit | 33631ac48cd91bf9bee1cd7f25f2f23fc640cb65 (patch) | |
tree | c95612501c97a432b02228bb2ed418ddcddd5ede /FS | |
parent | 33622ee94a063863870d9ea208970226eeb7ecd7 (diff) |
print customer statements on the fly, #15864
Diffstat (limited to 'FS')
-rw-r--r-- | FS/FS/Conf.pm | 7 | ||||
-rw-r--r-- | FS/FS/cust_statement.pm | 15 |
2 files changed, 21 insertions, 1 deletions
diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm index 2899de3ee..8e48dc20d 100644 --- a/FS/FS/Conf.pm +++ b/FS/FS/Conf.pm @@ -4673,6 +4673,13 @@ and customer address. Include units.', 'select_enum' => [ 'Classic', 'Recurring' ], }, + { + 'key' => 'cust_main-print_statement_link', + 'section' => 'UI', + 'description' => 'Show a link to download a current statement for the customer.', + 'type' => 'checkbox', + }, + { 'key' => 'username-pound', 'section' => 'username', diff --git a/FS/FS/cust_statement.pm b/FS/FS/cust_statement.pm index 83dd5c1be..45fae1ccf 100644 --- a/FS/FS/cust_statement.pm +++ b/FS/FS/cust_statement.pm @@ -60,6 +60,10 @@ Creates a new record. To add the record to the database, see L<"insert">. Note that this stores the hash reference, not a distinct copy of the hash it points to. You can ask the object for a copy with the I<hash> method. +Pass "statementnum => 'ALL'" to create a temporary statement that includes +all of the customer's invoices. This statement can't be inserted and won't +set the statementnum field on any invoices. + =cut sub new { FS::Record::new(@_); } @@ -165,7 +169,16 @@ Returns the associated invoices (cust_bill records) for this statement. sub cust_bill { my $self = shift; - qsearch('cust_bill', { 'statementnum' => $self->statementnum } ); + # we use it about a thousand times, let's cache it + $self->{Hash}->{cust_bill} ||= [ + qsearch('cust_bill', { + $self->statementnum eq 'ALL' ? + ('custnum' => $self->custnum) : + ('statementnum' => $self->statementnum) + } ) + ]; + + @{ $self->{Hash}->{cust_bill} } } sub _aggregate { |