summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Kohler <ivan@freeside.biz>2016-11-18 09:24:37 -0800
committerIvan Kohler <ivan@freeside.biz>2016-11-18 09:24:37 -0800
commitc2685608b13db2485e2457a5ba43c394b2c814a1 (patch)
tree1e2842a9a4bb6819976113ebe039b5696ba588c8
parenta39ad17a0b4f4fa3fdf988804dc2bd313180eccf (diff)
don't link to deleted attachments if there aren't any
-rw-r--r--FS/FS/cust_main.pm16
1 files changed, 16 insertions, 0 deletions
diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm
index f9cb342..e1f73bf 100644
--- a/FS/FS/cust_main.pm
+++ b/FS/FS/cust_main.pm
@@ -3623,6 +3623,22 @@ sub charge_postal_fee {
$error ? $error : $cust_pkg;
}
+=item num_cust_attachment_deleted
+
+Returns the number of deleted attachments for this customer (see
+L<FS::num_cust_attachment>).
+
+=cut
+
+sub num_cust_attachments_deleted {
+ my $self = shift;
+ $self->scalar_sql(
+ " SELECT COUNT(*) FROM cust_attachment ".
+ " WHERE custnum = ? AND disabled IS NOT NULL AND disabled > 0",
+ $self->custnum
+ );
+}
+
=item cust_bill [ OPTION => VALUE... | EXTRA_QSEARCH_PARAMS_HASHREF ]
Returns all the invoices (see L<FS::cust_bill>) for this customer.