Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 5063-item-module-doPhoto
This commit is contained in:
commit
c1fe09ab5d
56
CHANGELOG.md
56
CHANGELOG.md
|
@ -5,28 +5,66 @@ All notable changes to this project will be documented in this file.
|
|||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [2308.01] - 2023-03-09
|
||||
|
||||
### Added
|
||||
-
|
||||
|
||||
### Changed
|
||||
-
|
||||
|
||||
### Fixed
|
||||
-
|
||||
|
||||
## [2306.01] - 2023-02-23
|
||||
|
||||
### Added
|
||||
- (Tickets -> Datos Básicos) Mensaje de confirmación al intentar generar tickets con negativos
|
||||
- (Artículos) El visible y disponible se calcula a partir de un almacén diferente dependiendo de la sección en la que te encuentres. Se ha añadido un icono que informa sobre a partir de que almacén se esta calculando.
|
||||
|
||||
### Changed
|
||||
- (General -> Inicio) Ahora permite recuperar la contraseña tanto con el correo de recuperación como el usuario
|
||||
|
||||
### Fixed
|
||||
- (Monitor de tickets) Cuando ordenas por columna, ya no se queda deshabilitado el botón de 'Actualizar'
|
||||
- (Zone -> Días de entrega) Al hacer click en un día, muestra correctamente las zonas
|
||||
- (Artículos) El disponible en la vista previa se muestra correctamente
|
||||
|
||||
## [2304.01] - 2023-02-09
|
||||
|
||||
### Added
|
||||
-
|
||||
- (Rutas) Al descargar varias facturas se comprime en un zip
|
||||
- (Trabajadores -> Nuevo trabajador) Nueva sección
|
||||
- (Tickets -> Adelantar tickets) Añadidos campos "líneas" y "litros" al ticket origen
|
||||
- (Tickets -> Adelantar tickets) Nuevo icono muestra cuando las agencias de los tickets origen/destino son distintas
|
||||
|
||||
### Changed
|
||||
-
|
||||
- (Entradas -> Compras) Cambiados los campos "Precio Grouping/Packing" por "PVP" y "Precio" por "Coste"
|
||||
- (Artículos -> Últimas entradas) Cambiados los campos "P.P.U." y "P.P.P." por "PVP"
|
||||
- (Rutas -> Sumario/Tickets) Actualizados campos de los tickets
|
||||
- (Proveedores -> Crear/Editar) Permite añadir Proveedores con la misma razón social pero con países distintos
|
||||
- (Tickets -> Adelantar tickets) Cambiados selectores de estado por checks "Pendiente origen/destino"
|
||||
- (Tickets -> Adelantar tickets) Cambiado stock de destino a origen.
|
||||
|
||||
### Fixed
|
||||
-
|
||||
- (Artículos -> Etiquetas) Permite intercambiar la relevancia entre dos etiquetas.
|
||||
- (Cliente -> Datos Fiscales) No se permite seleccionar 'Notificar vía e-mail' a los clientes sin e-mail
|
||||
- (Tickets -> Datos básicos) Permite guardar la hora de envío
|
||||
- (Tickets -> Añadir pago) Eliminado "null" en las referencias
|
||||
- (Tickets -> Adelantar tickets) Permite ordenar por importe
|
||||
- (Tickets -> Adelantar tickets) El filtrado por encajado muestra también los tickets sin tipo de encajado
|
||||
|
||||
## [2302.01] - 2023-01-26
|
||||
|
||||
### Added
|
||||
- (General -> Inicio) Permite recuperar la contraseña
|
||||
- (Tickets -> Opciones) Subir albarán a Docuware
|
||||
- (Tickets -> Opciones) Enviar correo con PDF de Docuware
|
||||
- (Artículos -> Datos Básicos) Añadido campo Unidades/Caja
|
||||
- (General -> Inicio) Permite recuperar la contraseña
|
||||
- (Tickets -> Opciones) Subir albarán a Docuware
|
||||
- (Tickets -> Opciones) Enviar correo con PDF de Docuware
|
||||
- (Artículos -> Datos Básicos) Añadido campo Unidades/Caja
|
||||
|
||||
### Changed
|
||||
- (Reclamaciones -> Descriptor) Cambiado el campo Agencia por Zona
|
||||
- (Tickets -> Líneas preparadas) Actualizada sección para que sea más visual
|
||||
- (Reclamaciones -> Descriptor) Cambiado el campo Agencia por Zona
|
||||
- (Tickets -> Líneas preparadas) Actualizada sección para que sea más visual
|
||||
|
||||
### Fixed
|
||||
- (General) Al utilizar el traductor de Google se descuadraban los iconos
|
||||
|
|
|
@ -3,9 +3,9 @@ module.exports = Self => {
|
|||
description: 'Send email to the user',
|
||||
accepts: [
|
||||
{
|
||||
arg: 'email',
|
||||
arg: 'user',
|
||||
type: 'string',
|
||||
description: 'The email of user',
|
||||
description: 'The user name or email',
|
||||
required: true
|
||||
}
|
||||
],
|
||||
|
@ -15,11 +15,20 @@ module.exports = Self => {
|
|||
}
|
||||
});
|
||||
|
||||
Self.recoverPassword = async function(email) {
|
||||
Self.recoverPassword = async function(user) {
|
||||
const models = Self.app.models;
|
||||
|
||||
const usesEmail = user.indexOf('@') !== -1;
|
||||
if (!usesEmail) {
|
||||
const account = await models.Account.findOne({
|
||||
fields: ['email'],
|
||||
where: {name: user}
|
||||
});
|
||||
user = account.email;
|
||||
}
|
||||
|
||||
try {
|
||||
await models.user.resetPassword({email, emailTemplate: 'recover-password'});
|
||||
await models.user.resetPassword({email: user, emailTemplate: 'recover-password'});
|
||||
} catch (err) {
|
||||
if (err.code === 'EMAIL_NOT_FOUND')
|
||||
return;
|
||||
|
|
|
@ -22,7 +22,7 @@ module.exports = Self => {
|
|||
|
||||
Self.latest = async filter => {
|
||||
const conn = Self.dataSource.connector;
|
||||
const minDate = new Date();
|
||||
const minDate = Date.vnNew();
|
||||
minDate.setFullYear(minDate.getFullYear() - 1);
|
||||
|
||||
const where = {dated: {gte: minDate}};
|
||||
|
|
|
@ -2,7 +2,7 @@ const app = require('vn-loopback/server/server');
|
|||
|
||||
describe('campaign latest()', () => {
|
||||
it('should return the campaigns from the last year', async() => {
|
||||
const now = new Date();
|
||||
const now = Date.vnNew();
|
||||
const result = await app.models.Campaign.latest();
|
||||
const randomIndex = Math.floor(Math.random() * result.length);
|
||||
const campaignDated = result[randomIndex].dated;
|
||||
|
@ -12,7 +12,7 @@ describe('campaign latest()', () => {
|
|||
});
|
||||
|
||||
it('should return the campaigns from the current year', async() => {
|
||||
const now = new Date();
|
||||
const now = Date.vnNew();
|
||||
const currentYear = now.getFullYear();
|
||||
const result = await app.models.Campaign.latest({
|
||||
where: {dated: {like: `%${currentYear}%`}}
|
||||
|
|
|
@ -4,7 +4,7 @@ describe('campaign upcoming()', () => {
|
|||
it('should return the upcoming campaign but from the last year', async() => {
|
||||
const response = await app.models.Campaign.upcoming();
|
||||
const campaignDated = response.dated;
|
||||
const now = new Date();
|
||||
const now = Date.vnNew();
|
||||
|
||||
expect(campaignDated).toEqual(jasmine.any(Date));
|
||||
expect(campaignDated).toBeLessThanOrEqual(now);
|
||||
|
|
|
@ -14,7 +14,7 @@ module.exports = Self => {
|
|||
});
|
||||
|
||||
Self.upcoming = async() => {
|
||||
const minDate = new Date();
|
||||
const minDate = Date.vnNew();
|
||||
minDate.setFullYear(minDate.getFullYear() - 1);
|
||||
|
||||
return Self.findOne({
|
||||
|
|
|
@ -21,7 +21,7 @@ module.exports = Self => {
|
|||
|
||||
if (!this.login) return;
|
||||
|
||||
if (Date.now() > this.login.expires)
|
||||
if (Date.vnNow() > this.login.expires)
|
||||
this.login = await requestToken();
|
||||
|
||||
return this.login;
|
||||
|
@ -48,7 +48,7 @@ module.exports = Self => {
|
|||
userId: requestData.userId,
|
||||
token: requestData.authToken
|
||||
},
|
||||
expires: Date.now() + (1000 * 60 * tokenLifespan)
|
||||
expires: Date.vnNow() + (1000 * 60 * tokenLifespan)
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ module.exports = Self => {
|
|||
await models.Chat.create({
|
||||
senderFk: sender.id,
|
||||
recipient: to,
|
||||
dated: new Date(),
|
||||
dated: Date.vnNew(),
|
||||
checkUserStatus: 0,
|
||||
message: message,
|
||||
status: 0,
|
||||
|
|
|
@ -49,7 +49,7 @@ module.exports = Self => {
|
|||
await models.Chat.create({
|
||||
senderFk: sender.id,
|
||||
recipient: `@${recipient.name}`,
|
||||
dated: new Date(),
|
||||
dated: Date.vnNew(),
|
||||
checkUserStatus: 1,
|
||||
message: message,
|
||||
status: 0,
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
const models = require('vn-loopback/server/server').models;
|
||||
|
||||
describe('Chat sendCheckingPresence()', () => {
|
||||
const today = new Date();
|
||||
const today = Date.vnNew();
|
||||
today.setHours(6, 0);
|
||||
const chatModel = models.Chat;
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ module.exports = Self => {
|
|||
}
|
||||
});
|
||||
|
||||
Self.setSaleQuantity = async(saleId, quantity) => {
|
||||
Self.setSaleQuantity = async(saleId, quantity, options) => {
|
||||
const models = Self.app.models;
|
||||
const myOptions = {};
|
||||
let tx;
|
||||
|
|
|
@ -32,7 +32,7 @@ module.exports = Self => {
|
|||
where: {code: 'trash'}
|
||||
}, myOptions);
|
||||
|
||||
const date = new Date();
|
||||
const date = Date.vnNew();
|
||||
date.setMonth(date.getMonth() - 4);
|
||||
|
||||
const dmsToDelete = await models.Dms.find({
|
||||
|
|
|
@ -163,7 +163,7 @@ module.exports = Self => {
|
|||
fields: ['alertLevel']
|
||||
});
|
||||
|
||||
signedTime ? signedTime != undefined : signedTime = new Date();
|
||||
signedTime ? signedTime != undefined : signedTime = Date.vnNew();
|
||||
|
||||
if (alertLevel >= 2) {
|
||||
let dir;
|
||||
|
|
|
@ -127,7 +127,7 @@ module.exports = Self => {
|
|||
const uploadOptions = {
|
||||
headers: {
|
||||
'Content-Type': 'multipart/form-data',
|
||||
'X-File-ModifiedDate': new Date(),
|
||||
'X-File-ModifiedDate': Date.vnNew(),
|
||||
'Cookie': options.headers.headers.Cookie,
|
||||
...data.getHeaders()
|
||||
},
|
||||
|
|
|
@ -230,7 +230,7 @@ module.exports = Self => {
|
|||
UPDATE edi.tableConfig
|
||||
SET updated = ?
|
||||
WHERE fileName = ?
|
||||
`, [new Date(), baseName], options);
|
||||
`, [Date.vnNew(), baseName], options);
|
||||
}
|
||||
|
||||
console.log(`Updated table ${toTable}\n`);
|
||||
|
|
|
@ -32,7 +32,7 @@ module.exports = Self => {
|
|||
|
||||
if (!config.cleanDays) return;
|
||||
|
||||
const cleanDate = new Date();
|
||||
const cleanDate = Date.vnNew();
|
||||
cleanDate.setDate(cleanDate.getDate() - config.cleanDays);
|
||||
|
||||
await models.NotificationQueue.destroyAll({
|
||||
|
|
|
@ -10,7 +10,7 @@ describe('Notification Clean()', () => {
|
|||
const notification = await models.Notification.findOne({}, options);
|
||||
const notificationConfig = await models.NotificationConfig.findOne({});
|
||||
|
||||
const cleanDate = new Date();
|
||||
const cleanDate = Date.vnNew();
|
||||
cleanDate.setDate(cleanDate.getDate() - (notificationConfig.cleanDays + 1));
|
||||
|
||||
let before;
|
||||
|
|
|
@ -20,10 +20,9 @@
|
|||
"type": "date"
|
||||
}
|
||||
},
|
||||
|
||||
"scope": {
|
||||
"where" :{
|
||||
"expired": null
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -77,7 +77,7 @@ module.exports = Self => {
|
|||
const newImage = await Self.upsertWithWhere(data, {
|
||||
name: fileName,
|
||||
collectionFk: collectionName,
|
||||
updated: (new Date).getTime()
|
||||
updated: Date.vnNow()
|
||||
}, myOptions);
|
||||
|
||||
// Resizes and saves the image
|
||||
|
|
|
@ -6,6 +6,16 @@
|
|||
"table": "util.notificationAcl"
|
||||
}
|
||||
},
|
||||
"properties":{
|
||||
"notificationFk": {
|
||||
"id": true,
|
||||
"type": "number"
|
||||
},
|
||||
"roleFk":{
|
||||
"id": true,
|
||||
"type": "number"
|
||||
}
|
||||
},
|
||||
"relations": {
|
||||
"notification": {
|
||||
"type": "belongsTo",
|
||||
|
|
|
@ -0,0 +1,62 @@
|
|||
const UserError = require('vn-loopback/util/user-error');
|
||||
|
||||
module.exports = Self => {
|
||||
Self.observe('before save', async function(ctx) {
|
||||
const models = Self.app.models;
|
||||
const userId = ctx.options.accessToken.userId;
|
||||
const user = await ctx.instance.userFk;
|
||||
const modifiedUser = await getUserToModify(null, user, models);
|
||||
|
||||
if (userId != modifiedUser.id && userId != modifiedUser.bossFk)
|
||||
throw new UserError('You dont have permission to modify this user');
|
||||
});
|
||||
|
||||
Self.remoteMethod('deleteNotification', {
|
||||
description: 'Deletes a notification subscription',
|
||||
accepts: [
|
||||
{
|
||||
arg: 'ctx',
|
||||
type: 'object',
|
||||
http: {source: 'context'}
|
||||
},
|
||||
{
|
||||
arg: 'notificationId',
|
||||
type: 'number',
|
||||
required: true
|
||||
},
|
||||
],
|
||||
returns: {
|
||||
type: 'object',
|
||||
root: true
|
||||
},
|
||||
http: {
|
||||
verb: 'POST',
|
||||
path: '/deleteNotification'
|
||||
}
|
||||
});
|
||||
|
||||
Self.deleteNotification = async function(ctx, notificationId) {
|
||||
const models = Self.app.models;
|
||||
const user = ctx.req.accessToken.userId;
|
||||
const modifiedUser = await getUserToModify(notificationId, null, models);
|
||||
|
||||
if (user != modifiedUser.id && user != modifiedUser.bossFk)
|
||||
throw new UserError('You dont have permission to modify this user');
|
||||
|
||||
await models.NotificationSubscription.destroyById(notificationId);
|
||||
};
|
||||
|
||||
async function getUserToModify(notificationId, userFk, models) {
|
||||
let userToModify = userFk;
|
||||
if (notificationId) {
|
||||
const subscription = await models.NotificationSubscription.findById(notificationId);
|
||||
userToModify = subscription.userFk;
|
||||
}
|
||||
return await models.Worker.findOne({
|
||||
fields: ['id', 'bossFk'],
|
||||
where: {
|
||||
id: userToModify
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
|
@ -7,15 +7,18 @@
|
|||
}
|
||||
},
|
||||
"properties": {
|
||||
"notificationFk": {
|
||||
"id": {
|
||||
"type": "number",
|
||||
"id": true,
|
||||
"description": "Identifier"
|
||||
"description": "Primary key"
|
||||
},
|
||||
"notificationFk": {
|
||||
"type": "number",
|
||||
"description": "Foreign key to Notification"
|
||||
},
|
||||
"userFk": {
|
||||
"type": "number",
|
||||
"id": true,
|
||||
"description": "Identifier"
|
||||
"description": "Foreign key to Account"
|
||||
}
|
||||
},
|
||||
"relations": {
|
||||
|
|
|
@ -0,0 +1,74 @@
|
|||
const models = require('vn-loopback/server/server').models;
|
||||
|
||||
describe('loopback model NotificationSubscription', () => {
|
||||
it('Should fail to delete a notification if the user is not editing itself or a subordinate', async() => {
|
||||
const tx = await models.NotificationSubscription.beginTransaction({});
|
||||
|
||||
try {
|
||||
const options = {transaction: tx};
|
||||
const user = 9;
|
||||
const notificationSubscriptionId = 2;
|
||||
const ctx = {req: {accessToken: {userId: user}}};
|
||||
const notification = await models.NotificationSubscription.findById(notificationSubscriptionId);
|
||||
|
||||
let error;
|
||||
|
||||
try {
|
||||
await models.NotificationSubscription.deleteNotification(ctx, notification.id, options);
|
||||
} catch (e) {
|
||||
error = e;
|
||||
}
|
||||
|
||||
expect(error.message).toContain('You dont have permission to modify this user');
|
||||
await tx.rollback();
|
||||
} catch (e) {
|
||||
await tx.rollback();
|
||||
throw e;
|
||||
}
|
||||
});
|
||||
|
||||
it('Should delete a notification if the user is editing itself', async() => {
|
||||
const tx = await models.NotificationSubscription.beginTransaction({});
|
||||
|
||||
try {
|
||||
const options = {transaction: tx};
|
||||
const user = 9;
|
||||
const notificationSubscriptionId = 4;
|
||||
const ctx = {req: {accessToken: {userId: user}}};
|
||||
const notification = await models.NotificationSubscription.findById(notificationSubscriptionId);
|
||||
|
||||
await models.NotificationSubscription.deleteNotification(ctx, notification.id, options);
|
||||
|
||||
const deletedNotification = await models.NotificationSubscription.findById(notificationSubscriptionId);
|
||||
|
||||
expect(deletedNotification).toBeNull();
|
||||
await tx.rollback();
|
||||
} catch (e) {
|
||||
await tx.rollback();
|
||||
throw e;
|
||||
}
|
||||
});
|
||||
|
||||
it('Should delete a notification if the user is editing a subordinate', async() => {
|
||||
const tx = await models.NotificationSubscription.beginTransaction({});
|
||||
|
||||
try {
|
||||
const options = {transaction: tx};
|
||||
const user = 9;
|
||||
const notificationSubscriptionId = 5;
|
||||
const ctx = {req: {accessToken: {userId: user}}};
|
||||
const notification = await models.NotificationSubscription.findById(notificationSubscriptionId);
|
||||
|
||||
await models.NotificationSubscription.deleteNotification(ctx, notification.id, options);
|
||||
|
||||
const deletedNotification = await models.NotificationSubscription.findById(notificationSubscriptionId);
|
||||
|
||||
expect(deletedNotification).toBeNull();
|
||||
await tx.rollback();
|
||||
} catch (e) {
|
||||
await tx.rollback();
|
||||
throw e;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
@ -0,0 +1 @@
|
|||
ALTER TABLE `vn`.`supplier` ADD UNIQUE (name, countryFk);
|
|
@ -1,2 +1,173 @@
|
|||
DELETE FROM `salix`.`ACL` WHERE model="SaleChecked";
|
||||
DROP TABLE IF EXISTS `vn`.`saleChecked`;
|
||||
DROP PROCEDURE IF EXISTS `vn`.`clean`;
|
||||
|
||||
DELIMITER $$
|
||||
$$
|
||||
CREATE DEFINER=`root`@`localhost` PROCEDURE `vn`.`clean`()
|
||||
BEGIN
|
||||
DECLARE vDateShort DATETIME;
|
||||
DECLARE vOneYearAgo DATE;
|
||||
DECLARE vFourYearsAgo DATE;
|
||||
DECLARE v18Month DATE;
|
||||
DECLARE v26Month DATE;
|
||||
DECLARE v3Month DATE;
|
||||
DECLARE vTrashId VARCHAR(15);
|
||||
|
||||
SET vDateShort = util.VN_CURDATE() - INTERVAL 2 MONTH;
|
||||
SET vOneYearAgo = util.VN_CURDATE() - INTERVAL 1 YEAR;
|
||||
SET vFourYearsAgo = util.VN_CURDATE() - INTERVAL 4 YEAR;
|
||||
SET v18Month = util.VN_CURDATE() - INTERVAL 18 MONTH;
|
||||
SET v26Month = util.VN_CURDATE() - INTERVAL 26 MONTH;
|
||||
SET v3Month = util.VN_CURDATE() - INTERVAL 3 MONTH;
|
||||
|
||||
DELETE FROM ticketParking WHERE created < vDateShort;
|
||||
DELETE FROM routesMonitor WHERE dated < vDateShort;
|
||||
DELETE FROM workerTimeControlLog WHERE created < vDateShort;
|
||||
DELETE FROM `message` WHERE sendDate < vDateShort;
|
||||
DELETE FROM messageInbox WHERE sendDate < vDateShort;
|
||||
DELETE FROM messageInbox WHERE sendDate < vDateShort;
|
||||
DELETE FROM workerTimeControl WHERE timed < vFourYearsAgo;
|
||||
DELETE FROM itemShelving WHERE created < util.VN_CURDATE() AND visible = 0;
|
||||
DELETE FROM ticketDown WHERE created < TIMESTAMPADD(DAY,-1,util.VN_CURDATE());
|
||||
DELETE FROM entryLog WHERE creationDate < vDateShort;
|
||||
DELETE IGNORE FROM expedition WHERE created < v26Month;
|
||||
DELETE FROM sms WHERE created < v18Month;
|
||||
DELETE FROM saleTracking WHERE created < vOneYearAgo;
|
||||
DELETE FROM ticketTracking WHERE created < v18Month;
|
||||
DELETE tobs FROM ticketObservation tobs
|
||||
JOIN ticket t ON tobs.ticketFk = t.id WHERE t.shipped < TIMESTAMPADD(YEAR,-2,util.VN_CURDATE());
|
||||
DELETE sc.* FROM saleCloned sc JOIN sale s ON s.id = sc.saleClonedFk JOIN ticket t ON t.id = s.ticketFk WHERE t.shipped < vOneYearAgo;
|
||||
DELETE FROM sharingCart where ended < vDateShort;
|
||||
DELETE FROM sharingClient where ended < vDateShort;
|
||||
DELETE tw.* FROM ticketWeekly tw
|
||||
LEFT JOIN sale s ON s.ticketFk = tw.ticketFk WHERE s.itemFk IS NULL;
|
||||
DELETE FROM claim WHERE ticketCreated < vFourYearsAgo;
|
||||
DELETE FROM message WHERE sendDate < vDateShort;
|
||||
-- Robert ubicacion anterior de trevelLog comentario para debug
|
||||
DELETE FROM zoneEvent WHERE `type` = 'day' AND dated < v3Month;
|
||||
DELETE bm
|
||||
FROM buyMark bm
|
||||
JOIN buy b ON b.id = bm.id
|
||||
JOIN entry e ON e.id = b.entryFk
|
||||
JOIN travel t ON t.id = e.travelFk
|
||||
WHERE t.landed <= vDateShort;
|
||||
DELETE FROM vn.buy WHERE created < vDateShort AND entryFk = 9200;
|
||||
DELETE FROM vn.itemShelvingLog WHERE created < vDateShort;
|
||||
DELETE FROM vn.stockBuyed WHERE creationDate < vDateShort;
|
||||
DELETE FROM vn.itemCleanLog WHERE created < util.VN_NOW() - INTERVAL 1 YEAR;
|
||||
DELETE FROM printQueue WHERE statusCode = 'printed' AND created < vDateShort;
|
||||
|
||||
-- Equipos duplicados
|
||||
DELETE w.*
|
||||
FROM workerTeam w
|
||||
JOIN (SELECT id, team, workerFk, COUNT(*) - 1 as duplicated
|
||||
FROM workerTeam
|
||||
GROUP BY team,workerFk
|
||||
HAVING duplicated
|
||||
) d ON d.team = w.team AND d.workerFk = w.workerFk AND d.id != w.id;
|
||||
|
||||
DELETE sc
|
||||
FROM saleComponent sc
|
||||
JOIN sale s ON s.id= sc.saleFk
|
||||
JOIN ticket t ON t.id= s.ticketFk
|
||||
WHERE t.shipped < v18Month;
|
||||
|
||||
DELETE c
|
||||
FROM vn.claim c
|
||||
JOIN vn.claimState cs ON cs.id = c.claimStateFk
|
||||
WHERE cs.description = "Anulado" AND
|
||||
c.created < vDateShort;
|
||||
DELETE
|
||||
FROM vn.expeditionTruck
|
||||
WHERE ETD < v3Month;
|
||||
|
||||
-- borrar travels sin entradas
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp.thermographToDelete;
|
||||
CREATE TEMPORARY TABLE tmp.thermographToDelete
|
||||
SELECT th.id,th.dmsFk
|
||||
FROM vn.travel t
|
||||
LEFT JOIN vn.entry e ON e.travelFk = t.id
|
||||
JOIN vn.travelThermograph th ON th.travelFk = t.id
|
||||
WHERE t.shipped < TIMESTAMPADD(MONTH, -3, util.VN_CURDATE()) AND e.travelFk IS NULL;
|
||||
|
||||
SELECT dt.id INTO vTrashId
|
||||
FROM vn.dmsType dt
|
||||
WHERE dt.code = 'trash';
|
||||
|
||||
UPDATE tmp.thermographToDelete th
|
||||
JOIN vn.dms d ON d.id = th.dmsFk
|
||||
SET d.dmsTypeFk = vTrashId;
|
||||
|
||||
DELETE th
|
||||
FROM tmp.thermographToDelete tmp
|
||||
JOIN vn.travelThermograph th ON th.id = tmp.id;
|
||||
|
||||
DELETE t
|
||||
FROM vn.travel t
|
||||
LEFT JOIN vn.entry e ON e.travelFk = t.id
|
||||
WHERE t.shipped < TIMESTAMPADD(MONTH, -3, util.VN_CURDATE()) AND e.travelFk IS NULL;
|
||||
|
||||
UPDATE dms d
|
||||
JOIN dmsType dt ON dt.id = d.dmsTypeFk
|
||||
SET d.dmsTypeFk = vTrashId
|
||||
WHERE created < TIMESTAMPADD(MONTH, -dt.monthToDelete, util.VN_CURDATE());
|
||||
|
||||
-- borrar entradas sin compras
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp.entryToDelete;
|
||||
CREATE TEMPORARY TABLE tmp.entryToDelete
|
||||
SELECT e.*
|
||||
FROM vn.entry e
|
||||
LEFT JOIN vn.buy b ON b.entryFk = e.id
|
||||
JOIN vn.entryConfig ec ON e.id != ec.defaultEntry
|
||||
WHERE e.dated < TIMESTAMPADD(MONTH, -3, util.VN_CURDATE()) AND b.entryFK IS NULL;
|
||||
|
||||
DELETE e
|
||||
FROM vn.entry e
|
||||
JOIN tmp.entryToDelete tmp ON tmp.id = e.id;
|
||||
|
||||
-- borrar de route registros menores a 4 años
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp.routeToDelete;
|
||||
CREATE TEMPORARY TABLE tmp.routeToDelete
|
||||
SELECT *
|
||||
FROM vn.route r
|
||||
WHERE created < TIMESTAMPADD(YEAR,-4,util.VN_CURDATE());
|
||||
|
||||
UPDATE tmp.routeToDelete tmp
|
||||
JOIN vn.dms d ON d.id = tmp.gestdocFk
|
||||
SET d.dmsTypeFk = vTrashId;
|
||||
|
||||
DELETE r
|
||||
FROM tmp.routeToDelete tmp
|
||||
JOIN vn.route r ON r.id = tmp.id;
|
||||
|
||||
-- borrar registros de dua y awb menores a 2 años
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp.duaToDelete;
|
||||
CREATE TEMPORARY TABLE tmp.duaToDelete
|
||||
SELECT *
|
||||
FROM vn.dua
|
||||
WHERE operated < TIMESTAMPADD(YEAR,-2,util.VN_CURDATE());
|
||||
|
||||
UPDATE tmp.duaToDelete tm
|
||||
JOIN vn.dms d ON d.id = tm.gestdocFk
|
||||
SET d.dmsTypeFk = vTrashId;
|
||||
|
||||
DELETE d
|
||||
FROM tmp.duaToDelete tmp
|
||||
JOIN vn.dua d ON d.id = tmp.id;
|
||||
|
||||
DELETE FROM vn.awb WHERE created < TIMESTAMPADD(YEAR,-2,util.VN_CURDATE());
|
||||
|
||||
-- Borra los registros de collection y ticketcollection
|
||||
DELETE FROM vn.collection WHERE created < vDateShort;
|
||||
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp.thermographToDelete;
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp.entryToDelete;
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp.duaToDelete;
|
||||
|
||||
DELETE FROM travelLog WHERE creationDate < v3Month;
|
||||
|
||||
CALL shelving_clean;
|
||||
|
||||
END$$
|
||||
DELIMITER ;
|
||||
|
|
|
@ -3,7 +3,3 @@ ALTER TABLE `vn`.`itemConfig` ADD CONSTRAINT itemConfig_FK FOREIGN KEY (defaultT
|
|||
ALTER TABLE `vn`.`itemConfig` ADD validPriorities varchar(50) DEFAULT '[1,2,3]' NOT NULL;
|
||||
ALTER TABLE `vn`.`itemConfig` ADD defaultPriority INT DEFAULT 2 NOT NULL;
|
||||
ALTER TABLE `vn`.`item` MODIFY COLUMN relevancy tinyint(1) DEFAULT 0 NOT NULL COMMENT 'La web ordena de forma descendiente por este campo para mostrar los artículos';
|
||||
|
||||
INSERT INTO `salix`.`ACL`
|
||||
(model, property, accessType, permission, principalType, principalId)
|
||||
VALUES('ItemConfig', '*', 'READ', 'ALLOW', 'ROLE', 'buyer');
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
ALTER TABLE `vn`.`itemConfig` ADD defaultTag INT DEFAULT 56 NOT NULL;
|
||||
ALTER TABLE `vn`.`itemConfig` ADD CONSTRAINT itemConfig_FK FOREIGN KEY (defaultTag) REFERENCES vn.tag(id);
|
||||
ALTER TABLE `vn`.`itemConfig` ADD validPriorities varchar(50) DEFAULT '[1,2,3]' NOT NULL;
|
||||
ALTER TABLE `vn`.`itemConfig` ADD defaultPriority INT DEFAULT 2 NOT NULL;
|
||||
ALTER TABLE `vn`.`item` MODIFY COLUMN relevancy tinyint(1) DEFAULT 0 NOT NULL COMMENT 'La web ordena de forma descendiente por este campo para mostrar los artículos';
|
|
@ -0,0 +1,3 @@
|
|||
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`)
|
||||
VALUES
|
||||
('Tag', 'onSubmit', 'WRITE', 'ALLOW', 'ROLE', 'employee');
|
|
@ -0,0 +1,24 @@
|
|||
UPDATE `salix`.`ACL`
|
||||
SET accessType='READ'
|
||||
WHERE model='Worker'
|
||||
AND property='*'
|
||||
AND accessType='*'
|
||||
AND permission='ALLOW'
|
||||
AND principalType='ROLE'
|
||||
AND principalId='employee';
|
||||
|
||||
|
||||
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`)
|
||||
VALUES
|
||||
('Worker', 'updateAttributes', 'WRITE', 'ALLOW', 'ROLE', 'hr'),
|
||||
('Worker', 'createAbsence', '*', 'ALLOW', 'ROLE', 'employee'),
|
||||
('Worker', 'updateAbsence', 'WRITE', 'ALLOW', 'ROLE', 'employee'),
|
||||
('Worker', 'deleteAbsence', '*', 'ALLOW', 'ROLE', 'employee'),
|
||||
('Worker', 'new', 'WRITE', 'ALLOW', 'ROLE', 'hr'),
|
||||
('Role', '*', 'READ', 'ALLOW', 'ROLE', 'hr');
|
||||
|
||||
ALTER TABLE `vn`.`workerConfig` ADD roleFk int(10) unsigned NOT NULL COMMENT 'Rol por defecto al dar de alta un trabajador nuevo';
|
||||
UPDATE `vn`.`workerConfig`
|
||||
SET roleFk = 1
|
||||
WHERE id = 1;
|
||||
|
|
@ -0,0 +1,110 @@
|
|||
DROP PROCEDURE IF EXISTS vn.ticket_canAdvance;
|
||||
|
||||
DELIMITER $$
|
||||
$$
|
||||
CREATE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_canAdvance`(vDateFuture DATE, vDateToAdvance DATE, vWarehouseFk INT)
|
||||
BEGIN
|
||||
/**
|
||||
* Devuelve los tickets y la cantidad de lineas de venta que se pueden adelantar.
|
||||
*
|
||||
* @param vDateFuture Fecha de los tickets que se quieren adelantar.
|
||||
* @param vDateToAdvance Fecha a cuando se quiere adelantar.
|
||||
* @param vWarehouseFk Almacén
|
||||
*/
|
||||
|
||||
DECLARE vDateInventory DATE;
|
||||
|
||||
SELECT inventoried INTO vDateInventory FROM vn.config;
|
||||
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp.stock;
|
||||
CREATE TEMPORARY TABLE tmp.stock
|
||||
(itemFk INT PRIMARY KEY,
|
||||
amount INT)
|
||||
ENGINE = MEMORY;
|
||||
|
||||
INSERT INTO tmp.stock(itemFk, amount)
|
||||
SELECT itemFk, SUM(quantity) amount FROM
|
||||
(
|
||||
SELECT itemFk, quantity
|
||||
FROM vn.itemTicketOut
|
||||
WHERE shipped >= vDateInventory
|
||||
AND shipped < vDateFuture
|
||||
AND warehouseFk = vWarehouseFk
|
||||
UNION ALL
|
||||
SELECT itemFk, quantity
|
||||
FROM vn.itemEntryIn
|
||||
WHERE landed >= vDateInventory
|
||||
AND landed < vDateFuture
|
||||
AND isVirtualStock = FALSE
|
||||
AND warehouseInFk = vWarehouseFk
|
||||
UNION ALL
|
||||
SELECT itemFk, quantity
|
||||
FROM vn.itemEntryOut
|
||||
WHERE shipped >= vDateInventory
|
||||
AND shipped < vDateFuture
|
||||
AND warehouseOutFk = vWarehouseFk
|
||||
) t
|
||||
GROUP BY itemFk HAVING amount != 0;
|
||||
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp.filter;
|
||||
CREATE TEMPORARY TABLE tmp.filter
|
||||
(INDEX (id))
|
||||
SELECT s.ticketFk futureId,
|
||||
t2.ticketFk id,
|
||||
count(DISTINCT s.id) saleCount,
|
||||
t2.state,
|
||||
t2.isNotValidated,
|
||||
st.name futureState,
|
||||
st.isNotValidated futureIsNotValidated,
|
||||
GROUP_CONCAT(DISTINCT ipt.code ORDER BY ipt.code) futureIpt,
|
||||
t2.ipt,
|
||||
t.workerFk,
|
||||
CAST(SUM(litros) AS DECIMAL(10,0)) futureLiters,
|
||||
CAST(COUNT(*) AS DECIMAL(10,0)) `futureLines`,
|
||||
t2.shipped,
|
||||
t.shipped futureShipped,
|
||||
t2.totalWithVat,
|
||||
t.totalWithVat futureTotalWithVat,
|
||||
t2.agency,
|
||||
am.name futureAgency,
|
||||
t2.lines,
|
||||
t2.liters,
|
||||
SUM((s.quantity <= IFNULL(st.amount,0))) hasStock
|
||||
FROM vn.ticket t
|
||||
JOIN vn.ticketState ts ON ts.ticketFk = t.id
|
||||
JOIN vn.state st ON st.id = ts.stateFk
|
||||
JOIN vn.saleVolume sv ON t.id = sv.ticketFk
|
||||
JOIN (SELECT
|
||||
t2.id ticketFk,
|
||||
t2.addressFk,
|
||||
st.isNotValidated,
|
||||
st.name state,
|
||||
GROUP_CONCAT(DISTINCT ipt.code ORDER BY ipt.code) ipt,
|
||||
t2.shipped,
|
||||
t2.totalWithVat,
|
||||
am.name agency,
|
||||
CAST(SUM(litros) AS DECIMAL(10,0)) liters,
|
||||
CAST(COUNT(*) AS DECIMAL(10,0)) `lines`
|
||||
FROM vn.ticket t2
|
||||
JOIN vn.saleVolume sv ON t2.id = sv.ticketFk
|
||||
JOIN vn.sale s ON s.ticketFk = t2.id
|
||||
JOIN vn.item i ON i.id = s.itemFk
|
||||
JOIN vn.ticketState ts ON ts.ticketFk = t2.id
|
||||
JOIN vn.state st ON st.id = ts.stateFk
|
||||
JOIN vn.agencyMode am ON t2.agencyModeFk = am.id
|
||||
LEFT JOIN vn.itemPackingType ipt ON ipt.code = i.itemPackingTypeFk
|
||||
WHERE t2.shipped BETWEEN vDateToAdvance AND util.dayend(vDateToAdvance)
|
||||
AND t2.warehouseFk = vWarehouseFk
|
||||
GROUP BY t2.id) t2 ON t2.addressFk = t.addressFk
|
||||
JOIN vn.sale s ON s.ticketFk = t.id
|
||||
JOIN vn.item i ON i.id = s.itemFk
|
||||
JOIN vn.agencyMode am ON t.agencyModeFk = am.id
|
||||
LEFT JOIN vn.itemPackingType ipt ON ipt.code = i.itemPackingTypeFk
|
||||
LEFT JOIN tmp.stock st ON st.itemFk = s.itemFk
|
||||
WHERE t.shipped BETWEEN vDateFuture AND util.dayend(vDateFuture)
|
||||
AND t.warehouseFk = vWarehouseFk
|
||||
GROUP BY t.id;
|
||||
|
||||
DROP TEMPORARY TABLE tmp.stock;
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -0,0 +1,6 @@
|
|||
UPDATE `vn`.`client`
|
||||
SET isToBeMailed = FALSE
|
||||
WHERE
|
||||
mailAddress is NULL
|
||||
AND email is NULL
|
||||
AND isToBeMailed = TRUE;
|
|
@ -0,0 +1,30 @@
|
|||
DROP FUNCTION IF EXISTS `vn`.`invoiceOut_getWeight`;
|
||||
|
||||
DELIMITER $$
|
||||
$$
|
||||
CREATE DEFINER=`root`@`localhost` FUNCTION `vn`.`invoiceOut_getWeight`(vInvoice VARCHAR(15)) RETURNS decimal(10,2)
|
||||
READS SQL DATA
|
||||
BEGIN
|
||||
/**
|
||||
* Calcula el peso de una factura emitida
|
||||
*
|
||||
* @param vInvoice Id de la factura
|
||||
* @return vTotalWeight peso de la factura
|
||||
*/
|
||||
DECLARE vTotalWeight DECIMAL(10,2);
|
||||
|
||||
SELECT SUM(CAST(IFNULL(i.stems, 1)
|
||||
* s.quantity
|
||||
* IF(ic.grams, ic.grams, IFNULL(i.weightByPiece, 0)) / 1000 AS DECIMAL(10,2)))
|
||||
INTO vTotalWeight
|
||||
FROM ticket t
|
||||
JOIN sale s ON s.ticketFk = t.id
|
||||
JOIN item i ON i.id = s.itemFk
|
||||
JOIN itemCost ic ON ic.itemFk = i.id
|
||||
AND ic.warehouseFk = t.warehouseFk
|
||||
WHERE t.refFk = vInvoice
|
||||
AND i.intrastatFk;
|
||||
|
||||
RETURN vTotalWeight;
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -0,0 +1,3 @@
|
|||
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`)
|
||||
VALUES
|
||||
('Client', 'getClientOrSupplierReference', 'READ', 'ALLOW', 'ROLE', 'employee');
|
|
@ -0,0 +1,127 @@
|
|||
DROP PROCEDURE IF EXISTS `vn`.`ticket_canAdvance`;
|
||||
|
||||
DELIMITER $$
|
||||
$$
|
||||
CREATE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_canAdvance`(vDateFuture DATE, vDateToAdvance DATE, vWarehouseFk INT)
|
||||
BEGIN
|
||||
/**
|
||||
* Devuelve los tickets y la cantidad de lineas de venta que se pueden adelantar.
|
||||
*
|
||||
* @param vDateFuture Fecha de los tickets que se quieren adelantar.
|
||||
* @param vDateToAdvance Fecha a cuando se quiere adelantar.
|
||||
* @param vWarehouseFk Almacén
|
||||
*/
|
||||
|
||||
DECLARE vDateInventory DATE;
|
||||
|
||||
SELECT inventoried INTO vDateInventory FROM config;
|
||||
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp.stock;
|
||||
CREATE TEMPORARY TABLE tmp.stock
|
||||
(itemFk INT PRIMARY KEY,
|
||||
amount INT)
|
||||
ENGINE = MEMORY;
|
||||
|
||||
INSERT INTO tmp.stock(itemFk, amount)
|
||||
SELECT itemFk, SUM(quantity) amount FROM
|
||||
(
|
||||
SELECT itemFk, quantity
|
||||
FROM itemTicketOut
|
||||
WHERE shipped >= vDateInventory
|
||||
AND shipped < vDateFuture
|
||||
AND warehouseFk = vWarehouseFk
|
||||
UNION ALL
|
||||
SELECT itemFk, quantity
|
||||
FROM itemEntryIn
|
||||
WHERE landed >= vDateInventory
|
||||
AND landed < vDateFuture
|
||||
AND isVirtualStock = FALSE
|
||||
AND warehouseInFk = vWarehouseFk
|
||||
UNION ALL
|
||||
SELECT itemFk, quantity
|
||||
FROM itemEntryOut
|
||||
WHERE shipped >= vDateInventory
|
||||
AND shipped < vDateFuture
|
||||
AND warehouseOutFk = vWarehouseFk
|
||||
) t
|
||||
GROUP BY itemFk HAVING amount != 0;
|
||||
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp.filter;
|
||||
CREATE TEMPORARY TABLE tmp.filter
|
||||
(INDEX (id))
|
||||
|
||||
SELECT
|
||||
origin.ticketFk futureId,
|
||||
dest.ticketFk id,
|
||||
dest.state,
|
||||
origin.futureState,
|
||||
origin.futureIpt,
|
||||
dest.ipt,
|
||||
origin.workerFk,
|
||||
origin.futureLiters,
|
||||
origin.futureLines,
|
||||
dest.shipped,
|
||||
origin.shipped futureShipped,
|
||||
dest.totalWithVat,
|
||||
origin.totalWithVat futureTotalWithVat,
|
||||
dest.agency,
|
||||
origin.futureAgency,
|
||||
dest.lines,
|
||||
dest.liters,
|
||||
origin.futureLines - origin.hasStock AS notMovableLines,
|
||||
(origin.futureLines = origin.hasStock) AS isFullMovable
|
||||
FROM (
|
||||
SELECT
|
||||
s.ticketFk,
|
||||
t.workerFk,
|
||||
t.shipped,
|
||||
t.totalWithVat,
|
||||
st.name futureState,
|
||||
t.addressFk,
|
||||
am.name futureAgency,
|
||||
count(s.id) futureLines,
|
||||
GROUP_CONCAT(DISTINCT ipt.code ORDER BY ipt.code) futureIpt,
|
||||
CAST(SUM(litros) AS DECIMAL(10,0)) futureLiters,
|
||||
SUM((s.quantity <= IFNULL(st.amount,0))) hasStock
|
||||
FROM ticket t
|
||||
JOIN sale s ON s.ticketFk = t.id
|
||||
JOIN saleVolume sv ON sv.saleFk = s.id
|
||||
JOIN item i ON i.id = s.itemFk
|
||||
JOIN ticketState ts ON ts.ticketFk = t.id
|
||||
JOIN state st ON st.id = ts.stateFk
|
||||
JOIN agencyMode am ON t.agencyModeFk = am.id
|
||||
LEFT JOIN itemPackingType ipt ON ipt.code = i.itemPackingTypeFk
|
||||
LEFT JOIN tmp.stock st ON st.itemFk = i.id
|
||||
WHERE t.shipped BETWEEN vDateFuture AND util.dayend(vDateFuture)
|
||||
AND t.warehouseFk = vWarehouseFk
|
||||
GROUP BY t.id
|
||||
) origin
|
||||
JOIN (
|
||||
SELECT
|
||||
t.id ticketFk,
|
||||
t.addressFk,
|
||||
st.name state,
|
||||
GROUP_CONCAT(DISTINCT ipt.code ORDER BY ipt.code) ipt,
|
||||
t.shipped,
|
||||
t.totalWithVat,
|
||||
am.name agency,
|
||||
CAST(SUM(litros) AS DECIMAL(10,0)) liters,
|
||||
CAST(COUNT(*) AS DECIMAL(10,0)) `lines`
|
||||
FROM ticket t
|
||||
JOIN sale s ON s.ticketFk = t.id
|
||||
JOIN saleVolume sv ON sv.saleFk = s.id
|
||||
JOIN item i ON i.id = s.itemFk
|
||||
JOIN ticketState ts ON ts.ticketFk = t.id
|
||||
JOIN state st ON st.id = ts.stateFk
|
||||
JOIN agencyMode am ON t.agencyModeFk = am.id
|
||||
LEFT JOIN itemPackingType ipt ON ipt.code = i.itemPackingTypeFk
|
||||
WHERE t.shipped BETWEEN vDateToAdvance AND util.dayend(vDateToAdvance)
|
||||
AND t.warehouseFk = vWarehouseFk
|
||||
AND st.order <= 5
|
||||
GROUP BY t.id
|
||||
) dest ON dest.addressFk = origin.addressFk
|
||||
WHERE origin.hasStock != 0;
|
||||
|
||||
DROP TEMPORARY TABLE tmp.stock;
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -0,0 +1,4 @@
|
|||
INSERT INTO `salix`.`ACL` (model,property,accessType,principalId)
|
||||
VALUES
|
||||
('NotificationSubscription','*','*','employee'),
|
||||
('NotificationAcl','*','READ','employee');
|
|
@ -0,0 +1,4 @@
|
|||
ALTER TABLE `vn`.`itemConfig` ADD warehouseFk smallint(6) unsigned NULL;
|
||||
UPDATE `vn`.`itemConfig`
|
||||
SET warehouseFk=60
|
||||
WHERE id=0;
|
|
@ -0,0 +1,4 @@
|
|||
ALTER TABLE
|
||||
`util`.`notificationSubscription`
|
||||
ADD
|
||||
CONSTRAINT `notificationSubscription_UN` UNIQUE KEY (`notificationFk`, `userFk`);
|
|
@ -0,0 +1,7 @@
|
|||
ALTER TABLE `util`.`notificationSubscription`
|
||||
ADD `id` int(11) auto_increment NULL,
|
||||
DROP PRIMARY KEY,
|
||||
ADD CONSTRAINT PRIMARY KEY (`id`);
|
||||
|
||||
ALTER TABLE `util`.`notificationSubscription`
|
||||
ADD KEY `notificationSubscription_ibfk_1` (`notificationFk`);
|
|
@ -2,7 +2,33 @@ CREATE SCHEMA IF NOT EXISTS `vn2008`;
|
|||
CREATE SCHEMA IF NOT EXISTS `tmp`;
|
||||
|
||||
UPDATE `util`.`config`
|
||||
SET `environment`= 'test';
|
||||
SET `environment`= 'development';
|
||||
|
||||
-- FOR MOCK vn.time
|
||||
|
||||
DROP PROCEDURE IF EXISTS `vn`.`mockVnTime`;
|
||||
|
||||
DELIMITER $$
|
||||
$$
|
||||
CREATE DEFINER=`root`@`localhost` PROCEDURE `vn`.`mockVnTime`()
|
||||
BEGIN
|
||||
|
||||
DECLARE vDate DATE;
|
||||
SET vDate = '2000-01-01';
|
||||
|
||||
WHILE ( YEAR(vDate) <= 2002 ) DO
|
||||
INSERT IGNORE INTO vn.`time` (dated, period, `month`, `year`, `day`, week, yearMonth, salesYear)
|
||||
VALUES (vDate, CONCAT(YEAR(vDate), (WEEK(vDate)+1)), MONTH(vDate), YEAR(vDate), DAY(vDate), WEEK(vDate)+1, CONCAT(YEAR(vDate), MONTH(vDate)), YEAR(vDate));
|
||||
|
||||
SET vDate = DATE_ADD(vDate, INTERVAL 1 DAY);
|
||||
END WHILE;
|
||||
|
||||
END$$
|
||||
DELIMITER ;
|
||||
|
||||
CALL `vn`.`mockVnTime`();
|
||||
DROP PROCEDURE IF EXISTS `vn`.`mockVnTime`;
|
||||
-- END MOCK vn.time
|
||||
|
||||
ALTER TABLE `vn`.`itemTaxCountry` AUTO_INCREMENT = 1;
|
||||
ALTER TABLE `vn`.`address` AUTO_INCREMENT = 1;
|
||||
|
@ -691,7 +717,8 @@ INSERT INTO `vn`.`ticket`(`id`, `priority`, `agencyModeFk`,`warehouseFk`,`routeF
|
|||
(28, 1, 8, 1, 1, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1103, 'Phone Box', 123, NULL, 0, 1, 5, 1, util.VN_CURDATE()),
|
||||
(29, 1, 8, 1, 1, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1103, 'Phone Box', 123, NULL, 0, 1, 5, 1, util.VN_CURDATE()),
|
||||
(30, 1, 8, 1, 1, util.VN_CURDATE(), DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), 1103, 'Phone Box', 123, NULL, 0, 1, 5, 1, util.VN_CURDATE()),
|
||||
(31, 1, 8, 1, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL + 2 DAY), 1103, 'Phone Box', 123, NULL, 0, 1, 5, 1, util.VN_CURDATE());
|
||||
(31, 1, 8, 1, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL + 2 DAY), 1103, 'Phone Box', 123, NULL, 0, 1, 5, 1, util.VN_CURDATE()),
|
||||
(32, 1, 8, 1, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL + 2 DAY), 1103, 'Phone Box', 123, NULL, 0, 1, 5, 1, util.VN_CURDATE());
|
||||
|
||||
INSERT INTO `vn`.`ticketObservation`(`id`, `ticketFk`, `observationTypeFk`, `description`)
|
||||
VALUES
|
||||
|
@ -934,10 +961,10 @@ INSERT INTO `vn`.`expedition`(`id`, `agencyModeFk`, `ticketFk`, `freightItemFk`,
|
|||
(7, 2, 4, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -3 MONTH), 1, 18, NULL, 94, NULL,NULL),
|
||||
(8, 3, 5, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -4 MONTH), 1, 18, NULL, 94, 1, NULL),
|
||||
(9, 3, 6, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 18, NULL, 94, 2, NULL),
|
||||
(10, 7, 7, 71, NOW(), 1, 18, NULL, 94, 3, NULL),
|
||||
(11, 7, 8, 71, NOW(), 1, 18, NULL, 94, 3, NULL),
|
||||
(12, 7, 9, 71, NOW(), 1, 18, NULL, 94, 3, NULL),
|
||||
(13, 1, 10,71, NOW(), 1, 18, NULL, 94, 3, NULL);
|
||||
(10, 7, 7, 71, util.VN_NOW(), 1, 18, NULL, 94, 3, NULL),
|
||||
(11, 7, 8, 71, util.VN_NOW(), 1, 18, NULL, 94, 3, NULL),
|
||||
(12, 7, 9, 71, util.VN_NOW(), 1, 18, NULL, 94, 3, NULL),
|
||||
(13, 1, 10,71, util.VN_NOW(), 1, 18, NULL, 94, 3, NULL);
|
||||
|
||||
|
||||
INSERT INTO `vn`.`expeditionState`(`id`, `created`, `expeditionFk`, `typeFk`, `userFk`)
|
||||
|
@ -993,7 +1020,9 @@ INSERT INTO `vn`.`sale`(`id`, `itemFk`, `ticketFk`, `concept`, `quantity`, `pric
|
|||
(34, 4, 28, 'Melee weapon heavy shield 1x0.5m', 20, 1.72, 0, 0, 0, util.VN_CURDATE()),
|
||||
(35, 4, 29, 'Melee weapon heavy shield 1x0.5m', 20, 1.72, 0, 0, 0, util.VN_CURDATE()),
|
||||
(36, 4, 30, 'Melee weapon heavy shield 1x0.5m', 20, 1.72, 0, 0, 0, util.VN_CURDATE()),
|
||||
(37, 4, 31, 'Melee weapon heavy shield 1x0.5m', 20, 1.72, 0, 0, 0, util.VN_CURDATE());
|
||||
(37, 4, 31, 'Melee weapon heavy shield 1x0.5m', 20, 1.72, 0, 0, 0, util.VN_CURDATE()),
|
||||
(38, 2, 32, 'Melee weapon combat fist 15cm', 30, 7.07, 0, 0, 0, DATE_ADD(util.VN_CURDATE(), INTERVAL +1 MONTH)),
|
||||
(39, 1, 32, 'Ranged weapon longbow 2m', 2, 103.49, 0, 0, 0, util.VN_CURDATE());
|
||||
|
||||
INSERT INTO `vn`.`saleChecked`(`saleFk`, `isChecked`)
|
||||
VALUES
|
||||
|
@ -1910,7 +1939,7 @@ DROP TEMPORARY TABLE IF EXISTS tmp.worker;
|
|||
CREATE TEMPORARY TABLE tmp.worker
|
||||
(PRIMARY KEY (id))
|
||||
ENGINE = MEMORY
|
||||
SELECT w.id, w.id as `workerFk`, 'VNL', CONCAT(YEAR(DATE_ADD(CURDATE(), INTERVAL -1 YEAR)), '-12-25'), CONCAT(YEAR(DATE_ADD(CURDATE(), INTERVAL +1 YEAR)), '-12-25'), CONCAT('E-46-', RPAD(CONCAT(w.id, 9), 8, w.id)), NULL as `notes`, NULL as `departmentFk`, 23, 1 as `workerBusinessProfessionalCategoryFk`, 1 as `calendarTypeFk`, 1 as `isHourlyLabor`, 1 as `workerBusinessAgreementFk`, 1 as `workcenterFk`
|
||||
SELECT w.id, w.id as `workerFk`, 'VNL', CONCAT(YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 YEAR)), '-12-25') as started, CONCAT(YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL +1 YEAR)), '-12-25') as ended, CONCAT('E-46-', RPAD(CONCAT(w.id, 9), 8, w.id)), NULL as `notes`, NULL as `departmentFk`, 23, 1 as `workerBusinessProfessionalCategoryFk`, 1 as `calendarTypeFk`, 1 as `isHourlyLabor`, 1 as `workerBusinessAgreementFk`, 1 as `workcenterFk`
|
||||
FROM `vn`.`worker` `w`;
|
||||
|
||||
INSERT INTO `vn`.`business`(`id`, `workerFk`, `companyCodeFk`, `started`, `ended`, `workerBusiness`, `reasonEndFk`, `notes`, `departmentFk`, `workerBusinessProfessionalCategoryFk`, `calendarTypeFk`, `isHourlyLabor`, `workerBusinessAgreementFk`, `workcenterFk`)
|
||||
|
@ -1920,7 +1949,7 @@ DROP TEMPORARY TABLE IF EXISTS tmp.worker;
|
|||
CREATE TEMPORARY TABLE tmp.worker
|
||||
(PRIMARY KEY (id))
|
||||
ENGINE = MEMORY
|
||||
SELECT '1111' as 'id', w.id as `workerFk`, 'VNL', CONCAT(YEAR(DATE_ADD(CURDATE(), INTERVAL -2 YEAR)), '-12-25'), CONCAT(YEAR(DATE_ADD(CURDATE(), INTERVAL -1 YEAR)), '-12-24'), CONCAT('E-46-', RPAD(CONCAT(w.id, 9), 8, w.id)), NULL as `notes`, NULL as `departmentFk`, 23, 1 as `workerBusinessProfessionalCategoryFk`, 1 as `calendarTypeFk`, 1 as `isHourlyLabor`, 1 as `workerBusinessAgreementFk`, 1 as `workcenterFk`
|
||||
SELECT '1111' as 'id', w.id as `workerFk`, 'VNL', CONCAT(YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -2 YEAR)), '-12-25') as started, CONCAT(YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 YEAR)) as ended, '-12-24'), CONCAT('E-46-', RPAD(CONCAT(w.id, 9), 8, w.id)), NULL as `notes`, NULL as `departmentFk`, 23, 1 as `workerBusinessProfessionalCategoryFk`, 1 as `calendarTypeFk`, 1 as `isHourlyLabor`, 1 as `workerBusinessAgreementFk`, 1 as `workcenterFk`
|
||||
FROM `vn`.`worker` `w`
|
||||
WHERE `w`.`id` = 1109;
|
||||
|
||||
|
@ -1954,10 +1983,6 @@ INSERT INTO `vn`.`workerBusinessType` (`id`, `name`, `isFullTime`, `isPermanent`
|
|||
(100, 'INDEFINIDO A TIEMPO COMPLETO', 1, 1, 1),
|
||||
(109, 'CONVERSION DE TEMPORAL EN INDEFINIDO T.COMPLETO', 1, 1, 1);
|
||||
|
||||
INSERT INTO `vn`.`businessCategory` (`id`, `description`, `rate`)
|
||||
VALUES
|
||||
(1, 'basic employee', 1);
|
||||
|
||||
UPDATE `vn`.`business` b
|
||||
SET `rate` = 7,
|
||||
`workerBusinessCategoryFk` = 1,
|
||||
|
@ -2629,7 +2654,7 @@ INSERT INTO `vn`.`machineWorker` (`workerFk`, `machineFk`, `inTimed`, `outTimed`
|
|||
|
||||
INSERT INTO `vn`.`zoneExclusion` (`id`, `zoneFk`, `dated`, `created`, `userFk`)
|
||||
VALUES
|
||||
(1, 1, DATE_ADD(CURDATE(), INTERVAL (IF(DAYOFWEEK(CURDATE())<=7, 7, 14) - DAYOFWEEK(util.VN_CURDATE())) DAY), util.VN_CURDATE(), 100),
|
||||
(1, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL (IF(DAYOFWEEK(util.VN_CURDATE())<=7, 7, 14) - DAYOFWEEK(util.VN_CURDATE())) DAY), util.VN_CURDATE(), 100),
|
||||
(2, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL (IF(DAYOFWEEK(util.VN_CURDATE())<=8, 8, 15) - DAYOFWEEK(util.VN_CURDATE())) DAY), util.VN_CURDATE(), 100);
|
||||
|
||||
INSERT INTO `vn`.`zoneExclusionGeo` (`zoneExclusionFk`, `geoFk`)
|
||||
|
@ -2705,7 +2730,10 @@ INSERT INTO `util`.`notificationSubscription` (`notificationFk`, `userFk`)
|
|||
VALUES
|
||||
(1, 1109),
|
||||
(1, 1110),
|
||||
(3, 1109);
|
||||
(3, 1109),
|
||||
(1,9),
|
||||
(1,3);
|
||||
|
||||
|
||||
INSERT INTO `vn`.`routeConfig` (`id`, `defaultWorkCenterFk`)
|
||||
VALUES
|
||||
|
@ -2719,9 +2747,9 @@ INSERT INTO `vn`.`collection` (`id`, `created`, `workerFk`, `stateFk`, `itemPack
|
|||
VALUES
|
||||
(3, util.VN_NOW(), 1107, 5, NULL, 0, 0, 1, NULL, NULL);
|
||||
|
||||
INSERT INTO `vn`.`itemConfig` (`id`, `isItemTagTriggerDisabled`, `monthToDeactivate`, `wasteRecipients`, `validPriorities`, `defaultPriority`, `defaultTag`)
|
||||
INSERT INTO `vn`.`itemConfig` (`id`, `isItemTagTriggerDisabled`, `monthToDeactivate`, `wasteRecipients`, `validPriorities`, `defaultPriority`, `defaultTag`, `warehouseFk`)
|
||||
VALUES
|
||||
(0, 0, 24, '', '[1,2,3]', 2, 56);
|
||||
(0, 0, 24, '', '[1,2,3]', 2, 56, 60);
|
||||
|
||||
INSERT INTO `vn`.`ticketCollection` (`ticketFk`, `collectionFk`, `created`, `level`, `wagon`, `smartTagFk`, `usedShelves`, `itemCount`, `liters`)
|
||||
VALUES
|
||||
|
@ -2751,10 +2779,14 @@ INSERT INTO `vn`.`mdbApp` (`app`, `baselineBranchFk`, `userFk`, `locked`)
|
|||
VALUES
|
||||
('foo', 'master', NULL, NULL),
|
||||
('bar', 'test', 9, util.VN_NOW());
|
||||
INSERT INTO `vn`.`ticketLog` (`id`, `originFk`, `userFk`, `action`, `changedModel`, `oldInstance`, `newInstance`, `changedModelId`)
|
||||
VALUES
|
||||
(1, 1, 9, 'insert', 'Ticket', '{}', '{"clientFk":1, "nickname": "Bat cave"}', 1);
|
||||
|
||||
INSERT INTO `vn`.`profileType` (`id`, `name`)
|
||||
VALUES
|
||||
(1, 'working');
|
||||
|
||||
INSERT INTO `vn`.`newWorkerConfig` (`id`, `street`, `provinceFk`, `companyFk`, `profileTypeFk`, `roleFk`)
|
||||
VALUES
|
||||
(1, 'S/ ', 1, 442, 1, 1);
|
||||
|
||||
INSERT INTO `salix`.`url` (`appName`, `environment`, `url`)
|
||||
VALUES
|
||||
|
@ -2765,3 +2797,7 @@ INSERT INTO `vn`.`payDemDetail` (`id`, `detail`)
|
|||
VALUES
|
||||
(1, 1);
|
||||
|
||||
INSERT INTO `vn`.`workerConfig` (`id`, `businessUpdated`, `roleFk`)
|
||||
VALUES
|
||||
(1, NULL, 1);
|
||||
|
||||
|
|
|
@ -3,18 +3,17 @@ USE `util`;
|
|||
|
||||
DELIMITER ;;
|
||||
DROP FUNCTION IF EXISTS `util`.`mockedDate`;
|
||||
CREATE FUNCTION `util`.`mockedDate`()
|
||||
CREATE FUNCTION `util`.`mockedDate`()
|
||||
RETURNS DATETIME
|
||||
DETERMINISTIC
|
||||
BEGIN
|
||||
RETURN NOW();
|
||||
-- '2022-01-19 08:00:00'
|
||||
RETURN CONVERT_TZ('2001-01-01 11:00:00', 'utc', 'Europe/Madrid');
|
||||
END ;;
|
||||
DELIMITER ;
|
||||
|
||||
DELIMITER ;;
|
||||
DROP FUNCTION IF EXISTS `util`.`VN_CURDATE`;
|
||||
CREATE FUNCTION `util`.`VN_CURDATE`()
|
||||
CREATE FUNCTION `util`.`VN_CURDATE`()
|
||||
RETURNS DATE
|
||||
DETERMINISTIC
|
||||
BEGIN
|
||||
|
@ -24,7 +23,7 @@ DELIMITER ;
|
|||
|
||||
DELIMITER ;;
|
||||
DROP FUNCTION IF EXISTS `util`.`VN_CURTIME`;
|
||||
CREATE FUNCTION `util`.`VN_CURTIME`()
|
||||
CREATE FUNCTION `util`.`VN_CURTIME`()
|
||||
RETURNS TIME
|
||||
DETERMINISTIC
|
||||
BEGIN
|
||||
|
@ -34,10 +33,10 @@ DELIMITER ;
|
|||
|
||||
DELIMITER ;;
|
||||
DROP FUNCTION IF EXISTS `util`.`VN_NOW`;
|
||||
CREATE FUNCTION `util`.`VN_NOW`()
|
||||
CREATE FUNCTION `util`.`VN_NOW`()
|
||||
RETURNS DATETIME
|
||||
DETERMINISTIC
|
||||
BEGIN
|
||||
RETURN mockedDate();
|
||||
RETURN mockedDate();
|
||||
END ;;
|
||||
DELIMITER ;
|
||||
DELIMITER ;
|
||||
|
|
|
@ -26286,6 +26286,7 @@ CREATE TABLE `entry` (
|
|||
`typeFk` varchar(100) COLLATE utf8mb3_unicode_ci DEFAULT NULL COMMENT 'Tipo de entrada',
|
||||
`reference` varchar(50) COLLATE utf8mb3_unicode_ci DEFAULT NULL COMMENT 'Referencia para eti',
|
||||
`ref` varchar(50) GENERATED ALWAYS AS (`invoiceNumber`) VIRTUAL COMMENT 'Columna virtual provisional para Salix',
|
||||
`observationEditorFk` INT(10) unsigned NULL COMMENT 'Último usuario que ha modificado el campo evaNotes',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `Id_Proveedor` (`supplierFk`),
|
||||
KEY `Fecha` (`dated`),
|
||||
|
@ -26300,7 +26301,8 @@ CREATE TABLE `entry` (
|
|||
CONSTRAINT `entry_FK_1` FOREIGN KEY (`typeFk`) REFERENCES `entryType` (`code`) ON UPDATE CASCADE,
|
||||
CONSTRAINT `entry_ibfk_1` FOREIGN KEY (`supplierFk`) REFERENCES `supplier` (`id`) ON UPDATE CASCADE,
|
||||
CONSTRAINT `entry_ibfk_6` FOREIGN KEY (`travelFk`) REFERENCES `travel` (`id`) ON UPDATE CASCADE,
|
||||
CONSTRAINT `entry_ibfk_7` FOREIGN KEY (`companyFk`) REFERENCES `company` (`id`) ON UPDATE CASCADE
|
||||
CONSTRAINT `entry_ibfk_7` FOREIGN KEY (`companyFk`) REFERENCES `company` (`id`) ON UPDATE CASCADE,
|
||||
CONSTRAINT `entry_observationEditorFk` FOREIGN KEY (`observationEditorFk`) REFERENCES `account`.`user`(`id`) ON UPDATE CASCADE
|
||||
) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='InnoDB free: 88064 kB; (`Id_Proveedor`) REFER `vn2008/Provee';
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
|
||||
|
@ -80203,4 +80205,3 @@ USE `vncontrol`;
|
|||
-- Dump completed on 2022-11-21 7:57:28
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ const app = require('vn-loopback/server/server');
|
|||
const ParameterizedSQL = require('loopback-connector').ParameterizedSQL;
|
||||
|
||||
describe('buyUltimate()', () => {
|
||||
const today = new Date();
|
||||
const today = Date.vnNew();
|
||||
it(`should create buyUltimate temporal table and update it's values`, async() => {
|
||||
let stmts = [];
|
||||
let stmt;
|
||||
|
|
|
@ -5,7 +5,7 @@ describe('buyUltimateFromInterval()', () => {
|
|||
let today;
|
||||
let future;
|
||||
beforeAll(() => {
|
||||
let now = new Date();
|
||||
let now = Date.vnNew();
|
||||
now.setHours(0, 0, 0, 0);
|
||||
today = now;
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ const app = require('vn-loopback/server/server');
|
|||
const ParameterizedSQL = require('loopback-connector').ParameterizedSQL;
|
||||
|
||||
describe('ticket ticketCalculateClon()', () => {
|
||||
const today = new Date();
|
||||
const today = Date.vnNew();
|
||||
it('should add the ticket to the order containing the original ticket', async() => {
|
||||
let stmts = [];
|
||||
let stmt;
|
||||
|
|
|
@ -2,7 +2,7 @@ const app = require('vn-loopback/server/server');
|
|||
const ParameterizedSQL = require('loopback-connector').ParameterizedSQL;
|
||||
|
||||
describe('ticket ticketCreateWithUser()', () => {
|
||||
const today = new Date();
|
||||
const today = Date.vnNew();
|
||||
it('should confirm the procedure creates the expected ticket', async() => {
|
||||
let stmts = [];
|
||||
let stmt;
|
||||
|
|
|
@ -3,9 +3,9 @@ const ParameterizedSQL = require('loopback-connector').ParameterizedSQL;
|
|||
|
||||
describe('timeBusiness_calculateByUser()', () => {
|
||||
it('should return the expected hours for today', async() => {
|
||||
let start = new Date();
|
||||
let start = Date.vnNew();
|
||||
start.setHours(0, 0, 0, 0);
|
||||
let end = new Date();
|
||||
let end = Date.vnNew();
|
||||
end.setHours(0, 0, 0, 0);
|
||||
|
||||
let stmts = [];
|
||||
|
|
|
@ -3,11 +3,11 @@ const ParameterizedSQL = require('loopback-connector').ParameterizedSQL;
|
|||
|
||||
describe('timeControl_calculateByUser()', () => {
|
||||
it(`should return today's worked hours`, async() => {
|
||||
let start = new Date();
|
||||
let start = Date.vnNew();
|
||||
start.setHours(0, 0, 0, 0);
|
||||
start.setDate(start.getDate() - 1);
|
||||
|
||||
let end = new Date();
|
||||
let end = Date.vnNew();
|
||||
end.setHours(0, 0, 0, 0);
|
||||
end.setDate(end.getDate() + 1);
|
||||
|
||||
|
@ -17,7 +17,7 @@ describe('timeControl_calculateByUser()', () => {
|
|||
stmts.push('START TRANSACTION');
|
||||
|
||||
stmts.push(`
|
||||
DROP TEMPORARY TABLE IF EXISTS
|
||||
DROP TEMPORARY TABLE IF EXISTS
|
||||
tmp.timeControlCalculate,
|
||||
tmp.timeBusinessCalculate
|
||||
`);
|
||||
|
@ -48,14 +48,14 @@ describe('timeControl_calculateByUser()', () => {
|
|||
});
|
||||
|
||||
it(`should return the worked hours between last sunday and monday`, async() => {
|
||||
let lastSunday = new Date();
|
||||
let lastSunday = Date.vnNew();
|
||||
let daysSinceSunday = lastSunday.getDay();
|
||||
if (daysSinceSunday === 0) // this means today is sunday but you need the previous sunday :)
|
||||
daysSinceSunday = 7;
|
||||
lastSunday.setHours(23, 0, 0, 0);
|
||||
lastSunday.setDate(lastSunday.getDate() - daysSinceSunday);
|
||||
|
||||
let monday = new Date();
|
||||
let monday = Date.vnNew();
|
||||
let daysSinceMonday = daysSinceSunday - 1; // aiming for monday (today could be monday)
|
||||
monday.setHours(7, 0, 0, 0);
|
||||
monday.setDate(monday.getDate() - daysSinceMonday);
|
||||
|
@ -66,7 +66,7 @@ describe('timeControl_calculateByUser()', () => {
|
|||
stmts.push('START TRANSACTION');
|
||||
|
||||
stmts.push(`
|
||||
DROP TEMPORARY TABLE IF EXISTS
|
||||
DROP TEMPORARY TABLE IF EXISTS
|
||||
tmp.timeControlCalculate,
|
||||
tmp.timeBusinessCalculate
|
||||
`);
|
||||
|
|
|
@ -6,7 +6,7 @@ describe('zone zone_getLanded()', () => {
|
|||
let stmts = [];
|
||||
let stmt;
|
||||
stmts.push('START TRANSACTION');
|
||||
const date = new Date();
|
||||
const date = Date.vnNew();
|
||||
date.setHours(0, 0, 0, 0);
|
||||
|
||||
let params = {
|
||||
|
@ -40,7 +40,7 @@ describe('zone zone_getLanded()', () => {
|
|||
it(`should return data for a shipped tomorrow`, async() => {
|
||||
let stmts = [];
|
||||
let stmt;
|
||||
const date = new Date();
|
||||
const date = Date.vnNew();
|
||||
date.setHours(0, 0, 0, 0);
|
||||
|
||||
stmts.push('START TRANSACTION');
|
||||
|
|
|
@ -436,7 +436,7 @@ let actions = {
|
|||
},
|
||||
|
||||
pickDate: async function(selector, date) {
|
||||
date = date || new Date();
|
||||
date = date || Date.vnNew();
|
||||
|
||||
const timeZoneOffset = date.getTimezoneOffset() * 60000;
|
||||
const localDate = (new Date(date.getTime() - timeZoneOffset))
|
||||
|
|
|
@ -31,7 +31,7 @@ export default {
|
|||
},
|
||||
recoverPassword: {
|
||||
recoverPasswordButton: 'vn-login a[ui-sref="recover-password"]',
|
||||
email: 'vn-recover-password vn-textfield[ng-model="$ctrl.email"]',
|
||||
email: 'vn-recover-password vn-textfield[ng-model="$ctrl.user"]',
|
||||
sendEmailButton: 'vn-recover-password vn-submit',
|
||||
},
|
||||
accountIndex: {
|
||||
|
@ -58,6 +58,7 @@ export default {
|
|||
deleteAccount: '.vn-menu [name="deleteUser"]',
|
||||
setPassword: '.vn-menu [name="setPassword"]',
|
||||
activateAccount: '.vn-menu [name="enableAccount"]',
|
||||
disableAccount: '.vn-menu [name="disableAccount"]',
|
||||
activateUser: '.vn-menu [name="activateUser"]',
|
||||
deactivateUser: '.vn-menu [name="deactivateUser"]',
|
||||
newPassword: 'vn-textfield[ng-model="$ctrl.newPassword"]',
|
||||
|
@ -561,15 +562,15 @@ export default {
|
|||
payoutBank: '.vn-dialog vn-autocomplete[ng-model="$ctrl.bankFk"]',
|
||||
payoutDescription: 'vn-textfield[ng-model="$ctrl.receipt.description"]',
|
||||
submitPayout: '.vn-dialog button[response="accept"]',
|
||||
searchWeeklyResult: 'vn-ticket-weekly-index vn-table vn-tbody > vn-tr',
|
||||
searchWeeklyResult: 'vn-ticket-weekly-index vn-card smart-table slot-table table tbody tr',
|
||||
searchResultDate: 'vn-ticket-summary [label=Landed] span',
|
||||
topbarSearch: 'vn-searchbar',
|
||||
moreMenu: 'vn-ticket-index vn-icon-button[icon=more_vert]',
|
||||
fourthWeeklyTicket: 'vn-ticket-weekly-index vn-table vn-tbody vn-tr:nth-child(4)',
|
||||
fiveWeeklyTicket: 'vn-ticket-weekly-index vn-table vn-tbody vn-tr:nth-child(5)',
|
||||
weeklyTicket: 'vn-ticket-weekly-index vn-table > div > vn-tbody > vn-tr',
|
||||
firstWeeklyTicketDeleteIcon: 'vn-ticket-weekly-index vn-tr:nth-child(1) vn-icon-button[icon="delete"]',
|
||||
firstWeeklyTicketAgency: 'vn-ticket-weekly-index vn-tr:nth-child(1) [ng-model="weekly.agencyModeFk"]',
|
||||
fourthWeeklyTicket: 'vn-ticket-weekly-index vn-card smart-table slot-table tr:nth-child(4)',
|
||||
fiveWeeklyTicket: 'vn-ticket-weekly-index vn-card smart-table slot-table tr:nth-child(5)',
|
||||
weeklyTicket: 'vn-ticket-weekly-index vn-card smart-table slot-table table tbody tr',
|
||||
firstWeeklyTicketDeleteIcon: 'vn-ticket-weekly-index vn-card smart-table slot-table tr:nth-child(1) vn-icon-button[icon="delete"]',
|
||||
firstWeeklyTicketAgency: 'vn-ticket-weekly-index vn-card smart-table slot-table tr:nth-child(1) [ng-model="weekly.agencyModeFk"]',
|
||||
acceptDeleteTurn: '.vn-confirm.shown button[response="accept"]'
|
||||
},
|
||||
createTicketView: {
|
||||
|
@ -777,18 +778,16 @@ export default {
|
|||
ipt: 'vn-autocomplete[label="Destination IPT"]',
|
||||
tableIpt: 'vn-autocomplete[name="ipt"]',
|
||||
tableFutureIpt: 'vn-autocomplete[name="futureIpt"]',
|
||||
futureState: 'vn-autocomplete[label="Origin Grouped State"]',
|
||||
state: 'vn-autocomplete[label="Destination Grouped State"]',
|
||||
isFullMovable: 'vn-check[ng-model="filter.isFullMovable"]',
|
||||
warehouseFk: 'vn-autocomplete[label="Warehouse"]',
|
||||
tableButtonSearch: 'vn-button[vn-tooltip="Search"]',
|
||||
moveButton: 'vn-button[vn-tooltip="Advance tickets"]',
|
||||
acceptButton: '.vn-confirm.shown button[response="accept"]',
|
||||
multiCheck: 'vn-multi-check',
|
||||
firstCheck: 'tbody > tr:nth-child(1) > td > vn-check',
|
||||
tableId: 'vn-textfield[name="id"]',
|
||||
tableFutureId: 'vn-textfield[name="futureId"]',
|
||||
tableLiters: 'vn-textfield[name="liters"]',
|
||||
tableLines: 'vn-textfield[name="lines"]',
|
||||
tableStock: 'vn-textfield[name="hasStock"]',
|
||||
submit: 'vn-submit[label="Search"]',
|
||||
table: 'tbody > tr:not(.empty-rows)'
|
||||
},
|
||||
|
@ -943,9 +942,9 @@ export default {
|
|||
routeSummary: {
|
||||
header: 'vn-route-summary > vn-card > h5',
|
||||
cost: 'vn-route-summary vn-label-value[label="Cost"]',
|
||||
firstTicketID: 'vn-route-summary vn-tbody > vn-tr:nth-child(1) > vn-td:nth-child(2) > span',
|
||||
firstTicketID: 'vn-route-summary vn-tbody > vn-tr:nth-child(1) > vn-td:nth-child(10) > span',
|
||||
firstTicketDescriptor: '.vn-popover.shown vn-ticket-descriptor',
|
||||
firstAlias: 'vn-route-summary vn-tbody > vn-tr:nth-child(1) > vn-td:nth-child(3) > span',
|
||||
firstAlias: 'vn-route-summary vn-tbody > vn-tr:nth-child(1) > vn-td:nth-child(5) > span',
|
||||
firstClientDescriptor: '.vn-popover.shown vn-client-descriptor',
|
||||
goToRouteSummaryButton: 'vn-route-summary > vn-card > h5 > a',
|
||||
|
||||
|
@ -969,6 +968,7 @@ export default {
|
|||
confirmButton: '.vn-confirm.shown button[response="accept"]'
|
||||
},
|
||||
workerSummary: {
|
||||
summaryIcon: 'vn-worker-descriptor a[title="Go to module summary"]',
|
||||
header: 'vn-worker-summary h5',
|
||||
id: 'vn-worker-summary vn-one:nth-child(1) > vn-label-value:nth-child(3) > section > span',
|
||||
email: 'vn-worker-summary vn-one:nth-child(1) > vn-label-value:nth-child(4) > section > span',
|
||||
|
@ -1021,6 +1021,25 @@ export default {
|
|||
furlough: 'vn-worker-calendar > vn-side-menu [name="absenceTypes"] > vn-chip:nth-child(4)',
|
||||
halfFurlough: 'vn-worker-calendar > vn-side-menu [name="absenceTypes"] > vn-chip:nth-child(5)',
|
||||
},
|
||||
workerCreate: {
|
||||
newWorkerButton: 'vn-worker-index a[ui-sref="worker.create"]',
|
||||
firstname: 'vn-worker-create vn-textfield[ng-model="$ctrl.worker.firstName"]',
|
||||
lastname: 'vn-worker-create vn-textfield[ng-model="$ctrl.worker.lastNames"]',
|
||||
birth: 'vn-worker-create vn-date-picker[ng-model="$ctrl.worker.birth"]',
|
||||
fi: 'vn-worker-create vn-textfield[ng-model="$ctrl.worker.fi"]',
|
||||
code: 'vn-worker-create vn-textfield[ng-model="$ctrl.worker.code"]',
|
||||
phone: 'vn-worker-create vn-textfield[ng-model="$ctrl.worker.phone"]',
|
||||
city: 'vn-worker-create vn-textfield[ng-model="$ctrl.worker.city"]',
|
||||
postcode: 'vn-worker-create vn-datalist[ng-model="$ctrl.worker.postcode"]',
|
||||
street: 'vn-worker-create vn-textfield[ng-model="$ctrl.worker.street"]',
|
||||
user: 'vn-worker-create vn-textfield[ng-model="$ctrl.worker.name"]',
|
||||
email: 'vn-worker-create vn-textfield[ng-model="$ctrl.worker.email"]',
|
||||
boss: 'vn-worker-create vn-autocomplete[ng-model="$ctrl.worker.bossFk"]',
|
||||
role: 'vn-worker-create vn-autocomplete[ng-model="$ctrl.worker.roleFk"]',
|
||||
iban: 'vn-worker-create vn-textfield[ng-model="$ctrl.worker.iban"]',
|
||||
switft: 'vn-worker-create vn-autocomplete[ng-model="$ctrl.worker.bankEntityFk"]',
|
||||
createButton: 'vn-worker-create vn-submit[label="Create"]',
|
||||
},
|
||||
invoiceOutIndex: {
|
||||
topbarSearch: 'vn-searchbar',
|
||||
searchResult: 'vn-invoice-out-index vn-card > vn-table > div > vn-tbody > a.vn-tr',
|
||||
|
@ -1239,6 +1258,21 @@ export default {
|
|||
importBuysButton: 'vn-entry-buy-import button[type="submit"]'
|
||||
},
|
||||
entryLatestBuys: {
|
||||
table: 'tbody > tr:not(.empty-rows)',
|
||||
chip: 'vn-chip > vn-icon',
|
||||
generalSearchInput: 'vn-textfield[ng-model="$ctrl.filter.search"]',
|
||||
firstReignIcon: 'vn-horizontal.item-category vn-one',
|
||||
typeInput: 'vn-autocomplete[ng-model="$ctrl.filter.typeFk"]',
|
||||
salesPersonInput: 'vn-autocomplete[ng-model="$ctrl.filter.salesPersonFk"]',
|
||||
supplierInput: 'vn-autocomplete[ng-model="$ctrl.filter.supplierFk"]',
|
||||
fromInput: 'vn-date-picker[ng-model="$ctrl.filter.from"]',
|
||||
toInput: 'vn-date-picker[ng-model="$ctrl.filter.to"]',
|
||||
activeCheck: 'vn-check[ng-model="$ctrl.filter.active"]',
|
||||
floramondoCheck: 'vn-check[ng-model="$ctrl.filter.floramondo"]',
|
||||
visibleCheck: 'vn-check[ng-model="$ctrl.filter.visible"]',
|
||||
addTagButton: 'vn-icon-button[vn-tooltip="Add tag"]',
|
||||
itemTagInput: 'vn-autocomplete[ng-model="itemTag.tagFk"]',
|
||||
itemTagValueInput: 'vn-autocomplete[ng-model="itemTag.value"]',
|
||||
firstBuy: 'vn-entry-latest-buys tbody > tr:nth-child(1)',
|
||||
allBuysCheckBox: 'vn-entry-latest-buys thead vn-check',
|
||||
secondBuyCheckBox: 'vn-entry-latest-buys tbody tr:nth-child(2) vn-check[ng-model="buy.checked"]',
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
require('@babel/register')({presets: ['@babel/env']});
|
||||
require('core-js/stable');
|
||||
require('regenerator-runtime/runtime');
|
||||
require('vn-loopback/server/boot/date')();
|
||||
|
||||
const axios = require('axios');
|
||||
const Docker = require('../../db/docker.js');
|
||||
|
|
|
@ -26,7 +26,7 @@ describe('RecoverPassword path', async() => {
|
|||
expect(message.text).toContain('Notification sent!');
|
||||
});
|
||||
|
||||
it('should send email', async() => {
|
||||
it('should send email using email', async() => {
|
||||
await page.waitForState('login');
|
||||
await page.waitToClick(selectors.recoverPassword.recoverPasswordButton);
|
||||
|
||||
|
@ -37,4 +37,16 @@ describe('RecoverPassword path', async() => {
|
|||
|
||||
expect(message.text).toContain('Notification sent!');
|
||||
});
|
||||
|
||||
it('should send email using username', async() => {
|
||||
await page.waitForState('login');
|
||||
await page.waitToClick(selectors.recoverPassword.recoverPasswordButton);
|
||||
|
||||
await page.write(selectors.recoverPassword.email, 'BruceWayne');
|
||||
await page.waitToClick(selectors.recoverPassword.sendEmailButton);
|
||||
const message = await page.waitForSnackbar();
|
||||
await page.waitForState('login');
|
||||
|
||||
expect(message.text).toContain('Notification sent!');
|
||||
});
|
||||
});
|
||||
|
|
|
@ -4,7 +4,7 @@ import getBrowser from '../../helpers/puppeteer';
|
|||
describe('Client credit insurance path', () => {
|
||||
let browser;
|
||||
let page;
|
||||
let previousMonth = new Date();
|
||||
let previousMonth = Date.vnNew();
|
||||
previousMonth.setMonth(previousMonth.getMonth() - 1);
|
||||
|
||||
beforeAll(async() => {
|
||||
|
|
|
@ -22,7 +22,8 @@ describe('Worker time control path', () => {
|
|||
const hankPymId = 1107;
|
||||
|
||||
it('should go to the next month, go to current month and go 1 month in the past', async() => {
|
||||
let date = new Date();
|
||||
let date = Date.vnNew();
|
||||
date.setDate(1);
|
||||
date.setMonth(date.getMonth() + 1);
|
||||
let month = date.toLocaleString('default', {month: 'long'});
|
||||
|
||||
|
@ -31,7 +32,8 @@ describe('Worker time control path', () => {
|
|||
|
||||
expect(result).toContain(month);
|
||||
|
||||
date = new Date();
|
||||
date = Date.vnNew();
|
||||
date.setDate(1);
|
||||
month = date.toLocaleString('default', {month: 'long'});
|
||||
|
||||
await page.click(selectors.workerTimeControl.previousMonthButton);
|
||||
|
@ -39,7 +41,8 @@ describe('Worker time control path', () => {
|
|||
|
||||
expect(result).toContain(month);
|
||||
|
||||
date = new Date();
|
||||
date = Date.vnNew();
|
||||
date.setDate(1);
|
||||
date.setMonth(date.getMonth() - 1);
|
||||
const timestamp = Math.round(date.getTime() / 1000);
|
||||
month = date.toLocaleString('default', {month: 'long'});
|
||||
|
|
|
@ -4,7 +4,7 @@ import getBrowser from '../../helpers/puppeteer';
|
|||
|
||||
describe('Worker calendar path', () => {
|
||||
const reasonableTimeBetweenClicks = 300;
|
||||
const date = new Date();
|
||||
const date = Date.vnNew();
|
||||
const lastYear = (date.getFullYear() - 1).toString();
|
||||
|
||||
let browser;
|
||||
|
|
|
@ -0,0 +1,74 @@
|
|||
import selectors from '../../helpers/selectors.js';
|
||||
import getBrowser from '../../helpers/puppeteer';
|
||||
|
||||
describe('Worker create path', () => {
|
||||
let browser;
|
||||
let page;
|
||||
let newWorker;
|
||||
beforeAll(async() => {
|
||||
browser = await getBrowser();
|
||||
page = browser.page;
|
||||
await page.loginAndModule('hr', 'worker');
|
||||
await page.waitToClick(selectors.workerCreate.newWorkerButton);
|
||||
await page.waitForState('worker.create');
|
||||
});
|
||||
|
||||
afterAll(async() => {
|
||||
await browser.close();
|
||||
});
|
||||
|
||||
it('should insert default data', async() => {
|
||||
await page.write(selectors.workerCreate.firstname, 'Victor');
|
||||
await page.write(selectors.workerCreate.lastname, 'Von Doom');
|
||||
await page.write(selectors.workerCreate.fi, '78457139E');
|
||||
await page.write(selectors.workerCreate.phone, '12356789');
|
||||
await page.write(selectors.workerCreate.postcode, '46680');
|
||||
await page.write(selectors.workerCreate.street, 'S/ Doomstadt');
|
||||
await page.write(selectors.workerCreate.email, 'doctorDoom@marvel.com');
|
||||
await page.write(selectors.workerCreate.iban, 'ES9121000418450200051332');
|
||||
await page.autocompleteSearch(selectors.workerCreate.switft, 'BBKKESMMMMM');
|
||||
|
||||
// should check for autocompleted worker code and worker user name
|
||||
const workerCode = await page
|
||||
.waitToGetProperty(selectors.workerCreate.code, 'value');
|
||||
|
||||
newWorker = await page
|
||||
.waitToGetProperty(selectors.workerCreate.user, 'value');
|
||||
|
||||
expect(workerCode).toEqual('VVD');
|
||||
expect(newWorker).toContain('victorvd');
|
||||
|
||||
// should fail if necessary data is void
|
||||
await page.waitToClick(selectors.workerCreate.createButton);
|
||||
let message = await page.waitForSnackbar();
|
||||
|
||||
expect(message.text).toContain('is a required argument');
|
||||
|
||||
// should create a new worker and go to worker basic data'
|
||||
await page.pickDate(selectors.workerCreate.birth, new Date(1962, 8, 5));
|
||||
await page.autocompleteSearch(selectors.workerCreate.boss, 'deliveryBoss');
|
||||
await page.waitToClick(selectors.workerCreate.createButton);
|
||||
message = await page.waitForSnackbar();
|
||||
await page.waitForState('worker.card.basicData');
|
||||
|
||||
expect(message.text).toContain('Data saved!');
|
||||
|
||||
// 'rollback'
|
||||
await page.loginAndModule('sysadmin', 'account');
|
||||
await page.accessToSearchResult(newWorker);
|
||||
|
||||
await page.waitToClick(selectors.accountDescriptor.menuButton);
|
||||
await page.waitToClick(selectors.accountDescriptor.deactivateUser);
|
||||
await page.waitToClick(selectors.accountDescriptor.acceptButton);
|
||||
message = await page.waitForSnackbar();
|
||||
|
||||
expect(message.text).toContain('User deactivated!');
|
||||
|
||||
await page.waitToClick(selectors.accountDescriptor.menuButton);
|
||||
await page.waitToClick(selectors.accountDescriptor.disableAccount);
|
||||
await page.waitToClick(selectors.accountDescriptor.acceptButton);
|
||||
message = await page.waitForSnackbar();
|
||||
|
||||
expect(message.text).toContain('Account disabled!');
|
||||
});
|
||||
});
|
|
@ -22,7 +22,7 @@ describe('Item fixed prices path', () => {
|
|||
});
|
||||
|
||||
it('should fill the fixed price data', async() => {
|
||||
const now = new Date();
|
||||
const now = Date.vnNew();
|
||||
await page.autocompleteSearch(selectors.itemFixedPrice.fourthWarehouse, 'Warehouse one');
|
||||
await page.writeOnEditableTD(selectors.itemFixedPrice.fourthGroupingPrice, '1');
|
||||
await page.writeOnEditableTD(selectors.itemFixedPrice.fourthPackingPrice, '1');
|
||||
|
|
|
@ -93,7 +93,7 @@ describe('Ticket Edit basic data path', () => {
|
|||
|
||||
it(`should split ticket without negatives`, async() => {
|
||||
const newAgency = 'Gotham247';
|
||||
const newDate = new Date();
|
||||
const newDate = Date.vnNew();
|
||||
newDate.setDate(newDate.getDate() - 1);
|
||||
|
||||
await page.accessToSearchResult('14');
|
||||
|
@ -127,7 +127,7 @@ describe('Ticket Edit basic data path', () => {
|
|||
});
|
||||
|
||||
it(`should old ticket have old date and agency`, async() => {
|
||||
const oldDate = new Date();
|
||||
const oldDate = Date.vnNew();
|
||||
const oldAgency = 'Super-Man delivery';
|
||||
|
||||
await page.accessToSearchResult('14');
|
||||
|
|
|
@ -4,7 +4,7 @@ import getBrowser from '../../helpers/puppeteer';
|
|||
describe('Ticket create path', () => {
|
||||
let browser;
|
||||
let page;
|
||||
let nextMonth = new Date();
|
||||
let nextMonth = Date.vnNew();
|
||||
nextMonth.setMonth(nextMonth.getMonth() + 1);
|
||||
|
||||
beforeAll(async() => {
|
||||
|
|
|
@ -55,7 +55,7 @@ describe('Ticket Summary path', () => {
|
|||
let result = await page
|
||||
.waitToGetProperty(selectors.ticketSummary.firstSaleItemId, 'innerText');
|
||||
|
||||
expect(result).toContain('000002');
|
||||
expect(result).toContain('2');
|
||||
});
|
||||
|
||||
it(`should click on the first sale ID to make the item descriptor visible`, async() => {
|
||||
|
|
|
@ -63,6 +63,6 @@ describe('Ticket index payout path', () => {
|
|||
const reference = await page.waitToGetProperty(selectors.clientBalance.firstLineReference, 'innerText');
|
||||
|
||||
expect(count).toEqual(4);
|
||||
expect(reference).toContain('Cash, Albaran: 7, 8Payment');
|
||||
expect(reference).toContain('Cash,Albaran: 7, 8Payment');
|
||||
});
|
||||
});
|
||||
|
|
|
@ -4,12 +4,17 @@ import getBrowser from '../../helpers/puppeteer';
|
|||
describe('Ticket Advance path', () => {
|
||||
let browser;
|
||||
let page;
|
||||
const httpRequests = [];
|
||||
|
||||
beforeAll(async() => {
|
||||
browser = await getBrowser();
|
||||
page = browser.page;
|
||||
await page.loginAndModule('employee', 'ticket');
|
||||
await page.accessToSection('ticket.advance');
|
||||
page.on('request', req => {
|
||||
if (req.url().includes(`Tickets/getTicketsAdvance`))
|
||||
httpRequests.push(req.url());
|
||||
});
|
||||
});
|
||||
|
||||
afterAll(async() => {
|
||||
|
@ -43,116 +48,74 @@ describe('Ticket Advance path', () => {
|
|||
it('should search with the required data', async() => {
|
||||
await page.waitToClick(selectors.ticketAdvance.openAdvancedSearchButton);
|
||||
await page.waitToClick(selectors.ticketAdvance.submit);
|
||||
await page.waitForNumberOfElements(selectors.ticketAdvance.table, 1);
|
||||
|
||||
expect(httpRequests.length).toBeGreaterThan(0);
|
||||
});
|
||||
|
||||
it('should search with the origin IPT', async() => {
|
||||
await page.waitToClick(selectors.ticketAdvance.openAdvancedSearchButton);
|
||||
await page.autocompleteSearch(selectors.ticketAdvance.ipt, 'Horizontal');
|
||||
await page.waitToClick(selectors.ticketAdvance.submit);
|
||||
await page.waitForNumberOfElements(selectors.ticketAdvance.table, 0);
|
||||
|
||||
await page.waitToClick(selectors.ticketAdvance.openAdvancedSearchButton);
|
||||
await page.clearInput(selectors.ticketAdvance.ipt);
|
||||
await page.waitToClick(selectors.ticketAdvance.submit);
|
||||
await page.waitForNumberOfElements(selectors.ticketAdvance.table, 1);
|
||||
});
|
||||
|
||||
it('should search with the destination IPT', async() => {
|
||||
await page.waitToClick(selectors.ticketAdvance.openAdvancedSearchButton);
|
||||
await page.autocompleteSearch(selectors.ticketAdvance.futureIpt, 'Horizontal');
|
||||
await page.waitToClick(selectors.ticketAdvance.submit);
|
||||
await page.waitForNumberOfElements(selectors.ticketAdvance.table, 0);
|
||||
|
||||
const request = httpRequests.find(req => req.includes(('futureIpt=H')));
|
||||
|
||||
expect(request).toBeDefined();
|
||||
|
||||
httpRequests.splice(httpRequests.indexOf(request), 1);
|
||||
|
||||
await page.waitToClick(selectors.ticketAdvance.openAdvancedSearchButton);
|
||||
await page.clearInput(selectors.ticketAdvance.futureIpt);
|
||||
await page.waitToClick(selectors.ticketAdvance.submit);
|
||||
await page.waitForNumberOfElements(selectors.ticketAdvance.table, 1);
|
||||
});
|
||||
|
||||
it('should search with the origin grouped state', async() => {
|
||||
it('should search with the destination IPT', async() => {
|
||||
await page.waitToClick(selectors.ticketAdvance.openAdvancedSearchButton);
|
||||
await page.autocompleteSearch(selectors.ticketAdvance.futureState, 'Free');
|
||||
await page.autocompleteSearch(selectors.ticketAdvance.ipt, 'Horizontal');
|
||||
await page.waitToClick(selectors.ticketAdvance.submit);
|
||||
await page.waitForNumberOfElements(selectors.ticketAdvance.table, 1);
|
||||
|
||||
const request = httpRequests.find(req => req.includes(('ipt=H')));
|
||||
|
||||
expect(request).toBeDefined();
|
||||
|
||||
httpRequests.splice(httpRequests.indexOf(request), 1);
|
||||
|
||||
await page.waitToClick(selectors.ticketAdvance.openAdvancedSearchButton);
|
||||
await page.clearInput(selectors.ticketAdvance.futureState);
|
||||
await page.clearInput(selectors.ticketAdvance.ipt);
|
||||
await page.waitToClick(selectors.ticketAdvance.submit);
|
||||
await page.waitForNumberOfElements(selectors.ticketAdvance.table, 1);
|
||||
});
|
||||
|
||||
it('should search with the destination grouped state', async() => {
|
||||
await page.waitToClick(selectors.ticketAdvance.openAdvancedSearchButton);
|
||||
await page.autocompleteSearch(selectors.ticketAdvance.state, 'Free');
|
||||
await page.waitToClick(selectors.ticketAdvance.submit);
|
||||
await page.waitForNumberOfElements(selectors.ticketAdvance.table, 0);
|
||||
|
||||
await page.waitToClick(selectors.ticketAdvance.openAdvancedSearchButton);
|
||||
await page.clearInput(selectors.ticketAdvance.state);
|
||||
await page.waitToClick(selectors.ticketAdvance.submit);
|
||||
await page.waitForNumberOfElements(selectors.ticketAdvance.table, 1);
|
||||
});
|
||||
|
||||
it('should search in smart-table with an IPT Origin', async() => {
|
||||
await page.waitToClick(selectors.ticketAdvance.tableButtonSearch);
|
||||
await page.autocompleteSearch(selectors.ticketAdvance.tableFutureIpt, 'Vertical');
|
||||
await page.waitForNumberOfElements(selectors.ticketAdvance.table, 1);
|
||||
|
||||
const request = httpRequests.find(req => req.includes(('futureIpt')));
|
||||
|
||||
expect(request).toBeDefined();
|
||||
|
||||
httpRequests.splice(httpRequests.indexOf(request), 1);
|
||||
|
||||
await page.waitToClick(selectors.ticketAdvance.tableButtonSearch);
|
||||
await page.waitToClick(selectors.ticketAdvance.openAdvancedSearchButton);
|
||||
await page.waitToClick(selectors.ticketAdvance.submit);
|
||||
await page.waitForNumberOfElements(selectors.ticketAdvance.table, 1);
|
||||
});
|
||||
|
||||
it('should search in smart-table with an IPT Destination', async() => {
|
||||
await page.waitToClick(selectors.ticketAdvance.tableButtonSearch);
|
||||
await page.autocompleteSearch(selectors.ticketAdvance.tableIpt, 'Vertical');
|
||||
await page.waitForNumberOfElements(selectors.ticketAdvance.table, 1);
|
||||
|
||||
const request = httpRequests.find(req => req.includes(('ipt')));
|
||||
|
||||
expect(request).toBeDefined();
|
||||
|
||||
httpRequests.splice(httpRequests.indexOf(request), 1);
|
||||
|
||||
await page.waitToClick(selectors.ticketAdvance.tableButtonSearch);
|
||||
await page.waitToClick(selectors.ticketAdvance.openAdvancedSearchButton);
|
||||
await page.waitToClick(selectors.ticketAdvance.submit);
|
||||
await page.waitForNumberOfElements(selectors.ticketAdvance.table, 1);
|
||||
});
|
||||
|
||||
it('should search in smart-table with stock', async() => {
|
||||
await page.waitToClick(selectors.ticketAdvance.tableButtonSearch);
|
||||
await page.write(selectors.ticketAdvance.tableStock, '5');
|
||||
await page.waitForNumberOfElements(selectors.ticketAdvance.table, 2);
|
||||
|
||||
await page.waitToClick(selectors.ticketAdvance.tableButtonSearch);
|
||||
await page.waitToClick(selectors.ticketAdvance.openAdvancedSearchButton);
|
||||
await page.waitToClick(selectors.ticketAdvance.submit);
|
||||
await page.waitForNumberOfElements(selectors.ticketAdvance.table, 1);
|
||||
});
|
||||
|
||||
it('should search in smart-table with especified Lines', async() => {
|
||||
await page.waitToClick(selectors.ticketAdvance.tableButtonSearch);
|
||||
await page.write(selectors.ticketAdvance.tableLines, '0');
|
||||
await page.keyboard.press('Enter');
|
||||
await page.waitForNumberOfElements(selectors.ticketAdvance.table, 1);
|
||||
|
||||
await page.waitToClick(selectors.ticketAdvance.tableButtonSearch);
|
||||
await page.waitToClick(selectors.ticketAdvance.openAdvancedSearchButton);
|
||||
await page.waitToClick(selectors.ticketAdvance.submit);
|
||||
await page.waitForNumberOfElements(selectors.ticketAdvance.table, 1);
|
||||
});
|
||||
|
||||
it('should search in smart-table with especified Liters', async() => {
|
||||
await page.waitToClick(selectors.ticketAdvance.tableButtonSearch);
|
||||
await page.write(selectors.ticketAdvance.tableLiters, '0');
|
||||
await page.keyboard.press('Enter');
|
||||
await page.waitForNumberOfElements(selectors.ticketAdvance.table, 1);
|
||||
|
||||
await page.waitToClick(selectors.ticketAdvance.tableButtonSearch);
|
||||
await page.waitToClick(selectors.ticketAdvance.openAdvancedSearchButton);
|
||||
await page.waitToClick(selectors.ticketAdvance.submit);
|
||||
await page.waitForNumberOfElements(selectors.ticketAdvance.table, 1);
|
||||
});
|
||||
|
||||
it('should check the three last tickets and move to the future', async() => {
|
||||
await page.waitToClick(selectors.ticketAdvance.multiCheck);
|
||||
it('should check the first ticket and move to the present', async() => {
|
||||
await page.waitToClick(selectors.ticketAdvance.firstCheck);
|
||||
await page.waitToClick(selectors.ticketAdvance.moveButton);
|
||||
await page.waitToClick(selectors.ticketAdvance.acceptButton);
|
||||
const message = await page.waitForSnackbar();
|
||||
|
|
|
@ -45,7 +45,7 @@ describe('Claim summary path', () => {
|
|||
it('should display the claimed line(s)', async() => {
|
||||
const result = await page.waitToGetProperty(selectors.claimSummary.firstSaleItemId, 'innerText');
|
||||
|
||||
expect(result).toContain('000002');
|
||||
expect(result).toContain('2');
|
||||
});
|
||||
|
||||
it(`should click on the first sale ID making the item descriptor visible`, async() => {
|
||||
|
|
|
@ -18,7 +18,7 @@ describe('Route basic Data path', () => {
|
|||
});
|
||||
|
||||
it('should edit the route basic data', async() => {
|
||||
const nextMonth = new Date();
|
||||
const nextMonth = Date.vnNew();
|
||||
nextMonth.setMonth(nextMonth.getMonth() + 1);
|
||||
|
||||
await page.autocompleteSearch(selectors.routeBasicData.worker, 'adminBossNick');
|
||||
|
|
|
@ -19,7 +19,7 @@ describe('InvoiceIn basic data path', () => {
|
|||
});
|
||||
|
||||
it(`should edit the invoiceIn basic data`, async() => {
|
||||
const now = new Date();
|
||||
const now = Date.vnNew();
|
||||
await page.pickDate(selectors.invoiceInBasicData.issued, now);
|
||||
await page.pickDate(selectors.invoiceInBasicData.operated, now);
|
||||
await page.autocompleteSearch(selectors.invoiceInBasicData.supplier, 'Verdnatura');
|
||||
|
|
|
@ -100,7 +100,7 @@ describe('InvoiceOut descriptor path', () => {
|
|||
});
|
||||
|
||||
it(`should check the invoiceOut booked in the summary data`, async() => {
|
||||
let today = new Date();
|
||||
let today = Date.vnNew();
|
||||
|
||||
let day = today.getDate();
|
||||
if (day < 10) day = `0${day}`;
|
||||
|
|
|
@ -4,7 +4,7 @@ import getBrowser from '../../helpers/puppeteer';
|
|||
describe('Travel create path', () => {
|
||||
let browser;
|
||||
let page;
|
||||
const date = new Date();
|
||||
const date = Date.vnNew();
|
||||
const day = 15;
|
||||
date.setDate(day);
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ describe('Travel basic data path', () => {
|
|||
});
|
||||
|
||||
it('should set a wrong delivery date then receive an error on submit', async() => {
|
||||
const lastMonth = new Date();
|
||||
const lastMonth = Date.vnNew();
|
||||
lastMonth.setMonth(lastMonth.getMonth() - 1);
|
||||
|
||||
await page.pickDate(selectors.travelBasicData.deliveryDate, lastMonth);
|
||||
|
|
|
@ -123,7 +123,7 @@ describe('Travel descriptor path', () => {
|
|||
});
|
||||
|
||||
it('should update the landed date to a future date to enable cloneWithEntries', async() => {
|
||||
const nextMonth = new Date();
|
||||
const nextMonth = Date.vnNew();
|
||||
nextMonth.setMonth(nextMonth.getMonth() + 1);
|
||||
await page.pickDate(selectors.travelBasicData.deliveryDate, nextMonth);
|
||||
await page.waitToClick(selectors.travelBasicData.save);
|
||||
|
|
|
@ -4,10 +4,15 @@ import getBrowser from '../../helpers/puppeteer';
|
|||
describe('Entry lastest buys path', () => {
|
||||
let browser;
|
||||
let page;
|
||||
const httpRequests = [];
|
||||
|
||||
beforeAll(async() => {
|
||||
browser = await getBrowser();
|
||||
page = browser.page;
|
||||
page.on('request', req => {
|
||||
if (req.url().includes(`Buys/latestBuysFilter`))
|
||||
httpRequests.push(req.url());
|
||||
});
|
||||
await page.loginAndModule('buyer', 'entry');
|
||||
});
|
||||
|
||||
|
@ -20,6 +25,87 @@ describe('Entry lastest buys path', () => {
|
|||
await page.waitForSelector(selectors.entryLatestBuys.editBuysButton, {visible: false});
|
||||
});
|
||||
|
||||
it('should filter by name', async() => {
|
||||
await page.write(selectors.entryLatestBuys.generalSearchInput, 'Melee');
|
||||
await page.keyboard.press('Enter');
|
||||
await page.waitToClick(selectors.entryLatestBuys.chip);
|
||||
|
||||
expect(httpRequests.find(req => req.includes(('search=Melee')))).toBeDefined();
|
||||
});
|
||||
|
||||
it('should filter by reign and type', async() => {
|
||||
await page.click(selectors.entryLatestBuys.firstReignIcon);
|
||||
await page.autocompleteSearch(selectors.entryLatestBuys.typeInput, 'Alstroemeria');
|
||||
await page.click(selectors.entryLatestBuys.chip);
|
||||
|
||||
expect(httpRequests.find(req => req.includes(('categoryFk')))).toBeDefined();
|
||||
expect(httpRequests.find(req => req.includes(('typeFk')))).toBeDefined();
|
||||
});
|
||||
|
||||
it('should filter by from date', async() => {
|
||||
await page.pickDate(selectors.entryLatestBuys.fromInput, new Date());
|
||||
await page.waitToClick(selectors.entryLatestBuys.chip);
|
||||
|
||||
expect(httpRequests.find(req => req.includes(('from')))).toBeDefined();
|
||||
});
|
||||
|
||||
it('should filter by to date', async() => {
|
||||
await page.pickDate(selectors.entryLatestBuys.toInput, new Date());
|
||||
await page.waitToClick(selectors.entryLatestBuys.chip);
|
||||
|
||||
expect(httpRequests.find(req => req.includes(('to')))).toBeDefined();
|
||||
});
|
||||
|
||||
it('should filter by sales person', async() => {
|
||||
await page.autocompleteSearch(selectors.entryLatestBuys.salesPersonInput, 'buyerNick');
|
||||
await page.waitToClick(selectors.entryLatestBuys.chip);
|
||||
|
||||
expect(httpRequests.find(req => req.includes(('salesPersonFk')))).toBeDefined();
|
||||
});
|
||||
|
||||
it('should filter by supplier', async() => {
|
||||
await page.autocompleteSearch(selectors.entryLatestBuys.supplierInput, 'Farmer King');
|
||||
await page.waitToClick(selectors.entryLatestBuys.chip);
|
||||
|
||||
expect(httpRequests.find(req => req.includes(('supplierFk')))).toBeDefined();
|
||||
});
|
||||
|
||||
it('should filter by active', async() => {
|
||||
await page.waitToClick(selectors.entryLatestBuys.activeCheck);
|
||||
await page.waitToClick(selectors.entryLatestBuys.activeCheck);
|
||||
await page.waitToClick(selectors.entryLatestBuys.chip);
|
||||
|
||||
expect(httpRequests.find(req => req.includes(('active=true')))).toBeDefined();
|
||||
expect(httpRequests.find(req => req.includes(('active=false')))).toBeDefined();
|
||||
});
|
||||
|
||||
it('should filter by visible', async() => {
|
||||
await page.waitToClick(selectors.entryLatestBuys.visibleCheck);
|
||||
await page.waitToClick(selectors.entryLatestBuys.visibleCheck);
|
||||
await page.waitToClick(selectors.entryLatestBuys.chip);
|
||||
|
||||
expect(httpRequests.find(req => req.includes(('visible=true')))).toBeDefined();
|
||||
expect(httpRequests.find(req => req.includes(('visible=false')))).toBeDefined();
|
||||
});
|
||||
|
||||
it('should filter by floramondo', async() => {
|
||||
await page.waitToClick(selectors.entryLatestBuys.floramondoCheck);
|
||||
await page.waitToClick(selectors.entryLatestBuys.floramondoCheck);
|
||||
await page.waitToClick(selectors.entryLatestBuys.chip);
|
||||
|
||||
expect(httpRequests.find(req => req.includes(('floramondo=true')))).toBeDefined();
|
||||
expect(httpRequests.find(req => req.includes(('floramondo=false')))).toBeDefined();
|
||||
});
|
||||
|
||||
it('should filter by tag Color', async() => {
|
||||
await page.waitToClick(selectors.entryLatestBuys.addTagButton);
|
||||
await page.autocompleteSearch(selectors.entryLatestBuys.itemTagInput, 'Color');
|
||||
await page.autocompleteSearch(selectors.entryLatestBuys.itemTagValueInput, 'Brown');
|
||||
await page.waitToClick(selectors.entryLatestBuys.chip);
|
||||
|
||||
expect(httpRequests.find(req => req.includes(('tags')))).toBeDefined();
|
||||
});
|
||||
|
||||
it('should select all lines but one and then check the edit buys button appears', async() => {
|
||||
await page.waitToClick(selectors.entryLatestBuys.allBuysCheckBox);
|
||||
await page.waitToClick(selectors.entryLatestBuys.secondBuyCheckBox);
|
||||
|
|
|
@ -87,6 +87,7 @@ ngModule.vnComponent('vnButtonMenu', {
|
|||
selectFields: '<?',
|
||||
initialData: '<?',
|
||||
showFilter: '<?',
|
||||
fields: '<?',
|
||||
field: '=?',
|
||||
url: '@?',
|
||||
data: '<?',
|
||||
|
|
|
@ -15,7 +15,7 @@ export default class Calendar extends FormInput {
|
|||
constructor($element, $scope, vnWeekDays, moment) {
|
||||
super($element, $scope);
|
||||
this.weekDays = vnWeekDays.locales;
|
||||
this.defaultDate = new Date();
|
||||
this.defaultDate = Date.vnNew();
|
||||
this.displayControls = true;
|
||||
this.moment = moment;
|
||||
}
|
||||
|
@ -115,8 +115,8 @@ export default class Calendar extends FormInput {
|
|||
let wday = date.getDay();
|
||||
let month = date.getMonth();
|
||||
|
||||
const currentDay = new Date().getDate();
|
||||
const currentMonth = new Date().getMonth();
|
||||
const currentDay = Date.vnNew().getDate();
|
||||
const currentMonth = Date.vnNew().getMonth();
|
||||
|
||||
let classes = {
|
||||
today: day === currentDay && month === currentMonth,
|
||||
|
|
|
@ -2,7 +2,7 @@ describe('Component vnCalendar', () => {
|
|||
let controller;
|
||||
let $element;
|
||||
|
||||
let date = new Date();
|
||||
let date = Date.vnNew();
|
||||
date.setHours(0, 0, 0, 0);
|
||||
date.setDate(1);
|
||||
|
||||
|
@ -48,7 +48,7 @@ describe('Component vnCalendar', () => {
|
|||
it(`should return the selected element, then emit a 'selection' event`, () => {
|
||||
jest.spyOn(controller, 'emit');
|
||||
|
||||
const day = new Date();
|
||||
const day = Date.vnNew();
|
||||
day.setHours(0, 0, 0, 0);
|
||||
|
||||
const clickEvent = new Event('click');
|
||||
|
|
|
@ -147,28 +147,17 @@ export default class CrudModel extends ModelProxy {
|
|||
this.moreRows = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves current changes on the server.
|
||||
*
|
||||
* @return {Promise} The save request promise
|
||||
*/
|
||||
save() {
|
||||
if (!this.isChanged)
|
||||
return this.$q.resolve();
|
||||
getChanges() {
|
||||
if (!this.isChanged) return null;
|
||||
|
||||
let deletes = [];
|
||||
let updates = [];
|
||||
let creates = [];
|
||||
let orgDeletes = [];
|
||||
let orgUpdates = [];
|
||||
let orgCreates = [];
|
||||
const deletes = [];
|
||||
const updates = [];
|
||||
const creates = [];
|
||||
|
||||
let pk = this.primaryKey;
|
||||
const pk = this.primaryKey;
|
||||
|
||||
for (let row of this.removed) {
|
||||
for (let row of this.removed)
|
||||
deletes.push(row.$orgRow[pk]);
|
||||
orgDeletes.push(row);
|
||||
}
|
||||
|
||||
for (let row of this.data) {
|
||||
if (row.$isNew) {
|
||||
|
@ -178,7 +167,6 @@ export default class CrudModel extends ModelProxy {
|
|||
data[prop] = row[prop];
|
||||
}
|
||||
creates.push(row);
|
||||
orgCreates.push(row);
|
||||
} else if (row.$oldData) {
|
||||
let data = {};
|
||||
for (let prop in row.$oldData)
|
||||
|
@ -187,28 +175,38 @@ export default class CrudModel extends ModelProxy {
|
|||
data,
|
||||
where: {[pk]: row.$orgRow[pk]}
|
||||
});
|
||||
orgUpdates.push(row);
|
||||
}
|
||||
}
|
||||
|
||||
let changes = {deletes, updates, creates};
|
||||
const changes = {deletes, updates, creates};
|
||||
|
||||
for (let prop in changes) {
|
||||
if (changes[prop].length === 0)
|
||||
changes[prop] = undefined;
|
||||
}
|
||||
|
||||
if (!changes)
|
||||
return this.$q.resolve();
|
||||
return changes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves current changes on the server.
|
||||
*
|
||||
* @return {Promise} The save request promise
|
||||
*/
|
||||
save() {
|
||||
const pk = this.primaryKey;
|
||||
const changes = this.getChanges();
|
||||
if (!changes) return this.$q.resolve();
|
||||
|
||||
const creates = changes.creates || [];
|
||||
let url = this.saveUrl ? this.saveUrl : `${this._url}/crud`;
|
||||
return this.$http.post(url, changes)
|
||||
.then(res => {
|
||||
const created = res.data;
|
||||
|
||||
// Apply new data to created instances
|
||||
for (let i = 0; i < orgCreates.length; i++) {
|
||||
const row = orgCreates[i];
|
||||
for (let i = 0; i < creates.length; i++) {
|
||||
const row = creates[i];
|
||||
row[pk] = created[i][pk];
|
||||
|
||||
for (let prop in row) {
|
||||
|
|
|
@ -4,7 +4,7 @@ describe('Component vnDatePicker', () => {
|
|||
let $ctrl;
|
||||
|
||||
let today;
|
||||
today = new Date();
|
||||
today = Date.vnNew();
|
||||
today.setHours(0, 0, 0, 0);
|
||||
|
||||
beforeEach(ngModule('vnCore'));
|
||||
|
|
|
@ -82,8 +82,6 @@
|
|||
}
|
||||
&[type=time],
|
||||
&[type=date] {
|
||||
clip-path: inset(0 20px 0 0);
|
||||
|
||||
&::-webkit-inner-spin-button,
|
||||
&::-webkit-clear-button {
|
||||
display: none;
|
||||
|
@ -99,7 +97,7 @@
|
|||
}
|
||||
&[type=number] {
|
||||
-moz-appearance: textfield;
|
||||
|
||||
|
||||
&::-webkit-outer-spin-button,
|
||||
&::-webkit-inner-spin-button {
|
||||
-webkit-appearance: none;
|
||||
|
|
|
@ -31,7 +31,7 @@ export default class InputTime extends Field {
|
|||
|
||||
date = this.modelDate
|
||||
? new Date(this.modelDate)
|
||||
: new Date();
|
||||
: Date.vnNew();
|
||||
date.setHours(split[0], split[1], 0, 0);
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ describe('Component vnInputTime', () => {
|
|||
|
||||
describe('field() setter', () => {
|
||||
it(`should display the formated the date`, () => {
|
||||
let date = new Date();
|
||||
let date = Date.vnNew();
|
||||
$ctrl.field = date;
|
||||
let displayed = $filter('date')(date, 'HH:mm');
|
||||
|
||||
|
|
|
@ -478,8 +478,8 @@ export default class SmartTable extends Component {
|
|||
|
||||
const params = {q: JSON.stringify(stateFilter)};
|
||||
|
||||
this.$state.go(this.$state.current.name, params, {location: 'replace'});
|
||||
this.refresh();
|
||||
this.$state.go(this.$state.current.name, params, {location: 'replace'})
|
||||
.then(() => this.refresh());
|
||||
}
|
||||
|
||||
applySort() {
|
||||
|
@ -499,8 +499,8 @@ export default class SmartTable extends Component {
|
|||
stateFilter.tableOrder = order;
|
||||
|
||||
const params = {q: JSON.stringify(stateFilter)};
|
||||
this.$state.go(this.$state.current.name, params, {location: 'replace'});
|
||||
this.refresh();
|
||||
this.$state.go(this.$state.current.name, params, {location: 'replace'})
|
||||
.then(() => this.refresh());
|
||||
}
|
||||
|
||||
filterSanitizer(field) {
|
||||
|
@ -589,7 +589,7 @@ export default class SmartTable extends Component {
|
|||
refresh() {
|
||||
this.isRefreshing = true;
|
||||
this.model.refresh()
|
||||
.then(() => this.isRefreshing = false);
|
||||
.finally(() => this.isRefreshing = false);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -160,7 +160,7 @@ describe('Component smartTable', () => {
|
|||
describe('applySort()', () => {
|
||||
it('should call the $state go and model refresh without making changes on the model order', () => {
|
||||
controller.$state = {
|
||||
go: jest.fn(),
|
||||
go: jest.fn().mockReturnValue(new Promise(resolve => resolve())),
|
||||
current: {
|
||||
name: 'section'
|
||||
}
|
||||
|
@ -171,13 +171,12 @@ describe('Component smartTable', () => {
|
|||
|
||||
expect(controller.model.order).toBeUndefined();
|
||||
expect(controller.$state.go).toHaveBeenCalled();
|
||||
expect(controller.refresh).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should call the $state go and model refresh after setting model order according to the controller sortCriteria', () => {
|
||||
const orderBy = {field: 'myField', sortType: 'ASC'};
|
||||
controller.$state = {
|
||||
go: jest.fn(),
|
||||
go: jest.fn().mockReturnValue(new Promise(resolve => resolve())),
|
||||
current: {
|
||||
name: 'section'
|
||||
}
|
||||
|
@ -190,7 +189,6 @@ describe('Component smartTable', () => {
|
|||
|
||||
expect(controller.model.order).toEqual(`${orderBy.field} ${orderBy.sortType}`);
|
||||
expect(controller.$state.go).toHaveBeenCalled();
|
||||
expect(controller.refresh).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -293,12 +291,10 @@ describe('Component smartTable', () => {
|
|||
controller.$inputsScope = {
|
||||
searchProps: {}
|
||||
};
|
||||
jest.spyOn(controller, 'refresh');
|
||||
|
||||
controller.defaultFilter();
|
||||
|
||||
expect(controller.model.addFilter).toHaveBeenCalled();
|
||||
expect(controller.refresh).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -3,5 +3,4 @@ import './ucwords';
|
|||
import './dash-if-empty';
|
||||
import './percentage';
|
||||
import './currency';
|
||||
import './zero-fill';
|
||||
import './id';
|
||||
|
|
|
@ -1,25 +0,0 @@
|
|||
describe('ZeroFill filter', () => {
|
||||
let zeroFillFilter;
|
||||
|
||||
beforeEach(ngModule('vnCore'));
|
||||
|
||||
beforeEach(inject(_zeroFillFilter_ => {
|
||||
zeroFillFilter = _zeroFillFilter_;
|
||||
}));
|
||||
|
||||
it('should return null for a input null', () => {
|
||||
expect(zeroFillFilter(null, null)).toBeNull();
|
||||
});
|
||||
|
||||
it('should return a positive number pads a number with five zeros', () => {
|
||||
expect(zeroFillFilter(1, 5)).toBe('00001');
|
||||
});
|
||||
|
||||
it('should return negative number pads a number with five zeros', () => {
|
||||
expect(zeroFillFilter(-1, 5)).toBe('-00001');
|
||||
});
|
||||
|
||||
it('should return zero number with zero zeros', () => {
|
||||
expect(zeroFillFilter(0, 1)).toBe('0');
|
||||
});
|
||||
});
|
|
@ -1,17 +0,0 @@
|
|||
import ngModule from '../module';
|
||||
|
||||
/**
|
||||
* Pads a number with zeros.
|
||||
*
|
||||
* @param {Number} input The number to pad
|
||||
* @param {Number} padLength The resulting number of digits
|
||||
* @return {String} The zero-filled number
|
||||
*/
|
||||
export default function zeroFill() {
|
||||
return function(input, padLength) {
|
||||
if (input == null) return input;
|
||||
let sign = Math.sign(input) === -1 ? '-' : '';
|
||||
return sign + new Array(padLength).concat([Math.abs(input)]).join('0').slice(-padLength);
|
||||
};
|
||||
}
|
||||
ngModule.filter('zeroFill', zeroFill);
|
|
@ -0,0 +1,2 @@
|
|||
import * as date from 'vn-loopback/server/boot/date';
|
||||
date.default();
|
|
@ -10,3 +10,4 @@ import './week-days';
|
|||
import './report';
|
||||
import './email';
|
||||
import './file';
|
||||
import './date';
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
|
||||
<vn-dialog
|
||||
vn-id="instanceLog">
|
||||
<tpl-body>
|
||||
<vn-log
|
||||
class="vn-instance-log"
|
||||
url="{{$ctrl.url}}"
|
||||
origin-id="$ctrl.originId"
|
||||
changed-model="$ctrl.changedModel"
|
||||
|
|
|
@ -1,13 +1,9 @@
|
|||
.vn-dialog {
|
||||
& > .window:not(:has(.empty-rows)) {
|
||||
width:60%;
|
||||
vn-log {
|
||||
vn-card {
|
||||
visibility: hidden;
|
||||
& > * {
|
||||
visibility: visible;
|
||||
}
|
||||
}
|
||||
vn-log.vn-instance-log {
|
||||
vn-card {
|
||||
width: 900px;
|
||||
visibility: hidden;
|
||||
& > * {
|
||||
visibility: visible;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,6 +42,7 @@ vn-log {
|
|||
& > td.after,
|
||||
& > th.after {
|
||||
width: 40%;
|
||||
white-space: pre-line;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<h5 class="vn-mb-md vn-mt-lg" translate>Recover password</h5>
|
||||
<vn-textfield
|
||||
label="Email"
|
||||
ng-model="$ctrl.email"
|
||||
label="User or recovery email"
|
||||
ng-model="$ctrl.user"
|
||||
vn-focus>
|
||||
</vn-textfield>
|
||||
<div
|
||||
|
|
|
@ -20,7 +20,7 @@ export default class Controller {
|
|||
|
||||
submit() {
|
||||
const params = {
|
||||
email: this.email
|
||||
user: this.user
|
||||
};
|
||||
|
||||
this.$http.post('Accounts/recoverPassword', params)
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
Recover password: Recuperar contraseña
|
||||
We will sent you an email to recover your password: Te enviaremos un correo para restablecer tu contraseña
|
||||
Notification sent!: ¡Notificación enviada!
|
||||
User or recovery email: Usuario o correo de recuperación
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
Reset password: Restrablecer contraseña
|
||||
New password: Nueva contraseña
|
||||
Repeat password: Repetir contraseñaç
|
||||
Repeat password: Repetir contraseña
|
||||
Password changed!: ¡Contraseña cambiada!
|
||||
Password requirements: >
|
||||
La contraseña debe tener al menos {{ length }} caracteres de longitud,
|
||||
|
|
|
@ -197,7 +197,7 @@ export default class UploadPhoto extends Component {
|
|||
timeout: this.canceler.promise,
|
||||
transformRequest: ([file]) => {
|
||||
const formData = new FormData();
|
||||
const now = new Date();
|
||||
const now = Date.vnNew();
|
||||
const timestamp = now.getTime();
|
||||
const fileName = `${file.name}_${timestamp}`;
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import './module';
|
||||
import './routes';
|
||||
import './components';
|
||||
import './services';
|
||||
import './styles';
|
||||
import 'vn-loopback/server/boot/date';
|
||||
|
|
|
@ -14,6 +14,10 @@ import './modules/ticket/front/module.js';
|
|||
import './modules/travel/front/module.js';
|
||||
import './modules/worker/front/module.js';
|
||||
import './modules/shelving/front/module.js';
|
||||
import 'vn-loopback/server/boot/date';
|
||||
|
||||
// Set NODE_ENV
|
||||
process.env.NODE_ENV = 'development';
|
||||
|
||||
core.run(vnInterceptor => {
|
||||
vnInterceptor.setApiPath(null);
|
||||
|
@ -39,3 +43,4 @@ window.ngModule = function(moduleName, ...args) {
|
|||
|
||||
return angular.mock.module(...fns);
|
||||
};
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
// For a detailed explanation regarding each configuration property, visit:
|
||||
// https://jestjs.io/docs/en/configuration.html
|
||||
/* eslint max-len: ["error", { "code": 150 }]*/
|
||||
|
||||
module.exports = {
|
||||
name: 'front end',
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
module.exports = Self => {
|
||||
Self.remoteMethodCtx('post', {
|
||||
description: 'Returns the sent parameters',
|
||||
returns: {
|
||||
type: 'object',
|
||||
root: true
|
||||
},
|
||||
http: {
|
||||
path: `/post`,
|
||||
verb: 'POST'
|
||||
}
|
||||
});
|
||||
|
||||
Self.post = async ctx => {
|
||||
return ctx.req.body;
|
||||
};
|
||||
};
|
|
@ -1,4 +1,5 @@
|
|||
|
||||
module.exports = function(Self) {
|
||||
require('../methods/application/status')(Self);
|
||||
require('../methods/application/post')(Self);
|
||||
};
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue