@@ -, +, @@
- targetted for Windows, which is not supported by Koha
- reference to sms removed
- refers to a table sms_messages that doesn't exist
- uses getmember() that doesn't exist
- script calls routines that no longer exist in SMS.pm
error_codes(), parse_phone(), write_sms()
- template sms-home.tt is not accessible form anywhere
in the templates
- see sms/sms.pl
---
.../intranet-tmpl/prog/en/modules/sms/sms-home.tt | 35 ------
sms/sms.pl | 37 -------
sms/sms_listen.pl | 123 ---------------------
sms/sms_listen_windows_start.pl | 17 ---
t/db_dependent/00-strict.t | 4 +-
5 files changed, 2 insertions(+), 214 deletions(-)
delete mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/sms/sms-home.tt
delete mode 100755 sms/sms.pl
delete mode 100755 sms/sms_listen.pl
delete mode 100755 sms/sms_listen_windows_start.pl
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/sms/sms-home.tt
+++ a/koha-tmpl/intranet-tmpl/prog/en/modules/sms/sms-home.tt
@@ -1,35 +0,0 @@
-[% INCLUDE 'doc-head-open.inc' %]
-
-
-
-
-
-
-[% IF ( error ) %]
[% error %]
[% END %]
-
-
-
-
-
-[% INCLUDE 'tools-menu.inc' %]
-
-
-[% INCLUDE 'intranet-bottom.inc' %]
--- a/sms/sms.pl
+++ a/sms/sms.pl
@@ -1,37 +0,0 @@
-#!/usr/bin/perl
-
-use strict;
-#use warnings; FIXME - Bug 2505
-use CGI qw ( -utf8 );
-use C4::SMS;
-use C4::Output;
-use C4::Auth;
-
-my $query = new CGI;
-my $message = $query->param( 'message' );
-my $phone = $query->param( 'phone' );
-my $operation = $query->param('operation');
-my $result;
-my $errorcode;
-my ($template, $loggedinuser, $cookie)
- = get_template_and_user({template_name => "sms/sms-home.tt",
- query => $query,
- type => "intranet",
- authnotrequired => 0,
- flagsrequired => {circulate => "circulate_remaining_permissions" },
- debug => 1,
- });
-if ($operation eq "sendsms"){
- $phone=parse_phone($phone);
- if ($phone){
- ##write to a queue and exit
- my $me=C4::Context->userenv;
- $result=write_sms($me->{cardnumber},$message,$phone);
- } else {
- $errorcode=-1104;
- }
-}
-my $error=error_codes($errorcode);
-$template->param(error=>$error);
-output_html_with_http_headers $query, $cookie, $template->output;
-
--- a/sms/sms_listen.pl
+++ a/sms/sms_listen.pl
@@ -1,123 +0,0 @@
-#!/usr/bin/perl
-
-use strict;
-use warnings;
-
-use C4::SMS;
-use C4::Auth;
-use C4::Context;
-use C4::Members;
-use C4::Circulation;
-
-my ($res,$ua);
-my $message;
-my $result;
-my $errorcode;
-my $smsid;
-my $wait=600;## 10 mn. wait between sms checking
-my $dbh=C4::Context->dbh;
-
-STARTAGAIN:
-($res,$ua)=get_sms_auth();
-AGAIN:
-$errorcode=0;
-if ($res->{pRetCode}==200){
- $result=read_sms($ua,$res->{pSessionId});
- $errorcode=$result->{pErrCode};
- print "connected\n";
-} else {
- kill_sms($ua,$res->{pSessionId});
- warn (error_codes($res->{pErrCode}),$res->{pErrcode}) ;
-# sleep $wait;
- goto FINISH;
-}
-if ($errorcode && $errorcode !=-9005){
- kill_sms($ua,$res->{pSessionId});
- warn error_codes($errorcode) ;
- # sleep $wait;
- goto FINISH;
-} elsif ($errorcode ==-9005){
- print "no more messages to read\n";
- goto WAITING;
-}
-
-
-#Parse the message to a useful hash
-my @action=parse_message( $result->{pContent});
-## Log the request in our database;
-$smsid=write_sms($action[1], $result->{pContent},$result->{pMsisdn});
-print "message logged\n";
-##Now do the service required
-if (uc($action[0]) eq "RN"){
- print "dealing request\n";
- my ($ok,$cardnumber)=C4::Auth::checkpw($dbh,$action[1],$action[2]);
- unless ($ok) {
- ##wrong user/pass
- $message="Yanlis kullanici/sifre! :Wrong username/password!";
- my $send=send_message($result,$message,$smsid);
- goto AGAIN;
- }
- my $item=getiteminformation(undef,0,$action[3]);
- if ($item){
- my $borrower=getmember($cardnumber);
- my $status=renewstatus(undef,$borrower->{borrowernumber},$item->{itemnumber});
- if ($status==1) {
- my $date=renewbook(undef,$borrower->{borrowernumber},$item->{itemnumber});
- $message="Uzatildi :Renewed ".$item->{barcode}." : ".$date;
- } elsif($status==2) {
- $message="Cok erken- yenilenmedi! :Too early-not renewed:".$item->{barcode};
- } elsif($status==3) {
- $message="Uzatamazsiniz GERI getiriniz! :No more renewals RETURN the item:".$item->{barcode};
- } elsif($status==4) {
- $message="Ayirtildi GERI getiriniz! :Reserved RETURN the item:".$item->{barcode};
- } elsif($status==0) {
- $message="Uzatilamaz! :Can not renew:".$item->{barcode};
- }
- } else {
- $message="Yanlis barkot! :Wrong barcode!";
- }
-} else {
- ## reply about error
- $message="Yanlis mesaj formati! :Wrong message! :
- RN usercardno password barcode";
-} ### wrong service
-send_message($result,$message,$smsid);
-
-goto AGAIN;
-
-
-WAITING:
-##Now send the messages waiting in queue
-my $smssth=$dbh->prepare("SELECT smsid,user_phone,message from sms_messages where date_replied like '0000-00-00%' ");
-$smssth->execute();
-my @phones;
-while (my $data=$smssth->fetchrow_hashref){
- push @phones,$data;
-}
-$smssth->finish;
-
-foreach my $user(@phones){
- print "replying $user->{user_phone}";
- my $send=send_sms($ua,$user->{user_phone},$user->{message},$res->{pSessionId});
- my $reply="--failed\n";
- if ($send->{pRetCode}==200){
- $reply= "--replied\n";
- mod_sms($user->{smsid},"Sent");
- }
- print $reply;
-}
-
-sub send_message {
- my ($mes,$message,$smsid)=@_;
- my $send=send_sms($ua,$mes->{pMsisdn},$message,$res->{pSessionId});
- if ($send->{pRetCode}==200){
- mod_sms($smsid,$message);
- } else {
- my $error=error_codes($send->{pErrCode});
- mod_sms($smsid,"Not replied error:".$error);
- }
- return $send;
-}
-FINISH:
-1;
-__END__
--- a/sms/sms_listen_windows_start.pl
+++ a/sms/sms_listen_windows_start.pl
@@ -1,17 +0,0 @@
-#!/usr/bin/perl
-# script that starts the zebraqueue
-# Written by TG on 01/08/2006
-use strict;
-#use warnings; FIXME - Bug 2505
-
-use Win32::Process;
-use Win32;
-use C4::Context;
-use CGI qw ( -utf8 );
-my $input=new CGI;
-my $fileplace=C4::Context->config('intranetdir');
-my $fullpath=$fileplace."/cgi-bin/sms";
-my $ZebraObj;
-my $pid=Win32::Process::Create($ZebraObj, "C:/perl/bin/perl.exe", 'perl sms_listen.pl', 0, DETACHED_PROCESS, $fullpath);
-
-print $input->redirect("/cgi-bin/koha/mainpage.pl?pid=$pid");
--- a/t/db_dependent/00-strict.t
+++ a/t/db_dependent/00-strict.t
@@ -16,9 +16,9 @@ my @dirs = ( 'acqui', 'admin', 'authorities', 'basket',
'mainpage.pl', 'Makefile.PL', 'members', 'misc', 'offline_circ', 'opac',
'patroncards', 'reports', 'reserve', 'reviews',
'rewrite-config.PL', 'rotating_collections', 'serials', 'services', 'skel',
- 'sms', 'suggestion', 'svc', 'tags', 'tools', 'virtualshelves' );
+ 'suggestion', 'svc', 'tags', 'tools', 'virtualshelves' );
$Test::Strict::TEST_STRICT = 0;
-$Test::Strict::TEST_SKIP = [ 'misc/kohalib.pl', 'sms/sms_listen_windows_start.pl', 'misc/plack/koha.psgi' ];
+$Test::Strict::TEST_SKIP = [ 'misc/kohalib.pl', 'misc/plack/koha.psgi' ];
all_perl_files_ok(@dirs);
--