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.
25 # find Koha's Perl modules
26 # test carefully before changing this
28 eval { require "$FindBin::Bin/../kohalib.pl" };
37 pod2usage( -verbose => 2 );
42 "TalkingTechItivaPhoneNotification system preference not activated... dying\n"
43 unless ( C4::Context->preference("TalkingTechItivaPhoneNotification") );
46 my $dbh = C4::Context->dbh;
58 'i|input:s' => \$infile,
63 die pod2usage() if $help;
65 # initialize the input data, either file or query
66 if ( defined $infile ) {
67 my $IN open( $IN, '<', $infile ) || die("Cannot open input file");
68 print "Opening $infile\n" if ( defined $verbose );
72 # data should take to form "<Transaction ID>","<SUCCESS or FAIL>"
73 s/["\n]//g; # strip quotes and newlines: they're unnecessary
74 my @data = split(/,/);
75 my $result = update_notice(@data);
81 die pod2usage( -verbose => 1 );
84 print "$updated of $total results lines processed\n" if ( defined $verbose );
88 TalkingTech_itiva_inbound.pl
92 TalkingTech_itiva_inbound.pl
93 TalkingTech_itiva_inbound.pl -v --input=/tmp/talkingtech/results.csv
95 Script to process received Results files for Talking Tech i-tiva
96 phone notification system.
100 =item B<--help> B<-h>
106 Provide verbose log information.
108 =item B<--input> B<-i>
110 REQUIRED. Path to incoming results file.
117 my $message_id = shift;
120 if ( $status =~ m/SUCCESS/i ) {
123 elsif ( $status =~ m/FAIL/i ) {
127 warn "unexpected status $status for message ID $message_id\n";
132 "UPDATE message_queue SET status = ? WHERE message_id = ? and status = 'pending'";
133 my $sth = $dbh->prepare($query);
135 my $result = $sth->execute( $status, $message_id );