summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorivan <ivan>2007-07-13 23:59:39 +0000
committerivan <ivan>2007-07-13 23:59:39 +0000
commitaf17d8bf17247fda0afd4b20b5212f728aac8fd3 (patch)
tree4b0701541ee2e542fa1a754a521386931c647338 /bin
parentbd8d2cd5fd7035e2775c72113aaeb6abc84dd73f (diff)
adding quick find-overapplied script
Diffstat (limited to 'bin')
-rw-r--r--bin/find-overapplied27
-rwxr-xr-xbin/strip-eps20
2 files changed, 47 insertions, 0 deletions
diff --git a/bin/find-overapplied b/bin/find-overapplied
new file mode 100644
index 000000000..6bcc31539
--- /dev/null
+++ b/bin/find-overapplied
@@ -0,0 +1,27 @@
+#!/usr/bin/perl -w
+
+use strict;
+use Data::Dumper;
+use FS::UID qw(adminsuidsetup);
+use FS::Record qw(qsearch);
+use FS::cust_credit;
+use FS::cust_pay;
+
+my $user = shift or die &usage;
+adminsuidsetup $user;
+
+my @credits = grep { $_->credited < 0 } qsearch('cust_credit', {});
+my @payments = grep { $_->unapplied < 0 } qsearch('cust_pay', {});
+
+if ( @credits ) {
+ print scalar(@credits). " overapplied credits:\n". Dumper(@credits). "\n";
+}
+
+if ( @payments ) {
+ print scalar(@payments). " overapplied credits:\n". Dumper(@payments). "\n";
+}
+
+sub usage {
+ die "Usage:\n\n find-overapplied user\n";
+}
+
diff --git a/bin/strip-eps b/bin/strip-eps
new file mode 100755
index 000000000..2c2d124d7
--- /dev/null
+++ b/bin/strip-eps
@@ -0,0 +1,20 @@
+#!/usr/bin/perl -w
+
+# Author: Andy Turner <andrew.turner@acadia.net>
+
+use strict;
+
+# The first line has some binary magic for file identification
+# purposes. GhostScript doesn't like it. Strip it.
+scalar <>;
+
+# Add a header so that we can use magic to determine the file type.
+print "%!PS-Adobe-3.0 EPSF-3.0\n";
+
+while (<>) {
+ print;
+
+ # Illustrator Version 7 format EPS files have a bunch of binary gook
+ # after the "%%EOF" line. (% is a comment in PostScript, right?)
+ last if /^%%EOF/;
+}