(bug #3802) fix branch deletion checks
[koha.git] / sms / sms.pl
blob230aa904261155654fe126edf7781dcb8c1cb21e
1 #!/usr/bin/perl
3 use strict;
4 use CGI;
5 use C4::SMS;
6 use C4::Output;
7 use C4::Auth;
9 my $query = new CGI;
10 my $message = $query->param( 'message' );
11 my $phone = $query->param( 'phone' );
12 my $operation = $query->param('operation');
13 my $result;
14 my $errorcode;
15 my ($template, $loggedinuser, $cookie)
16 = get_template_and_user({template_name => "sms/sms-home.tmpl",
17 query => $query,
18 type => "intranet",
19 authnotrequired => 0,
20 flagsrequired => {circulate => "circulate_remaining_permissions" },
21 debug => 1,
22 });
23 if ($operation eq "sendsms"){
24 $phone=parse_phone($phone);
25 if ($phone){
26 ##write to a queue and exit
27 my $me=C4::Context->userenv;
28 $result=write_sms($me->{cardnumber},$message,$phone);
29 } else {
30 $errorcode=-1104;
33 my $error=error_codes($errorcode);
34 $template->param(error=>$error);
35 output_html_with_http_headers $query, $cookie, $template->output;