0
1
Fork 0

#4365 Fixes & refactor

This commit is contained in:
Juan Ferrer 2022-10-05 10:49:54 +02:00
parent bf5ad50f94
commit 1e514ab12a
7 changed files with 19 additions and 23 deletions

2
debian/changelog vendored
View File

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

View File

@ -1,6 +1,5 @@
Hedera.AddressList = new Class Hedera.AddressList = new Class({
({
Extends: Hedera.Form Extends: Hedera.Form
,activate: function() { ,activate: function() {

View File

@ -2,20 +2,16 @@
<vn-group> <vn-group>
<db-form id="user-form"> <db-form id="user-form">
<db-model property="model" id="user-model" updatable="true"> <db-model property="model" id="user-model" updatable="true">
<custom> SELECT id, defaultAddressFk
SELECT id, defaultAddressFk FROM myClient c
FROM myClient c
</custom>
</db-model> </db-model>
</db-form> </db-form>
<db-model id="addresses" updatable="true"> <db-model id="addresses" updatable="true">
<custom> SELECT a.id, a.nickname, p.name province, a.postalCode,
SELECT a.id, a.nickname, p.name province, a.postalCode, a.city, a.street, a.isActive
a.city, a.street, a.isActive FROM myAddress a
FROM myAddress a LEFT JOIN vn.province p ON p.id = a.provinceFk
LEFT JOIN vn.province p ON p.id = a.provinceFk WHERE a.isActive
WHERE a.isActive
</custom>
</db-model> </db-model>
</vn-group> </vn-group>
<div id="title"> <div id="title">

View File

@ -118,9 +118,9 @@
<db-model property="model" id="addresses"> <db-model property="model" id="addresses">
SELECT a.id, a.nickname, p.name province, a.city, a.street, a.isActive, c.country SELECT a.id, a.nickname, p.name province, a.city, a.street, a.isActive, c.country
FROM myAddress a FROM myAddress a
LEFT JOIN vn.province p ON p.id = a.provinceFk LEFT JOIN vn.province p ON p.id = a.provinceFk
JOIN vn.country c ON c.id = p.countryFk JOIN vn.country c ON c.id = p.countryFk
WHERE a.isActive WHERE a.isActive
</db-model> </db-model>
<custom> <custom>
<div <div

View File

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

View File

@ -3,6 +3,7 @@
namespace Vn\Web; namespace Vn\Web;
use Vn\Lib; use Vn\Lib;
use Vn\Lib\Locale;
/** /**
* Base class for JSON application. * Base class for JSON application.
@ -50,7 +51,7 @@ class JsonService extends RestService {
if (_ENABLE_DEBUG || $errno & $eUser) if (_ENABLE_DEBUG || $errno & $eUser)
$json->message = $message; $json->message = $message;
else else
$json->message = \s('Something went wrong'); $json->message = s('Something went wrong');
if (_ENABLE_DEBUG) { if (_ENABLE_DEBUG) {
$json->code = $errno; $json->code = $errno;
@ -80,7 +81,7 @@ class JsonService extends RestService {
$json->message = $e->getMessage(); $json->message = $e->getMessage();
} else { } else {
$json->exception = 'Exception'; $json->exception = 'Exception';
$json->message = \s('Something went wrong'); $json->message = s('Something went wrong');
} }
if (_ENABLE_DEBUG) { if (_ENABLE_DEBUG) {

View File

@ -34,7 +34,7 @@ class RestService extends Service {
$isAuthorized = $db->getValue('SELECT myUser_checkRestPriv(#)', $isAuthorized = $db->getValue('SELECT myUser_checkRestPriv(#)',
[$_REQUEST['method']]); [$_REQUEST['method']]);
if (!$isAuthorized) if (!$isAuthorized)
throw new ForbiddenException(\s('You don\'t have enough privileges')); throw new ForbiddenException(s('You don\'t have enough privileges'));
if ($method::SECURITY == Security::DEFINER) { if ($method::SECURITY == Security::DEFINER) {
$methodDb = $db; $methodDb = $db;
@ -42,7 +42,7 @@ class RestService extends Service {
$methodDb = $this->getUserDb($_SESSION['user']); $methodDb = $this->getUserDb($_SESSION['user']);
if ($method::PARAMS !== NULL && !$method->checkParams($_REQUEST, $method::PARAMS)) if ($method::PARAMS !== NULL && !$method->checkParams($_REQUEST, $method::PARAMS))
throw new UserException (\s('Missing parameters')); throw new UserException (s('Missing parameters'));
Locale::addPath('rest/'. dirname($_REQUEST['method'])); Locale::addPath('rest/'. dirname($_REQUEST['method']));
@ -52,7 +52,7 @@ class RestService extends Service {
$res = $method->run($methodDb); $res = $method->run($methodDb);
} catch (Db\Exception $e) { } catch (Db\Exception $e) {
if ($e->getCode() == 1644) if ($e->getCode() == 1644)
throw new UserException(\s($e->getMessage())); throw new UserException(s($e->getMessage()));
} }
if ($method::SECURITY == Security::DEFINER) if ($method::SECURITY == Security::DEFINER)