summaryrefslogtreecommitdiff
path: root/FS/FS
diff options
context:
space:
mode:
authorivan <ivan>2001-09-02 05:38:13 +0000
committerivan <ivan>2001-09-02 05:38:13 +0000
commit4f8a0bb6d0c789c7e156a446dc61dbe27938a372 (patch)
tree8d793aafaff9d0258d501e94caa9ad5e3bc74d4e /FS/FS
parent9b81123e5ff5825d2c3c000432e4dd18b5fd764f (diff)
migration. ugh.
Diffstat (limited to 'FS/FS')
-rw-r--r--FS/FS/cust_bill_pay.pm6
-rw-r--r--FS/FS/cust_credit_refund.pm6
-rw-r--r--FS/FS/cust_pay.pm57
-rw-r--r--FS/FS/cust_refund.pm55
4 files changed, 114 insertions, 10 deletions
diff --git a/FS/FS/cust_bill_pay.pm b/FS/FS/cust_bill_pay.pm
index fea6aee..ac82c54 100644
--- a/FS/FS/cust_bill_pay.pm
+++ b/FS/FS/cust_bill_pay.pm
@@ -1,4 +1,4 @@
-package cust_bill_pay;
+package FS::cust_bill_pay;
use strict;
use vars qw( @ISA );
@@ -156,7 +156,7 @@ sub check {
my $error =
$self->ut_numbern('billpaynum')
|| $self->ut_number('invnum')
- || $self->ut_numner('paynum')
+ || $self->ut_number('paynum')
|| $self->ut_money('amount')
|| $self->ut_numbern('_date')
;
@@ -194,7 +194,7 @@ sub cust_bill {
=head1 VERSION
-$Id: cust_bill_pay.pm,v 1.5 2001-09-02 04:25:55 ivan Exp $
+$Id: cust_bill_pay.pm,v 1.6 2001-09-02 05:38:13 ivan Exp $
=head1 BUGS
diff --git a/FS/FS/cust_credit_refund.pm b/FS/FS/cust_credit_refund.pm
index 200e34e..4c51957 100644
--- a/FS/FS/cust_credit_refund.pm
+++ b/FS/FS/cust_credit_refund.pm
@@ -1,4 +1,4 @@
-package cust_credit_refund;
+package FS::cust_credit_refund;
use strict;
use vars qw( @ISA );
@@ -141,7 +141,7 @@ sub check {
my $error =
$self->ut_numbern('creditrefundnum')
|| $self->ut_number('crednum')
- || $self->ut_numner('refundnum')
+ || $self->ut_number('refundnum')
|| $self->ut_money('amount')
|| $self->ut_numbern('_date')
;
@@ -170,7 +170,7 @@ sub cust_refund {
=head1 VERSION
-$Id: cust_credit_refund.pm,v 1.2 2001-09-02 01:27:11 ivan Exp $
+$Id: cust_credit_refund.pm,v 1.3 2001-09-02 05:38:13 ivan Exp $
=head1 BUGS
diff --git a/FS/FS/cust_pay.pm b/FS/FS/cust_pay.pm
index a70b7cb..70d1b73 100644
--- a/FS/FS/cust_pay.pm
+++ b/FS/FS/cust_pay.pm
@@ -105,6 +105,9 @@ sub insert {
$dbh->rollback if $oldAutoCommit;
return $error;
}
+ warn $cust_bill_pay;
+ warn $cust_bill_pay->cust_bill;
+ warn $cust_bill_pay->cust_bill->custnum;
$self->custnum($cust_bill_pay->cust_bill->custnum);
}
@@ -120,6 +123,56 @@ sub insert {
}
+sub upgrade_replace { #1.3.x->1.4.x
+ my $self = shift;
+
+ local $SIG{HUP} = 'IGNORE';
+ local $SIG{INT} = 'IGNORE';
+ local $SIG{QUIT} = 'IGNORE';
+ local $SIG{TERM} = 'IGNORE';
+ local $SIG{TSTP} = 'IGNORE';
+ local $SIG{PIPE} = 'IGNORE';
+
+ my $oldAutoCommit = $FS::UID::AutoCommit;
+ local $FS::UID::AutoCommit = 0;
+ my $dbh = dbh;
+
+ my $error = $self->check;
+ return $error if $error;
+
+ my %new = $self->hash;
+ my $new = FS::cust_pay->new(\%new);
+
+ if ( $self->invnum ) {
+ my $cust_bill_pay = new FS::cust_bill_pay {
+ 'invnum' => $self->invnum,
+ 'paynum' => $self->paynum,
+ 'amount' => $self->paid,
+ '_date' => $self->_date,
+ };
+ $error = $cust_bill_pay->insert;
+ if ( $error ) {
+ $dbh->rollback if $oldAutoCommit;
+ return $error;
+ }
+ $new->custnum($cust_bill_pay->cust_bill->custnum);
+ } else {
+ die;
+ }
+
+ $error = $new->SUPER::replace($self);
+ if ( $error ) {
+ $dbh->rollback if $oldAutoCommit;
+ return $error;
+ }
+
+ $dbh->commit or die $dbh->errstr if $oldAutoCommit;
+
+ '';
+
+
+}
+
=item delete
Currently unimplemented (accounting reasons).
@@ -152,7 +205,7 @@ sub check {
my $error =
$self->ut_numbern('paynum')
- || $self->ut_number('custnum')
+ || $self->ut_numbern('custnum')
|| $self->ut_money('paid')
|| $self->ut_numbern('_date')
|| $self->ut_textn('paybatch')
@@ -223,7 +276,7 @@ sub unapplied {
=head1 VERSION
-$Id: cust_pay.pm,v 1.5 2001-09-02 02:46:55 ivan Exp $
+$Id: cust_pay.pm,v 1.6 2001-09-02 05:38:13 ivan Exp $
=head1 BUGS
diff --git a/FS/FS/cust_refund.pm b/FS/FS/cust_refund.pm
index 89f8f68..77bacdf 100644
--- a/FS/FS/cust_refund.pm
+++ b/FS/FS/cust_refund.pm
@@ -96,9 +96,11 @@ sub insert {
my $error = $self->check;
return $error if $error;
+ die;
+
if ( $self->crednum ) {
my $cust_credit_refund = new FS::cust_credit_refund {
- 'cred' => $self->cred,
+ 'crednum' => $self->crednum,
'refundnum' => $self->refundnum,
'amount' => $self->refund,
'_date' => $self->_date,
@@ -123,6 +125,55 @@ sub insert {
}
+sub upgrade_replace {
+ my $self = shift;
+
+ local $SIG{HUP} = 'IGNORE';
+ local $SIG{INT} = 'IGNORE';
+ local $SIG{QUIT} = 'IGNORE';
+ local $SIG{TERM} = 'IGNORE';
+ local $SIG{TSTP} = 'IGNORE';
+ local $SIG{PIPE} = 'IGNORE';
+
+ my $oldAutoCommit = $FS::UID::AutoCommit;
+ local $FS::UID::AutoCommit = 0;
+ my $dbh = dbh;
+
+ my $error = $self->check;
+ return $error if $error;
+
+ my %new = $self->hash;
+ my $new = FS::cust_refund->new(\%new);
+
+ if ( $self->crednum ) {
+ my $cust_credit_refund = new FS::cust_credit_refund {
+ 'crednum' => $self->crednum,
+ 'refundnum' => $self->refundnum,
+ 'amount' => $self->refund,
+ '_date' => $self->_date,
+ };
+ $error = $cust_credit_refund->insert;
+ if ( $error ) {
+ $dbh->rollback if $oldAutoCommit;
+ return $error;
+ }
+ $new->custnum($cust_credit_refund->cust_credit->custnum);
+ } else {
+ die;
+ }
+
+ $error = $new->SUPER::insert($self);
+ if ( $error ) {
+ $dbh->rollback if $oldAutoCommit;
+ return $error;
+ }
+
+ $dbh->commit or die $dbh->errstr if $oldAutoCommit;
+
+ '';
+
+}
+
=item delete
Currently unimplemented (accounting reasons).
@@ -198,7 +249,7 @@ sub check {
=head1 VERSION
-$Id: cust_refund.pm,v 1.7 2001-09-02 04:25:55 ivan Exp $
+$Id: cust_refund.pm,v 1.8 2001-09-02 05:38:13 ivan Exp $
=head1 BUGS