projects
/
freeside.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
RT#38597: OQM - svc Circuit use and setup [fixed sql quoting]
[freeside.git]
/
FS
/
FS
/
cust_pay.pm
diff --git
a/FS/FS/cust_pay.pm
b/FS/FS/cust_pay.pm
index
89bb193
..
4d06862
100644
(file)
--- a/
FS/FS/cust_pay.pm
+++ b/
FS/FS/cust_pay.pm
@@
-2,9
+2,9
@@
package FS::cust_pay;
use strict;
use base qw( FS::otaker_Mixin FS::payinfo_transaction_Mixin FS::cust_main_Mixin
use strict;
use base qw( FS::otaker_Mixin FS::payinfo_transaction_Mixin FS::cust_main_Mixin
- FS::
Record
);
+ FS::
reason_Mixin FS::Record
);
use vars qw( $DEBUG $me $conf @encrypted_fields
use vars qw( $DEBUG $me $conf @encrypted_fields
- $unsuspendauto $ignore_noapply
+ $unsuspendauto $ignore_noapply
);
use Date::Format;
use Business::CreditCard;
);
use Date::Format;
use Business::CreditCard;
@@
-24,6
+24,8
@@
use FS::cust_pkg;
use FS::cust_pay_void;
use FS::upgrade_journal;
use FS::Cursor;
use FS::cust_pay_void;
use FS::upgrade_journal;
use FS::Cursor;
+use FS::reason;
+use FS::reason_type;
$DEBUG = 0;
$DEBUG = 0;
@@
-438,6
+440,15
@@
adds a record of the voided payment to the FS::cust_pay_void table.
sub void {
my $self = shift;
sub void {
my $self = shift;
+ my $reason = shift;
+
+ unless (ref($reason) || !$reason) {
+ $reason = FS::reason->new_or_existing(
+ 'class' => 'X',
+ 'type' => 'Void payment',
+ 'reason' => $reason
+ );
+ }
local $SIG{HUP} = 'IGNORE';
local $SIG{INT} = 'IGNORE';
local $SIG{HUP} = 'IGNORE';
local $SIG{INT} = 'IGNORE';
@@
-453,7
+464,7
@@
sub void {
my $cust_pay_void = new FS::cust_pay_void ( {
map { $_ => $self->get($_) } $self->fields
} );
my $cust_pay_void = new FS::cust_pay_void ( {
map { $_ => $self->get($_) } $self->fields
} );
- $cust_pay_void->reason
(shift) if scalar(@_)
;
+ $cust_pay_void->reason
num($reason->reasonnum) if $reason
;
my $error = $cust_pay_void->insert;
my $cust_pay_pending =
my $error = $cust_pay_void->insert;
my $cust_pay_pending =
@@
-960,7
+971,7
@@
sub batch_insert {
}
} elsif ( !$error ) { #normal case: apply payments as usual
}
} elsif ( !$error ) { #normal case: apply payments as usual
- $cust_pay->cust_main->apply_payments;
+ $cust_pay->cust_main->apply_payments
( 'manual'=>1 )
;
}
}
}
}
@@
-1023,6
+1034,8
@@
sub _upgrade_data { #class method
warn "$me upgrading $class\n" if $DEBUG;
warn "$me upgrading $class\n" if $DEBUG;
+ $class->_upgrade_reasonnum(%opt);
+
local $FS::payinfo_Mixin::ignore_masked_payinfo = 1;
##
local $FS::payinfo_Mixin::ignore_masked_payinfo = 1;
##
@@
-1311,7
+1324,7
@@
sub process_batch_import {
my $cust_pay = shift;
my $cust_main = $cust_pay->cust_main
or return "can't find customer to which payments apply";
my $cust_pay = shift;
my $cust_main = $cust_pay->cust_main
or return "can't find customer to which payments apply";
- my $error = $cust_main->apply_payments_and_credits;
+ my $error = $cust_main->apply_payments_and_credits
( 'manual'=>1 )
;
return $error
? "can't apply payments to customer ".$cust_pay->custnum."$error"
: '';
return $error
? "can't apply payments to customer ".$cust_pay->custnum."$error"
: '';