From 08b4a3437c853f29d7f5e626f35cb0a17354a6e5 Mon Sep 17 00:00:00 2001 From: alexm Date: Mon, 7 Aug 2023 07:25:11 +0200 Subject: [PATCH 1/6] refs #5762 feat(changePassword): salix compatibility --- debian/changelog | 2 +- forms/account/conf/index.js | 78 +--------------------- forms/account/conf/ui.xml | 69 +------------------- js/hedera/locale/ca.yml | 17 +++++ js/hedera/locale/es.yml | 19 ++++++ js/hedera/locale/fr.yml | 17 +++++ js/hedera/locale/pt.yml | 17 +++++ js/hedera/login.js | 12 +++- js/hedera/login.xml | 1 + js/htk/change-password/index.js | 111 ++++++++++++++++++++++++++++++++ js/htk/change-password/ui.xml | 62 ++++++++++++++++++ js/htk/htk.js | 33 +++++----- package.json | 2 +- 13 files changed, 279 insertions(+), 161 deletions(-) create mode 100644 js/htk/change-password/index.js create mode 100644 js/htk/change-password/ui.xml diff --git a/debian/changelog b/debian/changelog index 755bef2a..ad8892e6 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -hedera-web (23.30.1) stable; urgency=low +hedera-web (23.30.2) stable; urgency=low * Initial Release. diff --git a/forms/account/conf/index.js b/forms/account/conf/index.js index c603b618..55d73abc 100644 --- a/forms/account/conf/index.js +++ b/forms/account/conf/index.js @@ -7,79 +7,7 @@ export default new Class({ activate() { this.$.userModel.setInfo('c', 'myClient', 'hedera'); this.$.userModel.setInfo('u', 'myUser', 'account'); - - if (this.hash.$.verificationToken) - this.onPassChangeClick(); + this.$.changePassword.conn = this.conn + this.$.changePassword.user = this.gui.user } - - ,onPassChangeClick() { - this.$.oldPassword.value = ''; - this.$.newPassword.value = ''; - this.$.repeatPassword.value = ''; - - var verificationToken = this.hash.$.verificationToken; - this.$.oldPassword.style.display = verificationToken ? 'none' : 'block'; - this.$.changePassword.show(); - - if (verificationToken) - this.$.newPassword.focus(); - else - this.$.oldPassword.focus(); - } - - ,async onPassModifyClick() { - const form = this.$.changePassword.node; - Vn.Node.disableInputs(form); - try { - const oldPassword = this.$.oldPassword.value; - const newPassword = this.$.newPassword.value; - const repeatedPassword = this.$.repeatPassword.value; - - try { - if (newPassword == '' && repeatedPassword == '') - throw new Error(_('Passwords empty')); - if (newPassword !== repeatedPassword) - throw new Error(_('Passwords doesn\'t match')); - } catch (err) { - return Htk.Toast.showError(err.message); - } - - const verificationToken = this.hash.$.verificationToken; - const params = {newPassword}; - - try { - if (verificationToken) { - params.verificationToken = verificationToken; - await this.conn.send('user/restore-password', params); - } else { - let userId = this.gui.user.id; - params.oldPassword = oldPassword; - await this.conn.patch( - `Accounts/${userId}/changePassword`, params); - } - } catch(err) { - Htk.Toast.showError(err.message); - - if (verificationToken) - this.$.newPassword.select(); - else - this.$.oldPassword.select(); - - return; - } - - this.hash.unset('verificationToken'); - await this.conn.open(this.gui.user.name, newPassword); - this.$.changePassword.hide(); - } finally { - Vn.Node.disableInputs(form, false); - } - - Htk.Toast.showMessage(_('Password changed!')); - } - - ,onPassInfoClick() { - this.$.passwordInfo.show(); - } -}); - +}); \ No newline at end of file diff --git a/forms/account/conf/ui.xml b/forms/account/conf/ui.xml index 86d7c29b..d5e936ea 100644 --- a/forms/account/conf/ui.xml +++ b/forms/account/conf/ui.xml @@ -1,11 +1,5 @@ - - - SELECT length, nAlpha, nUpper, nDigits, nPunct - FROM account.userPassword - - SELECT u.id, u.name, u.email, u.nickname, @@ -27,7 +21,7 @@ + on-click="this.$.changePassword.open()"/>
@@ -74,64 +68,5 @@
- -
-
-
- Change password -
- - - -
-
- - -
-
-
- - -
-
- Password requirements -
-
    -
  • - {{passwordForm.length}} characters long -
  • -
  • - {{passwordForm.nAlpha}} alphabetic characters -
  • -
  • - {{passwordForm.nUpper}} capital letters -
  • -
  • - {{passwordForm.nDigits}} digits -
  • -
  • - {{passwordForm.nPunct}} symbols -
  • -
-
-
+ diff --git a/js/hedera/locale/ca.yml b/js/hedera/locale/ca.yml index 5ccdff26..d72f6e86 100644 --- a/js/hedera/locale/ca.yml +++ b/js/hedera/locale/ca.yml @@ -65,3 +65,20 @@ Account: Compte Addresses: Adreces Load an order: Si us plau carrega una comanda pendent a la cistella o en comença una de nova + +Old password: Contrasenya antiga +New password: Nova contrasenya +Repeat password: Repetir contrasenya +Requirements: Requisits +Modify: Modificar +Password requirements: Requisits de contrasenya +characters long: caràcters de longitud +alphabetic characters: caràcters alfabètics +capital letters: majúscules +digits: dígits +symbols: símbols +Password changed!: Contrasenya modificada! +Password doesn't meet the requirements: '' +Passwords doesn't match: Les contrasenyes no coincideixen! +Passwords empty: Les contrasenyes en blanc +Change password: Canvia la contrasenya \ No newline at end of file diff --git a/js/hedera/locale/es.yml b/js/hedera/locale/es.yml index 4fcf5573..746b0cb7 100644 --- a/js/hedera/locale/es.yml +++ b/js/hedera/locale/es.yml @@ -65,3 +65,22 @@ Account: Cuenta Addresses: Direcciones Load an order: Por favor carga un pedido pendiente en la cesta o empieza uno nuevo + +Old password: Contaseña antigua +New password: Nueva contraseña +Repeat password: Repetir contraseña +Requirements: Requisitos +Modify: Modificar +Password requirements: Requisitos de constraseña +characters long: carácteres de longitud +alphabetic characters: carácteres alfabéticos +capital letters: letras mayúsculas +digits: dígitos +symbols: 'símbolos. Ej: $%&.' +Password changed!: ¡Contraseña modificada! +Password doesn't meet the requirements: >- + La nueva contraseña no reune los requisitos de seguridad necesarios, pulsa en + info para más detalle +Passwords doesn't match: ¡Las contraseñas no coinciden! +Passwords empty: Contraseña vacía +Change password: Cambiar contraseña \ No newline at end of file diff --git a/js/hedera/locale/fr.yml b/js/hedera/locale/fr.yml index 7bc99938..8402c07b 100644 --- a/js/hedera/locale/fr.yml +++ b/js/hedera/locale/fr.yml @@ -65,3 +65,20 @@ Account: Compte Addresses: Adresses Load an order: Veuillez télécharger une commande en attente dans le panier ou en démarrer une nouvelle + +Old password: Ancien mot de passe +New password: Nouveau mot de passe +Repeat password: Répéter le mot de passe +Requirements: Exigences +Modify: Modifier +Password requirements: Mot de passe exigences +characters long: Longs caractères +alphabetic characters: les caractères alphabétiques +capital letters: lettres majuscules +digits: chiffres +symbols: 'symboles. Ej: $%&.' +Password changed!: Mot de passe modifié! +Password doesn't meet the requirements: '' +Passwords doesn't match: Les mots de passe ne correspondent pas! +Passwords empty: '' +Change password: Changer le mot de passe \ No newline at end of file diff --git a/js/hedera/locale/pt.yml b/js/hedera/locale/pt.yml index 8e3cfe61..bc7c6eae 100644 --- a/js/hedera/locale/pt.yml +++ b/js/hedera/locale/pt.yml @@ -63,3 +63,20 @@ Account: Conta Addresses: Moradas Load an order: Carregue um pedido pendente no carrinho ou inicie um novo + +Old password: Palavra-passe antiga +New password: Nova Palavra-passe +Repeat password: Repetir Palavra-passe +Requirements: Requisitos +Modify: Modificar +Password requirements: Requisitos de Palavra-passe +characters long: caracteres +alphabetic characters: caracteres alfabéticos +capital letters: letras maiúsculas +digits: dígitos +symbols: 'símbolos. Ej: $%&.' +Password changed!: Palavra-passe Modificada! +Password doesn't meet the requirements: Palavra-passe não atende aos requisitos +Passwords doesn't match: As Palavras-Passe não coincidem! +Passwords empty: Palavra-passe vazia +Change password: Mudar Palavra-passe \ No newline at end of file diff --git a/js/hedera/login.js b/js/hedera/login.js index 870518f6..3cc16484 100644 --- a/js/hedera/login.js +++ b/js/hedera/login.js @@ -26,6 +26,12 @@ module.exports = new Class({ self._onSubmit(); return false; }; + + if(this.hash.$.verificationToken){ + this.$.changePassword.conn = this.conn; + this.$.changePassword.token = this.hash.$.verificationToken; + this.$.changePassword.open(); + } } ,_onConnLoadChange(conn, isLoading) { @@ -94,7 +100,11 @@ module.exports = new Class({ return; } - await this._conn.send('user/recover-password', {recoverUser}); + await this.conn.post('VnUsers/recoverPassword', { + user: recoverUser, + app: 'hedera' + }); + Htk.Toast.showMessage(_('A mail has been sent wich you can recover your password')); } }); diff --git a/js/hedera/login.xml b/js/hedera/login.xml index 9b97e7bb..f82b2602 100644 --- a/js/hedera/login.xml +++ b/js/hedera/login.xml @@ -54,4 +54,5 @@
+
diff --git a/js/htk/change-password/index.js b/js/htk/change-password/index.js new file mode 100644 index 00000000..6494513d --- /dev/null +++ b/js/htk/change-password/index.js @@ -0,0 +1,111 @@ +var Component = require('vn/component'); +var Toast = require('../toast'); +var Tpl = require('./ui.xml').default; + +/** + * A change password popup. + */ +module.exports = new Class({ + Extends: Component, + Tag: 'htk-change-password', + Properties: { + /** + * The token url. + */ + token: { + type: String + ,set(value) { + this._token = value; + } + ,get() { + return this._token; + } + }, + conn: { + type: Db.Connection + ,set(x) { + this._conn = x + } + ,get() { + return this._conn; + } + }, + user: { + type: Object + } + }, + + initialize(props) { + Component.prototype.initialize.call(this, props); + }, + + async open() { + this.passwordForm = await this.conn.get('UserPasswords/findOne') + this.loadTemplateFromString(Tpl); + + this.$.oldPassword.value = ''; + this.$.newPassword.value = ''; + this.$.repeatPassword.value = ''; + + this.$.oldPassword.style.display = this.token ? 'none' : 'block'; + this.$.changePassword.open(); + + if (this.token) + this.$.newPassword.focus(); + else + this.$.oldPassword.focus(); + }, + + async onPassModifyClick() { + const form = this.$.changePassword.node; + Vn.Node.disableInputs(form); + try { + const oldPassword = this.$.oldPassword.value; + const newPassword = this.$.newPassword.value; + const repeatedPassword = this.$.repeatPassword.value; + + try { + if (newPassword == '' && repeatedPassword == '') + throw new Error(_('Passwords empty')); + if (newPassword !== repeatedPassword) + throw new Error(_('Passwords doesn\'t match')); + } catch (err) { + return Toast.showError(err.message); + } + + const params = {newPassword}; + + + try { + if (this.token) { + const headers = { + Authorization: this.token + }; + await this.conn.post('VnUsers/reset-password', params, {headers}); + } else { + params.userId = this.user.id; + params.oldPassword = oldPassword; + + await this.conn.patch(`Accounts/change-password`, params); + } + } catch(err) { + Toast.showError(err.message); + + if (this.token) + this.$.newPassword.select(); + else + this.$.oldPassword.select(); + + return; + } + + if(this.user) + await this.conn.open(this.user.name, newPassword); + this.$.changePassword.hide(); + } finally { + Vn.Node.disableInputs(form, false); + } + + Toast.showMessage(_('Password changed!')); + } +}); diff --git a/js/htk/change-password/ui.xml b/js/htk/change-password/ui.xml new file mode 100644 index 00000000..ebd8c92c --- /dev/null +++ b/js/htk/change-password/ui.xml @@ -0,0 +1,62 @@ + + +
+
+
+ Change password +
+ + + +
+
+ + +
+
+
+ + +
+
+ Password requirements +
+
    +
  • + {{this.passwordForm.length}} characters long +
  • +
  • + {{this.passwordForm.nAlpha}} alphabetic characters +
  • +
  • + {{this.passwordForm.nUpper}} capital letters +
  • +
  • + {{this.passwordForm.nDigits}} digits +
  • +
  • + {{this.passwordForm.nPunct}} symbols +
  • +
+
+
+ diff --git a/js/htk/htk.js b/js/htk/htk.js index 5cc21c26..8297fefe 100644 --- a/js/htk/htk.js +++ b/js/htk/htk.js @@ -3,22 +3,23 @@ require('db/db'); require('./style/index.scss'); Htk = module.exports = { - Popup : require('./popup') - ,Dialog : require('./dialog') - ,Toast : require('./toast') - ,Repeater : require('./repeater') - ,Grid : require('./grid') - ,Spinner : require('./spinner') - ,Icon : require('./icon') - ,FullImage : require('./full-image') - ,ImageEditor : require('./image-editor') - ,Assistant : require('./assistant') - ,AssistantBar : require('./assistant-bar') - ,Step : require('./step') - ,Loader : require('./loader') - ,List : require('./list') - ,Field : require('./field') - ,Column : require('./column') + Popup : require('./popup') + ,Dialog : require('./dialog') + ,Toast : require('./toast') + ,Repeater : require('./repeater') + ,Grid : require('./grid') + ,Spinner : require('./spinner') + ,Icon : require('./icon') + ,FullImage : require('./full-image') + ,ImageEditor : require('./image-editor') + ,Assistant : require('./assistant') + ,AssistantBar : require('./assistant-bar') + ,Step : require('./step') + ,Loader : require('./loader') + ,List : require('./list') + ,Field : require('./field') + ,Column : require('./column') + ,ChangePassword : require('./change-password') }; var Fields = { diff --git a/package.json b/package.json index e982d0b0..d8689b05 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "hedera-web", - "version": "23.30.1", + "version": "23.30.2", "description": "Verdnatura web page", "license": "GPL-3.0", "repository": { From 6915e06c719f1a1e996de11561158e930000bb07 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Mon, 9 Oct 2023 19:51:59 +0200 Subject: [PATCH 2/6] refs #6200 Minimal amount --- debian/changelog | 2 +- forms/ecomerce/catalog/locale/ca.yml | 1 + forms/ecomerce/catalog/locale/en.yml | 1 + forms/ecomerce/catalog/locale/es.yml | 1 + forms/ecomerce/catalog/locale/fr.yml | 1 + forms/ecomerce/catalog/locale/pt.yml | 1 + forms/ecomerce/catalog/style.scss | 12 ++++++++++++ forms/ecomerce/catalog/ui.xml | 14 +++++++++++++- package.json | 3 ++- 9 files changed, 33 insertions(+), 3 deletions(-) diff --git a/debian/changelog b/debian/changelog index 54f83ad0..16f9e02c 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -hedera-web (23.30.5) stable; urgency=low +hedera-web (23.40.1) stable; urgency=low * Initial Release. diff --git a/forms/ecomerce/catalog/locale/ca.yml b/forms/ecomerce/catalog/locale/ca.yml index 31ee9147..1062b6e0 100644 --- a/forms/ecomerce/catalog/locale/ca.yml +++ b/forms/ecomerce/catalog/locale/ca.yml @@ -46,3 +46,4 @@ NoMoreAmountAvailable: No hi ha més quantitat disponible MinimalGrouping: Empaquetat mínim Available: Disponible GroupingPrice: Preu per grup +MinimalQuantity: Quantitat mínima diff --git a/forms/ecomerce/catalog/locale/en.yml b/forms/ecomerce/catalog/locale/en.yml index 6940d979..7ee71528 100644 --- a/forms/ecomerce/catalog/locale/en.yml +++ b/forms/ecomerce/catalog/locale/en.yml @@ -46,3 +46,4 @@ NoMoreAmountAvailable: No more amount available MinimalGrouping: Minimal packing Available: Available GroupingPrice: Price per group +MinimalQuantity: Minimal quantity diff --git a/forms/ecomerce/catalog/locale/es.yml b/forms/ecomerce/catalog/locale/es.yml index 776ef9ba..20efddc7 100644 --- a/forms/ecomerce/catalog/locale/es.yml +++ b/forms/ecomerce/catalog/locale/es.yml @@ -46,3 +46,4 @@ NoMoreAmountAvailable: No hay más cantidad disponible MinimalGrouping: Empaquetado mínimo Available: Disponible GroupingPrice: Precio per grupo +MinimalQuantity: Cantidad mínima diff --git a/forms/ecomerce/catalog/locale/fr.yml b/forms/ecomerce/catalog/locale/fr.yml index bd6266b7..4d84a99a 100644 --- a/forms/ecomerce/catalog/locale/fr.yml +++ b/forms/ecomerce/catalog/locale/fr.yml @@ -46,3 +46,4 @@ NoMoreAmountAvailable: Pas plus disponible MinimalGrouping: Emballage minimal Available: Disponible GroupingPrice: Prix par groupe +MinimalQuantity: Quantité minimum diff --git a/forms/ecomerce/catalog/locale/pt.yml b/forms/ecomerce/catalog/locale/pt.yml index 9ade502e..02f793fe 100644 --- a/forms/ecomerce/catalog/locale/pt.yml +++ b/forms/ecomerce/catalog/locale/pt.yml @@ -46,3 +46,4 @@ NoMoreAmountAvailable: Não há mais quantidade disponível MinimalGrouping: Embalagem mínima Available: Disponível GroupingPrice: Preço por grupo +MinimalQuantity: Quantidade mínima diff --git a/forms/ecomerce/catalog/style.scss b/forms/ecomerce/catalog/style.scss index 76d3036f..f2ff4378 100644 --- a/forms/ecomerce/catalog/style.scss +++ b/forms/ecomerce/catalog/style.scss @@ -194,6 +194,17 @@ } } +.min-quantity { + position: absolute; + bottom: 30px; + right: 0; + + & > span { + font-size: 18px; + vertical-align: middle; + } +} + /* Tags */ .grid-view, @@ -351,6 +362,7 @@ & > .top { padding: 14px; + position: relative; & > .item-info { margin-left: 126px; diff --git a/forms/ecomerce/catalog/ui.xml b/forms/ecomerce/catalog/ui.xml index be118a1c..8bc3f3e6 100644 --- a/forms/ecomerce/catalog/ui.xml +++ b/forms/ecomerce/catalog/ui.xml @@ -117,7 +117,7 @@ SELECT i.id, i.longName item, i.subName, i.tag5, i.value5, i.tag6, i.value6, i.tag7, i.value7, i.tag8, i.value8, - i.relevancy, i.size, i.category, + i.relevancy, i.size, i.category, i.minQuantity, k.name ink, p.name producer, o.name origin, b.available, b.price, b.`grouping`, i.image, im.updated @@ -203,6 +203,12 @@ {{Vn.Value.format(item.price, '%.02d€')}}
+
+ + production_quantity_limits + + {{item.minQuantity}} +
@@ -461,6 +467,12 @@ +
+ {{card.minQuantity}} + + production_quantity_limits + +
Date: Mon, 9 Oct 2023 20:20:01 +0200 Subject: [PATCH 3/6] refs #6200 Style fixes --- debian/changelog | 2 +- forms/ecomerce/catalog/index.js | 8 ++++++++ forms/ecomerce/catalog/style.scss | 12 +++++++++++- forms/ecomerce/catalog/ui.xml | 7 ++++--- package.json | 2 +- 5 files changed, 25 insertions(+), 6 deletions(-) diff --git a/debian/changelog b/debian/changelog index 16f9e02c..93f3feba 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -hedera-web (23.40.1) stable; urgency=low +hedera-web (23.40.2) stable; urgency=low * Initial Release. diff --git a/forms/ecomerce/catalog/index.js b/forms/ecomerce/catalog/index.js index 80e85d5b..ed297040 100644 --- a/forms/ecomerce/catalog/index.js +++ b/forms/ecomerce/catalog/index.js @@ -202,6 +202,12 @@ const Catalog = new Class({ this.hideMenu(); } + + ,itemRenderer(builder, form) { + var minQuantity = builder.$.minQuantity; + minQuantity.style.display = form.$.minQuantity + ? 'block' : 'hidden'; + } ,realmRenderer(builder, form) { var link = builder.$.link; @@ -273,6 +279,8 @@ const Catalog = new Class({ orderId: this.orderId }); this.$.cardPopup.show(event.currentTarget); + this.$.cardMinQuantity.style.display = form.$.minQuantity + ? 'block' : 'none'; } ,onAddLotClick(column, value, row) { diff --git a/forms/ecomerce/catalog/style.scss b/forms/ecomerce/catalog/style.scss index f2ff4378..7f0b998d 100644 --- a/forms/ecomerce/catalog/style.scss +++ b/forms/ecomerce/catalog/style.scss @@ -192,15 +192,20 @@ margin: 0; margin-bottom: 1px; } + & > .min-quantity { + bottom: 30px; + right: 0; + } } .min-quantity { position: absolute; bottom: 30px; right: 0; + font-size: .8rem; & > span { - font-size: 18px; + font-size: 16px; vertical-align: middle; } } @@ -383,6 +388,11 @@ margin-top: 15px 0; font-size: .9rem; } + & > .min-quantity { + bottom: 0; + right: 0; + padding: 14px; + } } & > .lots-grid { border-top: 1px solid #DDD; diff --git a/forms/ecomerce/catalog/ui.xml b/forms/ecomerce/catalog/ui.xml index 8bc3f3e6..35f0115b 100644 --- a/forms/ecomerce/catalog/ui.xml +++ b/forms/ecomerce/catalog/ui.xml @@ -149,7 +149,8 @@ id="grid-view" empty-message="_Choose filter from right menu" form-id="item" - model="items"> + model="items" + renderer="itemRenderer">
-
+
production_quantity_limits @@ -467,7 +468,7 @@ -
+
{{card.minQuantity}} production_quantity_limits diff --git a/package.json b/package.json index 2fd90425..06a8834c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "hedera-web", - "version": "23.40.1", + "version": "23.40.2", "description": "Verdnatura web page", "license": "GPL-3.0", "repository": { From 4a09fe39a80a79db9632cd9750412301a98d6fd4 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Mon, 9 Oct 2023 21:01:11 +0200 Subject: [PATCH 4/6] refs #6200 style fixes, mock local date --- debian/changelog | 2 +- forms/admin/visits/index.js | 4 +-- forms/cms/contact/index.js | 2 +- forms/ecomerce/catalog/style.scss | 4 ++- forms/ecomerce/catalog/ui.xml | 4 +-- forms/ecomerce/checkout/index.js | 6 ++-- forms/reports/shelves/index.js | 2 +- js/htk/calendar/index.js | 4 +-- js/htk/image/index.js | 2 +- js/vn/cookie.js | 52 +++++++++++++------------------ js/vn/date.js | 16 ++++++++++ package.json | 2 +- rest/edi/lib/segment.php | 2 +- 13 files changed, 56 insertions(+), 46 deletions(-) diff --git a/debian/changelog b/debian/changelog index 93f3feba..45f25338 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -hedera-web (23.40.2) stable; urgency=low +hedera-web (23.40.3) stable; urgency=low * Initial Release. diff --git a/forms/admin/visits/index.js b/forms/admin/visits/index.js index 78f093d8..02f5fa16 100644 --- a/forms/admin/visits/index.js +++ b/forms/admin/visits/index.js @@ -7,8 +7,8 @@ export default new Class({ ,activate() { if (!this.hash.$.to) this.hash.assign({ - from: new Date(), - to: new Date() + from: Date.vnNew(), + to: Date.vnNew() }); } }); diff --git a/forms/cms/contact/index.js b/forms/cms/contact/index.js index 7bff0faf..9e9d6f68 100644 --- a/forms/cms/contact/index.js +++ b/forms/cms/contact/index.js @@ -14,7 +14,7 @@ export default new Class({ ,refreshCaptcha() { params = { srv: 'rest:misc/captcha', - stamp: new Date().getTime() + stamp: Date.vnNew().getTime() }; this.$.captchaImg.src = '?'+ Vn.Url.makeUri(params); } diff --git a/forms/ecomerce/catalog/style.scss b/forms/ecomerce/catalog/style.scss index 7f0b998d..c218c348 100644 --- a/forms/ecomerce/catalog/style.scss +++ b/forms/ecomerce/catalog/style.scss @@ -193,16 +193,18 @@ margin-bottom: 1px; } & > .min-quantity { - bottom: 30px; + bottom: 32px; right: 0; } } .min-quantity { position: absolute; + display: none; bottom: 30px; right: 0; font-size: .8rem; + color: #c44; & > span { font-size: 16px; diff --git a/forms/ecomerce/catalog/ui.xml b/forms/ecomerce/catalog/ui.xml index 35f0115b..26a80fda 100644 --- a/forms/ecomerce/catalog/ui.xml +++ b/forms/ecomerce/catalog/ui.xml @@ -469,10 +469,10 @@
- {{card.minQuantity}} production_quantity_limits - + + {{card.minQuantity}}
diff --git a/forms/ecomerce/checkout/index.js b/forms/ecomerce/checkout/index.js index d556c66d..99e07177 100644 --- a/forms/ecomerce/checkout/index.js +++ b/forms/ecomerce/checkout/index.js @@ -8,7 +8,7 @@ export default new Class({ this.autoStepLocked = true; this.$.assistant.stepsIndex = this.agencySteps; - this.today = new Date(); + this.today = Date.vnNew(); this.today.setHours(0, 0, 0, 0); }, @@ -22,8 +22,8 @@ export default new Class({ let date; const row = orderForm.$ || defaultsForm.$ || {}; - if (!date || date.getTime() < (new Date()).getTime()) { - date = new Date(); + if (!date || date.getTime() < (Date.vnNew()).getTime()) { + date = Date.vnNew(); date.setHours(0, 0, 0, 0); let addDays = 0; diff --git a/forms/reports/shelves/index.js b/forms/reports/shelves/index.js index 0cbb379c..1fd0d8d0 100644 --- a/forms/reports/shelves/index.js +++ b/forms/reports/shelves/index.js @@ -6,7 +6,7 @@ export default new Class({ activate() { this.$.lot.assign({ - date: new Date(), + date: Date.vnNew(), useIds: false }); }, diff --git a/js/htk/calendar/index.js b/js/htk/calendar/index.js index 24f757ef..ae265941 100644 --- a/js/htk/calendar/index.js +++ b/js/htk/calendar/index.js @@ -141,7 +141,7 @@ module.exports = new Class({ } ,goToCurrentMonth() { - var date = new Date(); + var date = Date.vnNew(); this.goToMonth(date.getFullYear(), date.getMonth()); } @@ -179,7 +179,7 @@ module.exports = new Class({ // Marks the current day - var today = new Date(); + var today = Date.vnNew(); if (this.year == today.getFullYear() && this.month == today.getMonth()) { diff --git a/js/htk/image/index.js b/js/htk/image/index.js index efe3a752..e73fdc06 100644 --- a/js/htk/image/index.js +++ b/js/htk/image/index.js @@ -192,7 +192,7 @@ module.exports = new Class({ } ,_onFileUpload(cell) { - this._stamp = new Date().getTime(); + this._stamp = Date.vnNew().getTime(); this._refreshSrc(cell); this.popup.hide(); } diff --git a/js/vn/cookie.js b/js/vn/cookie.js index 7ab233e1..8e90dfae 100644 --- a/js/vn/cookie.js +++ b/js/vn/cookie.js @@ -3,69 +3,61 @@ */ module.exports = { - set: function (key, value, days) - { + set: function(key, value, days) { var strCookie = key + '=' + value + ';'; - if (days != undefined) - { - var date = new Date (); - date.setTime (date.getTime () + days * 86400000); - strCookie += 'expires=' + date.toGMTString (); + if (days != undefined) { + var date = Date.vnNew(); + date.setTime(date.getTime() + days * 86400000); + strCookie += 'expires=' + date.toGMTString(); } document.cookie = strCookie; } - ,unset: function (key) - { - this.set (key, '', -1); + ,unset: function(key) { + this.set(key, '', -1); } - ,get: function (key) - { - var cookie = new String (document.cookie); - var start = cookie.indexOf (key + '='); + ,get: function(key) { + var cookie = new String(document.cookie); + var start = cookie.indexOf(key + '='); - if (start != -1) - { + if (start != -1) { var end; start += key.length + 1; - end = cookie.indexOf (';', start); + end = cookie.indexOf(';', start); if (end > 0) - return cookie.substring (start, end); + return cookie.substring(start, end); else - return cookie.substring (start); + return cookie.substring(start); } return null; } - ,getInt: function (key) - { - var value = this.get (key); + ,getInt: function(key) { + var value = this.get(key); if (value != null) - return parseInt (value); + return parseInt(value); return null; } - ,getFloat: function (key) - { - var value = this.get (key); + ,getFloat: function(key) { + var value = this.get(key); if (value != null) - return parseFloat (value); + return parseFloat(value); return null; } - ,check: function (key) - { - return this.get (key) != null; + ,check: function(key) { + return this.get(key) != null; } }; diff --git a/js/vn/date.js b/js/vn/date.js index 470315fb..594a07dc 100644 --- a/js/vn/date.js +++ b/js/vn/date.js @@ -6,6 +6,22 @@ Date.prototype.clone = function() { return new Date(this.getTime()); } +Date.vnUTC = () => { + const env = process.env.NODE_ENV; + if (!env || env === 'development') + return new Date(Date.UTC(2001, 0, 1, 11)); + + return new Date(); +}; + +Date.vnNew = () => { + return new Date(Date.vnUTC()); +}; + +Date.vnNow = () => { + return new Date(Date.vnUTC()).getTime(); +}; + module.exports = { WDays: [ diff --git a/package.json b/package.json index 06a8834c..1a31fab3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "hedera-web", - "version": "23.40.2", + "version": "23.40.3", "description": "Verdnatura web page", "license": "GPL-3.0", "repository": { diff --git a/rest/edi/lib/segment.php b/rest/edi/lib/segment.php index 6e6f52b3..e25bd007 100644 --- a/rest/edi/lib/segment.php +++ b/rest/edi/lib/segment.php @@ -18,7 +18,7 @@ class Segment { switch ($type) { case Type::DATE: - $tmp = new Date(); + $tmp = Date.vnNew(); $tmp->setDate(substr($v, 0, 4), substr($v, 4, 2), substr($v, 6, 2)); return $tmp; case Type::TIME: From 1535a557a8c0bb4962a0610d30c0319963348732 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Mon, 9 Oct 2023 21:08:40 +0200 Subject: [PATCH 5/6] refs #6200 Fixes: style & add to basket --- debian/changelog | 2 +- forms/ecomerce/catalog/index.js | 2 +- forms/ecomerce/catalog/style.scss | 3 ++- package.json | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/debian/changelog b/debian/changelog index 45f25338..df99b5be 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -hedera-web (23.40.3) stable; urgency=low +hedera-web (23.40.4) stable; urgency=low * Initial Release. diff --git a/forms/ecomerce/catalog/index.js b/forms/ecomerce/catalog/index.js index ed297040..a550f0ac 100644 --- a/forms/ecomerce/catalog/index.js +++ b/forms/ecomerce/catalog/index.js @@ -325,7 +325,7 @@ const Catalog = new Class({ } if (amountSum > 0) { - this.conn.execQuery(sql); + await this.conn.execQuery(sql); var itemName = this.$.$card.get('item'); Htk.Toast.showMessage( diff --git a/forms/ecomerce/catalog/style.scss b/forms/ecomerce/catalog/style.scss index c218c348..8fcc25b4 100644 --- a/forms/ecomerce/catalog/style.scss +++ b/forms/ecomerce/catalog/style.scss @@ -204,7 +204,8 @@ bottom: 30px; right: 0; font-size: .8rem; - color: #c44; + color: #a44; + cursor: pointer; & > span { font-size: 16px; diff --git a/package.json b/package.json index 1a31fab3..df1f922b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "hedera-web", - "version": "23.40.3", + "version": "23.40.5", "description": "Verdnatura web page", "license": "GPL-3.0", "repository": { From fba880fb330815b0012e94dde77c039dd0c65039 Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Tue, 10 Oct 2023 09:37:29 +0200 Subject: [PATCH 6/6] refs #6200 Version increased --- debian/changelog | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index df99b5be..ee25dfca 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -hedera-web (23.40.4) stable; urgency=low +hedera-web (23.40.6) stable; urgency=low * Initial Release. diff --git a/package.json b/package.json index df1f922b..ef46e548 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "hedera-web", - "version": "23.40.5", + "version": "23.40.6", "description": "Verdnatura web page", "license": "GPL-3.0", "repository": {