SMS bugs solved, refactor
This commit is contained in:
parent
95a8efb8cf
commit
719c062eef
|
@ -1,4 +1,4 @@
|
||||||
hedera-web (1.405.46) stable; urgency=low
|
hedera-web (1.405.47) stable; urgency=low
|
||||||
|
|
||||||
* Initial Release.
|
* Initial Release.
|
||||||
|
|
||||||
|
|
|
@ -303,7 +303,7 @@ Hedera.Catalog = new Class
|
||||||
{
|
{
|
||||||
var sql = '';
|
var sql = '';
|
||||||
var batch = new Sql.Batch ();
|
var batch = new Sql.Batch ();
|
||||||
var query = new Sql.String ({query: 'CALL basket_item_add (#warehouse, #item, #amount);'});
|
var query = new Sql.String ({query: 'CALL basketAddItem (#warehouse, #item, #amount);'});
|
||||||
var amountSum = 0;
|
var amountSum = 0;
|
||||||
|
|
||||||
for (var warehouse in this.items)
|
for (var warehouse in this.items)
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
</db-form>
|
</db-form>
|
||||||
<db-query id="confirm-query" on-ready="onConfirm">
|
<db-query id="confirm-query" on-ready="onConfirm">
|
||||||
<custom>
|
<custom>
|
||||||
CALL basket_confirm ()
|
CALL basketConfirm
|
||||||
</custom>
|
</custom>
|
||||||
</db-query>
|
</db-query>
|
||||||
</vn-group>
|
</vn-group>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "hedera-web",
|
"name": "hedera-web",
|
||||||
"version": "1.405.46",
|
"version": "1.405.47",
|
||||||
"description": "Verdnatura web page",
|
"description": "Verdnatura web page",
|
||||||
"license": "GPL-3.0",
|
"license": "GPL-3.0",
|
||||||
"repository": {
|
"repository": {
|
||||||
|
|
|
@ -11,39 +11,34 @@ class Sms extends Vn\Web\JsonRequest
|
||||||
|
|
||||||
function run ($db)
|
function run ($db)
|
||||||
{
|
{
|
||||||
$smsConfig = $db->getRow ('SELECT uri, user, password, title FROM sms_config');
|
$smsConfig = $db->getObject ('SELECT uri, user, password, title FROM sms_config');
|
||||||
|
|
||||||
$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['to']
|
||||||
,$_REQUEST['text']
|
,$_REQUEST['text']
|
||||||
);
|
);
|
||||||
$xmlResponse = new SimpleXMLElement ($xmlString);
|
$xmlResponse = new SimpleXMLElement ($xmlString);
|
||||||
|
$res = $xmlResponse->sms;
|
||||||
|
|
||||||
$customer = empty ($_REQUEST['customer']) ? NULL : $_REQUEST['customer'];
|
$db->query (
|
||||||
|
'INSERT INTO vn2008.sms (Id_trabajador, `text`, `to`, `from`, sent, response, Id_Cliente)
|
||||||
|
VALUES (account.userGetId(), #, #, #, #, #, #)',
|
||||||
|
[
|
||||||
|
$_REQUEST['text']
|
||||||
|
,$_REQUEST['to']
|
||||||
|
,$_REQUEST['to']
|
||||||
|
,$res->codigo
|
||||||
|
,$res->descripcion
|
||||||
|
,empty ($_REQUEST['customer']) ? NULL : $_REQUEST['customer']
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
try {
|
if ($sms->codigo != 0)
|
||||||
$sms = $xmlResponse->sms;
|
throw new Lib\UserException ($res->descripcion);
|
||||||
$db->query (
|
|
||||||
'INSERT INTO vn2008.sms (Id_trabajador, `text`, `to`, `from`, sent, response, Id_Cliente)
|
|
||||||
VALUES (account.userGetId(), #, #, #, #, #, #)',
|
|
||||||
[
|
|
||||||
$_REQUEST['text']
|
|
||||||
,$_REQUEST['to']
|
|
||||||
,$_REQUEST['to']
|
|
||||||
,$sms->codigo
|
|
||||||
,$sms->descripcion
|
|
||||||
,$customer
|
|
||||||
]
|
|
||||||
);
|
|
||||||
}
|
|
||||||
catch (Exception $e)
|
|
||||||
{
|
|
||||||
trigger_error ($e->getMessage (), E_USER_WARNING);
|
|
||||||
}
|
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,7 +87,8 @@ abstract class Service
|
||||||
|
|
||||||
if (isset ($_COOKIE['PHPSESSID'])
|
if (isset ($_COOKIE['PHPSESSID'])
|
||||||
|| isset ($_SESSION['access'])
|
|| isset ($_SESSION['access'])
|
||||||
|| isset ($_SESSION['skipVisit']))
|
|| isset ($_SESSION['skipVisit'])
|
||||||
|
|| !isset ($_SERVER['HTTP_USER_AGENT']))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
$agent = $_SERVER['HTTP_USER_AGENT'];
|
$agent = $_SERVER['HTTP_USER_AGENT'];
|
||||||
|
|
Loading…
Reference in New Issue