SMS bugs solved, refactor

This commit is contained in:
Juan Ferrer Toribio 2017-12-13 19:28:54 +01:00
parent 95a8efb8cf
commit 719c062eef
6 changed files with 26 additions and 30 deletions

2
debian/changelog vendored
View File

@ -1,4 +1,4 @@
hedera-web (1.405.46) stable; urgency=low
hedera-web (1.405.47) stable; urgency=low
* Initial Release.

View File

@ -303,7 +303,7 @@ Hedera.Catalog = new Class
{
var sql = '';
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;
for (var warehouse in this.items)

View File

@ -25,7 +25,7 @@
</db-form>
<db-query id="confirm-query" on-ready="onConfirm">
<custom>
CALL basket_confirm ()
CALL basketConfirm
</custom>
</db-query>
</vn-group>

View File

@ -1,6 +1,6 @@
{
"name": "hedera-web",
"version": "1.405.46",
"version": "1.405.47",
"description": "Verdnatura web page",
"license": "GPL-3.0",
"repository": {

View File

@ -11,39 +11,34 @@ class Sms extends Vn\Web\JsonRequest
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 (
$smsConfig['user']
,$smsConfig['password']
,$smsConfig['title']
$smsConfig->user
,$smsConfig->password
,$smsConfig->title
,$_REQUEST['to']
,$_REQUEST['text']
);
$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 {
$sms = $xmlResponse->sms;
$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);
}
if ($sms->codigo != 0)
throw new Lib\UserException ($res->descripcion);
return TRUE;
}

View File

@ -87,7 +87,8 @@ abstract class Service
if (isset ($_COOKIE['PHPSESSID'])
|| isset ($_SESSION['access'])
|| isset ($_SESSION['skipVisit']))
|| isset ($_SESSION['skipVisit'])
|| !isset ($_SERVER['HTTP_USER_AGENT']))
return;
$agent = $_SERVER['HTTP_USER_AGENT'];