projects
/
freeside.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
localize header / merge github#56
[freeside.git]
/
FS
/
FS
/
Misc
/
prune.pm
diff --git
a/FS/FS/Misc/prune.pm
b/FS/FS/Misc/prune.pm
index
371f31c
..
ce72405
100644
(file)
--- a/
FS/FS/Misc/prune.pm
+++ b/
FS/FS/Misc/prune.pm
@@
-22,6
+22,10
@@
use FS::Misc::prune qw(prune_applications);
prune_applications();
prune_applications();
+=head1 SUBROUTINES
+
+=over 4
+
=item prune_applications OPTION_HASH
Removes applications of credits to refunds in the event that the database
=item prune_applications OPTION_HASH
Removes applications of credits to refunds in the event that the database
@@
-34,39
+38,40
@@
affected records is returned rather than actually deleting the records.
sub prune_applications {
my $options = shift;
sub prune_applications {
my $options = shift;
- my $dbh = dbh
+ my $dbh = dbh
;
local $DEBUG = 1 if exists($options->{debug});
local $DEBUG = 1 if exists($options->{debug});
+
my $ccr = <<EOW;
WHERE
my $ccr = <<EOW;
WHERE
-
0 = (select count(*)
from cust_credit
+
NOT EXISTS (select 1
from cust_credit
where cust_credit_refund.crednum = cust_credit.crednum)
or
where cust_credit_refund.crednum = cust_credit.crednum)
or
-
0 = (select count(*)
from cust_refund
+
NOT EXISTS (select 1
from cust_refund
where cust_credit_refund.refundnum = cust_refund.refundnum)
EOW
my $ccb = <<EOW;
WHERE
where cust_credit_refund.refundnum = cust_refund.refundnum)
EOW
my $ccb = <<EOW;
WHERE
-
0 = (select count(*)
from cust_credit
+
NOT EXISTS (select 1
from cust_credit
where cust_credit_bill.crednum = cust_credit.crednum)
or
where cust_credit_bill.crednum = cust_credit.crednum)
or
-
0 = (select count(*)
from cust_bill
+
NOT EXISTS (select 1
from cust_bill
where cust_credit_bill.invnum = cust_bill.invnum)
EOW
my $cbp = <<EOW;
WHERE
where cust_credit_bill.invnum = cust_bill.invnum)
EOW
my $cbp = <<EOW;
WHERE
-
0 = (select count(*)
from cust_bill
+
NOT EXISTS (select 1
from cust_bill
where cust_bill_pay.invnum = cust_bill.invnum)
or
where cust_bill_pay.invnum = cust_bill.invnum)
or
-
0 = (select count(*)
from cust_pay
+
NOT EXISTS (select 1
from cust_pay
where cust_bill_pay.paynum = cust_pay.paynum)
EOW
my $cpr = <<EOW;
WHERE
where cust_bill_pay.paynum = cust_pay.paynum)
EOW
my $cpr = <<EOW;
WHERE
-
0 = (select count(*)
from cust_pay
+
NOT EXISTS (select 1
from cust_pay
where cust_pay_refund.paynum = cust_pay.paynum)
or
where cust_pay_refund.paynum = cust_pay.paynum)
or
-
0 = (select count(*)
from cust_refund
+
NOT EXISTS (select 1
from cust_refund
where cust_pay_refund.refundnum = cust_refund.refundnum)
EOW
where cust_pay_refund.refundnum = cust_refund.refundnum)
EOW