3 # Copyright (C) 2011 ByWater Solutions
5 # This file is part of Koha.
7 # Koha is free software; you can redistribute it and/or modify it under the
8 # terms of the GNU General Public License as published by the Free Software
9 # Foundation; either version 2 of the License, or (at your option) any later
12 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License along
17 # with Koha; if not, write to the Free Software Foundation, Inc.,
18 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23 # find Koha's Perl modules
24 # test carefully before changing this
26 eval { require "$FindBin::Bin/../kohalib.pl" };
35 pod2usage( -verbose => 2 );
39 die "TalkingTechItivaPhoneNotification system preference not activated... dying\n" unless (C4::Context->preference("TalkingTechItivaPhoneNotification"));
42 my $dbh = C4::Context->dbh;
54 'i|input:s' => \$infile,
59 die pod2usage() if $help;
61 # initialize the input data, either file or query
62 if (defined $infile) {
63 open(IN, $infile) || die ("Cannot open input file");
64 print "Opening $infile\n" if (defined $verbose);
67 # data should take to form "<Transaction ID>","<SUCCESS or FAIL>"
68 s/["\n]//g; # strip quotes and newlines: they're unnecessary
69 my @data = split(/,/);
70 my $result = update_notice(@data);
75 die pod2usage( -verbose => 1 );
78 print "$updated of $total results lines processed\n" if (defined $verbose);
83 TalkingTech_itiva_inbound.pl
87 TalkingTech_itiva_inbound.pl
88 TalkingTech_itiva_inbound.pl -v --input=/tmp/talkingtech/results.csv
90 Script to process received Results files for Talking Tech i-tiva
91 phone notification system.
101 Provide verbose log information.
103 =item B<--input> B<-i>
105 REQUIRED. Path to incoming results file.
112 my $message_id = shift;
115 if ($status =~ m/SUCCESS/i) {
117 } elsif ($status =~ m/FAIL/i) {
120 warn "unexpected status $status for message ID $message_id\n";
124 my $query = "UPDATE message_queue SET status = ? WHERE message_id = ? and status = 'pending'";
125 my $sth = $dbh->prepare($query);
127 my $result = $sth->execute($status,$message_id);