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. * Initial Release.

View File

@ -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)

View File

@ -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>

View File

@ -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": {

View File

@ -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;
} }

View File

@ -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'];