Refactor
This commit is contained in:
parent
726b22dc73
commit
372bb33909
|
@ -1,4 +1,4 @@
|
|||
hedera-web (1.405.54) stable; urgency=low
|
||||
hedera-web (1.405.55) stable; urgency=low
|
||||
|
||||
* Initial Release.
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
<htk-combo id="schema">
|
||||
<db-model property="model">
|
||||
<custom>
|
||||
SELECT name, `desc` FROM image_schema ORDER BY `desc`
|
||||
SELECT name, `desc` FROM imageCollection ORDER BY `desc`
|
||||
</custom>
|
||||
</db-model>
|
||||
</htk-combo>
|
||||
|
|
|
@ -14,9 +14,9 @@
|
|||
<htk-repeater form-id="new">
|
||||
<db-model property="model">
|
||||
<custom>
|
||||
SELECT title, date_time, text, image, id FROM news
|
||||
SELECT title, text, image, id FROM news
|
||||
WHERE tag != 'course'
|
||||
ORDER BY priority, date_time DESC
|
||||
ORDER BY priority, created DESC
|
||||
</custom>
|
||||
</db-model>
|
||||
<custom>
|
||||
|
@ -24,11 +24,6 @@
|
|||
<div class="new">
|
||||
<div class="top">
|
||||
<h2><htk-text form="new" column="title"/></h2>
|
||||
<!--
|
||||
<p class="new-info">
|
||||
<htk-text format="_%a, %e %b %Y" form="new" column="date_time"/>
|
||||
</p>
|
||||
-->
|
||||
<div class="new-text">
|
||||
<htk-html form="new" column="text"/>
|
||||
</div>
|
||||
|
|
|
@ -7,9 +7,9 @@
|
|||
<htk-repeater form-id="new">
|
||||
<db-model property="model">
|
||||
<custom>
|
||||
SELECT title, date_time, text, image, id FROM news
|
||||
SELECT title, created, text, image, id FROM news
|
||||
WHERE tag = 'course'
|
||||
ORDER BY priority, date_time DESC
|
||||
ORDER BY priority, created DESC
|
||||
</custom>
|
||||
</db-model>
|
||||
<custom>
|
||||
|
@ -18,7 +18,7 @@
|
|||
<div class="top">
|
||||
<h2><htk-text form="new" column="title"/></h2>
|
||||
<p class="new-info">
|
||||
<htk-text format="_%a, %e %b %Y" form="new" column="date_time"/>
|
||||
<htk-text format="_%a, %e %b %Y" form="new" column="created"/>
|
||||
</p>
|
||||
<div class="new-text">
|
||||
<htk-html form="new" column="text"/>
|
||||
|
|
|
@ -11,7 +11,7 @@ Hedera.New = new Class
|
|||
,activate: function ()
|
||||
{
|
||||
this.$('model').mode = Db.Model.Mode.ON_DEMAND;
|
||||
this.$('model').setDefault ('user_id', 'news',
|
||||
this.$('model').setDefault ('userFk', 'news',
|
||||
new Sql.Function ({schema: 'account', name: 'userGetId'}));
|
||||
|
||||
tinymce.init ({
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
<htk-combo form="iter" column="tag">
|
||||
<db-model property="model">
|
||||
<custom>
|
||||
SELECT name, description FROM news_tag
|
||||
SELECT name, description FROM newsTag
|
||||
ORDER BY description
|
||||
</custom>
|
||||
</db-model>
|
||||
|
|
|
@ -15,8 +15,8 @@
|
|||
<custom>
|
||||
SELECT n.id, u.nickname, priority, image, title
|
||||
FROM news n
|
||||
JOIN account.user u ON u.id = n.user_id
|
||||
ORDER BY priority, n.date_time DESC
|
||||
JOIN account.user u ON u.id = n.userFk
|
||||
ORDER BY priority, n.created DESC
|
||||
</custom>
|
||||
</db-model>
|
||||
<custom>
|
||||
|
|
|
@ -56,7 +56,8 @@ module.exports = new Class
|
|||
this.$('social-bar').conn = this._conn;
|
||||
|
||||
var sql = 'SELECT nickname FROM account.userView;'
|
||||
+'SELECT default_form, image_dir, image_host FROM config;'
|
||||
+'SELECT default_form, image_host FROM config;'
|
||||
+'SELECT url FROM imageConfig;'
|
||||
+'SELECT production_domain, test_domain FROM config;';
|
||||
this._conn.execQuery (sql, this.onMainQueryDone.bind (this));
|
||||
|
||||
|
@ -147,6 +148,10 @@ module.exports = new Class
|
|||
|
||||
// Retrieving configuration parameters
|
||||
|
||||
Vn.Config.imageUrl = resultSet.fetchValue ();
|
||||
|
||||
// Retrieving configuration parameters
|
||||
|
||||
var res = resultSet.fetchResult ();
|
||||
|
||||
if (res.next () && res.get ('test_domain'))
|
||||
|
@ -175,7 +180,7 @@ module.exports = new Class
|
|||
|
||||
,loadMenu: function ()
|
||||
{
|
||||
var sql = 'CALL formList ()';
|
||||
var sql = 'SELECT * FROM myMenu';
|
||||
this._conn.execQuery (sql, this._onMenuLoad.bind (this));
|
||||
}
|
||||
|
||||
|
@ -189,7 +194,7 @@ module.exports = new Class
|
|||
if (res)
|
||||
for (var i = 0; res.next (); i++)
|
||||
{
|
||||
var parent = res.get ('parent');
|
||||
var parent = res.get ('parentFk');
|
||||
|
||||
if (!sectionMap[parent])
|
||||
sectionMap[parent] = [];
|
||||
|
|
|
@ -81,9 +81,9 @@ module.exports = new Class
|
|||
var batch = new Sql.Batch ();
|
||||
batch.addValue ('transaction', parseInt (this.tpvOrder));
|
||||
|
||||
var query = 'SELECT t.amount, m.company_id '
|
||||
var query = 'SELECT t.amount, m.companyFk '
|
||||
+'FROM tpv_transaction_view t '
|
||||
+'JOIN tpv_merchant m ON t.merchant_id = m.id '
|
||||
+'JOIN tpvMerchant m ON m.id = t.merchant_id '
|
||||
+'WHERE t.id = #transaction';
|
||||
this.conn.execQuery (query,
|
||||
this._onRetryPayDone.bind (this), batch);
|
||||
|
@ -94,7 +94,7 @@ module.exports = new Class
|
|||
var res = resultSet.fetchResult ();
|
||||
|
||||
if (res.next ())
|
||||
this._realPay (res.get ('amount'), res.get ('company_id'));
|
||||
this._realPay (res.get ('amount'), res.get ('companyFk'));
|
||||
else
|
||||
Htk.Toast.showError (_('AmountError'));
|
||||
}
|
||||
|
|
|
@ -131,7 +131,7 @@ module.exports = new Class
|
|||
|
||||
,_makeSrc: function (subdir)
|
||||
{
|
||||
var src = Vn.Config['image_dir'] +'/';
|
||||
var src = Vn.Config.imageUrl +'/';
|
||||
|
||||
if (this._directory)
|
||||
src += this._directory +'/';
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "hedera-web",
|
||||
"version": "1.405.54",
|
||||
"version": "1.405.55",
|
||||
"description": "Verdnatura web page",
|
||||
"license": "GPL-3.0",
|
||||
"repository": {
|
||||
|
|
|
@ -34,16 +34,16 @@ class Query extends Vn\Web\JsonRequest
|
|||
if ($db->checkWarnings ()
|
||||
&& ($result = $db->query ('SHOW WARNINGS')))
|
||||
{
|
||||
$sql = 'SELECT description, @warn code '.
|
||||
'FROM sql_message WHERE code = @warn';
|
||||
$sql = 'SELECT `description`, @warn `code`
|
||||
FROM `message` WHERE `code` = @warn';
|
||||
|
||||
while ($row = $result->fetch_assoc ())
|
||||
while ($row = $result->fetch_object ())
|
||||
{
|
||||
if ($row['Code'] == 1265
|
||||
&& ($warning = $db->getRow ($sql)))
|
||||
trigger_error ("{$warning['code']}: {$warning['description']}", E_USER_WARNING);
|
||||
if ($row->Code == 1265
|
||||
&& ($warning = $db->getObject ($sql)))
|
||||
trigger_error ("{$warning->code}: {$warning->description}", E_USER_WARNING);
|
||||
else
|
||||
trigger_error ("{$row['Code']}: {$row['Message']}", E_USER_WARNING);
|
||||
trigger_error ("{$row->Code}: {$row->Message}", E_USER_WARNING);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -56,7 +56,7 @@ class Query extends Vn\Web\JsonRequest
|
|||
if ($e->getCode () == 1644)
|
||||
{
|
||||
$dbMessage = $e->getMessage ();
|
||||
$sql = 'SELECT description FROM sql_message WHERE code = #';
|
||||
$sql = 'SELECT `description` FROM `message` WHERE `code` = #';
|
||||
$message = $db->getValue ($sql, [$dbMessage]);
|
||||
|
||||
if ($message)
|
||||
|
|
|
@ -14,10 +14,10 @@ require_once (__DIR__.'/lib.php');
|
|||
class Resize extends Vn\Lib\Method
|
||||
{
|
||||
const PARAMS = [
|
||||
'src_dir'
|
||||
,'dst_dir'
|
||||
,'max_height'
|
||||
,'max_Width'
|
||||
'srcDir'
|
||||
,'dstDir'
|
||||
,'maxHeight'
|
||||
,'maxWidth'
|
||||
,'rewrite'
|
||||
,'crop'
|
||||
,'symbolic'
|
||||
|
@ -28,13 +28,13 @@ class Resize extends Vn\Lib\Method
|
|||
|
||||
$options = getopt ('', $params);
|
||||
|
||||
if (!$this->checkParams ($options, self::PARAMS)
|
||||
if (!$this->checkParams ($options, self::PARAMS))
|
||||
$this->usage ();
|
||||
|
||||
$srcDir = $options['src_dir'];
|
||||
$dstDir = $options['dst_dir'];
|
||||
$maxHeight = $options['max_height'];
|
||||
$maxWidth = $options['max_Width'];
|
||||
$srcDir = $options['srcDir'];
|
||||
$dstDir = $options['dstDir'];
|
||||
$maxHeight = $options['maxHeight'];
|
||||
$maxWidth = $options['maxWidth'];
|
||||
$rewrite = isset ($options['rewrite']);
|
||||
$crop = isset ($options['crop']);
|
||||
$symbolic = isset ($options['symbolic']);
|
||||
|
|
|
@ -52,8 +52,8 @@ class Thumb extends Vn\Web\RestRequest
|
|||
|
||||
$row = $db->getValue (
|
||||
'SELECT crop
|
||||
FROM image_schema s
|
||||
JOIN image_schema_size z ON z.image_schema_id = s.id
|
||||
FROM imageCollection s
|
||||
JOIN imageCollectionSize z ON z.collectionFk = s.id
|
||||
WHERE s.name = #schema
|
||||
AND z.width = #width
|
||||
AND z.height = #height'
|
||||
|
|
|
@ -86,7 +86,7 @@ class Upload extends Vn\Web\JsonRequest
|
|||
$symbolicSrc = "../full/$fileName";
|
||||
|
||||
$image = Image::create ($tmpName);
|
||||
Image::resizeSave ($image, $fullFile, $info['max_height'], $info['max_width']);
|
||||
Image::resizeSave ($image, $fullFile, $info['maxHeight'], $info['maxWidth']);
|
||||
|
||||
foreach ($info['sizes'] as $size => $i)
|
||||
{
|
||||
|
|
|
@ -26,8 +26,8 @@ class Util
|
|||
$db = $this->app->getSysConn ();
|
||||
|
||||
$info = $db->getRow (
|
||||
'SELECT id, max_width, max_height, `schema`, `table`, `column`
|
||||
FROM image_schema WHERE name = #schema'
|
||||
'SELECT id, maxWidth, maxHeight, `schema`, `table`, `column`
|
||||
FROM imageCollection WHERE name = #schema'
|
||||
,['schema' => $schema]
|
||||
);
|
||||
|
||||
|
@ -36,7 +36,7 @@ class Util
|
|||
|
||||
$res = $db->query (
|
||||
'SELECT width, height, crop
|
||||
FROM image_schema_size WHERE image_schema_id = #id'
|
||||
FROM imageCollectionSize WHERE collectionFk = #id'
|
||||
,['id' => $info['id']]
|
||||
);
|
||||
|
||||
|
|
|
@ -31,32 +31,32 @@ class Contact extends Vn\Web\JsonRequest
|
|||
//$db->queryFromFile (__DIR__.'/contact', $_REQUEST);
|
||||
//$customerId = $db->getValue ('SELECT @id');
|
||||
|
||||
$conf = $db->getRow (
|
||||
$conf = $db->getObject (
|
||||
'SELECT m.host, m.port, m.secure, m.sender, m.user, m.password, c.recipient
|
||||
FROM mail_config m JOIN contact c'
|
||||
FROM mailConfig m JOIN contact c'
|
||||
);
|
||||
|
||||
$mail = new PHPMailer ();
|
||||
$mail->isSMTP ();
|
||||
$mail->Host = $conf['host'];
|
||||
$mail->Host = $conf->host;
|
||||
|
||||
if (!empty ($conf['user']))
|
||||
if (!empty ($conf->user))
|
||||
{
|
||||
$mail->SMTPAuth = TRUE;
|
||||
$mail->Username = $conf['user'];
|
||||
$mail->Password = base64_decode ($conf['password']);
|
||||
$mail->Username = $conf->user;
|
||||
$mail->Password = base64_decode ($conf->password);
|
||||
}
|
||||
else
|
||||
$mail->SMTPAuth = FALSE;
|
||||
|
||||
if ($conf['secure'])
|
||||
if ($conf->secure)
|
||||
{
|
||||
$mail->SMTPSecure = 'ssl';
|
||||
$mail->Port = 465;
|
||||
}
|
||||
|
||||
$mail->setFrom ($conf['sender'], 'Web');
|
||||
$mail->addAddress ($conf['recipient']);
|
||||
$mail->setFrom ($conf->sender, 'Web');
|
||||
$mail->addAddress ($conf->recipient);
|
||||
$mail->isHTML (TRUE);
|
||||
$mail->Subject = s('New customer request');
|
||||
$mail->Body = '<pre>'. print_r ($_REQUEST, TRUE) .'</pre>';
|
||||
|
|
|
@ -7,7 +7,7 @@ class Production extends Vn\Web\JsonRequest
|
|||
function run ($db)
|
||||
{
|
||||
$row = $db->getObject (
|
||||
'SELECT displayText FROM production WHERE deviceId = #',
|
||||
'SELECT displayText FROM vn.routeGate WHERE deviceId = #',
|
||||
[$_REQUEST['deviceId']]
|
||||
);
|
||||
|
||||
|
|
|
@ -10,17 +10,17 @@ class ConfirmMail extends Vn\Lib\Method
|
|||
function run ($db)
|
||||
{
|
||||
$imap = NULL;
|
||||
$imapConf = $db->getRow (
|
||||
'SELECT host, user, pass, clean_period, success_folder, error_folder
|
||||
FROM tpv_imap_config'
|
||||
$imapConf = $db->getObject (
|
||||
'SELECT host, user, pass, cleanPeriod, successFolder, errorFolder
|
||||
FROM tpvImapConfig'
|
||||
);
|
||||
|
||||
$mailbox = sprintf ('{%s/imap/ssl/novalidate-cert}',
|
||||
$imapConf['host']);
|
||||
$imapConf->host);
|
||||
|
||||
$imap = imap_open ($mailbox
|
||||
,$imapConf['user']
|
||||
,base64_decode ($imapConf['pass'])
|
||||
,$imapConf->user
|
||||
,base64_decode ($imapConf->pass)
|
||||
);
|
||||
|
||||
if (!$imap)
|
||||
|
@ -61,9 +61,9 @@ class ConfirmMail extends Vn\Lib\Method
|
|||
// Moves the processed mail to another folder
|
||||
|
||||
if ($success)
|
||||
$folder = $imapConf['success_folder'];
|
||||
$folder = $imapConf->successFolder;
|
||||
else
|
||||
$folder = $imapConf['error_folder'];
|
||||
$folder = $imapConf->errorFolder;
|
||||
|
||||
if (!imap_mail_move ($imap, $msg, "$folder"))
|
||||
trigger_error (imap_last_error (), E_USER_WARNING);
|
||||
|
@ -80,12 +80,12 @@ class ConfirmMail extends Vn\Lib\Method
|
|||
if (rand (1, 20) == 1)
|
||||
{
|
||||
$folders = array (
|
||||
$imapConf['success_folder']
|
||||
,$imapConf['error_folder']
|
||||
$imapConf->successFolder
|
||||
,$imapConf->errorFolder
|
||||
);
|
||||
|
||||
$date = new \DateTime (NULL);
|
||||
$date->sub (new \DateInterval ($imapConf['clean_period']));
|
||||
$date->sub (new \DateInterval ($imapConf->cleanPeriod));
|
||||
$filter = sprintf ('BEFORE "%s"', $date->format('D, j M Y'));
|
||||
|
||||
foreach ($folders as $folder)
|
||||
|
|
|
@ -50,7 +50,7 @@ function procesaNotificacionSIS ($XML)
|
|||
$shaString = substr ($requestString, $start, $end - $start + 10);
|
||||
|
||||
$key = $db->getValue (
|
||||
'SELECT secret_key FROM tpv_merchant WHERE id = #'
|
||||
'SELECT secretKey FROM tpvMerchant WHERE id = #'
|
||||
,[$params['Ds_MerchantCode']]
|
||||
);
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ if (lang == null)
|
|||
process.exit(1);
|
||||
}
|
||||
|
||||
let nDirs;
|
||||
let nTasks;
|
||||
let projectDir;
|
||||
|
||||
fs.remove(lang, () => {
|
||||
|
@ -21,8 +21,6 @@ fs.remove(lang, () => {
|
|||
let len = projectDir.length + 1;
|
||||
|
||||
glob(`${projectDir}/**/locale/`, (err, localeDirs) => {
|
||||
nDirs = localeDirs.length * 2;
|
||||
|
||||
for (let localeDir of localeDirs) {
|
||||
localeDir = localeDir.substr(len)
|
||||
|
||||
|
@ -31,7 +29,9 @@ fs.remove(lang, () => {
|
|||
|
||||
exportLocale(localeDir);
|
||||
}
|
||||
})
|
||||
|
||||
nTasks = localeDirs.length;
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -40,7 +40,8 @@ function exportLocale (localeDir) {
|
|||
|
||||
fs.mkdirp(dstDir, err => {
|
||||
if (err) {
|
||||
onError(err);
|
||||
console.log(err);
|
||||
onTaskEnd();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -48,28 +49,26 @@ function exportLocale (localeDir) {
|
|||
|
||||
src = `${projectDir}/${localeDir}/en.json`;
|
||||
dst = `${dstDir}/en.json`;
|
||||
fs.copy(src, dst, onDirEnd);
|
||||
fs.copy(src, dst, onTaskEnd);
|
||||
|
||||
src = `${projectDir}/${localeDir}/${lang}.json`;
|
||||
dst = `${dstDir}/${lang}.json`;
|
||||
fs.copy(src, dst, onDirEnd);
|
||||
});
|
||||
}
|
||||
fs.copy(src, dst, onTaskEnd);
|
||||
|
||||
function onError (err) {
|
||||
console.log(err);
|
||||
onDirEnd();
|
||||
nTasks += 2;
|
||||
onTaskEnd();
|
||||
});
|
||||
}
|
||||
|
||||
let output;
|
||||
let archive;
|
||||
|
||||
function onDirEnd() {
|
||||
nDirs--;
|
||||
if (nDirs > 0) return;
|
||||
function onTaskEnd() {
|
||||
nTasks--;
|
||||
if (nTasks > 0) return;
|
||||
|
||||
output = fs.createWriteStream(`${lang}.zip`);
|
||||
output.on ('close', onArchiveEnd);
|
||||
output.on ('close', onArchiveClose);
|
||||
|
||||
archive = archiver('zip', {
|
||||
zlib: { level: 9 }
|
||||
|
@ -82,7 +81,7 @@ function onDirEnd() {
|
|||
archive.finalize();
|
||||
}
|
||||
|
||||
function onArchiveEnd() {
|
||||
function onArchiveClose() {
|
||||
fs.remove(lang);
|
||||
console.log ('Export finalized!');
|
||||
}
|
||||
|
|
|
@ -13,8 +13,8 @@ class Mailer
|
|||
function __construct ($db)
|
||||
{
|
||||
$this->conf = $db->getObject (
|
||||
'SELECT host, port, secure, sender, sender_name, user, password
|
||||
FROM hedera.mail_config'
|
||||
'SELECT host, port, secure, sender, senderName, user, password
|
||||
FROM hedera.mailConfig'
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -41,7 +41,7 @@ class Mailer
|
|||
$mail->Port = 465;
|
||||
}
|
||||
|
||||
$mail->setFrom ($conf->sender, $conf->sender_name);
|
||||
$mail->setFrom ($conf->sender, $conf->senderName);
|
||||
$mail->IsHTML (TRUE);
|
||||
$mail->Subject = $subject;
|
||||
$mail->Body = $body;
|
||||
|
|
Loading…
Reference in New Issue