is taken for that length of time. It is an error for the customer to owe
after this payment is made.
-A hash of optional arguments may be passed. Currently "manual" is supported.
+A hash of optional arguments may be passed. The following arguments are
+supported:
+
+=over 4
+
+=item manual
+
If true, a payment receipt is sent instead of a statement when
'payment_receipt_email' configuration option is set.
realtime payment, or from a third-party payment via self-service. It should
be I<false> when creating a payment from a billing event or from a batch.
+=item noemail
+
+Don't send an email receipt. (Note: does not currently work when
+payment_receipt-trigger is set to something other than default / cust_bill)
+
+=back
+
=cut
sub insert {
if ( $trigger eq 'cust_pay' ) {
my $error = $self->send_receipt(
'manual' => $options{'manual'},
+ 'noemail' => $options{'noemail'},
'cust_bill' => $cust_bill,
'cust_main' => $cust_main,
);
Customer (FS::cust_main) object (for efficiency).
+=item noemail
+
+Don't send an email receipt.
+
+=cut
+
=back
=cut
'msgtype' => 'receipt',
};
$error = $queue->insert(
- 'from' => $conf->config('invoice_from', $cust_main->agentnum),
+ 'from' => $conf->invoice_from_full( $cust_main->agentnum ),
#invoice_from??? well as good as any
'to' => \@invoicing_list,
'subject' => 'Payment receipt',
}
- } elsif ( ! $cust_main->invoice_noemail ) { #not manual
+ #not manual and no noemail flag (here or on the customer)
+ } elsif ( ! $opt->{'noemail'} && ! $cust_main->invoice_noemail ) {
my $queue = new FS::queue {
'job' => 'FS::cust_bill::queueable_email',
#not the most efficient, but hey, it only has to run once
- my $where = "WHERE ( otaker IS NULL OR otaker = '' OR otaker = 'ivan' ) ".
- " AND usernum IS NULL ".
- " AND 0 < ( SELECT COUNT(*) FROM cust_main ".
- " WHERE cust_main.custnum = cust_pay.custnum ) ";
+ my $where = " WHERE ( otaker IS NULL OR otaker = '' OR otaker = 'ivan' )
+ AND usernum IS NULL
+ AND EXISTS ( SELECT 1 FROM cust_main
+ WHERE cust_main.custnum = cust_pay.custnum )
+ ";
my $count_sql = "SELECT COUNT(*) FROM cust_pay $where";
$cust_pay->set('otaker', 'legacy');
}
- delete $FS::payby::hash{'COMP'}->{cust_pay}; #quelle kludge
my $error = $cust_pay->replace;
if ( $error ) {
next;
}
- $FS::payby::hash{'COMP'}->{cust_pay} = ''; #restore it
-
$count++;
if ( $DEBUG > 1 && $lastprog + 30 < time ) {
warn "$me $count/$total (".sprintf('%.2f',100*$count/$total). '%)'."\n";
# otaker->usernum upgrade
###
- delete $FS::payby::hash{'COMP'}->{cust_pay}; #quelle kludge
$class->_upgrade_otaker(%opt);
- $FS::payby::hash{'COMP'}->{cust_pay} = ''; #restore it
# if we do this anywhere else, it should become an FS::Upgrade method
my $num_to_upgrade = $class->count('paybatch is not null');