'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',
'custnum' => $cust_main->custnum,
};
- $error = $queue->insert(
+ my %opt = (
'invnum' => $cust_bill->invnum,
- 'template' => 'statement',
- 'notice_name' => 'Statement',
'no_coupon' => 1,
);
+ if ( my $mode = $conf->config('payment_receipt_statement_mode') ) {
+ $opt{'mode'} = $mode;
+ } else {
+ # backward compatibility, no good fix for this yet as some people may
+ # still have "invoice_latex_statement" and such options
+ $opt{'template'} = 'statement';
+ $opt{'notice_name'} = 'Statement';
+ }
+
+ $error = $queue->insert(%opt);
+
}
warn "send_receipt: $error\n" if $error;
#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');