SQL lowerCase refactor

This commit is contained in:
Juan 2018-05-11 11:25:10 +02:00
parent 2f1c31fa74
commit 87237ed366
14 changed files with 58 additions and 67 deletions

2
debian/changelog vendored
View File

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

View File

@ -7,7 +7,7 @@ Hedera.Address = new Class
{
this.$('model').setInfo ('a', 'myAddress', 'hedera', ['id'], 'id');
this.$('model').setDefault ('clientFk', 'a',
new Sql.Function ({schema: 'account', name: 'userGetId'}));
new Sql.Function ({schema: 'account', name: 'myUserGetId'}));
}
,onStatusChange: function (form)

View File

@ -13,7 +13,7 @@
<custom>
SELECT u.id, u.name, u.email, u.recoverPass,
u.nickname, u.lang, c.isToBeMailed, c.id clientFk
FROM account.userView u
FROM account.myUser u
LEFT JOIN myClient c
ON u.id = c.id
</custom>

View File

@ -24,7 +24,7 @@ Hedera.Checkout = new Class
if (orderForm.numRows > 0)
{
var i = orderForm;
date = i.get ('date_send');
date = i.get ('sent');
}
else
var i = defaultsForm;
@ -33,14 +33,14 @@ Hedera.Checkout = new Class
{
date = new Date ();
if (i.get('delivery_method') != 'PICKUP')
if (i.get('deliveryMethod') != 'PICKUP')
date.setTime (date.getTime () + 86400000);
}
this.$('date').value = date;
this.$('method').value = i.get ('delivery_method');
this.$('agency').value = i.get ('agency_id');
this.$('address').value = i.get ('address_id');
this.$('method').value = i.get ('deliveryMethod');
this.$('agency').value = i.get ('agencyModeFk');
this.$('address').value = i.get ('addressFk');
this.autoStepLocked = false;
}

View File

@ -6,37 +6,31 @@
<vn-param id="address" on-changed="onAddressChange"/>
<db-form id="defaults" on-ready="onValuesReady">
<db-model property="model">
<custom>
SELECT delivery_method, agency_id, address_id
FROM basket_defaults
</custom>
SELECT deliveryMethod, agencyModeFk, addressFk
FROM myBasketDefaults
</db-model>
</db-form>
<db-form id="order-form" on-ready="onValuesReady">
<db-model property="model">
<custom>
SELECT v.code delivery_method, o.date_send, o.agency_id, o.address_id
FROM basket o
JOIN vn2008.Vistas v ON o.delivery_method_id = v.vista_id
</custom>
SELECT m.code deliveryMethod, o.sent, o.agencyModeFk, o.addressFk
FROM myBasket o
JOIN vn.deliveryMethod m ON m.id = o.deliveryMethodFk
</db-model>
</db-form>
<db-model id="agencies"
auto-load="false"
result-index="1"
on-status-changed="onAgenciesReady">
<custom>
CALL vn.agencyListAvailable (#date, #address);
SELECT DISTINCT m.id, m.description
FROM tmp.agencyAvailable a
JOIN vn.agencyMode m
ON m.agencyFk = a.agencyFk
JOIN vn.deliveryMethod d
ON d.id = m.deliveryMethodFk
WHERE d.code IN ('AGENCY', 'DELIVERY')
ORDER BY m.description;
DROP TEMPORARY TABLE tmp.agencyAvailable;
</custom>
CALL vn.agencyListAvailable (#date, #address);
SELECT DISTINCT m.id, m.description
FROM tmp.agencyAvailable a
JOIN vn.agencyMode m
ON m.agencyFk = a.agencyFk
JOIN vn.deliveryMethod d
ON d.id = m.deliveryMethodFk
WHERE d.code IN ('AGENCY', 'DELIVERY')
ORDER BY m.description;
DROP TEMPORARY TABLE tmp.agencyAvailable;
<sql-batch property="batch">
<custom>
<item name="address" param="address"/>
@ -48,18 +42,16 @@
auto-load="false"
result-index="1"
on-status-changed="onWarehousesReady">
<custom>
CALL vn.agencyListAvailable (#date, #address);
SELECT DISTINCT m.id, m.description
FROM tmp.agencyAvailable a
JOIN vn.agencyMode m
ON m.agencyFk = a.agencyFk
JOIN vn.deliveryMethod d
ON d.id = m.deliveryMethodFk
WHERE d.code IN ('PICKUP')
ORDER BY m.description;
DROP TEMPORARY TABLE tmp.agencyAvailable;
</custom>
CALL vn.agencyListAvailable (#date, #address);
SELECT DISTINCT m.id, m.description
FROM tmp.agencyAvailable a
JOIN vn.agencyMode m
ON m.agencyFk = a.agencyFk
JOIN vn.deliveryMethod d
ON d.id = m.deliveryMethodFk
WHERE d.code IN ('PICKUP')
ORDER BY m.description;
DROP TEMPORARY TABLE tmp.agencyAvailable;
<sql-batch property="batch">
<custom>
<item name="address" param="address"/>
@ -124,13 +116,11 @@
on-change="onAddressChange"
renderer="addressRenderer">
<db-model property="model" id="addresses">
<custom>
SELECT a.id, a.nickname, p.name province, a.city, a.street, a.isActive, c.country
FROM myAddress a
LEFT JOIN vn.province p ON p.id = a.provinceFk
JOIN vn.country c ON c.id = p.countryFk
WHERE a.isActive
</custom>
SELECT a.id, a.nickname, p.name province, a.city, a.street, a.isActive, c.country
FROM myAddress a
LEFT JOIN vn.province p ON p.id = a.provinceFk
JOIN vn.country c ON c.id = p.countryFk
WHERE a.isActive
</db-model>
<custom>
<div class="address" id="address">

View File

@ -12,7 +12,7 @@ Hedera.New = new Class
{
this.$('model').mode = Db.Model.Mode.ON_DEMAND;
this.$('model').setDefault ('userFk', 'news',
new Sql.Function ({schema: 'account', name: 'userGetId'}));
new Sql.Function ({schema: 'account', name: 'myUserGetId'}));
tinymce.init ({
mode : 'exact'

View File

@ -1,8 +1,9 @@
var Module = require ('./module');
var Css = require ('./gui.css');
var Tpl = require ('./gui.xml');
require ('./gui.css');
module.exports = new Class
({
Extends: Htk.Component,
@ -55,11 +56,11 @@ module.exports = new Class
this.$('social-bar').conn = this._conn;
var sql = 'SELECT nickname FROM account.userView;'
+'SELECT default_form FROM config;'
var sql = 'SELECT nickname FROM account.myUser;'
+'SELECT defaultForm FROM config;'
+'SELECT url FROM imageConfig;'
+'SELECT dbproduccion FROM vn2008.tblContadores;'
+'SELECT production_domain, test_domain FROM config;';
+'SELECT productionDomain, testDomain FROM config;';
this._conn.execQuery (sql, this.onMainQueryDone.bind (this));
this.loadMenu ();
@ -167,17 +168,17 @@ module.exports = new Class
var res = resultSet.fetchResult ();
if (res.next () && res.get ('test_domain'))
if (res.next () && res.get ('testDomain'))
{
if (location.host != res.get ('production_domain'))
if (location.host != res.get ('productionDomain'))
{
var linkText = 'Old website';
var linkField = 'production_domain';
var linkField = 'productionDomain';
}
else
{
var linkText = 'Test the new website';
var linkField = 'test_domain';
var linkField = 'testDomain';
}
Vn.Node.setText (this.$('test-link'), _(linkText));
@ -395,7 +396,7 @@ module.exports = new Class
var formPath = this.formParam.value;
if (!formPath)
formPath = Vn.Config['default_form'];
formPath = Vn.Config.defaultForm;
this.openForm (formPath,
this._onFormLoad.bind (this));
@ -548,7 +549,7 @@ module.exports = new Class
sessionStorage.setItem ('supplantUser', user);
this.loadMenu ();
var sql = 'SELECT nickname FROM account.userView';
var sql = 'SELECT nickname FROM account.myUser';
this._conn.execQuery (sql, this._onSupplantName.bind (this));
if (callback)

View File

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

View File

@ -14,7 +14,7 @@ class ChangePassword extends Vn\Web\JsonRequest
$newPassword = $_REQUEST['newPassword'];
$oldPassword = $_REQUEST['oldPassword'];
$db->query ('CALL account.userChangePassword (#, #)',
$db->query ('CALL account.myUserChangePassword (#, #)',
[$oldPassword, $newPassword]);
Account::sync ($db, $_SESSION['user'], $newPassword);
return TRUE;

View File

@ -1,5 +1,5 @@
SELECT CONCAT_WS('/', c.pdfs_dir, invoiceGetPath(#invoice))
SELECT CONCAT_WS('/', c.pdfsDir, invoiceGetPath(#invoice))
FROM config c
JOIN invoice_view i
WHERE i.invoice_id = #invoice

View File

@ -31,7 +31,7 @@ class Sms extends Vn\Web\JsonRequest
$db->query (
'INSERT INTO vn.sms SET
`senderFk` = account.userGetId(),
`senderFk` = account.myUserGetId(),
`destinationFk` = #,
`destination` = #,
`message` = #,

View File

@ -66,7 +66,7 @@ class HtmlService extends Service
// If enabled, requests the user to choose between two web versions
if (!isset ($_SESSION['skipVersionMenu'])
&& $db->getValue ('SELECT test_domain FROM config'))
&& $db->getValue ('SELECT testDomain FROM config'))
{
$_SESSION['skipVersionMenu'] = TRUE;
header ('Location: ?method=version-menu');

View File

@ -64,9 +64,9 @@ class RestService extends Service
}
if ($method::SECURITY == Security::DEFINER)
$methodDb->query ('CALL account.userLogout ()');
$methodDb->query ('CALL account.myUserLogout ()');
$db->query ('CALL account.userLogout ()');
$db->query ('CALL account.myUserLogout ()');
return $res;
}

View File

@ -196,7 +196,7 @@ abstract class Service
}
else
{
$user = $db->getValue ('SELECT guest_user FROM config');
$user = $db->getValue ('SELECT guestUser FROM config');
$anonymousUser = TRUE;
}