SMS bugs solved
This commit is contained in:
parent
e0ced87f7c
commit
723b584af9
|
@ -1,4 +1,4 @@
|
||||||
hedera-web (1.405.52) stable; urgency=low
|
hedera-web (1.405.53) stable; urgency=low
|
||||||
|
|
||||||
* Initial Release.
|
* Initial Release.
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "hedera-web",
|
"name": "hedera-web",
|
||||||
"version": "1.405.52",
|
"version": "1.405.53",
|
||||||
"description": "Verdnatura web page",
|
"description": "Verdnatura web page",
|
||||||
"license": "GPL-3.0",
|
"license": "GPL-3.0",
|
||||||
"repository": {
|
"repository": {
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
use Vn\Web\Security;
|
use Vn\Web\Security;
|
||||||
use Vn\Web\Util;
|
use Vn\Web\Util;
|
||||||
|
use Vn\Lib;
|
||||||
|
|
||||||
class Invoice extends Vn\Web\RestRequest
|
class Invoice extends Vn\Web\RestRequest
|
||||||
{
|
{
|
||||||
|
@ -14,7 +15,7 @@ class Invoice extends Vn\Web\RestRequest
|
||||||
['invoice' => (int) $_GET['invoice']]);
|
['invoice' => (int) $_GET['invoice']]);
|
||||||
|
|
||||||
if (!$pdfPath)
|
if (!$pdfPath)
|
||||||
throw new Exception (s('Invoice id not found'));
|
throw new Lib\UserException (s('Invoice id not found'));
|
||||||
|
|
||||||
Util::printFile ($pdfPath);
|
Util::printFile ($pdfPath);
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,39 +5,48 @@ use Vn\Lib;
|
||||||
class Sms extends Vn\Web\JsonRequest
|
class Sms extends Vn\Web\JsonRequest
|
||||||
{
|
{
|
||||||
const PARAMS = [
|
const PARAMS = [
|
||||||
'to'
|
'destination'
|
||||||
,'text'
|
,'message'
|
||||||
|
];
|
||||||
|
|
||||||
|
const OK_STATES = [
|
||||||
|
0, // Ok
|
||||||
|
127 // Processing
|
||||||
];
|
];
|
||||||
|
|
||||||
function run ($db)
|
function run ($db)
|
||||||
{
|
{
|
||||||
$smsConfig = $db->getObject ('SELECT uri, user, password, title FROM sms_config');
|
$smsConfig = $db->getObject ('SELECT uri, user, password, title FROM vn.smsConfig');
|
||||||
|
|
||||||
$sClient = new SoapClient ($smsConfig->uri);
|
$sClient = new SoapClient ($smsConfig->uri);
|
||||||
$xmlString = $sClient->sendSMS (
|
$xmlString = $sClient->sendSMS (
|
||||||
$smsConfig->user
|
$smsConfig->user
|
||||||
,$smsConfig->password
|
,$smsConfig->password
|
||||||
,$smsConfig->title
|
,$smsConfig->title
|
||||||
,$_REQUEST['to']
|
,$_REQUEST['destination']
|
||||||
,$_REQUEST['text']
|
,$_REQUEST['message']
|
||||||
);
|
);
|
||||||
$xmlResponse = new SimpleXMLElement ($xmlString);
|
$xmlResponse = new SimpleXMLElement ($xmlString);
|
||||||
$res = $xmlResponse->sms;
|
$res = $xmlResponse->sms;
|
||||||
|
|
||||||
$db->query (
|
$db->query (
|
||||||
'INSERT INTO vn2008.sms (Id_trabajador, `text`, `to`, `from`, sent, response, Id_Cliente)
|
'INSERT INTO vn.sms SET
|
||||||
VALUES (account.userGetId(), #, #, #, #, #, #)',
|
`senderFk` = account.userGetId(),
|
||||||
|
`destinationFk` = #,
|
||||||
|
`destination` = #,
|
||||||
|
`message` = #,
|
||||||
|
`statusCode` = #,
|
||||||
|
`status` = #',
|
||||||
[
|
[
|
||||||
$_REQUEST['text']
|
empty ($_REQUEST['destinationId']) ? NULL : $_REQUEST['destinationId']
|
||||||
,$_REQUEST['to']
|
,$_REQUEST['destination']
|
||||||
,$_REQUEST['to']
|
,$_REQUEST['message']
|
||||||
,$res->codigo
|
,$res->codigo
|
||||||
,$res->descripcion
|
,$res->descripcion
|
||||||
,empty ($_REQUEST['customer']) ? NULL : $_REQUEST['customer']
|
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($res->codigo != 0)
|
if (!in_array ($res->codigo, self::OK_STATES))
|
||||||
throw new Lib\UserException ($res->descripcion);
|
throw new Lib\UserException ($res->descripcion);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
Loading…
Reference in New Issue