Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 5325-defaultSearch-SmartTable

This commit is contained in:
Carlos Satorres 2023-06-15 16:47:33 +02:00
commit 4157e30d4c
29 changed files with 191 additions and 69 deletions

View File

@ -14,7 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed
-
## [2324.01] - 2023-06-08
## [2324.01] - 2023-06-15
### Added
- (Tickets -> Abono) Al abonar permite crear el ticket abono con almacén o sin almmacén

View File

@ -8,7 +8,7 @@ Salix is also the scientific name of a beautifull tree! :)
Required applications.
* Node.js = 14.x LTS
* Node.js >= 16.x LTS
* Docker
* Git

View File

@ -62,10 +62,9 @@ module.exports = Self => {
scopes: ['change-password'],
userId: vnUser.id
});
throw new UserError('Pass expired', 'passExpired', {
id: vnUser.id,
token: changePasswordToken.id
});
const err = new UserError('Pass expired', 'passExpired');
err.details = {token: changePasswordToken};
throw err;
}
try {

View File

@ -0,0 +1,71 @@
CREATE TABLE `vn`.`packingSiteAdvanced` (
`ticketFk` int(11),
`workerFk` int(10) unsigned,
PRIMARY KEY (`ticketFk`),
KEY `packingSiteAdvanced_FK_1` (`workerFk`),
CONSTRAINT `packingSiteAdvanced_FK` FOREIGN KEY (`ticketFk`) REFERENCES `ticket` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `packingSiteAdvanced_FK_1` FOREIGN KEY (`workerFk`) REFERENCES `worker` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`)
VALUES
('PackingSiteAdvanced', '*', '*', 'ALLOW', 'ROLE', 'production');
DROP PROCEDURE IF EXISTS `vn`.`packingSite_startCollection`;
DELIMITER $$
$$
CREATE DEFINER=`root`@`localhost` PROCEDURE `vn`.`packingSite_startCollection`(vSelf INT, vTicketFk INT)
proc: BEGIN
/**
* @param vSelf packingSite id
* @param vTicketFk A ticket id from the collection to start
*/
DECLARE vExists BOOL;
DECLARE vIsAdvanced BOOL;
DECLARE vNewCollectionFk INT;
DECLARE vOldCollectionFk INT;
DECLARE vIsPackingByOther BOOL;
SELECT id, collectionFk
INTO vExists, vOldCollectionFk
FROM packingSite
WHERE id = vSelf;
IF NOT vExists THEN
CALL util.throw('packingSiteNotExists');
END IF;
SELECT COUNT(*) > 0
INTO vIsAdvanced
FROM packingSiteAdvanced
WHERE ticketFk = vTicketFk;
IF vIsAdvanced THEN
LEAVE proc;
END IF;
SELECT collectionFk INTO vNewCollectionFk
FROM ticketCollection WHERE ticketFk = vTicketFk;
IF vOldCollectionFk IS NOT NULL
AND vOldCollectionFk <> vNewCollectionFk THEN
SELECT COUNT(*) > 0
INTO vIsPackingByOther
FROM packingSite
WHERE id <> vSelf
AND collectionFk = vOldCollectionFk;
IF NOT vIsPackingByOther AND NOT collection_isPacked(vOldCollectionFk) THEN
CALL util.throw('cannotChangeCollection');
END IF;
END IF;
UPDATE packingSite SET collectionFk = vNewCollectionFk
WHERE id = vSelf;
END$$
DELIMITER ;

View File

@ -15,7 +15,7 @@ export default class Controller {
}
$onInit() {
if (!this.$state.params || !this.$state.params.id || !this.$state.params.token)
if (!this.$state.params.id)
this.$state.go('login');
this.$http.get('UserPasswords/findOne')
@ -25,7 +25,7 @@ export default class Controller {
}
submit() {
const id = this.$state.params.id;
const userId = this.$state.params.userId;
const newPassword = this.newPassword;
const oldPassword = this.oldPassword;
@ -35,12 +35,12 @@ export default class Controller {
throw new UserError(`Passwords don't match`);
const headers = {
Authorization: this.$state.params.token
Authorization: this.$state.params.id
};
this.$http.post('VnUsers/change-password',
{
id,
id: userId,
oldPassword,
newPassword
},

View File

@ -27,10 +27,9 @@ export default class Controller {
this.loading = false;
this.password = '';
this.focusUser();
if (req?.data?.error?.code == 'passExpired') {
const [args] = req.data.error.translateArgs;
this.$state.go('change-password', args);
}
const err = req.data?.error;
if (err?.code == 'passExpired')
this.$state.go('change-password', err.details.token);
throw req;
});

View File

@ -38,7 +38,7 @@ function config($stateProvider, $urlRouterProvider) {
})
.state('change-password', {
parent: 'outLayout',
url: '/change-password?id&token',
url: '/change-password?id&userId',
description: 'Change password',
template: '<vn-change-password></vn-change-password>'
})

View File

@ -0,0 +1,3 @@
name: account
columns:
id: id

View File

@ -0,0 +1,3 @@
name: cuenta
columns:
id: id

View File

@ -0,0 +1,5 @@
name: mail alias
columns:
id: id
mailAlias: alias
account: account

View File

@ -0,0 +1,5 @@
name: alias de correo
columns:
id: id
mailAlias: alias
account: cuenta

View File

@ -5,8 +5,7 @@ import UserError from 'core/lib/user-error';
export default class Controller extends Section {
onSynchronizeAll() {
this.vnApp.showSuccess(this.$t('Synchronizing in the background'));
this.$http.patch(`Accounts/syncAll`)
.then(() => this.vnApp.showSuccess(this.$t('Users synchronized!')));
this.$http.patch(`Accounts/syncAll`);
}
onUserSync() {

View File

@ -2,7 +2,7 @@ const UserError = require('vn-loopback/util/user-error');
const base64url = require('base64url');
module.exports = Self => {
Self.remoteMethodCtx('confirm', {
Self.remoteMethod('confirm', {
description: 'Confirms electronic payment transaction',
accessType: 'WRITE',
accepts: [
@ -30,7 +30,7 @@ module.exports = Self => {
}
});
Self.confirm = async(ctx, signatureVersion, merchantParameters, signature) => {
Self.confirm = async(signatureVersion, merchantParameters, signature) => {
const $ = Self.app.models;
let transaction;
@ -83,7 +83,7 @@ module.exports = Self => {
params['Ds_Currency'],
params['Ds_Response'],
params['Ds_ErrorCode']
], {userId: ctx.req.accessToken.userId});
]);
return true;
} catch (err) {

View File

@ -118,7 +118,8 @@
label="Company"
show-field="code"
value-field="id"
ng-model="$ctrl.companyFk">
ng-model="$ctrl.companyFk"
on-change="$ctrl.getInvoiceDate(value)">
</vn-autocomplete>
<vn-autocomplete
url="Printers"

View File

@ -7,23 +7,29 @@ class Controller extends Section {
$onInit() {
const date = Date.vnNew();
Object.assign(this, {
maxShipped: new Date(date.getFullYear(), date.getMonth(), 0),
clientsToInvoice: 'all',
maxShipped: new Date(date.getFullYear(), date.getMonth(), 0),
clientsToInvoice: 'all',
});
this.$http.get('UserConfigs/getUserConfig')
.then(res => {
this.companyFk = res.data.companyFk;
const params = {
companyFk: this.companyFk
};
return this.$http.get('InvoiceOuts/getInvoiceDate', {params});
})
.then(res => {
this.minInvoicingDate = res.data.issued ? new Date(res.data.issued) : null;
this.invoiceDate = this.minInvoicingDate;
});
}
.then(res => {
this.companyFk = res.data.companyFk;
this.getInvoiceDate(this.companyFk);
});
}
getInvoiceDate(companyFk) {
const params = { companyFk: companyFk };
this.fetchInvoiceDate(params);
}
fetchInvoiceDate(params) {
this.$http.get('InvoiceOuts/getInvoiceDate', { params })
.then(res => {
this.minInvoicingDate = res.data.issued ? new Date(res.data.issued) : null;
this.invoiceDate = this.minInvoicingDate;
});
}
stopInvoicing() {
this.status = 'stopping';
@ -42,7 +48,7 @@ class Controller extends Section {
throw new UserError('Invoice date and the max date should be filled');
if (this.invoiceDate < this.maxShipped)
throw new UserError('Invoice date can\'t be less than max date');
if (this.invoiceDate.getTime() < this.minInvoicingDate.getTime())
if (this.minInvoicingDate && this.invoiceDate.getTime() < this.minInvoicingDate.getTime())
throw new UserError('Exists an invoice with a previous date');
if (!this.companyFk)
throw new UserError('Choose a valid company');

View File

@ -2,14 +2,17 @@ name: request
columns:
id: id
description: description
created: created
buyerCode: buyer
quantity: quantity
price: price
isOk: ok
response: response
saleFk: sale
ticketFk: ticket
attenderFk: attender
requesterFk: requester
itemFk: item
clientFk: client
response: response
total: total
buyed: buyed
saleFk: sale
created: created
isOk: ok
requesterFk: requester
attenderFk: attender
ticketFk: ticket

View File

@ -1,15 +1,18 @@
name: peticion
name: petición
columns:
id: id
description: descripción
created: creado
buyerCode: comprador
quantity: cantidad
price: precio
isOk: ok
response: respuesta
saleFk: línea
ticketFk: ticket
attenderFk: asistente
requesterFk: solicitante
itemFk: artículo
clientFk: cliente
response: respuesta
total: total
buyed: comprado
saleFk: línea
created: creado
isOk: ok
requesterFk: solicitante
attenderFk: asistente
ticketFk: ticket

View File

@ -100,5 +100,8 @@
},
"TicketConfig": {
"dataSource": "vn"
},
"PackingSiteAdvanced": {
"dataSource": "vn"
}
}

View File

@ -0,0 +1,18 @@
{
"name": "PackingSiteAdvanced",
"base": "VnModel",
"options": {
"mysql": {
"table": "packingSiteAdvanced"
}
},
"properties": {
"ticketFk": {
"id": true,
"type": "number"
},
"workerFk": {
"type": "number"
}
}
}

View File

@ -1,14 +1,14 @@
name: zone event
name: event
columns:
id: id
zoneFk: zone
type: type
dated: dated
started: started
ended: ended
started: starts
ended: ends
weekDays: week days
hour: hour
travelingDays: traveling days
price: price
bonus: bonus
m3Max: max m3
m3Max: max. m3

View File

@ -1,11 +1,11 @@
name: evento zona
name: evento
columns:
id: id
zoneFk: zona
type: tipo
dated: fecha
started: comenzado
ended: terminado
started: empieza
ended: termina
weekDays: días semana
hour: hora
travelingDays: días de viaje

View File

@ -1,5 +1,5 @@
name: zone exclusion
name: exclusion
columns:
id: id
dated: dated
dated: date
zoneFk: zone

View File

@ -1,4 +1,4 @@
name: zone exclusion
name: exclusión
columns:
id: id
dated: fecha

View File

@ -1,5 +1,7 @@
name: zone included
name: inclusion
columns:
id: id
dated: dated
zoneFk: zone
isIncluded: incluida
geoFk: localización

View File

@ -1,5 +1,7 @@
name: zona incluida
name: inclusión
columns:
id: id
dated: fecha
zoneFk: zona
isIncluded: incluida
geoFk: localización

View File

@ -1,4 +1,4 @@
name: zone warehouse
name: warehouse
columns:
id: id
warehouseFk: warehouse

View File

@ -1,4 +1,4 @@
name: almacén zona
name: almacén
columns:
id: id
warehouseFk: almacén

2
package-lock.json generated
View File

@ -1,6 +1,6 @@
{
"name": "salix-back",
"version": "23.24.01",
"version": "23.26.01",
"lockfileVersion": 2,
"requires": true,
"packages": {