[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [8608] sms: add gateway
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [8608] sms: add gateway |
Date: |
Wed, 18 Jan 2012 15:03:49 +0000 |
Revision: 8608
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=8608
Author: sigurdne
Date: 2012-01-18 15:03:49 +0000 (Wed, 18 Jan 2012)
Log Message:
-----------
sms: add gateway
Modified Paths:
--------------
trunk/sms/inc/class.sms.inc.php
trunk/sms/inc/class.uisms.inc.php
trunk/sms/setup/setup.inc.php
trunk/sms/setup/tables_update.inc.php
Added Paths:
-----------
trunk/sms/inc/plugin/gateway/bergen_kommune/
trunk/sms/inc/plugin/gateway/bergen_kommune/README
trunk/sms/inc/plugin/gateway/bergen_kommune/SmsService.php
trunk/sms/inc/plugin/gateway/bergen_kommune/get.php
trunk/sms/inc/plugin/gateway/bergen_kommune/index.html
trunk/sms/inc/plugin/gateway/bergen_kommune/send.php
Modified: trunk/sms/inc/class.sms.inc.php
===================================================================
--- trunk/sms/inc/class.sms.inc.php 2012-01-18 12:52:11 UTC (rev 8607)
+++ trunk/sms/inc/class.sms.inc.php 2012-01-18 15:03:49 UTC (rev 8608)
@@ -469,21 +469,21 @@
while ($this->db->next_record())
{
- $gpid = "";
- $gp_code = "";
- $uid = $this->db->f('uid');
- $smslog_id = $this->db->f('smslog_id');
- $p_datetime = $this->db->f('p_datetime');
- $p_update = $this->db->f('p_update');
- $gpid = $this->db->f('p_gpid');
- // $gp_code = gpid2gpcode($gpid);
+ $gpid = "";
+ $gp_code = "";
+ $uid = $this->db->f('uid');
+ $smslog_id =
$this->db->f('smslog_id');
+ $p_datetime =
$this->db->f('p_datetime');
+ $p_update =
$this->db->f('p_update');
+ $gpid =
$this->db->f('p_gpid');
+ // $gp_code = gpid2gpcode($gpid);
+ $external_id = $this->db->f('external_id');
if($gpid)
{
$gp_code =
$GLOBALS['phpgw']->accounts->name2id($gpid);
}
-
$this->gw_set_delivery_status($gp_code,$uid,$smslog_id,$p_datetime,$p_update);
+
$this->gw_set_delivery_status($gp_code,$uid,$smslog_id,$p_datetime,$p_update,$external_id);
}
- //
$this->gw_set_delivery_status($gp_code,$uid,$smslog_id,$p_datetime,$p_update);
}
/* function execgwcustomcmd()
@@ -499,11 +499,12 @@
@include
$this->apps_path[inc]."/admin/commoncustomcmd.php";
}
-*/ function setsmsdeliverystatus($smslog_id,$uid,$p_status)
+*/ function
setsmsdeliverystatus($smslog_id,$uid,$p_status,$external_id = 0)
{
+ $external_id = (int) $external_id;
$datetime_now = $this->datetime_now();
$ok = false;
- $db_query = "UPDATE phpgw_sms_tblsmsoutgoing SET
p_update='$datetime_now',p_status='$p_status' WHERE smslog_id='$smslog_id' AND
uid='$uid'";
+ $db_query = "UPDATE phpgw_sms_tblsmsoutgoing SET
p_update='{$datetime_now}',p_status='{$p_status}', external_id = {$external_id}
WHERE smslog_id='$smslog_id' AND uid='$uid'";
$this->db->transaction_begin();
$this->db->query($db_query,__LINE__,__FILE__);
Modified: trunk/sms/inc/class.uisms.inc.php
===================================================================
--- trunk/sms/inc/class.uisms.inc.php 2012-01-18 12:52:11 UTC (rev 8607)
+++ trunk/sms/inc/class.uisms.inc.php 2012-01-18 15:03:49 UTC (rev 8608)
@@ -877,7 +877,7 @@
$data = array
(
'msgbox_data' =>
$GLOBALS['phpgw']->common->msgbox($msgbox_data),
- 'menu'
=> execMethod('sms.menu.links'),
+ 'menu' =>
execMethod('sms.menu.links'),
);
$appname = lang('config');
Added: trunk/sms/inc/plugin/gateway/bergen_kommune/README
===================================================================
--- trunk/sms/inc/plugin/gateway/bergen_kommune/README
(rev 0)
+++ trunk/sms/inc/plugin/gateway/bergen_kommune/README 2012-01-18 15:03:49 UTC
(rev 8608)
@@ -0,0 +1,14 @@
+PlaySMS gateway module for bergen_kommune
+
+Need a config-section named 'bergen_kommune' with values:
+
+array
+(
+ 'wsdl' =>
'http://soa01a.srv.bergenkom.no/biz/bk/sms/SmsService-v1?wsdl'// using SOAP
+ 'service_url' =>
'http://soa01a.srv.bergenkom.no/biz/bk/sms/SmsService-v1'// using SOAP
+ 'login' =>
+ 'password' =>
+ 'proxy_host' =>
+ 'proxy_port' =>
+);
+
Added: trunk/sms/inc/plugin/gateway/bergen_kommune/SmsService.php
===================================================================
--- trunk/sms/inc/plugin/gateway/bergen_kommune/SmsService.php
(rev 0)
+++ trunk/sms/inc/plugin/gateway/bergen_kommune/SmsService.php 2012-01-18
15:03:49 UTC (rev 8608)
@@ -0,0 +1,529 @@
+<?php
+ /**
+ * phpGroupWare
+ *
+ * @author Sigurd Nes <address@hidden>
+ * @copyright Copyright (C) 2012 Free Software Foundation, Inc.
http://www.fsf.org/
+ * @license http://www.gnu.org/licenses/gpl.html GNU General Public
License
+ * @internal Development of this application was funded by
http://www.bergen.kommune.no/bbb_/ekstern/
+ * @package phpgroupware
+ * @subpackage communication
+ * @category core
+ * @version $Id: SmsService.php 4237 2009-11-27 23:17:21Z sigurd $
+ */
+
+ /*
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+ /**
+ * soap client for pswin.com SMS service
+ * this code is generated by the
http://code.google.com/p/wsdl2php-interpreter/
+ *
+ * @package phpgroupware
+ * @subpackage sms
+ */
+
+
+ /**
+ * UserContextRest
+ */
+ class UserContextRest
+ {
+ /**
+ * @access public
+ * @var UserContext
+ */
+ public $userContext;
+ }
+
+ /**
+ * UserContext
+ */
+ class UserContext
+ {
+ /**
+ * @access public
+ * @var string
+ */
+ public $userid;
+ /**
+ * @access public
+ * @var string
+ */
+ public $onBehalfOfId;
+ /**
+ * @access public
+ * @var string
+ */
+ public $appid;
+ /**
+ * @access public
+ * @var string
+ */
+ public $transactionid;
+ }
+
+ /**
+ * MeldingsStatus
+ */
+ class MeldingsStatus
+ {
+ /**
+ * @access public
+ * @var integer
+ */
+ public $id;
+ /**
+ * @access public
+ * @var tnsSendingsStatus
+ */
+ public $status;
+ /**
+ * @access public
+ * @var string
+ */
+ public $feiltekst;
+ }
+
+
+ /**
+ * Melding
+ */
+ class Melding
+ {
+ /**
+ * @access public
+ * @var string
+ */
+ public $tlfmottaker;
+ /**
+ * @access public
+ * @var string
+ */
+ public $tekst;
+ /**
+ * @access public
+ * @var string
+ */
+ public $orgnr;
+ }
+
+ /**
+ * InnkommendeMelding
+ */
+ class InnkommendeMelding
+ {
+ /**
+ * @access public
+ * @var string
+ */
+ public $tlfavsender;
+ /**
+ * @access public
+ * @var string
+ */
+ public $tekst;
+ /**
+ * @access public
+ * @var string
+ */
+ public $kodeord;
+ }
+
+ /**
+ * SendingsStatus
+ */
+ class SendingsStatus
+ {
+ }
+
+ /**
+ * hentStatuser
+ */
+ class hentStatuser
+ {
+ /**
+ * @access public
+ * @var UserContext
+ */
+ public $userContext;
+ /**
+ * @access public
+ * @var MeldingsStatus[]
+ */
+ public $statuser;
+ }
+
+
+ /**
+ * hentStatuserResponse
+ */
+ class hentStatuserResponse
+ {
+ /**
+ * @access public
+ * @var MeldingsStatus[]
+ */
+ public $return;
+ }
+
+ /**
+ * hentStatus
+ */
+ class hentStatus
+ {
+ /**
+ * @access public
+ * @var UserContext
+ */
+ public $userContext;
+ /**
+ * @access public
+ * @var MeldingsStatus
+ */
+ public $status;
+ }
+
+ /**
+ * hentStatusResponse
+ */
+ class hentStatusResponse
+ {
+ /**
+ * @access public
+ * @var MeldingsStatus
+ */
+ public $return;
+ }
+
+ /**
+ * sendMelding
+ */
+ class sendMelding
+ {
+ /**
+ * @access public
+ * @var UserContext
+ */
+ public $userContext;
+ /**
+ * @access public
+ * @var Melding
+ */
+ public $melding;
+ }
+
+ /**
+ * sendMeldingResponse
+ */
+ class sendMeldingResponse
+ {
+ /**
+ * @access public
+ * @var MeldingsStatus
+ */
+ public $return;
+ }
+
+ /**
+ * sendMeldinger
+ */
+ class sendMeldinger
+ {
+ /**
+ * @access public
+ * @var UserContext
+ */
+ public $userContext;
+ /**
+ * @access public
+ * @var Melding[]
+ */
+ public $meldinger;
+ }
+
+ /**
+ * sendMeldingerResponse
+ */
+ class sendMeldingerResponse
+ {
+ /**
+ * @access public
+ * @var MeldingsStatus[]
+ */
+ public $return;
+ }
+
+ /**
+ * getNyeInnkommendeMeldinger
+ */
+ class getNyeInnkommendeMeldinger
+ {
+ /**
+ * @access public
+ * @var UserContext
+ */
+ public $userContext;
+ /**
+ * @access public
+ * @var string
+ */
+ public $kodeord;
+ }
+
+ /**
+ * getNyeInnkommendeMeldingerResponse
+ */
+ class getNyeInnkommendeMeldingerResponse
+ {
+ /**
+ * @access public
+ * @var InnkommendeMelding[]
+ */
+ public $return;
+ }
+
+ /**
+ * getInnkommendeMeldinger
+ */
+ class getInnkommendeMeldinger
+ {
+ /**
+ * @access public
+ * @var UserContext
+ */
+ public $userContext;
+ /**
+ * @access public
+ * @var string
+ */
+ public $kodeord;
+ /**
+ * @access public
+ * @var dateTime
+ */
+ public $fra;
+ /**
+ * @access public
+ * @var dateTime
+ */
+ public $til;
+ }
+
+ /**
+ * getInnkommendeMeldingerResponse
+ */
+ class getInnkommendeMeldingerResponse
+ {
+ /**
+ * @access public
+ * @var InnkommendeMelding[]
+ */
+ public $return;
+ }
+
+ /**
+ * SmsService
+ * @author WSDLInterpreter
+ */
+ class SmsService extends SoapClient
+ {
+ /**
+ * Default class map for wsdl=>php
+ * @access private
+ * @var array
+ */
+ private static $classmap = array
+ (
+ "UserContextRest" => "UserContextRest",
+ "UserContext" => "UserContext",
+ "MeldingsStatus" => "MeldingsStatus",
+ "Melding" => "Melding",
+ "InnkommendeMelding" => "InnkommendeMelding",
+ "SendingsStatus" => "SendingsStatus",
+ "hentStatuser" => "hentStatuser",
+ "hentStatuserResponse" => "hentStatuserResponse",
+ "hentStatus" => "hentStatus",
+ "hentStatusResponse" => "hentStatusResponse",
+ "sendMelding" => "sendMelding",
+ "sendMeldingResponse" => "sendMeldingResponse",
+ "sendMeldinger" => "sendMeldinger",
+ "sendMeldingerResponse" => "sendMeldingerResponse",
+ "getNyeInnkommendeMeldinger" =>
"getNyeInnkommendeMeldinger",
+ "getNyeInnkommendeMeldingerResponse" =>
"getNyeInnkommendeMeldingerResponse",
+ "getInnkommendeMeldinger" => "getInnkommendeMeldinger",
+ "getInnkommendeMeldingerResponse" =>
"getInnkommendeMeldingerResponse",
+ );
+
+ /**
+ * Constructor using wsdl location and options array
+ * @param string $wsdl WSDL location for this service
+ * @param array $options Options for the SoapClient
+ */
+ public function
__construct($wsdl="/home/sn5607/Documents/sms_gateway/SmsService-v1.xml",
$options=array())
+ {
+ foreach(self::$classmap as $wsdlClassName =>
$phpClassName)
+ {
+ if(!isset($options['classmap'][$wsdlClassName]))
+ {
+ $options['classmap'][$wsdlClassName] =
$phpClassName;
+ }
+ }
+ parent::__construct($wsdl, $options);
+ }
+
+ /**
+ * Checks if an argument list matches against a valid argument
type list
+ * @param array $arguments The argument list to check
+ * @param array $validParameters A list of valid argument types
+ * @return boolean true if arguments match against
validParameters
+ * @throws Exception invalid function signature message
+ */
+ public function _checkArguments($arguments, $validParameters)
+ {
+ $variables = "";
+ foreach ($arguments as $arg)
+ {
+ $type = gettype($arg);
+ if ($type == "object")
+ {
+ $type = get_class($arg);
+ }
+ $variables .= "(".$type.")";
+ }
+ if (!in_array($variables, $validParameters))
+ {
+ throw new Exception("Invalid parameter types:
".str_replace(")(", ", ", $variables));
+ }
+ return true;
+ }
+
+ /**
+ * Service Call: hentStatuser
+ * Parameter options:
+ * (hentStatuser) parameters
+ * @param mixed,... See function description for parameter
options
+ * @return hentStatuserResponse
+ * @throws Exception invalid function signature message
+ */
+ public function hentStatuser($mixed = null)
+ {
+ $validParameters = array
+ (
+ "(hentStatuser)",
+ );
+ $args = func_get_args();
+ $this->_checkArguments($args, $validParameters);
+ return $this->__soapCall("hentStatuser", $args);
+ }
+
+ /**
+ * Service Call: hentStatus
+ * Parameter options:
+ * (hentStatus) parameters
+ * @param mixed,... See function description for parameter
options
+ * @return hentStatusResponse
+ * @throws Exception invalid function signature message
+ */
+ public function hentStatus($mixed = null)
+ {
+ $validParameters = array
+ (
+ "(hentStatus)",
+ );
+ $args = func_get_args();
+ $this->_checkArguments($args, $validParameters);
+ return $this->__soapCall("hentStatus", $args);
+ }
+
+ /**
+ * Service Call: sendMelding
+ * Parameter options:
+ * (sendMelding) parameters
+ * @param mixed,... See function description for parameter
options
+ * @return sendMeldingResponse
+ * @throws Exception invalid function signature message
+ */
+ public function sendMelding($mixed = null)
+ {
+ $validParameters = array
+ (
+ "(sendMelding)",
+ );
+ $args = func_get_args();
+ $this->_checkArguments($args, $validParameters);
+ return $this->__soapCall("sendMelding", $args);
+ }
+
+
+ /**
+ * Service Call: sendMeldinger
+ * Parameter options:
+ * (sendMeldinger) parameters
+ * @param mixed,... See function description for parameter
options
+ * @return sendMeldingerResponse
+ * @throws Exception invalid function signature message
+ */
+ public function sendMeldinger($mixed = null)
+ {
+ $validParameters = array
+ (
+ "(sendMeldinger)",
+ );
+ $args = func_get_args();
+ $this->_checkArguments($args, $validParameters);
+ return $this->__soapCall("sendMeldinger", $args);
+ }
+
+
+ /**
+ * Service Call: getNyeInnkommendeMeldinger
+ * Parameter options:
+ * (getNyeInnkommendeMeldinger) parameters
+ * @param mixed,... See function description for parameter
options
+ * @return getNyeInnkommendeMeldingerResponse
+ * @throws Exception invalid function signature message
+ */
+ public function getNyeInnkommendeMeldinger($mixed = null)
+ {
+ $validParameters = array
+ (
+ "(getNyeInnkommendeMeldinger)",
+ );
+ $args = func_get_args();
+ $this->_checkArguments($args, $validParameters);
+ return $this->__soapCall("getNyeInnkommendeMeldinger",
$args);
+ }
+
+
+ /**
+ * Service Call: getInnkommendeMeldinger
+ * Parameter options:
+ * (getInnkommendeMeldinger) parameters
+ * @param mixed,... See function description for parameter
options
+ * @return getInnkommendeMeldingerResponse
+ * @throws Exception invalid function signature message
+ */
+ public function getInnkommendeMeldinger($mixed = null)
+ {
+ $validParameters = array
+ (
+ "(getInnkommendeMeldinger)",
+ );
+ $args = func_get_args();
+ $this->_checkArguments($args, $validParameters);
+ return $this->__soapCall("getInnkommendeMeldinger",
$args);
+ }
+ }
Added: trunk/sms/inc/plugin/gateway/bergen_kommune/get.php
===================================================================
--- trunk/sms/inc/plugin/gateway/bergen_kommune/get.php
(rev 0)
+++ trunk/sms/inc/plugin/gateway/bergen_kommune/get.php 2012-01-18 15:03:49 UTC
(rev 8608)
@@ -0,0 +1,71 @@
+<?php
+
+ class sms_sms_ extends sms_sms__
+ {
+ function __construct()
+ {
+ parent::__construct();
+ $this->sms_param =
$GLOBALS['phpgw_info']['sms_config']['bergen_kommune'];
+ }
+
+ function gw_customcmd()
+ {
+ // nothing
+ }
+
+ function gw_set_incoming_action()
+ {
+ $kodeord = 'Bgok';
+ $orgnr = '975621375';//BBB
+ $orgnr = 'IKT Drift';//BBB
+
+ $result = array();
+ $sms_msg = utf8_decode($sms_msg);
+
+ $sms_to = ltrim($sms_to, '+');
+
+ if( strlen($sms_to) < 9)
+ {
+ $sms_to = "47{$sms_to}";
+ }
+
+ require_once 'SmsService.php';
+
+ $options=array();
+ $options['soap_version'] = SOAP_1_1;
+ $options['location'] =
$this->sms_param['service_url'];
+ $options['uri'] =
"http://soa01a.srv.bergenkom.no/biz/bk/sms/SmsService-v1";
+ $options['trace'] = 1;
+ $options['proxy_host'] =
$this->sms_param['proxy_host'];
+ $options['proxy_port'] =
$this->sms_param['proxy_port'];
+ $options['encoding'] = 'iso-8859-1';//'UTF-8';
+ $options['login'] =
$this->sms_param['login'];
+ $options['password'] = $this->sms_param['password'];
+
+ $service = new SmsService($this->sms_param['wsdl'],
$options);
+
+ $UserContext = new UserContext();
+ $UserContext->userid =
$GLOBALS['phpgw_info']['user']['account_lid'];
+ $UserContext->appid = 'Portico';
+
+ $getNyeInnkommendeMeldinger = new
getNyeInnkommendeMeldinger();
+ $getNyeInnkommendeMeldinger->userContext = $UserContext;
+ $getNyeInnkommendeMeldinger->kodeord = $kodeord;
+
+ $ReturnValue =
$service->getNyeInnkommendeMeldinger($getNyeInnkommendeMeldinger);
+
+ _debug_array($ReturnValue);
+
+ die();
+
+
+/*
+ if
($this->setsmsincomingaction($sms_datetime,$sms_sender,$target_code,$message))
+ {
+
+ }
+
+*/
+ }
+
+ }
Added: trunk/sms/inc/plugin/gateway/bergen_kommune/index.html
===================================================================
Added: trunk/sms/inc/plugin/gateway/bergen_kommune/send.php
===================================================================
--- trunk/sms/inc/plugin/gateway/bergen_kommune/send.php
(rev 0)
+++ trunk/sms/inc/plugin/gateway/bergen_kommune/send.php 2012-01-18
15:03:49 UTC (rev 8608)
@@ -0,0 +1,147 @@
+<?php
+
+ class sms_sms extends sms_sms_
+ {
+ function __construct()
+ {
+ parent::__construct();
+ $this->sms_param =
$GLOBALS['phpgw_info']['sms_config']['bergen_kommune'];
+ }
+
+ function
gw_send_sms($mobile_sender,$sms_sender,$sms_to,$sms_msg,$gp_code="",$uid="",$smslog_id="",$flash=false)
+ {
+ $orgnr = '975621375';//BBB
+ $orgnr = 'IKT Drift';//BBB
+
+ $result = array();
+ $sms_msg = utf8_decode($sms_msg);
+
+ $sms_to = ltrim($sms_to, '+');
+
+ if( strlen($sms_to) < 9)
+ {
+ $sms_to = "47{$sms_to}";
+ }
+
+ require_once 'SmsService.php';
+
+ $options=array();
+ $options['soap_version'] = SOAP_1_1;
+ $options['location'] =
$this->sms_param['service_url'];
+ $options['uri'] =
"http://soa01a.srv.bergenkom.no/biz/bk/sms/SmsService-v1";
+ $options['trace'] = 1;
+ $options['proxy_host'] =
$this->sms_param['proxy_host'];
+ $options['proxy_port'] =
$this->sms_param['proxy_port'];
+ $options['encoding'] = 'iso-8859-1';//'UTF-8';
+ $options['login'] =
$this->sms_param['login'];
+ $options['password'] = $this->sms_param['password'];
+
+ $service = new SmsService($this->sms_param['wsdl'],
$options);
+
+ $Melding = new Melding();
+
+ $Melding->tlfmottaker = (string)$sms_to;
+ $Melding->orgnr = (string)$orgnr;
+ $Melding->tekst = (string)$sms_msg;
+
+ $UserContext = new UserContext();
+ $UserContext->userid =
$GLOBALS['phpgw_info']['user']['account_lid'];
+ $UserContext->appid = 'Portico';
+
+ $sendMelding = new sendMelding();
+ $sendMelding->UserContext = $UserContext;
+ $sendMelding->melding = $Melding;
+
+ $ReturnValue = $service->sendMelding($sendMelding);
+
+ $result['statuscode'] = $ReturnValue->return->status;
+ $result['messageid'] = $ReturnValue->return->id;
+ $result['description'] =
$ReturnValue->return->feiltekst;
+
+ // p_status :
+ // 0 = pending
+ // 1 = delivered
+ // 2 = failed
+
+ // status :
+ // OK
+ // Feil
+ // Venter = pending
+
+ switch ($result['statuscode'])
+ {
+ case 'OK';
+
$this->setsmsdeliverystatus($smslog_id,$uid,1,$result['messageid']);
+ $ret = true;
+ break;
+ case 'Venter';
+
$this->setsmsdeliverystatus($smslog_id,$uid,0,$result['messageid']);
+ $ret = true;
+ break;
+ case 'Feil';
+
$this->setsmsdeliverystatus($smslog_id,$uid,2,$result['messageid']);
+ $ret = true;
+ break;
+ }
+
+
+ return $ret;
+ }
+
+ function
gw_set_delivery_status($gp_code="",$uid="",$smslog_id="",$p_datetime="",$p_update="",$external_id=0)
+ {
+ require_once 'SmsService.php';
+
+ $options=array();
+ $options['soap_version'] = SOAP_1_1;
+ $options['location'] =
$this->sms_param['service_url'];
+ $options['uri'] =
"http://soa01a.srv.bergenkom.no/biz/bk/sms/SmsService-v1";
+ $options['trace'] = 1;
+ $options['proxy_host'] =
$this->sms_param['proxy_host'];
+ $options['proxy_port'] =
$this->sms_param['proxy_port'];
+ $options['encoding'] = 'iso-8859-1';//'UTF-8';
+ $options['login'] =
$this->sms_param['login'];
+ $options['password'] = $this->sms_param['password'];
+
+ $service = new SmsService($this->sms_param['wsdl'],
$options);
+ $UserContext = new UserContext();
+
+ $MeldingsStatus = new MeldingsStatus();
+ $MeldingsStatus->id = $external_id;
+ $MeldingsStatus->status = '';
+ $MeldingsStatus->feiltekst = '';
+
+ $hentStatus = new hentStatus();
+ $hentStatus->userContext = $UserContext;
+ $hentStatus->status = $MeldingsStatus;
+
+ $ReturnValue = $service->hentStatus($hentStatus);
+
+ $result['statuscode'] = $ReturnValue->return->status;
+ $result['messageid'] = $ReturnValue->return->id;
+ $result['description'] =
$ReturnValue->return->feiltekst;
+
+ // p_status :
+ // 0 = pending
+ // 1 = delivered
+ // 2 = failed
+
+
+ switch ($result['statuscode'])
+ {
+ case 'OK';
+
$this->setsmsdeliverystatus($smslog_id,$uid,1,$result['messageid']);
+ $ret = true;
+ break;
+ case 'Venter';
+
$this->setsmsdeliverystatus($smslog_id,$uid,0,$result['messageid']);
+ $ret = true;
+ break;
+ case 'Feil';
+
$this->setsmsdeliverystatus($smslog_id,$uid,2,$result['messageid']);
+ $ret = true;
+ break;
+ }
+ return;
+ }
+ }
Modified: trunk/sms/setup/setup.inc.php
===================================================================
--- trunk/sms/setup/setup.inc.php 2012-01-18 12:52:11 UTC (rev 8607)
+++ trunk/sms/setup/setup.inc.php 2012-01-18 15:03:49 UTC (rev 8608)
@@ -10,7 +10,7 @@
*/
$setup_info['sms']['name'] = 'sms';
- $setup_info['sms']['version'] = '0.9.17.510';
+ $setup_info['sms']['version'] = '0.9.17.511';
$setup_info['sms']['app_order'] = 8;
$setup_info['sms']['enable'] = 1;
$setup_info['sms']['app_group'] = 'office';
Modified: trunk/sms/setup/tables_update.inc.php
===================================================================
--- trunk/sms/setup/tables_update.inc.php 2012-01-18 12:52:11 UTC (rev
8607)
+++ trunk/sms/setup/tables_update.inc.php 2012-01-18 15:03:49 UTC (rev
8608)
@@ -425,3 +425,90 @@
return $GLOBALS['setup_info']['sms']['currentver'];
}
}
+
+ /**
+ * Update sms version from 0.9.17.510 to 0.9.17.511
+ * new to new config section
+ */
+
+ $test[] = '0.9.17.510';
+ function sms_upgrade0_9_17_510()
+ {
+ $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+
+ $custom_config =
CreateObject('admin.soconfig',$GLOBALS['phpgw']->locations->get_id('sms',
'run'));
+
+ // common
+ $receipt_section_bergen = $custom_config->add_section(array
+ (
+ 'name' => 'bergen_kommune',
+ 'descr' => 'bergen kommune SMS config-section'
+ )
+ );
+
+ $receipt = $custom_config->add_attrib(array
+ (
+ 'section_id' =>
$receipt_section_bergen['section_id'],
+ 'input_type' => 'text',
+ 'name' => 'service_url',
+ 'descr' => 'service_url'
+ )
+ );
+ $receipt = $custom_config->add_attrib(array
+ (
+ 'section_id' =>
$receipt_section_bergen['section_id'],
+ 'input_type' => 'text',
+ 'name' => 'login',
+ 'descr' => 'login'
+ )
+ );
+ $receipt = $custom_config->add_attrib(array
+ (
+ 'section_id' =>
$receipt_section_bergen['section_id'],
+ 'input_type' => 'password',
+ 'name' => 'password',
+ 'descr' => 'password'
+ )
+ );
+ $receipt = $custom_config->add_attrib(array
+ (
+ 'section_id' =>
$receipt_section_bergen['section_id'],
+ 'input_type' => 'text',
+ 'name' => 'wsdl',
+ 'descr' => 'wsdl'
+ )
+ );
+ $receipt = $custom_config->add_attrib(array
+ (
+ 'section_id' =>
$receipt_section_bergen['section_id'],
+ 'input_type' => 'text',
+ 'name' => 'proxy_host',
+ 'descr' => 'proxy_host'
+ )
+ );
+ $receipt = $custom_config->add_attrib(array
+ (
+ 'section_id' =>
$receipt_section_bergen['section_id'],
+ 'input_type' => 'text',
+ 'name' => 'proxy_port',
+ 'descr' => 'proxy_port'
+ )
+ );
+
+
+
$GLOBALS['phpgw_setup']->oProc->AddColumn('phpgw_sms_tblsmsoutgoing','external_id',
+ array
+ (
+ 'type' => 'int',
+ 'precision' => 4,
+ 'nullable' => True
+ )
+ );
+
+ if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+ {
+ $GLOBALS['setup_info']['sms']['currentver'] =
'0.9.17.511';
+ return $GLOBALS['setup_info']['sms']['currentver'];
+ }
+ }
+
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [8608] sms: add gateway,
Sigurd Nes <=