Bugzilla – Attachment 66832 Details for
Bug 19178
Remove outdated sms/* scripts
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 19178 - Remove outdated sms/* scripts and related files
Bug-19178---Remove-outdated-sms-scripts-and-relate.patch (text/plain), 9.10 KB, created by
Katrin Fischer
on 2017-09-05 06:30:19 UTC
(
hide
)
Description:
Bug 19178 - Remove outdated sms/* scripts and related files
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2017-09-05 06:30:19 UTC
Size:
9.10 KB
patch
obsolete
>From 8a3bb6496413e0d54836ba71a1493b16246603ba Mon Sep 17 00:00:00 2001 >From: Katrin Fischer <katrin.fischer.83@web.de> >Date: Sat, 26 Aug 2017 15:09:41 +0000 >Subject: [PATCH] Bug 19178 - Remove outdated sms/* scripts and related files > >Those files appear unmaintained and unusable with current >Koha and should be removed. > >It appears at some point there was work done on a feature >to send SMS messages to a phone number using a form in >the tools area. >This has never been documented, files and git history >make it look like work remained unfinished. > >sms/sms_listen_windows_start.pl >- targetted for Windows, which is not supported by Koha > >00-strict.t >- reference to sms removed > >sms/sms_listen.pl >- refers to a table sms_messages that doesn't exist >- uses getmember() that doesn't exist > >sms/sms.pl >- 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 > >sms-home.tt >- 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 > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/sms/sms-home.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/sms/sms-home.tt >deleted file mode 100644 >index d655b76..0000000 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/sms/sms-home.tt >+++ /dev/null >@@ -1,35 +0,0 @@ >-[% INCLUDE 'doc-head-open.inc' %] >-<title>Koha › Tools › Send SMS message</title> >-[% INCLUDE 'doc-head-close.inc' %] >-</head> >-<body id="sms_sms-home" class="pat"> >-[% INCLUDE 'header.inc' %] >-[% INCLUDE 'cat-search.inc' %] >- >-<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> › Send SMS message</div> >- >-<div id="doc3" class="yui-t2"> >- >- <div id="bd"> >- <div id="yui-main"> >- <div class="yui-b"> >- >-[% IF ( error ) %]<div class="dialog alert">[% error %] </div>[% END %] >-<form action="/cgi-bin/koha/sms/sms.pl" method="post"> >-<fieldset class="rows"> >-<legend>SMS Messaging</legend> >-<ol> >- <li><label for="message">Your message: </label><textarea name="message" id="message" cols="35" rows="4">[% message %]</textarea></li> >- <li><label for="phone">Phone:</label><input type="text" name="phone" id="phone" value="[% phone %]"/> (e.g., 5338644143)</li> >-</ol> >-</fieldset> >-<fieldset class="action"><input type="submit" value="Send SMS"><a class="cancel" href="/cgi-bin/koha/sms/sms.pl">Cancel</a></fieldset> >-</form> >- >-</div> >-</div> >-<div class="yui-b"> >-[% INCLUDE 'tools-menu.inc' %] >-</div> >-</div> >-[% INCLUDE 'intranet-bottom.inc' %] >diff --git a/sms/sms.pl b/sms/sms.pl >deleted file mode 100755 >index 5d599fb..0000000 >--- a/sms/sms.pl >+++ /dev/null >@@ -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; >- >diff --git a/sms/sms_listen.pl b/sms/sms_listen.pl >deleted file mode 100755 >index 0ee3f53..0000000 >--- a/sms/sms_listen.pl >+++ /dev/null >@@ -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__ >diff --git a/sms/sms_listen_windows_start.pl b/sms/sms_listen_windows_start.pl >deleted file mode 100755 >index a94dc95..0000000 >--- a/sms/sms_listen_windows_start.pl >+++ /dev/null >@@ -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"); >diff --git a/t/db_dependent/00-strict.t b/t/db_dependent/00-strict.t >index 11e9403..3b16d4c 100644 >--- a/t/db_dependent/00-strict.t >+++ b/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); >-- >2.7.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 19178
:
66496
|
66832
|
66833
|
68596