--- /dev/null
+#!/usr/bin/perl
+
+# Copyright (C) 2015 Georgia Public Library Service
+# Chris Sharp <csharp@georgialibraries.org>
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+# A script to reset an Evergreen Acquisitions purchase order.
+
+# Example workflow:
+#begin;
+#select id from action_trigger.event_output where id in (select template_output from action_trigger.event where event_def = 23 and target in (270, 271, 274, 275));
+#[record output IDs somewhere]
+#delete from action_trigger.event where event_def = 23 and target in (270, 271, 274, 275);
+#delete from action_trigger.event_output where id in (3020734, 3020735, 3020736, 3020733);
+#[^^ recorded IDs]
+#delete from acq.edi_message where purchase_order in (270, 271, 274, 275);
+#update acq.purchase_order set state = 'pending', order_date = null where id in (270, 271, 274, 275);
+#commit;
+
+
+use warnings;
+use strict;
+use DBI;
+
+my @po_ids = @ARGV;
+my $grab_output_ids = qq/select id from
+ action_trigger.event_output
+ where id in (
+ select template_output
+ from action_trigger.event
+ where event_def = 23
+ and target in (?)
+ )/;
+my $delete_at_events = qq/delete from action_trigger.event where event_def = 23 and target in (?)/;
+my $delete_at_outputs = qq/delete from action_trigger.event_output where id in (?)/;
+my $delete_edi_messages = qq/delete from acq.edi_message where purchase_order in (?)/;
+my $update_pos = qq/update acq.purchase_order set state = 'pending', order_date = null where id in (?)/;
+
+
+foreach my $id (@po_ids) {
+ print "$id, ";
+}
+
+#my $dbh = DBI->connect('DBI:Pg:');
+#my $sth = $dbh->prepare($grab_output_ids);
+#$sth->execute(@po_ids);