0
1
Fork 0
This commit is contained in:
Juan Ferrer Toribio 2017-12-20 12:34:04 +01:00
parent 726b22dc73
commit 372bb33909
22 changed files with 88 additions and 89 deletions

2
debian/changelog vendored
View File

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

View File

@ -9,7 +9,7 @@
<htk-combo id="schema"> <htk-combo id="schema">
<db-model property="model"> <db-model property="model">
<custom> <custom>
SELECT name, `desc` FROM image_schema ORDER BY `desc` SELECT name, `desc` FROM imageCollection ORDER BY `desc`
</custom> </custom>
</db-model> </db-model>
</htk-combo> </htk-combo>

View File

@ -14,9 +14,9 @@
<htk-repeater form-id="new"> <htk-repeater form-id="new">
<db-model property="model"> <db-model property="model">
<custom> <custom>
SELECT title, date_time, text, image, id FROM news SELECT title, text, image, id FROM news
WHERE tag != 'course' WHERE tag != 'course'
ORDER BY priority, date_time DESC ORDER BY priority, created DESC
</custom> </custom>
</db-model> </db-model>
<custom> <custom>
@ -24,11 +24,6 @@
<div class="new"> <div class="new">
<div class="top"> <div class="top">
<h2><htk-text form="new" column="title"/></h2> <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"> <div class="new-text">
<htk-html form="new" column="text"/> <htk-html form="new" column="text"/>
</div> </div>

View File

@ -7,9 +7,9 @@
<htk-repeater form-id="new"> <htk-repeater form-id="new">
<db-model property="model"> <db-model property="model">
<custom> <custom>
SELECT title, date_time, text, image, id FROM news SELECT title, created, text, image, id FROM news
WHERE tag = 'course' WHERE tag = 'course'
ORDER BY priority, date_time DESC ORDER BY priority, created DESC
</custom> </custom>
</db-model> </db-model>
<custom> <custom>
@ -18,7 +18,7 @@
<div class="top"> <div class="top">
<h2><htk-text form="new" column="title"/></h2> <h2><htk-text form="new" column="title"/></h2>
<p class="new-info"> <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> </p>
<div class="new-text"> <div class="new-text">
<htk-html form="new" column="text"/> <htk-html form="new" column="text"/>

View File

@ -11,7 +11,7 @@ Hedera.New = new Class
,activate: function () ,activate: function ()
{ {
this.$('model').mode = Db.Model.Mode.ON_DEMAND; 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'})); new Sql.Function ({schema: 'account', name: 'userGetId'}));
tinymce.init ({ tinymce.init ({

View File

@ -46,7 +46,7 @@
<htk-combo form="iter" column="tag"> <htk-combo form="iter" column="tag">
<db-model property="model"> <db-model property="model">
<custom> <custom>
SELECT name, description FROM news_tag SELECT name, description FROM newsTag
ORDER BY description ORDER BY description
</custom> </custom>
</db-model> </db-model>

View File

@ -15,8 +15,8 @@
<custom> <custom>
SELECT n.id, u.nickname, priority, image, title SELECT n.id, u.nickname, priority, image, title
FROM news n FROM news n
JOIN account.user u ON u.id = n.user_id JOIN account.user u ON u.id = n.userFk
ORDER BY priority, n.date_time DESC ORDER BY priority, n.created DESC
</custom> </custom>
</db-model> </db-model>
<custom> <custom>

View File

@ -56,7 +56,8 @@ 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.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;'; +'SELECT production_domain, test_domain FROM config;';
this._conn.execQuery (sql, this.onMainQueryDone.bind (this)); this._conn.execQuery (sql, this.onMainQueryDone.bind (this));
@ -147,6 +148,10 @@ module.exports = new Class
// Retrieving configuration parameters // Retrieving configuration parameters
Vn.Config.imageUrl = resultSet.fetchValue ();
// Retrieving configuration parameters
var res = resultSet.fetchResult (); var res = resultSet.fetchResult ();
if (res.next () && res.get ('test_domain')) if (res.next () && res.get ('test_domain'))
@ -175,7 +180,7 @@ module.exports = new Class
,loadMenu: function () ,loadMenu: function ()
{ {
var sql = 'CALL formList ()'; var sql = 'SELECT * FROM myMenu';
this._conn.execQuery (sql, this._onMenuLoad.bind (this)); this._conn.execQuery (sql, this._onMenuLoad.bind (this));
} }
@ -189,7 +194,7 @@ module.exports = new Class
if (res) if (res)
for (var i = 0; res.next (); i++) for (var i = 0; res.next (); i++)
{ {
var parent = res.get ('parent'); var parent = res.get ('parentFk');
if (!sectionMap[parent]) if (!sectionMap[parent])
sectionMap[parent] = []; sectionMap[parent] = [];

View File

@ -81,9 +81,9 @@ module.exports = new Class
var batch = new Sql.Batch (); var batch = new Sql.Batch ();
batch.addValue ('transaction', parseInt (this.tpvOrder)); 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 ' +'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'; +'WHERE t.id = #transaction';
this.conn.execQuery (query, this.conn.execQuery (query,
this._onRetryPayDone.bind (this), batch); this._onRetryPayDone.bind (this), batch);
@ -94,7 +94,7 @@ module.exports = new Class
var res = resultSet.fetchResult (); var res = resultSet.fetchResult ();
if (res.next ()) if (res.next ())
this._realPay (res.get ('amount'), res.get ('company_id')); this._realPay (res.get ('amount'), res.get ('companyFk'));
else else
Htk.Toast.showError (_('AmountError')); Htk.Toast.showError (_('AmountError'));
} }

View File

@ -131,7 +131,7 @@ module.exports = new Class
,_makeSrc: function (subdir) ,_makeSrc: function (subdir)
{ {
var src = Vn.Config['image_dir'] +'/'; var src = Vn.Config.imageUrl +'/';
if (this._directory) if (this._directory)
src += this._directory +'/'; src += this._directory +'/';

View File

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

View File

@ -34,16 +34,16 @@ class Query extends Vn\Web\JsonRequest
if ($db->checkWarnings () if ($db->checkWarnings ()
&& ($result = $db->query ('SHOW WARNINGS'))) && ($result = $db->query ('SHOW WARNINGS')))
{ {
$sql = 'SELECT description, @warn code '. $sql = 'SELECT `description`, @warn `code`
'FROM sql_message WHERE code = @warn'; FROM `message` WHERE `code` = @warn';
while ($row = $result->fetch_assoc ()) while ($row = $result->fetch_object ())
{ {
if ($row['Code'] == 1265 if ($row->Code == 1265
&& ($warning = $db->getRow ($sql))) && ($warning = $db->getObject ($sql)))
trigger_error ("{$warning['code']}: {$warning['description']}", E_USER_WARNING); trigger_error ("{$warning->code}: {$warning->description}", E_USER_WARNING);
else 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) if ($e->getCode () == 1644)
{ {
$dbMessage = $e->getMessage (); $dbMessage = $e->getMessage ();
$sql = 'SELECT description FROM sql_message WHERE code = #'; $sql = 'SELECT `description` FROM `message` WHERE `code` = #';
$message = $db->getValue ($sql, [$dbMessage]); $message = $db->getValue ($sql, [$dbMessage]);
if ($message) if ($message)

View File

@ -14,10 +14,10 @@ require_once (__DIR__.'/lib.php');
class Resize extends Vn\Lib\Method class Resize extends Vn\Lib\Method
{ {
const PARAMS = [ const PARAMS = [
'src_dir' 'srcDir'
,'dst_dir' ,'dstDir'
,'max_height' ,'maxHeight'
,'max_Width' ,'maxWidth'
,'rewrite' ,'rewrite'
,'crop' ,'crop'
,'symbolic' ,'symbolic'
@ -28,13 +28,13 @@ class Resize extends Vn\Lib\Method
$options = getopt ('', $params); $options = getopt ('', $params);
if (!$this->checkParams ($options, self::PARAMS) if (!$this->checkParams ($options, self::PARAMS))
$this->usage (); $this->usage ();
$srcDir = $options['src_dir']; $srcDir = $options['srcDir'];
$dstDir = $options['dst_dir']; $dstDir = $options['dstDir'];
$maxHeight = $options['max_height']; $maxHeight = $options['maxHeight'];
$maxWidth = $options['max_Width']; $maxWidth = $options['maxWidth'];
$rewrite = isset ($options['rewrite']); $rewrite = isset ($options['rewrite']);
$crop = isset ($options['crop']); $crop = isset ($options['crop']);
$symbolic = isset ($options['symbolic']); $symbolic = isset ($options['symbolic']);

View File

@ -52,8 +52,8 @@ class Thumb extends Vn\Web\RestRequest
$row = $db->getValue ( $row = $db->getValue (
'SELECT crop 'SELECT crop
FROM image_schema s FROM imageCollection s
JOIN image_schema_size z ON z.image_schema_id = s.id JOIN imageCollectionSize z ON z.collectionFk = s.id
WHERE s.name = #schema WHERE s.name = #schema
AND z.width = #width AND z.width = #width
AND z.height = #height' AND z.height = #height'

View File

@ -86,7 +86,7 @@ class Upload extends Vn\Web\JsonRequest
$symbolicSrc = "../full/$fileName"; $symbolicSrc = "../full/$fileName";
$image = Image::create ($tmpName); $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) foreach ($info['sizes'] as $size => $i)
{ {

View File

@ -26,8 +26,8 @@ class Util
$db = $this->app->getSysConn (); $db = $this->app->getSysConn ();
$info = $db->getRow ( $info = $db->getRow (
'SELECT id, max_width, max_height, `schema`, `table`, `column` 'SELECT id, maxWidth, maxHeight, `schema`, `table`, `column`
FROM image_schema WHERE name = #schema' FROM imageCollection WHERE name = #schema'
,['schema' => $schema] ,['schema' => $schema]
); );
@ -36,7 +36,7 @@ class Util
$res = $db->query ( $res = $db->query (
'SELECT width, height, crop 'SELECT width, height, crop
FROM image_schema_size WHERE image_schema_id = #id' FROM imageCollectionSize WHERE collectionFk = #id'
,['id' => $info['id']] ,['id' => $info['id']]
); );

View File

@ -31,32 +31,32 @@ class Contact extends Vn\Web\JsonRequest
//$db->queryFromFile (__DIR__.'/contact', $_REQUEST); //$db->queryFromFile (__DIR__.'/contact', $_REQUEST);
//$customerId = $db->getValue ('SELECT @id'); //$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 '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 = new PHPMailer ();
$mail->isSMTP (); $mail->isSMTP ();
$mail->Host = $conf['host']; $mail->Host = $conf->host;
if (!empty ($conf['user'])) if (!empty ($conf->user))
{ {
$mail->SMTPAuth = TRUE; $mail->SMTPAuth = TRUE;
$mail->Username = $conf['user']; $mail->Username = $conf->user;
$mail->Password = base64_decode ($conf['password']); $mail->Password = base64_decode ($conf->password);
} }
else else
$mail->SMTPAuth = FALSE; $mail->SMTPAuth = FALSE;
if ($conf['secure']) if ($conf->secure)
{ {
$mail->SMTPSecure = 'ssl'; $mail->SMTPSecure = 'ssl';
$mail->Port = 465; $mail->Port = 465;
} }
$mail->setFrom ($conf['sender'], 'Web'); $mail->setFrom ($conf->sender, 'Web');
$mail->addAddress ($conf['recipient']); $mail->addAddress ($conf->recipient);
$mail->isHTML (TRUE); $mail->isHTML (TRUE);
$mail->Subject = s('New customer request'); $mail->Subject = s('New customer request');
$mail->Body = '<pre>'. print_r ($_REQUEST, TRUE) .'</pre>'; $mail->Body = '<pre>'. print_r ($_REQUEST, TRUE) .'</pre>';

View File

@ -7,7 +7,7 @@ class Production extends Vn\Web\JsonRequest
function run ($db) function run ($db)
{ {
$row = $db->getObject ( $row = $db->getObject (
'SELECT displayText FROM production WHERE deviceId = #', 'SELECT displayText FROM vn.routeGate WHERE deviceId = #',
[$_REQUEST['deviceId']] [$_REQUEST['deviceId']]
); );

View File

@ -10,17 +10,17 @@ class ConfirmMail extends Vn\Lib\Method
function run ($db) function run ($db)
{ {
$imap = NULL; $imap = NULL;
$imapConf = $db->getRow ( $imapConf = $db->getObject (
'SELECT host, user, pass, clean_period, success_folder, error_folder 'SELECT host, user, pass, cleanPeriod, successFolder, errorFolder
FROM tpv_imap_config' FROM tpvImapConfig'
); );
$mailbox = sprintf ('{%s/imap/ssl/novalidate-cert}', $mailbox = sprintf ('{%s/imap/ssl/novalidate-cert}',
$imapConf['host']); $imapConf->host);
$imap = imap_open ($mailbox $imap = imap_open ($mailbox
,$imapConf['user'] ,$imapConf->user
,base64_decode ($imapConf['pass']) ,base64_decode ($imapConf->pass)
); );
if (!$imap) if (!$imap)
@ -61,9 +61,9 @@ class ConfirmMail extends Vn\Lib\Method
// Moves the processed mail to another folder // Moves the processed mail to another folder
if ($success) if ($success)
$folder = $imapConf['success_folder']; $folder = $imapConf->successFolder;
else else
$folder = $imapConf['error_folder']; $folder = $imapConf->errorFolder;
if (!imap_mail_move ($imap, $msg, "$folder")) if (!imap_mail_move ($imap, $msg, "$folder"))
trigger_error (imap_last_error (), E_USER_WARNING); trigger_error (imap_last_error (), E_USER_WARNING);
@ -80,12 +80,12 @@ class ConfirmMail extends Vn\Lib\Method
if (rand (1, 20) == 1) if (rand (1, 20) == 1)
{ {
$folders = array ( $folders = array (
$imapConf['success_folder'] $imapConf->successFolder
,$imapConf['error_folder'] ,$imapConf->errorFolder
); );
$date = new \DateTime (NULL); $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')); $filter = sprintf ('BEFORE "%s"', $date->format('D, j M Y'));
foreach ($folders as $folder) foreach ($folders as $folder)

View File

@ -50,7 +50,7 @@ function procesaNotificacionSIS ($XML)
$shaString = substr ($requestString, $start, $end - $start + 10); $shaString = substr ($requestString, $start, $end - $start + 10);
$key = $db->getValue ( $key = $db->getValue (
'SELECT secret_key FROM tpv_merchant WHERE id = #' 'SELECT secretKey FROM tpvMerchant WHERE id = #'
,[$params['Ds_MerchantCode']] ,[$params['Ds_MerchantCode']]
); );

View File

@ -12,7 +12,7 @@ if (lang == null)
process.exit(1); process.exit(1);
} }
let nDirs; let nTasks;
let projectDir; let projectDir;
fs.remove(lang, () => { fs.remove(lang, () => {
@ -21,8 +21,6 @@ fs.remove(lang, () => {
let len = projectDir.length + 1; let len = projectDir.length + 1;
glob(`${projectDir}/**/locale/`, (err, localeDirs) => { glob(`${projectDir}/**/locale/`, (err, localeDirs) => {
nDirs = localeDirs.length * 2;
for (let localeDir of localeDirs) { for (let localeDir of localeDirs) {
localeDir = localeDir.substr(len) localeDir = localeDir.substr(len)
@ -31,7 +29,9 @@ fs.remove(lang, () => {
exportLocale(localeDir); exportLocale(localeDir);
} }
})
nTasks = localeDirs.length;
});
}); });
}); });
@ -40,7 +40,8 @@ function exportLocale (localeDir) {
fs.mkdirp(dstDir, err => { fs.mkdirp(dstDir, err => {
if (err) { if (err) {
onError(err); console.log(err);
onTaskEnd();
return; return;
} }
@ -48,28 +49,26 @@ function exportLocale (localeDir) {
src = `${projectDir}/${localeDir}/en.json`; src = `${projectDir}/${localeDir}/en.json`;
dst = `${dstDir}/en.json`; dst = `${dstDir}/en.json`;
fs.copy(src, dst, onDirEnd); fs.copy(src, dst, onTaskEnd);
src = `${projectDir}/${localeDir}/${lang}.json`; src = `${projectDir}/${localeDir}/${lang}.json`;
dst = `${dstDir}/${lang}.json`; dst = `${dstDir}/${lang}.json`;
fs.copy(src, dst, onDirEnd); fs.copy(src, dst, onTaskEnd);
});
}
function onError (err) { nTasks += 2;
console.log(err); onTaskEnd();
onDirEnd(); });
} }
let output; let output;
let archive; let archive;
function onDirEnd() { function onTaskEnd() {
nDirs--; nTasks--;
if (nDirs > 0) return; if (nTasks > 0) return;
output = fs.createWriteStream(`${lang}.zip`); output = fs.createWriteStream(`${lang}.zip`);
output.on ('close', onArchiveEnd); output.on ('close', onArchiveClose);
archive = archiver('zip', { archive = archiver('zip', {
zlib: { level: 9 } zlib: { level: 9 }
@ -82,7 +81,7 @@ function onDirEnd() {
archive.finalize(); archive.finalize();
} }
function onArchiveEnd() { function onArchiveClose() {
fs.remove(lang); fs.remove(lang);
console.log ('Export finalized!'); console.log ('Export finalized!');
} }

View File

@ -13,8 +13,8 @@ class Mailer
function __construct ($db) function __construct ($db)
{ {
$this->conf = $db->getObject ( $this->conf = $db->getObject (
'SELECT host, port, secure, sender, sender_name, user, password 'SELECT host, port, secure, sender, senderName, user, password
FROM hedera.mail_config' FROM hedera.mailConfig'
); );
} }
@ -41,7 +41,7 @@ class Mailer
$mail->Port = 465; $mail->Port = 465;
} }
$mail->setFrom ($conf->sender, $conf->sender_name); $mail->setFrom ($conf->sender, $conf->senderName);
$mail->IsHTML (TRUE); $mail->IsHTML (TRUE);
$mail->Subject = $subject; $mail->Subject = $subject;
$mail->Body = $body; $mail->Body = $body;