add customer fields option with agent, display_custnum, status and name, RT#73721
[freeside.git] / FS / FS / cust_main.pm
index 9c8e374..ec5f4ff 100644 (file)
@@ -1895,7 +1895,7 @@ sub check_payinfo_cardtype {
   my $payinfo = $self->payinfo;
   $payinfo =~ s/\D//g;
 
-  return '' if $payinfo =~ /^99\d{14}$/; #token
+  return '' if $self->tokenized($payinfo); #token
 
   my %bop_card_types = map { $_=>1 } values %{ card_types() };
   my $cardtype = cardtype($payinfo);
@@ -3404,6 +3404,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.
@@ -5338,6 +5354,11 @@ sub _upgrade_data { #class method
 
 }
 
+sub queueable_upgrade {
+  my $class = shift;
+  FS::cust_main::Billing_Realtime::token_check(@_);
+}
+
 =back
 
 =head1 BUGS