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

View File

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

View File

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

View File

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

View File

@ -6,26 +6,21 @@
<vn-param id="address" on-changed="onAddressChange"/> <vn-param id="address" on-changed="onAddressChange"/>
<db-form id="defaults" on-ready="onValuesReady"> <db-form id="defaults" on-ready="onValuesReady">
<db-model property="model"> <db-model property="model">
<custom> SELECT deliveryMethod, agencyModeFk, addressFk
SELECT delivery_method, agency_id, address_id FROM myBasketDefaults
FROM basket_defaults
</custom>
</db-model> </db-model>
</db-form> </db-form>
<db-form id="order-form" on-ready="onValuesReady"> <db-form id="order-form" on-ready="onValuesReady">
<db-model property="model"> <db-model property="model">
<custom> SELECT m.code deliveryMethod, o.sent, o.agencyModeFk, o.addressFk
SELECT v.code delivery_method, o.date_send, o.agency_id, o.address_id FROM myBasket o
FROM basket o JOIN vn.deliveryMethod m ON m.id = o.deliveryMethodFk
JOIN vn2008.Vistas v ON o.delivery_method_id = v.vista_id
</custom>
</db-model> </db-model>
</db-form> </db-form>
<db-model id="agencies" <db-model id="agencies"
auto-load="false" auto-load="false"
result-index="1" result-index="1"
on-status-changed="onAgenciesReady"> on-status-changed="onAgenciesReady">
<custom>
CALL vn.agencyListAvailable (#date, #address); CALL vn.agencyListAvailable (#date, #address);
SELECT DISTINCT m.id, m.description SELECT DISTINCT m.id, m.description
FROM tmp.agencyAvailable a FROM tmp.agencyAvailable a
@ -36,7 +31,6 @@
WHERE d.code IN ('AGENCY', 'DELIVERY') WHERE d.code IN ('AGENCY', 'DELIVERY')
ORDER BY m.description; ORDER BY m.description;
DROP TEMPORARY TABLE tmp.agencyAvailable; DROP TEMPORARY TABLE tmp.agencyAvailable;
</custom>
<sql-batch property="batch"> <sql-batch property="batch">
<custom> <custom>
<item name="address" param="address"/> <item name="address" param="address"/>
@ -48,7 +42,6 @@
auto-load="false" auto-load="false"
result-index="1" result-index="1"
on-status-changed="onWarehousesReady"> on-status-changed="onWarehousesReady">
<custom>
CALL vn.agencyListAvailable (#date, #address); CALL vn.agencyListAvailable (#date, #address);
SELECT DISTINCT m.id, m.description SELECT DISTINCT m.id, m.description
FROM tmp.agencyAvailable a FROM tmp.agencyAvailable a
@ -59,7 +52,6 @@
WHERE d.code IN ('PICKUP') WHERE d.code IN ('PICKUP')
ORDER BY m.description; ORDER BY m.description;
DROP TEMPORARY TABLE tmp.agencyAvailable; DROP TEMPORARY TABLE tmp.agencyAvailable;
</custom>
<sql-batch property="batch"> <sql-batch property="batch">
<custom> <custom>
<item name="address" param="address"/> <item name="address" param="address"/>
@ -124,13 +116,11 @@
on-change="onAddressChange" on-change="onAddressChange"
renderer="addressRenderer"> renderer="addressRenderer">
<db-model property="model" id="addresses"> <db-model property="model" id="addresses">
<custom>
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
</custom>
</db-model> </db-model>
<custom> <custom>
<div class="address" id="address"> <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').mode = Db.Model.Mode.ON_DEMAND;
this.$('model').setDefault ('userFk', 'news', this.$('model').setDefault ('userFk', 'news',
new Sql.Function ({schema: 'account', name: 'userGetId'})); new Sql.Function ({schema: 'account', name: 'myUserGetId'}));
tinymce.init ({ tinymce.init ({
mode : 'exact' mode : 'exact'

View File

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

View File

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

View File

@ -14,7 +14,7 @@ class ChangePassword extends Vn\Web\JsonRequest
$newPassword = $_REQUEST['newPassword']; $newPassword = $_REQUEST['newPassword'];
$oldPassword = $_REQUEST['oldPassword']; $oldPassword = $_REQUEST['oldPassword'];
$db->query ('CALL account.userChangePassword (#, #)', $db->query ('CALL account.myUserChangePassword (#, #)',
[$oldPassword, $newPassword]); [$oldPassword, $newPassword]);
Account::sync ($db, $_SESSION['user'], $newPassword); Account::sync ($db, $_SESSION['user'], $newPassword);
return TRUE; 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 FROM config c
JOIN invoice_view i JOIN invoice_view i
WHERE i.invoice_id = #invoice WHERE i.invoice_id = #invoice

View File

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

View File

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

View File

@ -64,9 +64,9 @@ class RestService extends Service
} }
if ($method::SECURITY == Security::DEFINER) 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; return $res;
} }

View File

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