Tags beta, local config.php, removed MySQL cleartext plugin due to php7 lack of support

This commit is contained in:
Juan 2018-03-26 18:35:02 +02:00
parent fadc5505ad
commit 73b2750b8a
15 changed files with 220 additions and 183 deletions

1
.gitignore vendored
View File

@ -1,2 +1,3 @@
node_modules node_modules
build/ build/
config.php

View File

@ -8,6 +8,5 @@ $vnAutoloadMap['vn/web'] = __DIR__.'/web';
const _ENABLE_DEBUG = TRUE; const _ENABLE_DEBUG = TRUE;
const _DEV_MODE = TRUE; const _DEV_MODE = TRUE;
const _CONFIG_DIR = __DIR__.'/../../.config';
const _LOG_DIR = '/tmp'; const _LOG_DIR = '/tmp';
const _DATA_DIR = '/tmp'; const _DATA_DIR = '/tmp';

View File

@ -32,7 +32,7 @@ Hedera.Catalog = new Class
{ {
document.body.appendChild (this.$('right-panel')); document.body.appendChild (this.$('right-panel'));
this.$('items-model').setInfo ('a', 'Articles', 'vn2008', ['item_id']); this.$('items-model').setInfo ('i', 'item', 'vn', ['itemFk']);
if (localStorage.getItem ('hederaView')) if (localStorage.getItem ('hederaView'))
this.setView (parseInt (localStorage.getItem ('hederaView'))); this.setView (parseInt (localStorage.getItem ('hederaView')));
@ -200,7 +200,7 @@ Hedera.Catalog = new Class
if (type) if (type)
{ {
var row = types.search ('tipo_id', type); var row = types.search ('id', type);
if (row != -1) if (row != -1)
title = types.get (row, 'name'); title = types.get (row, 'name');
@ -269,15 +269,15 @@ Hedera.Catalog = new Class
this.onEraseClick (); this.onEraseClick ();
this.$('card').row = form.row; this.$('card').row = form.row;
this.$('card-item').value = form.get ('item_id'); this.$('card-item').value = form.get ('itemFk');
this.$('card-popup').show (button.node); this.$('card-popup').show (button.node);
} }
,onAddLotClick: function (column, value, row, button) ,onAddLotClick: function (column, value, row)
{ {
var model = this.$('item-lots'); var model = this.$('item-lots');
var grouping = model.get (row, 'grouping'); var grouping = model.get (row, 'grouping');
var warehouse = model.get (row, 'warehouse_id'); var warehouse = model.get (row, 'warehouseFk');
var available = model.get (row, 'available'); var available = model.get (row, 'available');
var lotAmount = this.items[warehouse]; var lotAmount = this.items[warehouse];
@ -321,7 +321,7 @@ Hedera.Catalog = new Class
{ {
this.conn.execQuery (sql); this.conn.execQuery (sql);
var itemName = this.$('card').get ('Article'); var itemName = this.$('card').get ('item');
Htk.Toast.showMessage ( Htk.Toast.showMessage (
sprintf (_('Added%dOf%s'), amountSum, itemName)); sprintf (_('Added%dOf%s'), amountSum, itemName));
} }
@ -342,7 +342,7 @@ Hedera.Catalog = new Class
this.$('card-item').value = undefined; this.$('card-item').value = undefined;
} }
,onStatusChange: function (model) ,onCardLoad: function ()
{ {
this.$('card-popup').reset (); this.$('card-popup').reset ();
} }
@ -426,13 +426,13 @@ Vn.Filter = new Class
this.parent (props); this.parent (props);
} }
,_onMouseDown: function (e) ,_onMouseDown: function ()
{ {
if (this._model && this._model.status === Db.Model.Status.CLEAN) if (this._model && this._model.status === Db.Model.Status.CLEAN)
this._model.refresh (); this._model.refresh ();
} }
,_onCloseClick: function (li) ,_onCloseClick: function ()
{ {
this._removeSelectionNode (); this._removeSelectionNode ();
this._changeValue (undefined); this._changeValue (undefined);

View File

@ -175,6 +175,8 @@
padding-bottom: .1em; padding-bottom: .1em;
font-weight: normal; font-weight: normal;
font-size: 1.1em; font-size: 1.1em;
text-overflow: ellipsis;
overflow: hidden;
} }
.item-info > p .item-info > p
{ {
@ -224,7 +226,6 @@
.item-card .top .item-card .top
{ {
padding: 1em; padding: 1em;
border-bottom: 1px solid #DDD;
} }
.item-card .item-info .item-card .item-info
{ {
@ -245,6 +246,10 @@
margin-top: 1em; margin-top: 1em;
font-size: .9em; font-size: .9em;
} }
.item-card .lots-grid
{
border-top: 1px solid #DDD;
}
.item-card .lots-grid tr .item-card .lots-grid tr
{ {
height: 3em; height: 3em;
@ -319,9 +324,7 @@
.list-view .item-info > h2 .list-view .item-info > h2
{ {
font-size: 1em; font-size: 1em;
text-overflow: ellipsis;
white-space: nowrap; white-space: nowrap;
overflow: hidden;
} }
.list-view .item-info > .color .list-view .item-info > .color
{ {

View File

@ -12,75 +12,67 @@
<vn-hash-param key="type" param="type"/> <vn-hash-param key="type" param="type"/>
<sql-filter type="AND" id="filter"> <sql-filter type="AND" id="filter">
<sql-filter-item type="EQUAL" primary="false" id="op-realm"> <sql-filter-item type="EQUAL" primary="false" id="op-realm">
<sql-field name="reino_id" target="t"/> <sql-field target="t" name="categoryFk"/>
<sql-value id="realm-value"/> <sql-value id="realm-value"/>
</sql-filter-item> </sql-filter-item>
<sql-filter-item type="EQUAL" id="op-type"> <sql-filter-item type="EQUAL" id="op-type">
<sql-field name="tipo_id" target="a"/> <sql-field target="i" name="typeFk"/>
<sql-value id="type-value"/> <sql-value id="type-value"/>
</sql-filter-item> </sql-filter-item>
<sql-filter-item type="LIKE" id="op-name"> <sql-filter-item type="LIKE" id="op-name">
<sql-field name="Article"/> <sql-field target="i" name="name"/>
<sql-search-tags param="search"/> <sql-search-tags param="search"/>
</sql-filter-item> </sql-filter-item>
<sql-filter-item type="EQUAL" id="op-color"> <sql-filter-item type="EQUAL" id="op-color">
<sql-field name="Color"/> <sql-field target="i" name="inkFk"/>
<sql-value param="color"/> <sql-value param="color"/>
</sql-filter-item> </sql-filter-item>
<sql-filter-item type="EQUAL" id="op-origin"> <sql-filter-item type="EQUAL" id="op-origin">
<sql-field name="id_origen"/> <sql-field target="i" name="originFk"/>
<sql-value param="origin"/> <sql-value param="origin"/>
</sql-filter-item> </sql-filter-item>
<sql-filter-item type="EQUAL" id="op-category"> <sql-filter-item type="EQUAL" id="op-category">
<sql-field name="Categoria"/> <sql-field target="i" name="category"/>
<sql-value param="category"/> <sql-value param="category"/>
</sql-filter-item> </sql-filter-item>
<sql-filter-item type="EQUAL" id="op-producer"> <sql-filter-item type="EQUAL" id="op-producer">
<sql-field name="producer_id"/> <sql-field target="i" name="producerFk"/>
<sql-value param="producer"/> <sql-value param="producer"/>
</sql-filter-item> </sql-filter-item>
</sql-filter> </sql-filter>
<db-form id="basket" on-ready="onBasketReady"> <db-form id="basket" on-ready="onBasketReady">
<db-model property="model"> <db-model property="model">
<custom> SELECT b.id, b.sent, a.description agency, m.code method
SELECT o.id, o.date_send, ag.description agency, v.code method FROM myBasket b
FROM basket o JOIN vn.agencyMode a ON a.id = b.agencyModeFk
JOIN vn2008.Agencias ag ON ag.Id_Agencia = o.agency_id JOIN vn.deliveryMethod m ON m.id = b.deliveryMethodFk
JOIN vn2008.Vistas v ON v.vista_id = o.delivery_method_id
</custom>
</db-model> </db-model>
</db-form> </db-form>
<db-query id="basket-lines">
<custom>
SELECT item_id, warehouse_id, SUM(amount) amount
FROM basket_item
GROUP BY warehouse_id
</custom>
</db-query>
<db-model <db-model
id="items-model" id="items-model"
result-index="2" result-index="2"
on-status-changed="onItemsChange"> on-status-changed="onItemsChange">
<custom> CREATE TEMPORARY TABLE tmp.bionic_calc
CREATE TEMPORARY TABLE tmp.bionic_calc (INDEX (item_id))
(INDEX (item_id)) ENGINE=MEMORY
ENGINE=MEMORY SELECT i.id item_id
SELECT a.Id_Article item_id FROM vn2008.Articles a FROM vn.item i
JOIN vn2008.Tipos t ON t.tipo_id = a.tipo_id JOIN vn.itemType t ON t.id = i.typeFk
WHERE #filter; WHERE #filter;
CALL bionic_calc (); CALL bionic_calc ();
SELECT a.Id_Article item_id, a.description, b.available, b.price, SELECT i.id itemFk, i.description, b.available, b.price,
b.producer, a.Foto, a.Article, a.Categoria, a.Medida, b.producer, i.image, i.name item, i.category, i.size,
IF(a.Tallos > 1, a.Tallos, NULL) Tallos, c.name color IF(i.stems > 1, i.stems, NULL) stems, c.name color,
FROM tmp.bionic_item b t.tag1, t.val1, t.tag2, t.val2, t.tag3, t.val3
JOIN vn2008.Articles a ON a.Id_Article = b.item_id FROM tmp.bionic_item b
LEFT JOIN vn2008.producer p ON p.producer_id = a.producer_id JOIN vn.item i ON i.id = b.item_id
LEFT JOIN vn.inkL10n c ON c.id = a.Color LEFT JOIN vn.itemTagArranged t ON t.itemFk = i.id
LEFT JOIN vn.originL10n o ON o.id = a.id_origen LEFT JOIN vn.producer p ON p.id = i.producerFk
WHERE b.available > 0 LEFT JOIN vn.inkL10n c ON c.id = i.inkFk
ORDER BY a.relevancy DESC, a.Article, a.Medida LEFT JOIN vn.originL10n o ON o.id = i.originFk
LIMIT 400; WHERE b.available > 0
</custom> ORDER BY i.relevancy DESC, i.name, i.size
LIMIT 400;
<sql-batch property="batch" id="filter-batch"> <sql-batch property="batch" id="filter-batch">
<custom> <custom>
<item name="filter" object="filter"/> <item name="filter" object="filter"/>
@ -93,33 +85,6 @@
<item name="item" param="card-item"/> <item name="item" param="card-item"/>
</custom> </custom>
</sql-batch> </sql-batch>
<db-form id="card-extend">
<db-model
property="model"
batch="card-batch"
on-status-changed-after="onStatusChange">
<custom>
SELECT a.description, o.name origin
FROM vn2008.Articles a
LEFT JOIN vn.originL10n o ON o.id = a.id_origen
WHERE a.Id_Article = #item
</custom>
</db-model>
</db-form>
<db-model
id="item-lots"
result-index="1"
on-status-changed-after="onStatusChange"
batch="card-batch">
<custom>
CALL bionic_from_item (#item);
SELECT p.warehouse_id, w.name warehouse, p.grouping, p.price, p.rate, l.available
FROM tmp.bionic_lot l
JOIN tmp.bionic_price p ON p.warehouse_id = l.warehouse_id
JOIN vn2008.warehouse w ON w.id = p.warehouse_id
ORDER BY warehouse_id, grouping;
</custom>
</db-model>
</vn-group> </vn-group>
<div id="title"> <div id="title">
<h1 id="title-text"><t>Catalog</t></h1> <h1 id="title-text"><t>Catalog</t></h1>
@ -152,7 +117,7 @@
directory="catalog" directory="catalog"
subdir="200x200" subdir="200x200"
form="item" form="item"
column="Foto" column="image"
full-dir="900x900"/> full-dir="900x900"/>
<div class="item-info"> <div class="item-info">
<htk-button <htk-button
@ -163,18 +128,18 @@
on-click="onAddItemClick" on-click="onAddItemClick"
class="add-button"/> class="add-button"/>
<h2> <h2>
<htk-text form="item" column="Article"/> <htk-text form="item" column="item"/>
</h2> </h2>
<p class="producer"> <p class="producer">
<htk-text form="item" column="producer"/> <htk-text form="item" column="producer"/>
</p> </p>
<p> <p>
<t>Size</t> <htk-text form="item" column="Medida"/>, <htk-text form="item" column="tag1"/> <htk-text form="item" column="val1"/>,
<t>Category</t> <htk-text form="item" column="Categoria"/> <htk-text form="item" column="tag2"/> <htk-text form="item" column="val2"/>
</p> </p>
<p class="color"> <p class="color">
<t>Color</t> <htk-text form="item" column="color"/> <htk-text form="item" column="tag3"/> <htk-text form="item" column="val3"/>
<htk-text form="item" column="Tallos" format="_, %.0d Units"/> <htk-text form="item" column="stems" format="_, %.0d Units"/>
</p> </p>
<div class="aval-price"> <div class="aval-price">
<htk-text form="item" column="available"/> <htk-text form="item" column="available"/>
@ -194,7 +159,7 @@
<div id="right-panel" class="right-panel" on-click="onRightPanelClick"> <div id="right-panel" class="right-panel" on-click="onRightPanelClick">
<div class="basket-info"> <div class="basket-info">
<p> <p>
<htk-text form="basket" column="date_send" format="%D"/> <htk-text form="basket" column="sent" format="%D"/>
</p> </p>
<p> <p>
<span id="method"/> <span id="method"/>
@ -216,13 +181,11 @@
id="realms-model" id="realms-model"
property="model" property="model"
on-status-changed="refreshTitleColor"> on-status-changed="refreshTitleColor">
<custom> SELECT c.id, l.name, c.color
SELECT r.id, l.name, r.color FROM vn.itemCategory c
FROM vn2008.reinos r JOIN vn.itemCategoryL10n l ON l.id = c.id
JOIN vn.itemCategoryL10n l ON l.id = r.id WHERE c.display
WHERE r.display != FALSE ORDER BY name
ORDER BY name
</custom>
</db-model> </db-model>
<custom> <custom>
<a id="link"> <a id="link">
@ -247,20 +210,18 @@
conn="conn" conn="conn"
result-index="1" result-index="1"
on-status-changed="refreshTitle"> on-status-changed="refreshTitle">
<custom> CALL item_available ();
CALL item_available (); SELECT DISTINCT t.id, l.name
SELECT DISTINCT t.tipo_id, l.name FROM vn.item i
FROM vn2008.Tipos t JOIN vn.itemType t ON t.id = i.typeFk
JOIN vn2008.Articles a ON a.tipo_id = t.tipo_id JOIN tmp.item_available a ON a.item_id = i.id
JOIN tmp.item_available i ON i.item_id = a.Id_Article JOIN vn.itemTypeL10n l ON l.id = t.id
JOIN vn.itemTypeL10n l ON l.id = t.tipo_id WHERE #filter
WHERE #filter ORDER BY name
ORDER BY name
</custom>
</db-model> </db-model>
<sql-filter property="filter" type="AND"> <sql-filter property="filter" type="AND">
<sql-filter-item type="EQUAL"> <sql-filter-item type="EQUAL">
<sql-field name="reino_id" target="t"/> <sql-field name="categoryFk" target="t"/>
<sql-value param="realm"/> <sql-value param="realm"/>
</sql-filter-item> </sql-filter-item>
</sql-filter> </sql-filter>
@ -269,17 +230,15 @@
placeholder="_Color" placeholder="_Color"
param="color"> param="color">
<db-model property="model" auto-load="false" result-index="1"> <db-model property="model" auto-load="false" result-index="1">
<custom> CALL item_available ();
CALL item_available (); SELECT DISTINCT k.id, l.name
SELECT DISTINCT c.Id_Tinta, l.name FROM vn.item i
FROM vn2008.Tintas c JOIN vn.itemType t ON t.id = i.typeFk
JOIN vn2008.Articles a ON a.Color = c.Id_Tinta JOIN tmp.item_available a ON a.item_id = i.id
JOIN vn2008.Tipos t ON t.tipo_id = a.tipo_id JOIN vn.ink k ON k.id = i.inkFk
JOIN vn.inkL10n l ON l.id = c.Id_Tinta JOIN vn.inkL10n l ON l.id = i.id
JOIN tmp.item_available i ON i.item_id = a.Id_Article WHERE #filter
WHERE #filter ORDER BY name
ORDER BY name
</custom>
</db-model> </db-model>
<sql-filter property="filter" always-ready="true" type="AND"> <sql-filter property="filter" always-ready="true" type="AND">
<pointer object="op-realm"/> <pointer object="op-realm"/>
@ -294,16 +253,14 @@
placeholder="_Producer" placeholder="_Producer"
param="producer"> param="producer">
<db-model property="model" auto-load="false" result-index="1"> <db-model property="model" auto-load="false" result-index="1">
<custom> CALL item_available ();
CALL item_available (); SELECT DISTINCT p.id, p.name
SELECT DISTINCT p.producer_id, p.name FROM vn.item i
FROM vn2008.producer p JOIN vn.itemType t ON t.id = i.typeFk
JOIN vn2008.Articles a ON a.producer_id = p.producer_id JOIN tmp.item_available a ON a.item_id = i.id
JOIN vn2008.Tipos t ON t.tipo_id = a.tipo_id JOIN vn.producer p ON p.id = i.producerFk
JOIN tmp.item_available i ON i.item_id = a.Id_Article WHERE #filter
WHERE #filter ORDER BY name
ORDER BY name
</custom>
</db-model> </db-model>
<sql-filter property="filter" always-ready="true" type="AND"> <sql-filter property="filter" always-ready="true" type="AND">
<pointer object="op-realm"/> <pointer object="op-realm"/>
@ -318,17 +275,15 @@
placeholder="_Origin" placeholder="_Origin"
param="origin"> param="origin">
<db-model property="model" auto-load="false" result-index="1"> <db-model property="model" auto-load="false" result-index="1">
<custom> CALL item_available ();
CALL item_available (); SELECT DISTINCT o.id, l.name, o.code
SELECT DISTINCT o.id, l.name, o.Abreviatura FROM vn.item i
FROM vn2008.Origen o JOIN vn.itemType t ON t.id = i.typeFk
JOIN vn2008.Articles a ON a.id_origen = o.id JOIN tmp.item_available a ON a.item_id = i.id
JOIN vn2008.Tipos t ON t.tipo_id = a.tipo_id JOIN vn.origin o ON o.id = i.originFk
JOIN vn.originL10n l ON l.id = o.id JOIN vn.originL10n l ON l.id = o.id
JOIN tmp.item_available i ON i.item_id = a.Id_Article WHERE #filter
WHERE #filter ORDER BY name
ORDER BY name
</custom>
</db-model> </db-model>
<sql-filter property="filter" always-ready="true" type="AND"> <sql-filter property="filter" always-ready="true" type="AND">
<pointer object="op-realm"/> <pointer object="op-realm"/>
@ -343,15 +298,13 @@
placeholder="_Category" placeholder="_Category"
param="category"> param="category">
<db-model property="model" auto-load="false" result-index="1"> <db-model property="model" auto-load="false" result-index="1">
<custom> CALL item_available ();
CALL item_available (); SELECT DISTINCT i.category, i.category
SELECT DISTINCT a.Categoria, a.Categoria category FROM vn.item i
FROM vn2008.Articles a JOIN vn.itemType t ON t.id = i.typeFk
JOIN vn2008.Tipos t ON t.tipo_id = a.tipo_id JOIN tmp.item_available a ON a.item_id = i.id
JOIN tmp.item_available i ON i.item_id = a.Id_Article WHERE #filter
WHERE #filter ORDER BY category
ORDER BY a.Categoria
</custom>
</db-model> </db-model>
<sql-filter property="filter" always-ready="true" type="AND"> <sql-filter property="filter" always-ready="true" type="AND">
<pointer object="op-realm"/> <pointer object="op-realm"/>
@ -369,7 +322,7 @@
<option value="D|relevancy" selected="true"> <option value="D|relevancy" selected="true">
<t>Relevancy</t> <t>Relevancy</t>
</option> </option>
<option value="A|Article"> <option value="A|item">
<t>Name</t> <t>Name</t>
</option> </option>
<option value="A|price"> <option value="A|price">
@ -381,10 +334,10 @@
<option value="A|available"> <option value="A|available">
<t>Available</t> <t>Available</t>
</option> </option>
<option value="A|Medida"> <option value="A|size">
<t>Lower size</t> <t>Lower size</t>
</option> </option>
<option value="D|Medida"> <option value="D|size">
<t>Higher size</t> <t>Higher size</t>
</option> </option>
<option value="A|color"> <option value="A|color">
@ -393,10 +346,10 @@
<option value="A|producer"> <option value="A|producer">
<t>Producer</t> <t>Producer</t>
</option> </option>
<option value="A|Abreviatura"> <option value="A|origin">
<t>Origin</t> <t>Origin</t>
</option> </option>
<option value="A|Categoria"> <option value="A|category">
<t>Category</t> <t>Category</t>
</option> </option>
</select> </select>
@ -415,32 +368,43 @@
modal="true" modal="true"
on-closed="onPopupClose"> on-closed="onPopupClose">
<div property="child-node" class="item-card"> <div property="child-node" class="item-card">
<db-form id="card-extend">
<db-model
property="model"
batch="card-batch"
on-status-changed-after="onCardLoad">
SELECT i.description, o.name origin
FROM vn.item i
LEFT JOIN vn.originL10n o ON o.id = i.originFk
WHERE i.id = #item
</db-model>
</db-form>
<div class="top"> <div class="top">
<htk-image <htk-image
directory="catalog" directory="catalog"
subdir="200x200" subdir="200x200"
form="card" form="card"
column="Foto" column="image"
full-dir="900x900" full-dir="900x900"
conn="conn" conn="conn"
editable="true"/> editable="true"/>
<div class="item-info"> <div class="item-info">
<h2> <h2>
<htk-text form="card" column="Article"/> <htk-text form="card" column="item"/>
</h2> </h2>
<p class="producer"> <p class="producer">
<htk-text form="card" column="producer"/> <htk-text form="card" column="producer"/>
</p> </p>
<p> <p>
@<htk-text form="card" column="item_id"/> @<htk-text form="card" column="itemFk"/>
</p> </p>
<p> <p>
<t>Size</t> <htk-text form="card" column="Medida"/>, <t>Size</t> <htk-text form="card" column="size"/>,
<t>Category</t> <htk-text form="card" column="Categoria"/> <t>Category</t> <htk-text form="card" column="category"/>
</p> </p>
<p class="color"> <p>
<t>Color</t> <htk-text form="card" column="color"/> <t>Color</t> <htk-text form="card" column="color"/>
<htk-text form="card" column="Tallos" format="_, %.0d Units"/> <htk-text form="card" column="stems" format="_, %.0d Units"/>
</p> </p>
<p> <p>
<t>Origin</t> <htk-text form="card-extend" column="origin"/> <t>Origin</t> <htk-text form="card-extend" column="origin"/>
@ -450,7 +414,37 @@
<htk-text form="card-extend" column="description" id="desc"/> <htk-text form="card-extend" column="description" id="desc"/>
</p> </p>
</div> </div>
<htk-grid class="lots-grid" model="item-lots" show-header="false"> <htk-repeater show-status="false">
<db-model
property="model"
batch="card-batch"
on-status-changed-after="onCardLoad">
SELECT l.name, it.value
FROM vn.itemTag it
JOIN vn.tag t ON t.id = it.tagFk
JOIN vn.tagL10n l ON l.id = t.id
WHERE it.itemFk = #item
</db-model>
<custom>
<p>
<htk-text form="form" column="name"/> <htk-text form="form" column="value"/>
</p>
</custom>
</htk-repeater>
<htk-grid class="lots-grid" show-header="false">
<db-model
id="item-lots"
property="model"
result-index="1"
on-status-changed-after="onCardLoad"
batch="card-batch">
CALL bionic_from_item (#item);
SELECT w.id warehouseFk, w.name warehouse, p.grouping, p.price, p.rate, l.available
FROM tmp.bionic_lot l
JOIN tmp.bionic_price p ON p.warehouse_id = l.warehouse_id
JOIN vn.warehouse w ON w.id = p.warehouse_id
ORDER BY warehouseFk, grouping;
</db-model>
<htk-column-text title="_Store" column="warehouse"/> <htk-column-text title="_Store" column="warehouse"/>
<htk-column-spin title="_Price" column="price" unit="€" digits="2"/> <htk-column-spin title="_Price" column="price" unit="€" digits="2"/>
<htk-column-text title="_Pack" column="grouping" format="x%.0d"/> <htk-column-text title="_Pack" column="grouping" format="x%.0d"/>

View File

@ -255,6 +255,12 @@ Model.implement
this._setStatus (Status.CLEAN); this._setStatus (Status.CLEAN);
} }
,appendChild: function (child)
{
if (child.nodeType === Node.TEXT_NODE)
this.query = child.textContent;
}
,loadXml: function (builder, node) ,loadXml: function (builder, node)
{ {
this.parent (builder, node); this.parent (builder, node);
@ -377,7 +383,7 @@ Model.implement
} }
} }
,_cleanData: function (error) ,_cleanData: function ()
{ {
this.data = null; this.data = null;
this.tables = null; this.tables = null;

View File

@ -62,6 +62,22 @@ module.exports = new Class
this._renderer; this._renderer;
} }
} }
/**
* Wether to show the model status.
**/
,showStatus:
{
type: Boolean
,set: function (x)
{
this._showStatus = x;
this._onModelChange();
}
,get: function ()
{
this._showStatus;
}
}
/** /**
* Message that should be displayed when source model is not ready. * Message that should be displayed when source model is not ready.
**/ **/
@ -74,6 +90,7 @@ module.exports = new Class
,_builder: null ,_builder: null
,_formId: 'form' ,_formId: 'form'
,_showStatus: true
,render: function () ,render: function ()
{ {
@ -172,14 +189,17 @@ module.exports = new Class
this.signalEmit ('change'); this.signalEmit ('change');
} }
,_showNoRecordsFound: function (count) ,_showNoRecordsFound: function ()
{ {
if (this._model.numRows === 0) if (this._model.numRows === 0)
this._showMessage (_('EmptyList'), 'clean'); this._showMessage (_('EmptyList'), 'clean');
} }
,_showMessage: function (message, src) ,_showMessage: function (message, src)
{ {
if (!this._showStatus)
return;
var div = this.createElement ('div'); var div = this.createElement ('div');
div.className = 'message'; div.className = 'message';
this._container.appendChild (div); this._container.appendChild (div);
@ -213,7 +233,7 @@ module.exports = new Class
this._showNoRecordsFound (); this._showNoRecordsFound ();
} }
,_onRowUpdate: function (model, row, columns) ,_onRowUpdate: function (model, row)
{ {
this._childsData[row].set.iterChanged (); this._childsData[row].set.iterChanged ();
} }

View File

@ -80,7 +80,7 @@ module.exports = new Class
{ {
var parser = new DOMParser (); var parser = new DOMParser ();
var xmlDoc = parser.parseFromString (xmlString, 'text/xml'); var xmlDoc = parser.parseFromString (xmlString, 'text/xml');
return this.loadFromXmlDoc (xmlDoc); return this.loadFromXmlDoc (xmlDoc, dstDocument);
} }
,loadFromXmlDoc: function (xmlDoc, dstDocument) ,loadFromXmlDoc: function (xmlDoc, dstDocument)
@ -193,7 +193,7 @@ module.exports = new Class
this._doc = dstDocument ? dstDocument : document; this._doc = dstDocument ? dstDocument : document;
} }
,_compileEnd: function (node) ,_compileEnd: function ()
{ {
for (var i = this._links.length - 1; i >= 0; i--) for (var i = this._links.length - 1; i >= 0; i--)
{ {
@ -333,12 +333,9 @@ module.exports = new Class
for (var i = 0; i < childNodes.length; i++) for (var i = 0; i < childNodes.length; i++)
{ {
var child = childNodes[i]; var child = childNodes[i];
var isElement = child.nodeType === Node.ELEMENT_NODE;
if (child.nodeType !== Node.ELEMENT_NODE) var childTagName = isElement ? child.tagName.toLowerCase () : null;
continue;
var childContext; var childContext;
var childTagName = child.tagName.toLowerCase ();
if (childTagName === 'pointer') if (childTagName === 'pointer')
{ {
@ -350,7 +347,7 @@ module.exports = new Class
} }
else if (childContext = this._compileNode (child)) else if (childContext = this._compileNode (child))
{ {
var prop = child.getAttribute ('property'); var prop = isElement ? child.getAttribute ('property') : null;
if (prop) if (prop)
{ {

View File

@ -10,8 +10,8 @@
<link rel="icon" type="image/png" href="image/favicon/favicon.png"/> <link rel="icon" type="image/png" href="image/favicon/favicon.png"/>
<link rel="icon" type="image/svg+xml" href="image/icon.svg" sizes="any"/> <link rel="icon" type="image/svg+xml" href="image/icon.svg" sizes="any"/>
<link rel="manifest" href="<?=$dir?>/manifest.json"/> <link rel="manifest" href="<?=$dir?>/manifest.json"/>
<?=js("$dir/main.js")?> <?=js("$dir/main")?>
<?=css("$dir/style.css")?> <?=css("$dir/style")?>
<title>Production</title> <title>Production</title>
</head> </head>
<body onload="onBodyLoad()"> <body onload="onBodyLoad()">

View File

@ -5,7 +5,7 @@
<meta name="viewport" content="user-scalable=no"/> <meta name="viewport" content="user-scalable=no"/>
<meta name="content-language" content="<?=$lang?>"/> <meta name="content-language" content="<?=$lang?>"/>
<link href="//fonts.googleapis.com/css?family=Roboto" rel="stylesheet" type="text/css"/> <link href="//fonts.googleapis.com/css?family=Roboto" rel="stylesheet" type="text/css"/>
<?=css("$dir/style.css")?> <?=css("$dir/style")?>
<title>Verdnatura</title> <title>Verdnatura</title>
</head> </head>
<body> <body>

View File

@ -5,7 +5,7 @@
<meta name="viewport" content="user-scalable=no"/> <meta name="viewport" content="user-scalable=no"/>
<meta name="content-language" content="<?=$lang?>"/> <meta name="content-language" content="<?=$lang?>"/>
<link href="//fonts.googleapis.com/css?family=Roboto" rel="stylesheet" type="text/css"/> <link href="//fonts.googleapis.com/css?family=Roboto" rel="stylesheet" type="text/css"/>
<?=css("$dir/style.css")?> <?=css("$dir/style")?>
<title>Verdnatura</title> <title>Verdnatura</title>
</head> </head>
<body> <body>

View File

@ -103,8 +103,9 @@ class HtmlService extends Service
//header ("Content-Security-Policy: default-src *; img-src *;"); //header ("Content-Security-Policy: default-src *; img-src *;");
} }
function errorHandler () function errorHandler ($err)
{ {
error_log("{$err->getMessage()} {$err->getTraceAsString()}");
$this->printHeader (); $this->printHeader ();
include (__DIR__.'/unavailable.html'); include (__DIR__.'/unavailable.html');
exit (0); exit (0);

View File

@ -15,12 +15,12 @@ function getUrl ($fileName)
function js ($fileName) function js ($fileName)
{ {
return '<script type="text/javascript" src="'. getUrl ($fileName) .'"></script>'."\n"; return '<script type="text/javascript" src="'. getUrl ($fileName) .'.js"></script>'."\n";
} }
function css ($fileName) function css ($fileName)
{ {
return '<link rel="stylesheet" type="text/css" href="'. getUrl ($fileName) .'"/>'."\n"; return '<link rel="stylesheet" type="text/css" href="'. getUrl ($fileName) .'.css"/>'."\n";
} }
function getWebpackAssets () function getWebpackAssets ()

View File

@ -63,6 +63,9 @@ class RestService extends Service
throw new UserException (s($e->getMessage ())); throw new UserException (s($e->getMessage ()));
} }
if ($method::SECURITY == Security::DEFINER)
$methodDb->query ('CALL account.userLogout ()');
$db->query ('CALL account.userLogout ()'); $db->query ('CALL account.userLogout ()');
return $res; return $res;

View File

@ -227,7 +227,7 @@ abstract class Service
/** /**
* Creates or returns a database connection where the authenticated user * Creates or returns a database connection where the authenticated user
* is the current logged user. * is the role of the current logged user.
* *
* @return {Db\Conn} The database connection * @return {Db\Conn} The database connection
*/ */
@ -235,10 +235,23 @@ abstract class Service
{ {
if ($this->userDb) if ($this->userDb)
return $this->userDb; return $this->userDb;
$password = $this->db->getValue ( $row = $this->db->getObject (
'SELECT password FROM account.user WHERE name = #', [$user]); 'SELECT r.name, rc.mysqlPassword, uc.loginKey
return $this->userDb = $this->app->createConnection ($user, $password); FROM account.user u
JOIN account.role r ON r.id = u.role
JOIN account.roleConfig rc ON TRUE
JOIN account.userConfig uc ON TRUE
WHERE u.name = #',
[$user]
);
$userName = "z-{$row->name}";
$password = base64_decode ($row->mysqlPassword);
$userDb = $this->app->createConnection ($userName, $password, TRUE);
$userDb->query ('CALL account.userLoginWithKey (#, #)', [$user, $row->loginKey]);
return $userDb;
} }
/** /**