#5878 - FiscalData validations #1851
|
@ -16,6 +16,7 @@
|
||||||
},
|
},
|
||||||
"cSpell.words": [
|
"cSpell.words": [
|
||||||
"salix",
|
"salix",
|
||||||
"fdescribe"
|
"fdescribe",
|
||||||
|
"Loggable"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,13 @@ 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/),
|
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).
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
|
## [2404.01] - 2024-01-25
|
||||||
|
|
||||||
|
### Added
|
||||||
|
### Changed
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
|
||||||
## [2402.01] - 2024-01-11
|
## [2402.01] - 2024-01-11
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
|
@ -68,7 +68,7 @@ module.exports = Self => {
|
||||||
userToUpdate.hasGrant = hasGrant;
|
userToUpdate.hasGrant = hasGrant;
|
||||||
|
|
||||||
if (roleFk) {
|
if (roleFk) {
|
||||||
const role = await models.Role.findById(roleFk, {fields: ['name']}, myOptions);
|
const role = await models.VnRole.findById(roleFk, {fields: ['name']}, myOptions);
|
||||||
const hasRole = await Self.hasRole(userId, role.name, myOptions);
|
const hasRole = await Self.hasRole(userId, role.name, myOptions);
|
||||||
|
|
||||||
if (!hasRole)
|
if (!hasRole)
|
||||||
|
|
|
@ -1,13 +1,5 @@
|
||||||
const {models} = require('vn-loopback/server/server');
|
const {models} = require('vn-loopback/server/server');
|
||||||
|
|
||||||
const handlePromiseLogout = (Self, {id}, courtesyTime) => {
|
|
||||||
new Promise(res => {
|
|
||||||
setTimeout(() => {
|
|
||||||
res(Self.logout(id));
|
|
||||||
}
|
|
||||||
, courtesyTime * 1000);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
module.exports = Self => {
|
module.exports = Self => {
|
||||||
Self.remoteMethodCtx('renewToken', {
|
Self.remoteMethodCtx('renewToken', {
|
||||||
description: 'Checks if the token has more than renewPeriod seconds to live and if so, renews it',
|
description: 'Checks if the token has more than renewPeriod seconds to live and if so, renews it',
|
||||||
|
@ -27,14 +19,26 @@ module.exports = Self => {
|
||||||
const {accessToken: token} = ctx.req;
|
const {accessToken: token} = ctx.req;
|
||||||
|
|
||||||
// Check if current token is valid
|
// Check if current token is valid
|
||||||
const isValid = await validateToken(token);
|
|
||||||
if (isValid)
|
const {renewPeriod, courtesyTime} = await models.AccessTokenConfig.findOne({
|
||||||
|
fields: ['renewPeriod', 'courtesyTime']
|
||||||
|
});
|
||||||
|
const now = Date.now();
|
||||||
|
const differenceMilliseconds = now - token.created;
|
||||||
|
const differenceSeconds = Math.floor(differenceMilliseconds / 1000);
|
||||||
|
const isNotExceeded = differenceSeconds < renewPeriod - courtesyTime;
|
||||||
|
if (isNotExceeded)
|
||||||
return token;
|
return token;
|
||||||
|
|
||||||
const {courtesyTime} = await models.AccessTokenConfig.findOne({fields: ['courtesyTime']});
|
|
||||||
|
|
||||||
// Schedule to remove current token
|
// Schedule to remove current token
|
||||||
handlePromiseLogout(Self, token, courtesyTime);
|
setTimeout(async() => {
|
||||||
|
try {
|
||||||
|
await Self.logout(token.id);
|
||||||
|
} catch (err) {
|
||||||
|
// eslint-disable-next-line no-console
|
||||||
|
console.error(err);
|
||||||
|
}
|
||||||
|
}, courtesyTime * 1000);
|
||||||
|
|
||||||
// Create new accessToken
|
// Create new accessToken
|
||||||
const user = await Self.findById(token.userId);
|
const user = await Self.findById(token.userId);
|
||||||
|
@ -42,14 +46,4 @@ module.exports = Self => {
|
||||||
|
|
||||||
return {id: accessToken.id, ttl: accessToken.ttl};
|
return {id: accessToken.id, ttl: accessToken.ttl};
|
||||||
};
|
};
|
||||||
|
|
||||||
async function validateToken(token) {
|
|
||||||
const accessTokenConfig = await models.AccessTokenConfig.findOne({fields: ['renewPeriod', 'courtesyTime']});
|
|
||||||
const now = Date.now();
|
|
||||||
const differenceMilliseconds = now - token.created;
|
|
||||||
const differenceSeconds = Math.floor(differenceMilliseconds / 1000);
|
|
||||||
const isValid = differenceSeconds < accessTokenConfig.renewPeriod - accessTokenConfig.courtesyTime;
|
|
||||||
|
|
||||||
return isValid;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -70,7 +70,7 @@ describe('VnUser privileges()', () => {
|
||||||
const tx = await models.VnUser.beginTransaction({});
|
const tx = await models.VnUser.beginTransaction({});
|
||||||
|
|
||||||
const options = {transaction: tx};
|
const options = {transaction: tx};
|
||||||
const agency = await models.Role.findOne({
|
const agency = await models.VnRole.findOne({
|
||||||
where: {
|
where: {
|
||||||
name: 'agency'
|
name: 'agency'
|
||||||
}
|
}
|
||||||
|
|
|
@ -139,9 +139,6 @@
|
||||||
"Warehouse": {
|
"Warehouse": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
},
|
},
|
||||||
"VnUser": {
|
|
||||||
"dataSource": "vn"
|
|
||||||
},
|
|
||||||
"OsTicket": {
|
"OsTicket": {
|
||||||
"dataSource": "osticket"
|
"dataSource": "osticket"
|
||||||
},
|
},
|
||||||
|
@ -156,6 +153,12 @@
|
||||||
},
|
},
|
||||||
"ViaexpressConfig": {
|
"ViaexpressConfig": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
|
},
|
||||||
|
"VnUser": {
|
||||||
|
"dataSource": "vn"
|
||||||
|
},
|
||||||
|
"VnRole": {
|
||||||
|
"dataSource": "vn"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,10 +17,6 @@
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"required": true
|
"required": true
|
||||||
},
|
},
|
||||||
"path": {
|
|
||||||
"type": "string",
|
|
||||||
"required": true
|
|
||||||
},
|
|
||||||
"code": {
|
"code": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"required": true
|
"required": true
|
||||||
|
@ -29,12 +25,12 @@
|
||||||
"relations": {
|
"relations": {
|
||||||
"readRole": {
|
"readRole": {
|
||||||
"type": "belongsTo",
|
"type": "belongsTo",
|
||||||
"model": "Role",
|
"model": "VnRole",
|
||||||
"foreignKey": "readRoleFk"
|
"foreignKey": "readRoleFk"
|
||||||
},
|
},
|
||||||
"writeRole": {
|
"writeRole": {
|
||||||
"type": "belongsTo",
|
"type": "belongsTo",
|
||||||
"model": "Role",
|
"model": "VnRole",
|
||||||
"foreignKey": "writeRoleFk"
|
"foreignKey": "writeRoleFk"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -46,12 +46,12 @@
|
||||||
},
|
},
|
||||||
"readRole": {
|
"readRole": {
|
||||||
"type": "belongsTo",
|
"type": "belongsTo",
|
||||||
"model": "Role",
|
"model": "VnRole",
|
||||||
"foreignKey": "readRoleFk"
|
"foreignKey": "readRoleFk"
|
||||||
},
|
},
|
||||||
"writeRole": {
|
"writeRole": {
|
||||||
"type": "belongsTo",
|
"type": "belongsTo",
|
||||||
"model": "Role",
|
"model": "VnRole",
|
||||||
"foreignKey": "writeRoleFk"
|
"foreignKey": "writeRoleFk"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -64,4 +64,3 @@
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
},
|
},
|
||||||
"role": {
|
"role": {
|
||||||
"type": "belongsTo",
|
"type": "belongsTo",
|
||||||
"model": "Role",
|
"model": "VnRole",
|
||||||
"foreignKey": "roleFk"
|
"foreignKey": "roleFk"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,73 @@
|
||||||
|
const models = require('vn-loopback/server/server').models;
|
||||||
|
|
||||||
|
describe('loopback model MailAliasAccount', () => {
|
||||||
|
it('should fail to add a mail Alias if the worker doesnt have ACLs', async() => {
|
||||||
|
const tx = await models.MailAliasAccount.beginTransaction({});
|
||||||
|
let error;
|
||||||
|
|
||||||
|
try {
|
||||||
|
const options = {transaction: tx, accessToken: {userId: 57}};
|
||||||
|
await models.MailAliasAccount.create({mailAlias: 2, account: 5}, options);
|
||||||
|
|
||||||
|
await tx.rollback();
|
||||||
|
} catch (e) {
|
||||||
|
await tx.rollback();
|
||||||
|
error = e;
|
||||||
|
}
|
||||||
|
|
||||||
|
expect(error.message).toEqual('The alias cant be modified');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should add a mail Alias', async() => {
|
||||||
|
const tx = await models.MailAliasAccount.beginTransaction({});
|
||||||
|
let error;
|
||||||
|
|
||||||
|
try {
|
||||||
|
const options = {transaction: tx, accessToken: {userId: 9}};
|
||||||
|
await models.MailAliasAccount.create({mailAlias: 2, account: 5}, options);
|
||||||
|
|
||||||
|
await tx.rollback();
|
||||||
|
} catch (e) {
|
||||||
|
await tx.rollback();
|
||||||
|
error = e;
|
||||||
|
}
|
||||||
|
|
||||||
|
expect(error).toBeUndefined();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should add a mail Alias of an inherit role', async() => {
|
||||||
|
const tx = await models.MailAliasAccount.beginTransaction({});
|
||||||
|
let error;
|
||||||
|
|
||||||
|
try {
|
||||||
|
const options = {transaction: tx, accessToken: {userId: 9}};
|
||||||
|
await models.MailAliasAccount.create({mailAlias: 3, account: 5}, options);
|
||||||
|
|
||||||
|
await tx.rollback();
|
||||||
|
} catch (e) {
|
||||||
|
await tx.rollback();
|
||||||
|
error = e;
|
||||||
|
}
|
||||||
|
|
||||||
|
expect(error).toBeUndefined();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should delete a mail Alias', async() => {
|
||||||
|
const tx = await models.MailAliasAccount.beginTransaction({});
|
||||||
|
let error;
|
||||||
|
|
||||||
|
try {
|
||||||
|
const options = {transaction: tx, accessToken: {userId: 1}};
|
||||||
|
const mailAclId = 2;
|
||||||
|
await models.MailAliasAccount.destroyAll({id: mailAclId}, options);
|
||||||
|
|
||||||
|
await tx.rollback();
|
||||||
|
} catch (e) {
|
||||||
|
await tx.rollback();
|
||||||
|
error = e;
|
||||||
|
}
|
||||||
|
|
||||||
|
expect(error).toBeUndefined();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
{
|
||||||
|
"name": "VnRole",
|
||||||
|
"base": "Role",
|
||||||
|
"validateUpsert": true,
|
||||||
|
"options": {
|
||||||
|
"mysql": {
|
||||||
|
"table": "account.role"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"mixins": {
|
||||||
|
"Loggable": true
|
||||||
|
}
|
||||||
|
}
|
|
@ -258,18 +258,20 @@ module.exports = function(Self) {
|
||||||
|
|
||||||
class Mailer {
|
class Mailer {
|
||||||
async send(verifyOptions, cb) {
|
async send(verifyOptions, cb) {
|
||||||
|
try {
|
||||||
const url = new URL(verifyOptions.verifyHref);
|
const url = new URL(verifyOptions.verifyHref);
|
||||||
if (process.env.NODE_ENV) url.port = '';
|
if (process.env.NODE_ENV) url.port = '';
|
||||||
|
|
||||||
const params = {
|
const email = new Email('email-verify', {
|
||||||
url: url.href,
|
url: url.href,
|
||||||
recipient: verifyOptions.to
|
recipient: verifyOptions.to
|
||||||
};
|
});
|
||||||
|
await email.send();
|
||||||
const email = new Email('email-verify', params);
|
|
||||||
email.send();
|
|
||||||
|
|
||||||
cb(null, verifyOptions.to);
|
cb(null, verifyOptions.to);
|
||||||
|
} catch (err) {
|
||||||
|
cb(err);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,9 @@
|
||||||
"table": "account.user"
|
"table": "account.user"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"mixins": {
|
||||||
|
"Loggable": true
|
||||||
|
},
|
||||||
"resetPasswordTokenTTL": "604800",
|
"resetPasswordTokenTTL": "604800",
|
||||||
"properties": {
|
"properties": {
|
||||||
"id": {
|
"id": {
|
||||||
|
@ -63,7 +66,7 @@
|
||||||
"relations": {
|
"relations": {
|
||||||
"role": {
|
"role": {
|
||||||
"type": "belongsTo",
|
"type": "belongsTo",
|
||||||
"model": "Role",
|
"model": "VnRole",
|
||||||
"foreignKey": "roleFk"
|
"foreignKey": "roleFk"
|
||||||
},
|
},
|
||||||
"roles": {
|
"roles": {
|
||||||
|
@ -95,27 +98,30 @@
|
||||||
"principalType": "ROLE",
|
"principalType": "ROLE",
|
||||||
"principalId": "$everyone",
|
"principalId": "$everyone",
|
||||||
"permission": "ALLOW"
|
"permission": "ALLOW"
|
||||||
},
|
}, {
|
||||||
{
|
|
||||||
"property": "recoverPassword",
|
"property": "recoverPassword",
|
||||||
"accessType": "EXECUTE",
|
"accessType": "EXECUTE",
|
||||||
"principalType": "ROLE",
|
"principalType": "ROLE",
|
||||||
"principalId": "$everyone",
|
"principalId": "$everyone",
|
||||||
"permission": "ALLOW"
|
"permission": "ALLOW"
|
||||||
},
|
}, {
|
||||||
{
|
|
||||||
"property": "validateAuth",
|
"property": "validateAuth",
|
||||||
"accessType": "EXECUTE",
|
"accessType": "EXECUTE",
|
||||||
"principalType": "ROLE",
|
"principalType": "ROLE",
|
||||||
"principalId": "$everyone",
|
"principalId": "$everyone",
|
||||||
"permission": "ALLOW"
|
"permission": "ALLOW"
|
||||||
},
|
}, {
|
||||||
{
|
|
||||||
"property": "privileges",
|
"property": "privileges",
|
||||||
"accessType": "*",
|
"accessType": "*",
|
||||||
"principalType": "ROLE",
|
"principalType": "ROLE",
|
||||||
"principalId": "$authenticated",
|
"principalId": "$authenticated",
|
||||||
"permission": "ALLOW"
|
"permission": "ALLOW"
|
||||||
|
}, {
|
||||||
|
"property": "renewToken",
|
||||||
|
"accessType": "WRITE",
|
||||||
|
"principalType": "ROLE",
|
||||||
|
"principalId": "$authenticated",
|
||||||
|
"permission": "ALLOW"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"scopes": {
|
"scopes": {
|
||||||
|
|
|
@ -59,8 +59,8 @@ async function test() {
|
||||||
const JunitReporter = require('jasmine-reporters');
|
const JunitReporter = require('jasmine-reporters');
|
||||||
jasmine.addReporter(new JunitReporter.JUnitXmlReporter());
|
jasmine.addReporter(new JunitReporter.JUnitXmlReporter());
|
||||||
|
|
||||||
jasmine.jasmine.DEFAULT_TIMEOUT_INTERVAL = 90000;
|
|
||||||
jasmine.exitOnCompletion = true;
|
jasmine.exitOnCompletion = true;
|
||||||
|
jasmine.jasmine.DEFAULT_TIMEOUT_INTERVAL = 900000;
|
||||||
}
|
}
|
||||||
|
|
||||||
const backSpecs = [
|
const backSpecs = [
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
FROM mariadb:10.7.7
|
FROM mariadb:10.11.6
|
||||||
|
|
||||||
ENV MYSQL_ROOT_PASSWORD root
|
ENV MYSQL_ROOT_PASSWORD root
|
||||||
ENV TZ Europe/Madrid
|
ENV TZ Europe/Madrid
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId) VALUES
|
||||||
|
('VnRole','*','READ','ALLOW','ROLE','employee'),
|
||||||
|
('VnRole','*','WRITE','ALLOW','ROLE','it');
|
||||||
|
|
||||||
|
DELETE FROM`salix`.`ACL` WHERE model='Role';
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
DELETE FROM `account`.`signInLog` where owner <> FALSE
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
-- Definición de la tabla mailAliasACL
|
||||||
|
|
||||||
|
CREATE OR REPLACE TABLE `account`.`mailAliasAcl` (
|
||||||
|
`mailAliasFk` int(10) unsigned NOT NULL,
|
||||||
|
`roleFk` int(10) unsigned NOT NULL,
|
||||||
|
FOREIGN KEY (`mailAliasFk`) REFERENCES `account`.`mailAlias` (`id`),
|
||||||
|
FOREIGN KEY (`roleFk`) REFERENCES `account`.`role` (`id`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_general_ci;
|
|
@ -0,0 +1,7 @@
|
||||||
|
ALTER TABLE `vn`.`invoiceCorrection` DROP FOREIGN KEY `cplusInvoiceTyoeFk`;
|
||||||
|
ALTER TABLE `vn`.`invoiceCorrection` DROP FOREIGN KEY `invoiceCorrectionType_Fk33`;
|
||||||
|
ALTER TABLE `vn`.`invoiceCorrection` DROP FOREIGN KEY `invoiceCorrection_ibfk_1`;
|
||||||
|
|
||||||
|
ALTER TABLE `vn`.`invoiceCorrection` ADD CONSTRAINT `siiTypeInvoiceOut_FK` FOREIGN KEY (`siiTypeInvoiceOutFk`) REFERENCES `vn`.`siiTypeInvoiceOut`(id) ON UPDATE CASCADE;
|
||||||
|
ALTER TABLE `vn`.`invoiceCorrection` ADD CONSTRAINT `invoiceCorrectionType_FK` FOREIGN KEY (`invoiceCorrectionTypeFk`) REFERENCES `vn`.`invoiceCorrectionType`(id) ON UPDATE CASCADE;
|
||||||
|
ALTER TABLE `vn`.`invoiceCorrection` ADD CONSTRAINT `cplusRectificationType_FK` FOREIGN KEY (`cplusRectificationTypeFk`) REFERENCES `vn`.`cplusRectificationType`(id) ON UPDATE CASCADE;
|
|
@ -0,0 +1,33 @@
|
||||||
|
DELIMITER $$
|
||||||
|
$$
|
||||||
|
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`getTaxBases`()
|
||||||
|
BEGIN
|
||||||
|
/**
|
||||||
|
* Calcula y devuelve en número de bases imponibles postivas y negativas
|
||||||
|
* Requiere la tabla temporal tmp.ticketToInvoice(id)
|
||||||
|
*
|
||||||
|
* returns tmp.taxBases
|
||||||
|
*/
|
||||||
|
|
||||||
|
CREATE OR REPLACE TEMPORARY TABLE tmp.ticket
|
||||||
|
(KEY (ticketFk))
|
||||||
|
ENGINE = MEMORY
|
||||||
|
SELECT id ticketFk
|
||||||
|
FROM tmp.ticketToInvoice;
|
||||||
|
|
||||||
|
CALL ticket_getTax(NULL);
|
||||||
|
|
||||||
|
DROP TEMPORARY TABLE IF EXISTS tmp.taxBases;
|
||||||
|
CREATE TEMPORARY TABLE tmp.taxBases
|
||||||
|
ENGINE = MEMORY
|
||||||
|
SELECT
|
||||||
|
SUM(taxableBase > 0) as positive,
|
||||||
|
SUM(taxableBase < 0) as negative
|
||||||
|
FROM(
|
||||||
|
SELECT SUM(taxableBase) taxableBase
|
||||||
|
FROM tmp.ticketTax
|
||||||
|
GROUP BY pgcFk
|
||||||
|
) t;
|
||||||
|
|
||||||
|
END$$
|
||||||
|
DELIMITER ;
|
|
@ -0,0 +1,9 @@
|
||||||
|
ALTER TABLE `vn`.`clientSms` ADD `ticketFk` int(11) NULL;
|
||||||
|
ALTER TABLE `vn`.`clientSms` ADD CONSTRAINT `clientSms_FK_2` FOREIGN KEY (`ticketFk`) REFERENCES `vn`.`ticket`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||||
|
|
||||||
|
INSERT INTO`vn`.`clientSms` (`clientFk`, `smsFk`, `ticketFk`)
|
||||||
|
SELECT `t`.`clientFk`, `s`.`smsFk`, `s`.`ticketFk`
|
||||||
|
FROM `vn`.`clientSms` `s`
|
||||||
|
JOIN `vn`.`ticket` `t` ON `t`.`id` = `s`.`ticketFk`;
|
||||||
|
|
||||||
|
RENAME TABLE `vn`.`ticketSms` TO `vn`.`ticketSms__`;
|
|
@ -0,0 +1,17 @@
|
||||||
|
DELETE FROM `salix`.`ACL`
|
||||||
|
WHERE model = 'VnUser'
|
||||||
|
AND property = 'renewToken';
|
||||||
|
|
||||||
|
INSERT INTO `account`.`role` (name, description)
|
||||||
|
VALUES ('timeControl','Tablet para fichar');
|
||||||
|
|
||||||
|
INSERT INTO `account`.`roleInherit` (role, inheritsFrom)
|
||||||
|
VALUES (127, 11);
|
||||||
|
|
||||||
|
INSERT INTO `salix`.`ACL` (model, property, accessType, permission, principalType, principalId)
|
||||||
|
VALUES
|
||||||
|
('WorkerTimeControl', 'login', 'READ', 'ALLOW', 'ROLE', 'timeControl'),
|
||||||
|
('WorkerTimeControl', 'getClockIn', 'READ', 'ALLOW', 'ROLE', 'timeControl'),
|
||||||
|
('WorkerTimeControl', 'clockIn', 'WRITE', 'ALLOW', 'ROLE', 'timeControl');
|
||||||
|
|
||||||
|
CALL `account`.`role_sync`();
|
|
@ -0,0 +1,2 @@
|
||||||
|
DELETE FROM `account`.`signInLog` where owner <> FALSE;
|
||||||
|
|
|
@ -0,0 +1,81 @@
|
||||||
|
DELIMITER $$
|
||||||
|
CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`ticketPositionInPath`(vTicketId INT)
|
||||||
|
RETURNS varchar(10) CHARSET utf8mb3 COLLATE utf8mb3_general_ci
|
||||||
|
DETERMINISTIC
|
||||||
|
BEGIN
|
||||||
|
|
||||||
|
DECLARE vRestTicketsMaxOrder INT;
|
||||||
|
DECLARE vRestTicketsMinOrder INT;
|
||||||
|
DECLARE vRestTicketsPacking INT;
|
||||||
|
DECLARE vMyProductionOrder INT;
|
||||||
|
DECLARE vPosition VARCHAR(10) DEFAULT 'MID';
|
||||||
|
DECLARE vMyPath INT;
|
||||||
|
DECLARE vMyWarehouse INT;
|
||||||
|
DECLARE PACKING_ORDER INT;
|
||||||
|
DECLARE vExpeditionsCount INT;
|
||||||
|
DECLARE vIsValenciaPath BOOLEAN DEFAULT FALSE;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
SELECT `order`
|
||||||
|
INTO PACKING_ORDER
|
||||||
|
FROM state
|
||||||
|
WHERE code = 'PACKING';
|
||||||
|
|
||||||
|
SELECT t.routeFk, t.warehouseFk, IFNULL(ts.productionOrder,0)
|
||||||
|
INTO vMyPath, vMyWarehouse, vMyProductionOrder
|
||||||
|
FROM ticket t
|
||||||
|
LEFT JOIN ticketState ts on ts.ticketFk = t.id
|
||||||
|
WHERE t.id = vTicketId;
|
||||||
|
|
||||||
|
SELECT (ag.`name` = 'VN_VALENCIA')
|
||||||
|
INTO vIsValenciaPath
|
||||||
|
FROM vn2008.Rutas r
|
||||||
|
JOIN vn2008.Agencias a on a.Id_Agencia = r.Id_Agencia
|
||||||
|
JOIN vn2008.agency ag on ag.agency_id = a.agency_id
|
||||||
|
WHERE r.Id_Ruta = vMyPath;
|
||||||
|
|
||||||
|
IF vIsValenciaPath THEN -- Rutas Valencia
|
||||||
|
|
||||||
|
SELECT COUNT(*)
|
||||||
|
INTO vExpeditionsCount
|
||||||
|
FROM expedition e
|
||||||
|
JOIN ticket t ON t.id = e.ticketFk
|
||||||
|
WHERE t.routeFk = vMyPath;
|
||||||
|
|
||||||
|
SELECT MAX(ts.productionOrder), MIN(ts.productionOrder)
|
||||||
|
INTO vRestTicketsMaxOrder, vRestTicketsMinOrder
|
||||||
|
FROM ticket t
|
||||||
|
LEFT JOIN ticketState ts on t.id = ts.ticketFk
|
||||||
|
WHERE t.routeFk = vMyPath
|
||||||
|
AND t.warehouseFk = vMyWarehouse
|
||||||
|
AND t.id != vTicketid;
|
||||||
|
|
||||||
|
SELECT COUNT(*)
|
||||||
|
INTO vRestTicketsPacking
|
||||||
|
FROM ticket t
|
||||||
|
LEFT JOIN ticketState ts on t.id = ts.ticketFk
|
||||||
|
WHERE ts.productionOrder = PACKING_ORDER
|
||||||
|
AND t.routeFk = vMyPath
|
||||||
|
AND t.warehouseFk = vMyWarehouse
|
||||||
|
AND t.id != vTicketid;
|
||||||
|
|
||||||
|
IF vExpeditionsCount = 1 THEN
|
||||||
|
SET vPosition = 'FIRST';
|
||||||
|
ELSEIF vRestTicketsMinOrder > PACKING_ORDER THEN
|
||||||
|
SET vPosition = 'LAST';
|
||||||
|
ELSEIF vRestTicketsPacking THEN
|
||||||
|
SET vPosition = 'SHARED';
|
||||||
|
ELSE
|
||||||
|
SET vPosition = 'MID';
|
||||||
|
END IF;
|
||||||
|
|
||||||
|
ELSE
|
||||||
|
SET vPosition = 'MID';
|
||||||
|
|
||||||
|
END IF;
|
||||||
|
|
||||||
|
RETURN vPosition;
|
||||||
|
|
||||||
|
END$$
|
||||||
|
DELIMITER ;
|
|
@ -0,0 +1,30 @@
|
||||||
|
DELIMITER $$
|
||||||
|
$$
|
||||||
|
CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`hasAnyPositiveBase`() RETURNS tinyint(1)
|
||||||
|
DETERMINISTIC
|
||||||
|
BEGIN
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Calcula si existe alguna base imponible positiva
|
||||||
|
* Requiere la tabla temporal tmp.ticketToInvoice(id) para getTaxBases()
|
||||||
|
*
|
||||||
|
* returns BOOLEAN
|
||||||
|
*/
|
||||||
|
|
||||||
|
DECLARE hasAnyPositiveBase BOOLEAN;
|
||||||
|
|
||||||
|
CALL getTaxBases();
|
||||||
|
|
||||||
|
SELECT positive INTO hasAnyPositiveBase
|
||||||
|
FROM tmp.taxBases
|
||||||
|
LIMIT 1;
|
||||||
|
|
||||||
|
DROP TEMPORARY TABLE
|
||||||
|
tmp.ticketTax,
|
||||||
|
tmp.ticket,
|
||||||
|
tmp.taxBases;
|
||||||
|
|
||||||
|
RETURN hasAnyPositiveBase;
|
||||||
|
|
||||||
|
END$$
|
||||||
|
DELIMITER ;
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,32 @@
|
||||||
|
DELIMITER $$
|
||||||
|
$$
|
||||||
|
CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`hasAnyNegativeBase`() RETURNS tinyint(1)
|
||||||
|
DETERMINISTIC
|
||||||
|
BEGIN
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Calcula si existe alguna base imponible negativa
|
||||||
|
* Requiere la tabla temporal tmp.ticketToInvoice(id) para getTaxBases()
|
||||||
|
*
|
||||||
|
* returns BOOLEAN
|
||||||
|
*/
|
||||||
|
|
||||||
|
DECLARE hasAnyNegativeBase BOOLEAN;
|
||||||
|
|
||||||
|
CALL getTaxBases();
|
||||||
|
|
||||||
|
SELECT negative INTO hasAnyNegativeBase
|
||||||
|
FROM tmp.taxBases
|
||||||
|
LIMIT 1;
|
||||||
|
|
||||||
|
DROP TEMPORARY TABLE
|
||||||
|
tmp.ticketTax,
|
||||||
|
tmp.ticket,
|
||||||
|
tmp.taxBases;
|
||||||
|
|
||||||
|
RETURN hasAnyNegativeBase;
|
||||||
|
|
||||||
|
END$$
|
||||||
|
DELIMITER ;
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,27 @@
|
||||||
|
DELIMITER $$
|
||||||
|
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`expedition_beforeInsert`
|
||||||
|
BEFORE INSERT ON `expedition`
|
||||||
|
FOR EACH ROW
|
||||||
|
BEGIN
|
||||||
|
DECLARE intcounter INT;
|
||||||
|
DECLARE vShipFk INT;
|
||||||
|
|
||||||
|
SET NEW.editorFk = account.myUser_getId();
|
||||||
|
|
||||||
|
IF NEW.freightItemFk IS NOT NULL THEN
|
||||||
|
|
||||||
|
UPDATE ticket SET packages = nz(packages) + 1 WHERE id = NEW.ticketFk;
|
||||||
|
|
||||||
|
SELECT IFNULL(MAX(counter),0) +1 INTO intcounter
|
||||||
|
FROM expedition e
|
||||||
|
INNER JOIN ticket t1 ON e.ticketFk = t1.id
|
||||||
|
LEFT JOIN ticketState ts ON ts.ticketFk = t1.id
|
||||||
|
INNER JOIN ticket t2 ON t2.addressFk = t1.addressFk AND DATE(t2.shipped) = DATE(t1.shipped)
|
||||||
|
AND t1.warehouseFk = t2.warehouseFk
|
||||||
|
WHERE t2.id = NEW.ticketFk AND ts.alertLevel < 3 AND t1.companyFk = t2.companyFk
|
||||||
|
AND t1.agencyModeFk = t2.agencyModeFk;
|
||||||
|
|
||||||
|
SET NEW.`counter` = intcounter;
|
||||||
|
END IF;
|
||||||
|
END$$
|
||||||
|
DELIMITER ;
|
|
@ -0,0 +1,58 @@
|
||||||
|
CREATE OR REPLACE DEFINER=`root`@`localhost`
|
||||||
|
SQL SECURITY DEFINER
|
||||||
|
VIEW `vn`.`expeditionRoute_freeTickets` AS
|
||||||
|
SELECT
|
||||||
|
`t`.`routeFk` AS `routeFk`,
|
||||||
|
`tss`.`ticketFk` AS `ticket`,
|
||||||
|
`s`.`name` AS `code`,
|
||||||
|
`w`.`name` AS `almacen`,
|
||||||
|
`tss`.`updated` AS `updated`,
|
||||||
|
`p`.`code` AS `parkingCode`
|
||||||
|
FROM `vn`.`ticketState` `tss`
|
||||||
|
JOIN `vn`.`ticket` `t` ON `t`.`id` = `tss`.`ticketFk`
|
||||||
|
JOIN `vn`.`warehouse` `w` ON `w`.`id` = `t`.`warehouseFk`
|
||||||
|
JOIN `vn`.`state` `s` ON `s`.`id` = `tss`.`state`
|
||||||
|
LEFT JOIN `vn`.`ticketParking` `tp` ON `tp`.`ticketFk` = `t`.`id`
|
||||||
|
LEFT JOIN `vn`.`parking` `p` ON `p`.`id` = `tp`.`parkingFk`
|
||||||
|
WHERE IFNULL(`t`.`packages`, 0) = 0;
|
||||||
|
|
||||||
|
CREATE OR REPLACE DEFINER=`root`@`localhost`
|
||||||
|
SQL SECURITY DEFINER
|
||||||
|
VIEW `vn`.`ticketState`
|
||||||
|
AS SELECT `tt`.`created` AS `updated`,
|
||||||
|
`tt`.`stateFk` AS `stateFk`,
|
||||||
|
`tt`.`userFk` AS `userFk`,
|
||||||
|
`tls`.`ticketFk` AS `ticketFk`,
|
||||||
|
`s`.`id` AS `state`,
|
||||||
|
`s`.`order` AS `productionOrder`,
|
||||||
|
`s`.`alertLevel` AS `alertLevel`,
|
||||||
|
`s`.`code` AS `code`,
|
||||||
|
`s`.`isPreviousPreparable` AS `isPreviousPreparable`,
|
||||||
|
`s`.`isPicked` AS `isPicked`
|
||||||
|
FROM (
|
||||||
|
(
|
||||||
|
`vn`.`ticketLastState` `tls`
|
||||||
|
JOIN `vn`.`ticketTracking` `tt` ON(`tt`.`id` = `tls`.`ticketTrackingFk`)
|
||||||
|
)
|
||||||
|
JOIN `vn`.`state` `s` ON(`s`.`id` = `tt`.`stateFk`)
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE OR REPLACE DEFINER=`root`@`localhost`
|
||||||
|
SQL SECURITY DEFINER
|
||||||
|
VIEW `vn`.`ticketStateToday`
|
||||||
|
AS
|
||||||
|
SELECT
|
||||||
|
`ts`.`ticketFk` AS `ticket`,
|
||||||
|
`ts`.`state` AS `state`,
|
||||||
|
`ts`.`productionOrder` AS `productionOrder`,
|
||||||
|
`ts`.`alertLevel` AS `alertLevel`,
|
||||||
|
`ts`.`userFk` AS `worker`,
|
||||||
|
`ts`.`code` AS `code`,
|
||||||
|
`ts`.`updated` AS `updated`,
|
||||||
|
`ts`.`isPicked` AS `isPicked`
|
||||||
|
FROM
|
||||||
|
`vn`.`ticketState` `ts`
|
||||||
|
JOIN `vn`.`ticket` `t` ON `t`.`id` = `ts`.`ticketFk`
|
||||||
|
WHERE
|
||||||
|
`t`.`shipped` BETWEEN `util`.`VN_CURDATE`() AND `util`.`VN_CURDATE`() + INTERVAL 1 DAY;
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
DELETE FROM salix.ACL
|
||||||
|
WHERE model = 'WorkerTimeControl'
|
||||||
|
AND property IN ('*','addTime');
|
||||||
|
|
||||||
|
INSERT INTO `salix`.`ACL` (model, property, accessType, permission, principalType, principalId)
|
||||||
|
VALUES
|
||||||
|
('WorkerTimeControl', 'addTimeEntry', 'WRITE', 'ALLOW', 'ROLE', 'employee'),
|
||||||
|
('WorkerTimeControl', 'deleteTimeEntry', 'WRITE', 'ALLOW', 'ROLE', 'employee'),
|
||||||
|
('WorkerTimeControl', 'updateTimeEntry', 'WRITE', 'ALLOW', 'ROLE', 'employee'),
|
||||||
|
('WorkerTimeControl', 'sendMail', 'WRITE', 'ALLOW', 'ROLE', 'employee'),
|
||||||
|
('WorkerTimeControl', 'updateWorkerTimeControlMail', 'WRITE', 'ALLOW', 'ROLE', 'employee'),
|
||||||
|
('WorkerTimeControl', 'weeklyHourRecordEmail', 'WRITE', 'ALLOW', 'ROLE', 'employee'),
|
||||||
|
('WorkerTimeControl', 'getMailStates', 'READ', 'ALLOW', 'ROLE', 'employee'),
|
||||||
|
('WorkerTimeControl', 'resendWeeklyHourEmail', 'WRITE', 'ALLOW', 'ROLE', 'employee');
|
|
@ -0,0 +1,58 @@
|
||||||
|
DELIMITER $$
|
||||||
|
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`invoiceOut_beforeInsert`
|
||||||
|
BEFORE INSERT ON `invoiceOut`
|
||||||
|
FOR EACH ROW
|
||||||
|
BEGIN
|
||||||
|
/**
|
||||||
|
* Reference format:
|
||||||
|
* - 0: Serial [A-Z]
|
||||||
|
* - 1: Sage company id
|
||||||
|
* - 2-3: Last two digits of issued year
|
||||||
|
* - 4-8: Autoincrement identifier
|
||||||
|
**/
|
||||||
|
DECLARE vNewRef INT DEFAULT 0;
|
||||||
|
DECLARE vCompanyCode INT;
|
||||||
|
DECLARE vLastRef VARCHAR(255);
|
||||||
|
DECLARE vRefStr VARCHAR(255);
|
||||||
|
DECLARE vRefLen INT DEFAULT 5;
|
||||||
|
DECLARE vYearLen INT DEFAULT 2;
|
||||||
|
DECLARE vPrefixLen INT;
|
||||||
|
|
||||||
|
SELECT companyCode INTO vCompanyCode
|
||||||
|
FROM company
|
||||||
|
WHERE id = NEW.companyFk;
|
||||||
|
|
||||||
|
IF vCompanyCode IS NULL THEN
|
||||||
|
CALL util.throw('sageCompanyNotDefined');
|
||||||
|
END IF;
|
||||||
|
|
||||||
|
SELECT MAX(i.ref) INTO vLastRef
|
||||||
|
FROM invoiceOut i
|
||||||
|
WHERE i.serial = NEW.serial
|
||||||
|
AND i.issued BETWEEN util.firstDayOfYear(NEW.issued) AND util.dayEnd(util.lastDayOfYear(NEW.issued))
|
||||||
|
AND i.companyFk = NEW.companyFk;
|
||||||
|
|
||||||
|
IF vLastRef IS NOT NULL THEN
|
||||||
|
SET vPrefixLen = LENGTH(NEW.serial) + LENGTH(vCompanyCode) + vYearLen;
|
||||||
|
SET vRefLen = LENGTH(vLastRef) - vPrefixLen;
|
||||||
|
SET vRefStr = SUBSTRING(vLastRef, vPrefixLen + 1);
|
||||||
|
SET vNewRef = vRefStr + 1;
|
||||||
|
|
||||||
|
IF LENGTH(vNewRef) > vRefLen THEN
|
||||||
|
CALL util.throw('refLenExceeded');
|
||||||
|
END IF;
|
||||||
|
|
||||||
|
SET NEW.ref = CONCAT(
|
||||||
|
SUBSTRING(vLastRef, 1, vPrefixLen),
|
||||||
|
LPAD(vNewRef, LENGTH(vRefStr), '0')
|
||||||
|
);
|
||||||
|
ELSE
|
||||||
|
SET NEW.ref = CONCAT(
|
||||||
|
NEW.serial,
|
||||||
|
vCompanyCode,
|
||||||
|
RIGHT(YEAR(NEW.issued), vYearLen),
|
||||||
|
LPAD(1, vRefLen, '0')
|
||||||
|
);
|
||||||
|
END IF;
|
||||||
|
END$$
|
||||||
|
DELIMITER ;
|
|
@ -0,0 +1 @@
|
||||||
|
ALTER TABLE `vn`.`item` DROP COLUMN stars;
|
|
@ -0,0 +1,74 @@
|
||||||
|
DELIMITER $$
|
||||||
|
$$
|
||||||
|
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_canbePostponed`(vOriginDated DATE, vFutureDated DATE, vWarehouseFk INT)
|
||||||
|
BEGIN
|
||||||
|
/**
|
||||||
|
* Devuelve un listado de tickets susceptibles de fusionarse con otros tickets en el futuro
|
||||||
|
*
|
||||||
|
* @param vOriginDated Fecha en cuestión
|
||||||
|
* @param vFutureDated Fecha en el futuro a sondear
|
||||||
|
* @param vWarehouseFk Identificador de vn.warehouse
|
||||||
|
*/
|
||||||
|
CREATE OR REPLACE TEMPORARY TABLE tmp.filter
|
||||||
|
(INDEX (id))
|
||||||
|
SELECT sv.ticketFk id,
|
||||||
|
sub2.id futureId,
|
||||||
|
GROUP_CONCAT(DISTINCT i.itemPackingTypeFk ORDER BY i.itemPackingTypeFk) ipt,
|
||||||
|
CAST(sum(litros) AS DECIMAL(10,0)) liters,
|
||||||
|
CAST(count(*) AS DECIMAL(10,0)) `lines`,
|
||||||
|
st.name state,
|
||||||
|
sub2.iptd futureIpt,
|
||||||
|
sub2.state futureState,
|
||||||
|
t.clientFk,
|
||||||
|
t.warehouseFk,
|
||||||
|
ts.alertLevel,
|
||||||
|
t.shipped,
|
||||||
|
t.totalWithVat,
|
||||||
|
sub2.shipped futureShipped,
|
||||||
|
t.workerFk,
|
||||||
|
st.code stateCode,
|
||||||
|
sub2.code futureStateCode,
|
||||||
|
st.classColor,
|
||||||
|
sub2.classColor futureClassColor
|
||||||
|
FROM vn.saleVolume sv
|
||||||
|
JOIN vn.sale s ON s.id = sv.saleFk
|
||||||
|
JOIN vn.item i ON i.id = s.itemFk
|
||||||
|
JOIN vn.ticket t ON t.id = sv.ticketFk
|
||||||
|
JOIN vn.address a ON a.id = t.addressFk
|
||||||
|
JOIN vn.province p ON p.id = a.provinceFk
|
||||||
|
JOIN vn.country c ON c.id = p.countryFk
|
||||||
|
JOIN vn.ticketState ts ON ts.ticketFk = t.id
|
||||||
|
JOIN vn.state st ON st.id = ts.stateFk
|
||||||
|
JOIN vn.alertLevel al ON al.id = ts.alertLevel
|
||||||
|
LEFT JOIN vn.ticketParking tp ON tp.ticketFk = t.id
|
||||||
|
LEFT JOIN (
|
||||||
|
SELECT *
|
||||||
|
FROM (
|
||||||
|
SELECT
|
||||||
|
t.addressFk,
|
||||||
|
t.id,
|
||||||
|
t.shipped,
|
||||||
|
st.name state,
|
||||||
|
st.code,
|
||||||
|
st.classColor,
|
||||||
|
GROUP_CONCAT(DISTINCT i.itemPackingTypeFk ORDER BY i.itemPackingTypeFk) iptd
|
||||||
|
FROM vn.ticket t
|
||||||
|
JOIN vn.ticketState ts ON ts.ticketFk = t.id
|
||||||
|
JOIN vn.state st ON st.id = ts.stateFk
|
||||||
|
JOIN vn.sale s ON s.ticketFk = t.id
|
||||||
|
JOIN vn.item i ON i.id = s.itemFk
|
||||||
|
WHERE t.shipped BETWEEN vFutureDated
|
||||||
|
AND util.dayend(vFutureDated)
|
||||||
|
AND t.warehouseFk = vWarehouseFk
|
||||||
|
GROUP BY t.id
|
||||||
|
) sub
|
||||||
|
GROUP BY sub.addressFk
|
||||||
|
) sub2 ON sub2.addressFk = t.addressFk AND t.id != sub2.id
|
||||||
|
WHERE t.shipped BETWEEN vOriginDated AND util.dayend(vOriginDated)
|
||||||
|
AND t.warehouseFk = vWarehouseFk
|
||||||
|
AND al.code = 'FREE'
|
||||||
|
AND tp.ticketFk IS NULL
|
||||||
|
GROUP BY sv.ticketFk
|
||||||
|
HAVING futureId;
|
||||||
|
END$$
|
||||||
|
DELIMITER ;
|
|
@ -606,6 +606,7 @@ INSERT INTO `vn`.`invoiceOutSerial` (`code`, `description`, `isTaxed`, `taxAreaF
|
||||||
('T', 'Española rapida', 1, 'NATIONAL', 0, 'quick'),
|
('T', 'Española rapida', 1, 'NATIONAL', 0, 'quick'),
|
||||||
('V', 'Intracomunitaria global', 0, 'CEE', 1, 'global'),
|
('V', 'Intracomunitaria global', 0, 'CEE', 1, 'global'),
|
||||||
('M', 'Múltiple nacional', 1, 'NATIONAL', 0, 'quick'),
|
('M', 'Múltiple nacional', 1, 'NATIONAL', 0, 'quick'),
|
||||||
|
('R', 'Rectificativa', 1, 'NATIONAL', 0, NULL),
|
||||||
('E', 'Exportación rápida', 0, 'WORLD', 0, 'quick');
|
('E', 'Exportación rápida', 0, 'WORLD', 0, 'quick');
|
||||||
|
|
||||||
INSERT INTO `vn`.`invoiceOut`(`id`, `serial`, `amount`, `issued`,`clientFk`, `created`, `companyFk`, `dued`, `booked`, `bankFk`, `hasPdf`)
|
INSERT INTO `vn`.`invoiceOut`(`id`, `serial`, `amount`, `issued`,`clientFk`, `created`, `companyFk`, `dued`, `booked`, `bankFk`, `hasPdf`)
|
||||||
|
@ -613,7 +614,7 @@ INSERT INTO `vn`.`invoiceOut`(`id`, `serial`, `amount`, `issued`,`clientFk`, `cr
|
||||||
(1, 'T', 1026.24, util.VN_CURDATE(), 1101, util.VN_CURDATE(), 442, util.VN_CURDATE(), util.VN_CURDATE(), 1, 0),
|
(1, 'T', 1026.24, util.VN_CURDATE(), 1101, util.VN_CURDATE(), 442, util.VN_CURDATE(), util.VN_CURDATE(), 1, 0),
|
||||||
(2, 'T', 121.36, util.VN_CURDATE(), 1102, util.VN_CURDATE(), 442, util.VN_CURDATE(), util.VN_CURDATE(), 1, 0),
|
(2, 'T', 121.36, util.VN_CURDATE(), 1102, util.VN_CURDATE(), 442, util.VN_CURDATE(), util.VN_CURDATE(), 1, 0),
|
||||||
(3, 'T', 8.88, util.VN_CURDATE(), 1103, util.VN_CURDATE(), 442, util.VN_CURDATE(), util.VN_CURDATE(), 1, 0),
|
(3, 'T', 8.88, util.VN_CURDATE(), 1103, util.VN_CURDATE(), 442, util.VN_CURDATE(), util.VN_CURDATE(), 1, 0),
|
||||||
(4, 'T', 8.88, util.VN_CURDATE(), 1103, util.VN_CURDATE(), 442, util.VN_CURDATE(), util.VN_CURDATE(), 1, 0),
|
(4, 'T', 8.88, util.VN_CURDATE(), 1104, util.VN_CURDATE(), 442, util.VN_CURDATE(), util.VN_CURDATE(), 1, 0),
|
||||||
(5, 'A', 8.88, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1103, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 442, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 0);
|
(5, 'A', 8.88, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1103, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 442, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 0);
|
||||||
|
|
||||||
UPDATE `vn`.`invoiceOut` SET ref = 'T1111111' WHERE id = 1;
|
UPDATE `vn`.`invoiceOut` SET ref = 'T1111111' WHERE id = 1;
|
||||||
|
@ -719,7 +720,7 @@ INSERT INTO `vn`.`route`(`id`, `time`, `workerFk`, `created`, `vehicleFk`, `agen
|
||||||
INSERT INTO `vn`.`ticket`(`id`, `priority`, `agencyModeFk`,`warehouseFk`,`routeFk`, `shipped`, `landed`, `clientFk`,`nickname`, `addressFk`, `refFk`, `isDeleted`, `zoneFk`, `zonePrice`, `zoneBonus`, `created`, `weight`)
|
INSERT INTO `vn`.`ticket`(`id`, `priority`, `agencyModeFk`,`warehouseFk`,`routeFk`, `shipped`, `landed`, `clientFk`,`nickname`, `addressFk`, `refFk`, `isDeleted`, `zoneFk`, `zonePrice`, `zoneBonus`, `created`, `weight`)
|
||||||
VALUES
|
VALUES
|
||||||
(1 , 3, 1, 1, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL -1 MONTH), INTERVAL +1 DAY), 1101, 'Bat cave', 121, NULL, 0, 1, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1),
|
(1 , 3, 1, 1, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL -1 MONTH), INTERVAL +1 DAY), 1101, 'Bat cave', 121, NULL, 0, 1, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1),
|
||||||
(2 , 1, 1, 1, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL -1 MONTH), INTERVAL +1 DAY), 1104, 'Stark tower', 124, NULL, 0, 1, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 2),
|
(2 , 1, 1, 1, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL -1 MONTH), INTERVAL +1 DAY), 1101, 'Bat cave', 1, NULL, 0, 1, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 2),
|
||||||
(3 , 1, 7, 1, 6, DATE_ADD(util.VN_CURDATE(), INTERVAL -2 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL -2 MONTH), INTERVAL +1 DAY), 1104, 'Stark tower', 124, NULL, 0, 3, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -2 MONTH), NULL),
|
(3 , 1, 7, 1, 6, DATE_ADD(util.VN_CURDATE(), INTERVAL -2 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL -2 MONTH), INTERVAL +1 DAY), 1104, 'Stark tower', 124, NULL, 0, 3, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -2 MONTH), NULL),
|
||||||
(4 , 3, 2, 1, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -3 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL -3 MONTH), INTERVAL +1 DAY), 1104, 'Stark tower', 124, NULL, 0, 9, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -3 MONTH), NULL),
|
(4 , 3, 2, 1, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -3 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL -3 MONTH), INTERVAL +1 DAY), 1104, 'Stark tower', 124, NULL, 0, 9, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -3 MONTH), NULL),
|
||||||
(5 , 3, 3, 3, 3, DATE_ADD(util.VN_CURDATE(), INTERVAL -4 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL -4 MONTH), INTERVAL +1 DAY), 1104, 'Stark tower', 124, NULL, 0, 10, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -4 MONTH), NULL),
|
(5 , 3, 3, 3, 3, DATE_ADD(util.VN_CURDATE(), INTERVAL -4 MONTH), DATE_ADD(DATE_ADD(util.VN_CURDATE(),INTERVAL -4 MONTH), INTERVAL +1 DAY), 1104, 'Stark tower', 124, NULL, 0, 10, 5, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -4 MONTH), NULL),
|
||||||
|
@ -928,25 +929,25 @@ INSERT INTO `vn`.`itemFamily`(`code`, `description`)
|
||||||
('VT', 'Sales');
|
('VT', 'Sales');
|
||||||
|
|
||||||
INSERT INTO `vn`.`item`(`id`, `typeFk`, `stems`, `originFk`, `description`, `producerFk`, `intrastatFk`, `expenseFk`,
|
INSERT INTO `vn`.`item`(`id`, `typeFk`, `stems`, `originFk`, `description`, `producerFk`, `intrastatFk`, `expenseFk`,
|
||||||
`comment`, `relevancy`, `image`, `subName`, `minPrice`, `stars`, `family`, `isFloramondo`, `genericFk`, `itemPackingTypeFk`, `hasMinPrice`, `packingShelve`, `weightByPiece`)
|
`comment`, `relevancy`, `image`, `subName`, `minPrice`, `family`, `isFloramondo`, `genericFk`, `itemPackingTypeFk`, `hasMinPrice`, `packingShelve`, `weightByPiece`)
|
||||||
VALUES
|
VALUES
|
||||||
(1, 2, 1, 1, NULL, 1, 06021010, 2000000000, NULL, 0, '1', NULL, 0, 1, 'EMB', 0, NULL, 'V', 0, 15,3),
|
(1, 2, 1, 1, NULL, 1, 06021010, 2000000000, NULL, 0, '1', NULL, 0, 'EMB', 0, NULL, 'V', 0, 15,3),
|
||||||
(2, 2, 1, 2, NULL, 1, 06021010, 2000000000, NULL, 0, '2', NULL, 0, 2, 'VT', 0, NULL, 'H', 0, 10,2),
|
(2, 2, 1, 2, NULL, 1, 06021010, 2000000000, NULL, 0, '2', NULL, 0, 'VT', 0, NULL, 'H', 0, 10,2),
|
||||||
(3, 1, 1, 3, NULL, 1, 05080000, 4751000000, NULL, 0, '3', NULL, 0, 5, 'VT', 0, NULL, NULL, 0, 5,5),
|
(3, 1, 1, 3, NULL, 1, 05080000, 4751000000, NULL, 0, '3', NULL, 0, 'VT', 0, NULL, NULL, 0, 5,5),
|
||||||
(4, 1, 1, 1, 'Increases block', 1, 05080000, 4751000000, NULL, 0, '4', NULL, 0, 3, 'VT', 0, NULL, NULL, 0, NULL,NULL),
|
(4, 1, 1, 1, 'Increases block', 1, 05080000, 4751000000, NULL, 0, '4', NULL, 0, 'VT', 0, NULL, NULL, 0, NULL,NULL),
|
||||||
(5, 3, 1, 2, NULL, 2, 06021010, 4751000000, NULL, 0, '5', NULL, 0, 3, 'VT', 0, NULL, NULL, 0, NULL,NULL),
|
(5, 3, 1, 2, NULL, 2, 06021010, 4751000000, NULL, 0, '5', NULL, 0, 'VT', 0, NULL, NULL, 0, NULL,NULL),
|
||||||
(6, 5, 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '6', NULL, 0, 4, 'VT', 0, NULL, NULL, 0, NULL,NULL),
|
(6, 5, 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '6', NULL, 0, 'VT', 0, NULL, NULL, 0, NULL,NULL),
|
||||||
(7, 5, 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '7', NULL, 0, 4, 'VT', 0, NULL, NULL, 0, NULL,NULL),
|
(7, 5, 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '7', NULL, 0, 'VT', 0, NULL, NULL, 0, NULL,NULL),
|
||||||
(8, 2, 1, 1, NULL, 1, 06021010, 2000000000, NULL, 0, '8', NULL, 0, 5, 'VT', 0, NULL, NULL, 0, NULL,NULL),
|
(8, 2, 1, 1, NULL, 1, 06021010, 2000000000, NULL, 0, '8', NULL, 0, 'VT', 0, NULL, NULL, 0, NULL,NULL),
|
||||||
(9, 2, 1, 2, NULL, 1, 06021010, 2000000000, NULL, 0, '9', NULL, 0, 4, 'VT', 1, NULL, NULL, 0, NULL,NULL),
|
(9, 2, 1, 2, NULL, 1, 06021010, 2000000000, NULL, 0, '9', NULL, 0, 'VT', 1, NULL, NULL, 0, NULL,NULL),
|
||||||
(10, 1, 1, 3, NULL, 1, 05080000, 4751000000, NULL, 0, '10', NULL, 0, 4, 'VT', 0, NULL, NULL, 0, NULL,NULL),
|
(10, 1, 1, 3, NULL, 1, 05080000, 4751000000, NULL, 0, '10', NULL, 0, 'VT', 0, NULL, NULL, 0, NULL,NULL),
|
||||||
(11, 1, 1, 1, NULL, 1, 05080000, 4751000000, NULL, 0, '11', NULL, 0, 4, 'VT', 0, NULL, NULL, 0, NULL,NULL),
|
(11, 1, 1, 1, NULL, 1, 05080000, 4751000000, NULL, 0, '11', NULL, 0, 'VT', 0, NULL, NULL, 0, NULL,NULL),
|
||||||
(12, 3, 1, 2, NULL, 2, 06021010, 4751000000, NULL, 0, '12', NULL, 0, 3, 'VT', 0, NULL, NULL, 0, NULL,NULL),
|
(12, 3, 1, 2, NULL, 2, 06021010, 4751000000, NULL, 0, '12', NULL, 0, 'VT', 0, NULL, NULL, 0, NULL,NULL),
|
||||||
(13, 5, 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '13', NULL, 1, 2, 'VT', 1, NULL, NULL, 1, NULL,NULL),
|
(13, 5, 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '13', NULL, 1, 'VT', 1, NULL, NULL, 1, NULL,NULL),
|
||||||
(14, 5, 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 4, 'VT', 1, NULL, NULL, 0, NULL,NULL),
|
(14, 5, 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 'VT', 1, NULL, NULL, 0, NULL,NULL),
|
||||||
(15, 4, NULL, 1, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 0, 'EMB', 0, NULL, NULL, 0, NULL,NULL),
|
(15, 4, NULL, 1, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 'EMB', 0, NULL, NULL, 0, NULL,NULL),
|
||||||
(16, 6, NULL, 1, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 0, 'EMB', 0, NULL, NULL, 0, NULL,NULL),
|
(16, 6, NULL, 1, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 'EMB', 0, NULL, NULL, 0, NULL,NULL),
|
||||||
(71, 6, NULL, 1, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 0, 'VT', 0, NULL, NULL, 0, NULL,NULL);
|
(71, 6, NULL, 1, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 'VT', 0, NULL, NULL, 0, NULL,NULL);
|
||||||
|
|
||||||
-- Update the taxClass after insert of the items
|
-- Update the taxClass after insert of the items
|
||||||
UPDATE `vn`.`itemTaxCountry` SET `taxClassFk` = 2
|
UPDATE `vn`.`itemTaxCountry` SET `taxClassFk` = 2
|
||||||
|
@ -2910,8 +2911,7 @@ INSERT INTO `vn`.`workerConfig` (`id`, `businessUpdated`, `roleFk`, `payMethodFk
|
||||||
|
|
||||||
INSERT INTO `vn`.`ticketRefund`(`refundTicketFk`, `originalTicketFk`)
|
INSERT INTO `vn`.`ticketRefund`(`refundTicketFk`, `originalTicketFk`)
|
||||||
VALUES
|
VALUES
|
||||||
(1, 12),
|
(24, 7);
|
||||||
(8, 10);
|
|
||||||
|
|
||||||
INSERT INTO `vn`.`deviceProductionModels` (`code`)
|
INSERT INTO `vn`.`deviceProductionModels` (`code`)
|
||||||
VALUES
|
VALUES
|
||||||
|
@ -3010,7 +3010,36 @@ INSERT INTO `vn`.`invoiceCorrectionType` (`id`, `description`)
|
||||||
(2, 'Error in sales details'),
|
(2, 'Error in sales details'),
|
||||||
(3, 'Error in customer data');
|
(3, 'Error in customer data');
|
||||||
|
|
||||||
|
UPDATE `vn`.`client`
|
||||||
|
SET fi='65004204V'
|
||||||
|
WHERE id=1;
|
||||||
|
|
||||||
|
UPDATE `vn`.`worker`
|
||||||
|
SET fi='59328808D'
|
||||||
|
WHERE id=1106;
|
||||||
|
|
||||||
|
|
||||||
|
INSERT INTO `account`.`mailAliasAcl` (`mailAliasFk`, `roleFk`)
|
||||||
|
VALUES
|
||||||
|
(1, 1),
|
||||||
|
(2, 9),
|
||||||
|
(3, 15);
|
||||||
|
|
||||||
INSERT INTO `vn`.`docuwareTablet` (`tablet`,`description`)
|
INSERT INTO `vn`.`docuwareTablet` (`tablet`,`description`)
|
||||||
VALUES
|
VALUES
|
||||||
('Tablet1','Jarvis tablet'),
|
('Tablet1','Jarvis tablet'),
|
||||||
('Tablet2','Avengers tablet');
|
('Tablet2','Avengers tablet');
|
||||||
|
|
||||||
|
INSERT INTO `vn`.`sms` (`id`, `senderFk`, `sender`, `destination`, `message`, `statusCode`, `status`, `created`)
|
||||||
|
VALUES (1, 66, '111111111', '0001111111111', 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.', 0, 'OK', util.VN_CURDATE()),
|
||||||
|
(2, 66, '222222222', '0002222222222', 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.', 0, 'PENDING', util.VN_CURDATE()),
|
||||||
|
(3, 66, '333333333', '0003333333333', 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.', 0, 'ERROR', util.VN_CURDATE()),
|
||||||
|
(4, 66, '444444444', '0004444444444', 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.', 0, 'OK', util.VN_CURDATE());
|
||||||
|
|
||||||
|
INSERT INTO `vn`.`clientSms` (`id`, `clientFk`, `smsFk`, `ticketFk`)
|
||||||
|
VALUES(1, 1103, 1, NULL),
|
||||||
|
(2, 1103, 2, NULL),
|
||||||
|
(3, 1103, 3, 32),
|
||||||
|
(4, 1103, 4, 32),
|
||||||
|
(13, 1101, 1, NULL),
|
||||||
|
(14, 1101, 4, 27);
|
||||||
|
|
|
@ -1,123 +0,0 @@
|
||||||
const app = require('vn-loopback/server/server');
|
|
||||||
const ParameterizedSQL = require('loopback-connector').ParameterizedSQL;
|
|
||||||
|
|
||||||
// 2277 solucionar problema al testear procedimiento con start transaction / rollback
|
|
||||||
xdescribe('ticket_componentMakeUpdate()', () => {
|
|
||||||
it('should recalculate the ticket components without make modifications', async() => {
|
|
||||||
let stmts = [];
|
|
||||||
let stmt;
|
|
||||||
|
|
||||||
let params = {
|
|
||||||
ticketId: 11,
|
|
||||||
clientId: 1102,
|
|
||||||
agencyModeId: 2,
|
|
||||||
addressId: 122,
|
|
||||||
zoneId: 3,
|
|
||||||
warehouseId: 1,
|
|
||||||
companyId: 442,
|
|
||||||
isDeleted: 0,
|
|
||||||
hasToBeUnrouted: 0,
|
|
||||||
componentOption: 1
|
|
||||||
};
|
|
||||||
|
|
||||||
stmts.push('START TRANSACTION');
|
|
||||||
|
|
||||||
stmt = new ParameterizedSQL('SELECT * FROM vn.ticket WHERE id = ?', [
|
|
||||||
params.ticketId
|
|
||||||
]);
|
|
||||||
stmts.push(stmt);
|
|
||||||
|
|
||||||
let originalTicketIndex = stmts.push(stmt) - 1;
|
|
||||||
|
|
||||||
stmt = new ParameterizedSQL('CALL vn.ticket_componentMakeUpdate(?, ?, ?, ?, ?, ?, ?, DATE_ADD(CURDATE(), INTERVAL +1 DAY), DATE_ADD(CURDATE(), INTERVAL +1 DAY), ?, ?, ?)', [
|
|
||||||
params.ticketId,
|
|
||||||
params.clientId,
|
|
||||||
params.agencyModeId,
|
|
||||||
params.addressId,
|
|
||||||
params.zoneId,
|
|
||||||
params.warehouseId,
|
|
||||||
params.companyId,
|
|
||||||
params.isDeleted,
|
|
||||||
params.hasToBeUnrouted,
|
|
||||||
params.componentOption
|
|
||||||
]);
|
|
||||||
stmts.push(stmt);
|
|
||||||
|
|
||||||
stmt = new ParameterizedSQL('SELECT * FROM vn.ticket WHERE id = ?', [
|
|
||||||
params.ticketId
|
|
||||||
]);
|
|
||||||
stmts.push(stmt);
|
|
||||||
|
|
||||||
let updatedTicketIndex = stmts.push(stmt) - 1;
|
|
||||||
|
|
||||||
stmts.push('ROLLBACK');
|
|
||||||
|
|
||||||
let sql = ParameterizedSQL.join(stmts, ';');
|
|
||||||
let result = await app.models.Ticket.rawStmt(sql);
|
|
||||||
|
|
||||||
let originalTicketData = result[originalTicketIndex];
|
|
||||||
let updatedTicketData = result[updatedTicketIndex];
|
|
||||||
|
|
||||||
expect(originalTicketData[0].isDeleted).toEqual(updatedTicketData[0].isDeleted);
|
|
||||||
expect(originalTicketData[0].routeFk).toEqual(updatedTicketData[0].routeFk);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should delete and unroute a ticket and recalculate the components', async() => {
|
|
||||||
let stmts = [];
|
|
||||||
let stmt;
|
|
||||||
|
|
||||||
let params = {
|
|
||||||
ticketId: 11,
|
|
||||||
clientId: 1102,
|
|
||||||
agencyModeId: 2,
|
|
||||||
addressId: 122,
|
|
||||||
zoneId: 3,
|
|
||||||
warehouseId: 1,
|
|
||||||
companyId: 442,
|
|
||||||
isDeleted: 1,
|
|
||||||
hasToBeUnrouted: 1,
|
|
||||||
componentOption: 1
|
|
||||||
};
|
|
||||||
|
|
||||||
stmts.push('START TRANSACTION');
|
|
||||||
|
|
||||||
stmt = new ParameterizedSQL('SELECT * FROM vn.ticket WHERE id = ?', [
|
|
||||||
params.ticketId
|
|
||||||
]);
|
|
||||||
stmts.push(stmt);
|
|
||||||
|
|
||||||
let originalTicketIndex = stmts.push(stmt) - 1;
|
|
||||||
|
|
||||||
stmt = new ParameterizedSQL('CALL vn.ticket_componentMakeUpdate(?, ?, ?, ?, ?, ?, ?, DATE_ADD(CURDATE(), INTERVAL +1 DAY), DATE_ADD(CURDATE(), INTERVAL +1 DAY), ?, ?, ?)', [
|
|
||||||
params.ticketId,
|
|
||||||
params.clientId,
|
|
||||||
params.agencyModeId,
|
|
||||||
params.addressId,
|
|
||||||
params.zoneId,
|
|
||||||
params.warehouseId,
|
|
||||||
params.companyId,
|
|
||||||
params.isDeleted,
|
|
||||||
params.hasToBeUnrouted,
|
|
||||||
params.componentOption
|
|
||||||
]);
|
|
||||||
stmts.push(stmt);
|
|
||||||
|
|
||||||
stmt = new ParameterizedSQL('SELECT * FROM vn.ticket WHERE id = ?', [
|
|
||||||
params.ticketId
|
|
||||||
]);
|
|
||||||
stmts.push(stmt);
|
|
||||||
|
|
||||||
let updatedTicketIndex = stmts.push(stmt) - 1;
|
|
||||||
|
|
||||||
stmts.push('ROLLBACK');
|
|
||||||
|
|
||||||
let sql = ParameterizedSQL.join(stmts, ';');
|
|
||||||
let result = await app.models.Ticket.rawStmt(sql);
|
|
||||||
|
|
||||||
let originalTicketData = result[originalTicketIndex];
|
|
||||||
let updatedTicketData = result[updatedTicketIndex];
|
|
||||||
|
|
||||||
expect(originalTicketData[0].isDeleted).not.toEqual(updatedTicketData[0].isDeleted);
|
|
||||||
expect(originalTicketData[0].routeFk).not.toEqual(updatedTicketData[0].routeFk);
|
|
||||||
});
|
|
||||||
});
|
|
|
@ -735,7 +735,7 @@ export default {
|
||||||
},
|
},
|
||||||
createStateView: {
|
createStateView: {
|
||||||
state: 'vn-autocomplete[ng-model="$ctrl.stateFk"]',
|
state: 'vn-autocomplete[ng-model="$ctrl.stateFk"]',
|
||||||
worker: 'vn-worker-autocomplete[ng-model="$ctrl.workerFk"]',
|
worker: 'vn-worker-autocomplete[ng-model="$ctrl.userFk"]',
|
||||||
saveStateButton: `button[type=submit]`
|
saveStateButton: `button[type=submit]`
|
||||||
},
|
},
|
||||||
claimsIndex: {
|
claimsIndex: {
|
||||||
|
|
|
@ -56,63 +56,6 @@ describe('Worker time control path', () => {
|
||||||
expect(result).toContain(month);
|
expect(result).toContain(month);
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should return error when insert 'out' of first entry`, async() => {
|
|
||||||
pending('https://redmine.verdnatura.es/issues/4707');
|
|
||||||
await page.waitToClick(selectors.workerTimeControl.mondayAddTimeButton);
|
|
||||||
await page.pickTime(selectors.workerTimeControl.dialogTimeInput, eightAm);
|
|
||||||
await page.autocompleteSearch(selectors.workerTimeControl.dialogTimeDirection, 'out');
|
|
||||||
await page.respondToDialog('accept');
|
|
||||||
const message = await page.waitForSnackbar();
|
|
||||||
|
|
||||||
expect(message.text).toBeDefined();
|
|
||||||
});
|
|
||||||
|
|
||||||
it(`should insert 'in' monday`, async() => {
|
|
||||||
pending('https://redmine.verdnatura.es/issues/4707');
|
|
||||||
await page.waitToClick(selectors.workerTimeControl.mondayAddTimeButton);
|
|
||||||
await page.pickTime(selectors.workerTimeControl.dialogTimeInput, eightAm);
|
|
||||||
await page.autocompleteSearch(selectors.workerTimeControl.dialogTimeDirection, 'in');
|
|
||||||
await page.respondToDialog('accept');
|
|
||||||
const result = await page.waitToGetProperty(selectors.workerTimeControl.firstEntryOfMonday, 'innerText');
|
|
||||||
|
|
||||||
expect(result).toEqual(eightAm);
|
|
||||||
});
|
|
||||||
|
|
||||||
it(`should insert 'out' monday`, async() => {
|
|
||||||
pending('https://redmine.verdnatura.es/issues/4707');
|
|
||||||
await page.waitToClick(selectors.workerTimeControl.mondayAddTimeButton);
|
|
||||||
await page.pickTime(selectors.workerTimeControl.dialogTimeInput, fourPm);
|
|
||||||
await page.autocompleteSearch(selectors.workerTimeControl.dialogTimeDirection, 'out');
|
|
||||||
await page.respondToDialog('accept');
|
|
||||||
const result = await page.waitToGetProperty(selectors.workerTimeControl.secondEntryOfMonday, 'innerText');
|
|
||||||
|
|
||||||
expect(result).toEqual(fourPm);
|
|
||||||
});
|
|
||||||
|
|
||||||
it(`should check Hank Pym worked 8:20 hours`, async() => {
|
|
||||||
pending('https://redmine.verdnatura.es/issues/4707');
|
|
||||||
await page.waitForTextInElement(selectors.workerTimeControl.mondayWorkedHours, '08:20 h.');
|
|
||||||
await page.waitForTextInElement(selectors.workerTimeControl.weekWorkedHours, '08:20 h.');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should remove first entry of monday', async() => {
|
|
||||||
pending('https://redmine.verdnatura.es/issues/4707');
|
|
||||||
await page.waitForTextInElement(selectors.workerTimeControl.firstEntryOfMonday, eightAm);
|
|
||||||
await page.waitForTextInElement(selectors.workerTimeControl.secondEntryOfMonday, fourPm);
|
|
||||||
await page.waitToClick(selectors.workerTimeControl.firstEntryOfMondayDelete);
|
|
||||||
await page.respondToDialog('accept');
|
|
||||||
const message = await page.waitForSnackbar();
|
|
||||||
|
|
||||||
expect(message.text).toContain('Entry removed');
|
|
||||||
});
|
|
||||||
|
|
||||||
it(`should be the 'out' the first entry of monday`, async() => {
|
|
||||||
pending('https://redmine.verdnatura.es/issues/4707');
|
|
||||||
const result = await page.waitToGetProperty(selectors.workerTimeControl.firstEntryOfMonday, 'innerText');
|
|
||||||
|
|
||||||
expect(result).toEqual(fourPm);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should change week of month', async() => {
|
it('should change week of month', async() => {
|
||||||
await page.click(selectors.workerTimeControl.thrirdWeekDay);
|
await page.click(selectors.workerTimeControl.thrirdWeekDay);
|
||||||
const result = await page.getProperty(selectors.workerTimeControl.mondayWorkedHours, 'innerText');
|
const result = await page.getProperty(selectors.workerTimeControl.mondayWorkedHours, 'innerText');
|
||||||
|
|
|
@ -188,17 +188,6 @@ describe('Ticket Edit sale path', () => {
|
||||||
expect(result).toContain('22.50');
|
expect(result).toContain('22.50');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should check in the history that logs has been added', async() => {
|
|
||||||
pending('https://redmine.verdnatura.es/issues/5455');
|
|
||||||
await page.reload({waitUntil: ['networkidle0', 'domcontentloaded']});
|
|
||||||
await page.waitToClick(selectors.ticketSales.firstSaleHistoryButton);
|
|
||||||
await page.waitForSelector(selectors.ticketSales.firstSaleHistory);
|
|
||||||
const result = await page.countElement(selectors.ticketSales.firstSaleHistory);
|
|
||||||
|
|
||||||
expect(result).toBeGreaterThan(0);
|
|
||||||
await page.waitToClick(selectors.ticketSales.closeHistory);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should recalculate price of sales', async() => {
|
it('should recalculate price of sales', async() => {
|
||||||
await page.waitToClick(selectors.ticketSales.firstSaleCheckbox);
|
await page.waitToClick(selectors.ticketSales.firstSaleCheckbox);
|
||||||
await page.waitToClick(selectors.ticketSales.secondSaleCheckbox);
|
await page.waitToClick(selectors.ticketSales.secondSaleCheckbox);
|
||||||
|
@ -236,7 +225,7 @@ describe('Ticket Edit sale path', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should show error trying to delete a ticket with a refund', async() => {
|
it('should show error trying to delete a ticket with a refund', async() => {
|
||||||
await page.accessToSearchResult('16');
|
await page.accessToSearchResult('6');
|
||||||
await page.waitToClick(selectors.ticketDescriptor.moreMenu);
|
await page.waitToClick(selectors.ticketDescriptor.moreMenu);
|
||||||
await page.waitToClick(selectors.ticketDescriptor.moreMenuDeleteTicket);
|
await page.waitToClick(selectors.ticketDescriptor.moreMenuDeleteTicket);
|
||||||
await page.waitToClick(selectors.globalItems.acceptButton);
|
await page.waitToClick(selectors.globalItems.acceptButton);
|
||||||
|
|
|
@ -1,31 +0,0 @@
|
||||||
import selectors from '../../helpers/selectors.js';
|
|
||||||
import getBrowser from '../../helpers/puppeteer';
|
|
||||||
|
|
||||||
// #2221 Local MySQL8 crashes when rest method Items/getBalance is called
|
|
||||||
xdescribe('Ticket diary path', () => {
|
|
||||||
let page;
|
|
||||||
|
|
||||||
beforeAll(async() => {
|
|
||||||
page = (await getBrowser()).page;
|
|
||||||
await page.loginAndModule('employee', 'ticket');
|
|
||||||
});
|
|
||||||
|
|
||||||
afterAll(async() => {
|
|
||||||
await page.browser().close();
|
|
||||||
});
|
|
||||||
|
|
||||||
it(`should navigate to item diary from ticket sale and check the lines`, async() => {
|
|
||||||
await page.accessToSearchResult('1');
|
|
||||||
await page.waitToClick(selectors.ticketSummary.firstSaleItemId);
|
|
||||||
await page.waitToClick(selectors.ticketSummary.popoverDiaryButton);
|
|
||||||
await page.waitForState('item.card.diary');
|
|
||||||
|
|
||||||
const secondIdClass = await page.getClassName(selectors.itemDiary.secondTicketId);
|
|
||||||
const fourthBalanceClass = await page.getClassName(selectors.itemDiary.fourthBalance);
|
|
||||||
const firstBalanceClass = await page.getClassName(selectors.itemDiary.firstBalance);
|
|
||||||
|
|
||||||
expect(secondIdClass).toContain('message');
|
|
||||||
expect(fourthBalanceClass).toContain('message');
|
|
||||||
expect(firstBalanceClass).toContain('balance');
|
|
||||||
});
|
|
||||||
});
|
|
|
@ -35,7 +35,7 @@ describe('Ticket index payout path', () => {
|
||||||
await page.waitToClick(selectors.ticketsIndex.openAdvancedSearchButton);
|
await page.waitToClick(selectors.ticketsIndex.openAdvancedSearchButton);
|
||||||
await page.write(selectors.ticketsIndex.advancedSearchClient, '1101');
|
await page.write(selectors.ticketsIndex.advancedSearchClient, '1101');
|
||||||
await page.keyboard.press('Enter');
|
await page.keyboard.press('Enter');
|
||||||
await page.waitForNumberOfElements(selectors.ticketsIndex.anySearchResult, 9);
|
await page.waitForNumberOfElements(selectors.ticketsIndex.anySearchResult, 10);
|
||||||
await page.waitToClick(selectors.ticketsIndex.firstTicketCheckbox);
|
await page.waitToClick(selectors.ticketsIndex.firstTicketCheckbox);
|
||||||
await page.waitToClick(selectors.ticketsIndex.secondTicketCheckbox);
|
await page.waitToClick(selectors.ticketsIndex.secondTicketCheckbox);
|
||||||
|
|
||||||
|
|
|
@ -1,114 +0,0 @@
|
||||||
import selectors from '../../helpers/selectors.js';
|
|
||||||
import getBrowser from '../../helpers/puppeteer.js';
|
|
||||||
|
|
||||||
// #1528 e2e claim/detail
|
|
||||||
xdescribe('Claim detail', () => {
|
|
||||||
let browser;
|
|
||||||
let page;
|
|
||||||
|
|
||||||
beforeAll(async() => {
|
|
||||||
browser = await getBrowser();
|
|
||||||
page = browser.page;
|
|
||||||
await page.loginAndModule('salesPerson', 'claim');
|
|
||||||
await page.accessToSearchResult('1');
|
|
||||||
await page.accessToSection('claim.card.detail');
|
|
||||||
});
|
|
||||||
|
|
||||||
afterAll(async() => {
|
|
||||||
await browser.close();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should add the first claimable item from ticket to the claim', async() => {
|
|
||||||
await page.waitToClick(selectors.claimDetail.addItemButton);
|
|
||||||
await page.waitToClick(selectors.claimDetail.firstClaimableSaleFromTicket);
|
|
||||||
const message = await page.waitForSnackbar();
|
|
||||||
|
|
||||||
expect(message.text).toContain('Data saved!');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should confirm the claim contains now two items', async() => {
|
|
||||||
const result = await page.countElement(selectors.claimDetail.claimDetailLine);
|
|
||||||
|
|
||||||
expect(result).toEqual(2);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should edit de first item claimed quantity', async() => {
|
|
||||||
await page.clearInput(selectors.claimDetail.firstItemQuantityInput); // selector deleted, find new upon fixes
|
|
||||||
await page.write(selectors.claimDetail.firstItemQuantityInput, '4'); // selector deleted, find new upon fixes
|
|
||||||
await page.keyboard.press('Enter');
|
|
||||||
const message = await page.waitForSnackbar();
|
|
||||||
|
|
||||||
expect(message.text).toContain('Data saved!');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should confirm the first item quantity, and the claimed total were correctly edited', async() => {
|
|
||||||
const claimedQuantity = page
|
|
||||||
.waitToGetProperty(selectors.claimDetail.firstItemQuantityInput, 'value'); // selector deleted, find new upon fixes
|
|
||||||
|
|
||||||
const totalClaimed = page
|
|
||||||
.waitToGetProperty(selectors.claimDetail.totalClaimed, 'innerText');
|
|
||||||
|
|
||||||
expect(claimedQuantity).toEqual('4');
|
|
||||||
expect(totalClaimed).toContain('€47.62');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should login as salesAssistant and navigate to the claim.detail section', async() => {
|
|
||||||
await page.loginAndModule('salesAssistant', 'claim');
|
|
||||||
await page.accessToSearchResult('1');
|
|
||||||
await page.accessToSection('claim.card.detail');
|
|
||||||
let url = await page.expectURL('/detail'); // replace with waitForState
|
|
||||||
|
|
||||||
expect(url).toBe(true);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should edit de second item claimed discount', async() => {
|
|
||||||
await page.waitToClick(selectors.claimDetail.secondItemDiscount);
|
|
||||||
await page.write(selectors.claimDetail.discount, '100');
|
|
||||||
await page.keyboard.press('Enter');
|
|
||||||
const message = await page.waitForSnackbar();
|
|
||||||
|
|
||||||
expect(message.text).toContain('Data saved!');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should check the mana is the expected one', async() => {
|
|
||||||
await page.waitToClick(selectors.claimDetail.secondItemDiscount);
|
|
||||||
const result = await page.waitToGetProperty(selectors.claimDetail.discoutPopoverMana, 'innerText');
|
|
||||||
|
|
||||||
expect(result).toContain('MANÁ: €106');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should delete the second item from the claim', async() => {
|
|
||||||
await page.waitToClick(selectors.claimDetail.secondItemDeleteButton);
|
|
||||||
const message = await page.waitForSnackbar();
|
|
||||||
|
|
||||||
expect(message.text).toContain('Data saved!');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should confirm the claim contains now one item', async() => {
|
|
||||||
const result = await page.countElement(selectors.claimDetail.claimDetailLine);
|
|
||||||
|
|
||||||
expect(result).toEqual(1);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should add the deleted ticket from to the claim', async() => {
|
|
||||||
await page.waitToClick(selectors.claimDetail.addItemButton);
|
|
||||||
await page.waitToClick(selectors.claimDetail.firstClaimableSaleFromTicket);
|
|
||||||
const message = await page.waitForSnackbar();
|
|
||||||
|
|
||||||
expect(message.text).toContain('Data saved!');
|
|
||||||
});
|
|
||||||
|
|
||||||
it(`should have been redirected to the next section in claims`, async() => {
|
|
||||||
let url = await page.expectURL('development'); // replace with waitForState
|
|
||||||
|
|
||||||
expect(url).toBe(true);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should navigate back to claim.detail to confirm the claim contains now two items', async() => {
|
|
||||||
await page.accessToSection('claim.card.detail');
|
|
||||||
await page.waitForSelector(selectors.claimDetail.claimDetailLine);
|
|
||||||
const result = await page.countElement(selectors.claimDetail.claimDetailLine);
|
|
||||||
|
|
||||||
expect(result).toEqual(2);
|
|
||||||
});
|
|
||||||
});
|
|
|
@ -28,7 +28,6 @@ describe('InvoiceOut summary path', () => {
|
||||||
|
|
||||||
it('should contain the tax breakdown', async() => {
|
it('should contain the tax breakdown', async() => {
|
||||||
const firstTax = await page.waitToGetProperty(selectors.invoiceOutSummary.taxOne, 'innerText');
|
const firstTax = await page.waitToGetProperty(selectors.invoiceOutSummary.taxOne, 'innerText');
|
||||||
|
|
||||||
const secondTax = await page.waitToGetProperty(selectors.invoiceOutSummary.taxTwo, 'innerText');
|
const secondTax = await page.waitToGetProperty(selectors.invoiceOutSummary.taxTwo, 'innerText');
|
||||||
|
|
||||||
expect(firstTax).toContain('10%');
|
expect(firstTax).toContain('10%');
|
||||||
|
@ -37,10 +36,9 @@ describe('InvoiceOut summary path', () => {
|
||||||
|
|
||||||
it('should contain the tickets info', async() => {
|
it('should contain the tickets info', async() => {
|
||||||
const firstTicket = await page.waitToGetProperty(selectors.invoiceOutSummary.ticketOne, 'innerText');
|
const firstTicket = await page.waitToGetProperty(selectors.invoiceOutSummary.ticketOne, 'innerText');
|
||||||
|
|
||||||
const secondTicket = await page.waitToGetProperty(selectors.invoiceOutSummary.ticketTwo, 'innerText');
|
const secondTicket = await page.waitToGetProperty(selectors.invoiceOutSummary.ticketTwo, 'innerText');
|
||||||
|
|
||||||
expect(firstTicket).toContain('Bat cave');
|
expect(firstTicket).toContain('Bat cave');
|
||||||
expect(secondTicket).toContain('Stark tower');
|
expect(secondTicket).toContain('Bat cave');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -105,17 +105,4 @@ describe('Travel basic data path', () => {
|
||||||
it(`should check the received checkbox was saved even tho it doesn't make sense`, async() => {
|
it(`should check the received checkbox was saved even tho it doesn't make sense`, async() => {
|
||||||
await page.waitForClassPresent(selectors.travelBasicData.received, 'checked');
|
await page.waitForClassPresent(selectors.travelBasicData.received, 'checked');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should navigate to the travel logs', async() => {
|
|
||||||
pending('https://redmine.verdnatura.es/issues/5455');
|
|
||||||
await page.accessToSection('travel.card.log');
|
|
||||||
await page.waitForState('travel.card.log');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should check the 1st log contains details from the changes made', async() => {
|
|
||||||
pending('https://redmine.verdnatura.es/issues/5455');
|
|
||||||
const result = await page.waitToGetProperty(selectors.travelLog.firstLogFirstTD, 'innerText');
|
|
||||||
|
|
||||||
expect(result).toContain('new reference!');
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -33,18 +33,6 @@ describe('Component vnTreeview', () => {
|
||||||
$element.remove();
|
$element.remove();
|
||||||
});
|
});
|
||||||
|
|
||||||
// See how to test DOM element in Jest
|
|
||||||
xdescribe('undrop()', () => {
|
|
||||||
it(`should reset all drop events and properties`, () => {
|
|
||||||
controller.dropping = angular.element(`<vn-treeview-child class="dropping"></vn-treeview-child>`);
|
|
||||||
jest.spyOn(controller.dropping.classList, 'remove');
|
|
||||||
|
|
||||||
controller.undrop();
|
|
||||||
|
|
||||||
expect(controller.dropping).toBeNull();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('dragOver()', () => {
|
describe('dragOver()', () => {
|
||||||
it(`should set the dragClientY property`, () => {
|
it(`should set the dragClientY property`, () => {
|
||||||
const event = new Event('dragover');
|
const event = new Event('dragover');
|
||||||
|
|
|
@ -23,7 +23,6 @@ export function directive($translate, $window) {
|
||||||
let rule = $attrs.rule.split('.');
|
let rule = $attrs.rule.split('.');
|
||||||
let modelName = rule.shift();
|
let modelName = rule.shift();
|
||||||
let fieldName = rule.shift();
|
let fieldName = rule.shift();
|
||||||
|
|
||||||
let split = $attrs.ngModel.split('.');
|
let split = $attrs.ngModel.split('.');
|
||||||
if (!fieldName) fieldName = split.pop() || null;
|
if (!fieldName) fieldName = split.pop() || null;
|
||||||
if (!modelName) modelName = firstUpper(split.pop() || '');
|
if (!modelName) modelName = firstUpper(split.pop() || '');
|
||||||
|
|
|
@ -68,3 +68,4 @@ Load more results: Cargar más resultados
|
||||||
Send cau: Enviar cau
|
Send cau: Enviar cau
|
||||||
By sending this ticket, all the data related to the error, the section, the user, etc., are already sent.: Al enviar este cau ya se envían todos los datos relacionados con el error, la sección, el usuario, etc
|
By sending this ticket, all the data related to the error, the section, the user, etc., are already sent.: Al enviar este cau ya se envían todos los datos relacionados con el error, la sección, el usuario, etc
|
||||||
ExplainReason: Explique el motivo por el que no deberia aparecer este fallo
|
ExplainReason: Explique el motivo por el que no deberia aparecer este fallo
|
||||||
|
You already have the mailAlias: Ya tienes este alias de correo
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
const LoopBackContext = require('loopback-context');
|
||||||
|
async function handleObserve(ctx) {
|
||||||
|
ctx.options.httpCtx = LoopBackContext.getCurrentContext();
|
||||||
|
}
|
||||||
|
module.exports = function(Self) {
|
||||||
|
let Mixin = {
|
||||||
|
'before save': handleObserve,
|
||||||
|
'before delete': handleObserve,
|
||||||
|
};
|
||||||
|
for (const [listener, handler] of Object.entries(Mixin))
|
||||||
|
Self.observe(listener, handler);
|
||||||
|
};
|
|
@ -1,15 +0,0 @@
|
||||||
const LoopBackContext = require('loopback-context');
|
|
||||||
|
|
||||||
module.exports = function(Self) {
|
|
||||||
Self.setup = function() {
|
|
||||||
Self.super_.setup.call(this);
|
|
||||||
};
|
|
||||||
|
|
||||||
Self.observe('before save', async function(ctx) {
|
|
||||||
ctx.options.httpCtx = LoopBackContext.getCurrentContext();
|
|
||||||
});
|
|
||||||
|
|
||||||
Self.observe('before delete', async function(ctx) {
|
|
||||||
ctx.options.httpCtx = LoopBackContext.getCurrentContext();
|
|
||||||
});
|
|
||||||
};
|
|
|
@ -1,5 +0,0 @@
|
||||||
{
|
|
||||||
"name": "Loggable",
|
|
||||||
"base": "VnModel",
|
|
||||||
"validateUpsert": true
|
|
||||||
}
|
|
|
@ -45,6 +45,7 @@
|
||||||
"Extension format is invalid": "Extension format is invalid",
|
"Extension format is invalid": "Extension format is invalid",
|
||||||
"NO_ZONE_FOR_THIS_PARAMETERS": "NO_ZONE_FOR_THIS_PARAMETERS",
|
"NO_ZONE_FOR_THIS_PARAMETERS": "NO_ZONE_FOR_THIS_PARAMETERS",
|
||||||
"This client can't be invoiced": "This client can't be invoiced",
|
"This client can't be invoiced": "This client can't be invoiced",
|
||||||
|
"You must provide the correction information to generate a corrective invoice": "You must provide the correction information to generate a corrective invoice",
|
||||||
"The introduced hour already exists": "The introduced hour already exists",
|
"The introduced hour already exists": "The introduced hour already exists",
|
||||||
"Invalid parameters to create a new ticket": "Invalid parameters to create a new ticket",
|
"Invalid parameters to create a new ticket": "Invalid parameters to create a new ticket",
|
||||||
"Concept cannot be blank": "Concept cannot be blank",
|
"Concept cannot be blank": "Concept cannot be blank",
|
||||||
|
@ -68,8 +69,7 @@
|
||||||
"Sent units from ticket": "I sent *{{quantity}}* units of [{{concept}} ({{itemId}})]({{{itemUrl}}}) to *\"{{nickname}}\"* coming from ticket id [{{ticketId}}]({{{ticketUrl}}})",
|
"Sent units from ticket": "I sent *{{quantity}}* units of [{{concept}} ({{itemId}})]({{{itemUrl}}}) to *\"{{nickname}}\"* coming from ticket id [{{ticketId}}]({{{ticketUrl}}})",
|
||||||
"Change quantity": "{{concept}} change of {{oldQuantity}} to {{newQuantity}}",
|
"Change quantity": "{{concept}} change of {{oldQuantity}} to {{newQuantity}}",
|
||||||
"Claim will be picked": "The product from the claim [({{claimId}})]({{{claimUrl}}}) from the client *{{clientName}}* will be picked",
|
"Claim will be picked": "The product from the claim [({{claimId}})]({{{claimUrl}}}) from the client *{{clientName}}* will be picked",
|
||||||
"Claim state has changed to incomplete": "The state of the claim [({{claimId}})]({{{claimUrl}}}) from client *{{clientName}}* has changed to *incomplete*",
|
"Claim state has changed to": "The state of the claim [({{claimId}})]({{{claimUrl}}}) from client *{{clientName}}* has changed to *{{newState}}*",
|
||||||
"Claim state has changed to canceled": "The state of the claim [({{claimId}})]({{{claimUrl}}}) from client *{{clientName}}* has changed to *canceled*",
|
|
||||||
"Customs agent is required for a non UEE member": "Customs agent is required for a non UEE member",
|
"Customs agent is required for a non UEE member": "Customs agent is required for a non UEE member",
|
||||||
"Incoterms is required for a non UEE member": "Incoterms is required for a non UEE member",
|
"Incoterms is required for a non UEE member": "Incoterms is required for a non UEE member",
|
||||||
"Client checked as validated despite of duplication": "Client checked as validated despite of duplication from client id {{clientId}}",
|
"Client checked as validated despite of duplication": "Client checked as validated despite of duplication from client id {{clientId}}",
|
||||||
|
@ -178,7 +178,8 @@
|
||||||
"The renew period has not been exceeded": "The renew period has not been exceeded",
|
"The renew period has not been exceeded": "The renew period has not been exceeded",
|
||||||
"You can not use the same password": "You can not use the same password",
|
"You can not use the same password": "You can not use the same password",
|
||||||
"Valid priorities": "Valid priorities: %d",
|
"Valid priorities": "Valid priorities: %d",
|
||||||
"Negative basis of tickets": "Negative basis of tickets: {{ticketsIds}}",
|
"hasAnyNegativeBase": "Negative basis of tickets: {{ticketsIds}}",
|
||||||
|
"hasAnyPositiveBase": "Positive basis of tickets: {{ticketsIds}}",
|
||||||
"This ticket cannot be left empty.": "This ticket cannot be left empty. %s",
|
"This ticket cannot be left empty.": "This ticket cannot be left empty. %s",
|
||||||
"Social name should be uppercase": "Social name should be uppercase",
|
"Social name should be uppercase": "Social name should be uppercase",
|
||||||
"Street should be uppercase": "Street should be uppercase",
|
"Street should be uppercase": "Street should be uppercase",
|
||||||
|
@ -200,6 +201,7 @@
|
||||||
"keepPrice": "keepPrice",
|
"keepPrice": "keepPrice",
|
||||||
"Cannot past travels with entries": "Cannot past travels with entries",
|
"Cannot past travels with entries": "Cannot past travels with entries",
|
||||||
"It was not able to remove the next expeditions:": "It was not able to remove the next expeditions: {{expeditions}}",
|
"It was not able to remove the next expeditions:": "It was not able to remove the next expeditions: {{expeditions}}",
|
||||||
"Try again": "Try again"
|
"Try again": "Try again",
|
||||||
|
"Incorrect pin": "Incorrect pin.",
|
||||||
|
"The notification subscription of this worker cant be modified": "The notification subscription of this worker cant be modified"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -73,6 +73,7 @@
|
||||||
"The secret can't be blank": "La contraseña no puede estar en blanco",
|
"The secret can't be blank": "La contraseña no puede estar en blanco",
|
||||||
"We weren't able to send this SMS": "No hemos podido enviar el SMS",
|
"We weren't able to send this SMS": "No hemos podido enviar el SMS",
|
||||||
"This client can't be invoiced": "Este cliente no puede ser facturado",
|
"This client can't be invoiced": "Este cliente no puede ser facturado",
|
||||||
|
"You must provide the correction information to generate a corrective invoice": "Debes informar la información de corrección para generar una factura rectificativa",
|
||||||
"This ticket can't be invoiced": "Este ticket no puede ser facturado",
|
"This ticket can't be invoiced": "Este ticket no puede ser facturado",
|
||||||
"You cannot add or modify services to an invoiced ticket": "No puedes añadir o modificar servicios a un ticket facturado",
|
"You cannot add or modify services to an invoiced ticket": "No puedes añadir o modificar servicios a un ticket facturado",
|
||||||
"This ticket can not be modified": "Este ticket no puede ser modificado",
|
"This ticket can not be modified": "Este ticket no puede ser modificado",
|
||||||
|
@ -136,8 +137,7 @@
|
||||||
"Sent units from ticket": "Envio *{{quantity}}* unidades de [{{concept}} ({{itemId}})]({{{itemUrl}}}) a *\"{{nickname}}\"* provenientes del ticket id [{{ticketId}}]({{{ticketUrl}}})",
|
"Sent units from ticket": "Envio *{{quantity}}* unidades de [{{concept}} ({{itemId}})]({{{itemUrl}}}) a *\"{{nickname}}\"* provenientes del ticket id [{{ticketId}}]({{{ticketUrl}}})",
|
||||||
"Change quantity": "{{concept}} cambia de {{oldQuantity}} a {{newQuantity}}",
|
"Change quantity": "{{concept}} cambia de {{oldQuantity}} a {{newQuantity}}",
|
||||||
"Claim will be picked": "Se recogerá el género de la reclamación [({{claimId}})]({{{claimUrl}}}) del cliente *{{clientName}}*",
|
"Claim will be picked": "Se recogerá el género de la reclamación [({{claimId}})]({{{claimUrl}}}) del cliente *{{clientName}}*",
|
||||||
"Claim state has changed to incomplete": "Se ha cambiado el estado de la reclamación [({{claimId}})]({{{claimUrl}}}) del cliente *{{clientName}}* a *incompleta*",
|
"Claim state has changed to": "Se ha cambiado el estado de la reclamación [({{claimId}})]({{{claimUrl}}}) del cliente *{{clientName}}* a *{{newState}}*",
|
||||||
"Claim state has changed to canceled": "Se ha cambiado el estado de la reclamación [({{claimId}})]({{{claimUrl}}}) del cliente *{{clientName}}* a *anulado*",
|
|
||||||
"Client checked as validated despite of duplication": "Cliente comprobado a pesar de que existe el cliente id {{clientId}}",
|
"Client checked as validated despite of duplication": "Cliente comprobado a pesar de que existe el cliente id {{clientId}}",
|
||||||
"ORDER_ROW_UNAVAILABLE": "No hay disponibilidad de este producto",
|
"ORDER_ROW_UNAVAILABLE": "No hay disponibilidad de este producto",
|
||||||
"Distance must be lesser than 1000": "La distancia debe ser inferior a 1000",
|
"Distance must be lesser than 1000": "La distancia debe ser inferior a 1000",
|
||||||
|
@ -306,7 +306,8 @@
|
||||||
"Mail not sent": "Se ha producido un fallo al enviar la factura al cliente [{{clientId}}]({{{clientUrl}}}), por favor revisa la dirección de correo electrónico",
|
"Mail not sent": "Se ha producido un fallo al enviar la factura al cliente [{{clientId}}]({{{clientUrl}}}), por favor revisa la dirección de correo electrónico",
|
||||||
"The renew period has not been exceeded": "El periodo de renovación no ha sido superado",
|
"The renew period has not been exceeded": "El periodo de renovación no ha sido superado",
|
||||||
"Valid priorities": "Prioridades válidas: %d",
|
"Valid priorities": "Prioridades válidas: %d",
|
||||||
"Negative basis of tickets": "Base negativa para los tickets: {{ticketsIds}}",
|
"hasAnyNegativeBase": "Base negativa para los tickets: {{ticketsIds}}",
|
||||||
|
"hasAnyPositiveBase": "Base positivas para los tickets: {{ticketsIds}}",
|
||||||
"You cannot assign an alias that you are not assigned to": "No puede asignar un alias que no tenga asignado",
|
"You cannot assign an alias that you are not assigned to": "No puede asignar un alias que no tenga asignado",
|
||||||
"This ticket cannot be left empty.": "Este ticket no se puede dejar vacío. %s",
|
"This ticket cannot be left empty.": "Este ticket no se puede dejar vacío. %s",
|
||||||
"The company has not informed the supplier account for bank transfers": "La empresa no tiene informado la cuenta de proveedor para transferencias bancarias",
|
"The company has not informed the supplier account for bank transfers": "La empresa no tiene informado la cuenta de proveedor para transferencias bancarias",
|
||||||
|
@ -331,6 +332,11 @@
|
||||||
"quantityLessThanMin": "La cantidad no puede ser menor que la cantidad mínima",
|
"quantityLessThanMin": "La cantidad no puede ser menor que la cantidad mínima",
|
||||||
"Cannot past travels with entries": "No se pueden pasar envíos con entradas",
|
"Cannot past travels with entries": "No se pueden pasar envíos con entradas",
|
||||||
"It was not able to remove the next expeditions:": "No se pudo eliminar las siguientes expediciones: {{expeditions}}",
|
"It was not able to remove the next expeditions:": "No se pudo eliminar las siguientes expediciones: {{expeditions}}",
|
||||||
|
"This claim has been updated": "La reclamación con Id: {{claimId}}, ha sido actualizada",
|
||||||
"This user does not have an assigned tablet": "Este usuario no tiene tablet asignada",
|
"This user does not have an assigned tablet": "Este usuario no tiene tablet asignada",
|
||||||
"Field are invalid": "El campo '{{tag}}' no es válido"
|
"Field are invalid": "El campo '{{tag}}' no es válido",
|
||||||
|
"Incorrect pin": "Pin incorrecto.",
|
||||||
|
"You already have the mailAlias": "Ya tienes este alias de correo",
|
||||||
|
"The alias cant be modified": "Este alias de correo no puede ser modificado",
|
||||||
|
"No tickets to invoice": "No hay tickets para facturar"
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,20 +25,19 @@
|
||||||
"FieldAcl": {
|
"FieldAcl": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
},
|
},
|
||||||
"Role": {
|
|
||||||
"dataSource": "vn",
|
|
||||||
"options": {
|
|
||||||
"mysql": {
|
|
||||||
"table": "salix.Role"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"RoleMapping": {
|
"RoleMapping": {
|
||||||
"dataSource": "vn",
|
"dataSource": "vn",
|
||||||
"options": {
|
"options": {
|
||||||
"mysql": {
|
"mysql": {
|
||||||
"table": "salix.RoleMapping"
|
"table": "salix.RoleMapping"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"relations": {
|
||||||
|
"role": {
|
||||||
|
"type": "belongsTo",
|
||||||
|
"model": "VnRole",
|
||||||
|
"foreignKey": "roleId"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"Schema": {
|
"Schema": {
|
||||||
|
|
|
@ -14,6 +14,9 @@
|
||||||
"MailAliasAccount": {
|
"MailAliasAccount": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
},
|
},
|
||||||
|
"MailAliasAcl": {
|
||||||
|
"dataSource": "vn"
|
||||||
|
},
|
||||||
"MailConfig": {
|
"MailConfig": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
},
|
},
|
||||||
|
|
|
@ -239,7 +239,7 @@ module.exports = Self => {
|
||||||
|
|
||||||
// Prepare data
|
// Prepare data
|
||||||
|
|
||||||
let roles = await $.Role.find({
|
let roles = await $.VnRole.find({
|
||||||
fields: ['id', 'name', 'description']
|
fields: ['id', 'name', 'description']
|
||||||
});
|
});
|
||||||
let roleRoles = await $.RoleRole.find({
|
let roleRoles = await $.RoleRole.find({
|
||||||
|
|
|
@ -2,54 +2,44 @@
|
||||||
const UserError = require('vn-loopback/util/user-error');
|
const UserError = require('vn-loopback/util/user-error');
|
||||||
|
|
||||||
module.exports = Self => {
|
module.exports = Self => {
|
||||||
|
Self.rewriteDbError(function(err) {
|
||||||
|
if (err.code === 'ER_DUP_ENTRY')
|
||||||
|
return new UserError(`You already have the mailAlias`);
|
||||||
|
return err;
|
||||||
|
});
|
||||||
|
|
||||||
Self.observe('before save', async ctx => {
|
Self.observe('before save', async ctx => {
|
||||||
const changes = ctx.currentInstance || ctx.instance;
|
const changes = ctx.currentInstance || ctx.instance;
|
||||||
|
|
||||||
await Self.hasGrant(ctx, changes.mailAlias);
|
await checkModifyPermission(ctx, changes.mailAlias);
|
||||||
});
|
});
|
||||||
|
|
||||||
Self.observe('before delete', async ctx => {
|
Self.observe('before delete', async ctx => {
|
||||||
const mailAliasAccount = await Self.findById(ctx.where.id);
|
const mailAliasAccount = await Self.findById(ctx.where.id);
|
||||||
|
|
||||||
await Self.hasGrant(ctx, mailAliasAccount.mailAlias);
|
await checkModifyPermission(ctx, mailAliasAccount.mailAlias);
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
async function checkModifyPermission(ctx, mailAliasFk) {
|
||||||
* Checks if current user has
|
const userId = ctx.options.accessToken.userId;
|
||||||
* grant to add/remove alias
|
|
||||||
*
|
|
||||||
* @param {Object} ctx - Request context
|
|
||||||
* @param {Interger} mailAlias - mailAlias id
|
|
||||||
* @return {Boolean} True for user with grant
|
|
||||||
*/
|
|
||||||
Self.hasGrant = async function(ctx, mailAlias) {
|
|
||||||
const models = Self.app.models;
|
const models = Self.app.models;
|
||||||
const accessToken = {req: {accessToken: ctx.options.accessToken}};
|
|
||||||
const userId = accessToken.req.accessToken.userId;
|
|
||||||
|
|
||||||
const canEditAlias = await models.ACL.checkAccessAcl(accessToken, 'MailAliasAccount', 'canEditAlias', 'WRITE');
|
const roles = await models.RoleMapping.find({
|
||||||
if (canEditAlias) return true;
|
fields: ['roleId'],
|
||||||
|
where: {principalId: userId}
|
||||||
|
});
|
||||||
|
|
||||||
const user = await models.VnUser.findById(userId, {fields: ['hasGrant']});
|
const availableMailAlias = await models.MailAliasAcl.findOne({
|
||||||
if (!user.hasGrant)
|
fields: ['mailAliasFk'],
|
||||||
throw new UserError(`You don't have grant privilege`);
|
include: {relation: 'mailAlias'},
|
||||||
|
where: {
|
||||||
const account = await models.Account.findById(userId, {
|
roleFk: {
|
||||||
fields: ['id'],
|
inq: roles.map(role => role.roleId),
|
||||||
include: {
|
},
|
||||||
relation: 'aliases',
|
mailAliasFk
|
||||||
scope: {
|
|
||||||
fields: ['mailAlias']
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const aliases = account.aliases().map(alias => alias.mailAlias);
|
if (!availableMailAlias) throw new UserError('The alias cant be modified');
|
||||||
|
}
|
||||||
const hasAlias = aliases.includes(mailAlias);
|
|
||||||
if (!hasAlias)
|
|
||||||
throw new UserError(`You cannot assign/remove an alias that you are not assigned to`);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -0,0 +1,31 @@
|
||||||
|
{
|
||||||
|
"name": "MailAliasAcl",
|
||||||
|
"base": "VnModel",
|
||||||
|
"options": {
|
||||||
|
"mysql": {
|
||||||
|
"table": "account.mailAliasAcl"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"properties": {
|
||||||
|
"mailAliasFk": {
|
||||||
|
"id": true,
|
||||||
|
"type": "number"
|
||||||
|
},
|
||||||
|
"roleFk": {
|
||||||
|
"id": true,
|
||||||
|
"type": "number"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"relations": {
|
||||||
|
"mailAlias": {
|
||||||
|
"type": "belongsTo",
|
||||||
|
"model": "MailAlias",
|
||||||
|
"foreignKey": "mailAliasFk"
|
||||||
|
},
|
||||||
|
"role": {
|
||||||
|
"type": "belongsTo",
|
||||||
|
"model": "Role",
|
||||||
|
"foreignKey": "roleFk"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -15,12 +15,12 @@
|
||||||
"relations": {
|
"relations": {
|
||||||
"owner": {
|
"owner": {
|
||||||
"type": "belongsTo",
|
"type": "belongsTo",
|
||||||
"model": "Role",
|
"model": "VnRole",
|
||||||
"foreignKey": "role"
|
"foreignKey": "role"
|
||||||
},
|
},
|
||||||
"inherits": {
|
"inherits": {
|
||||||
"type": "belongsTo",
|
"type": "belongsTo",
|
||||||
"model": "Role",
|
"model": "VnRole",
|
||||||
"foreignKey": "inheritsFrom"
|
"foreignKey": "inheritsFrom"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,12 +14,12 @@
|
||||||
"relations": {
|
"relations": {
|
||||||
"owner": {
|
"owner": {
|
||||||
"type": "belongsTo",
|
"type": "belongsTo",
|
||||||
"model": "Role",
|
"model": "VnRole",
|
||||||
"foreignKey": "role"
|
"foreignKey": "role"
|
||||||
},
|
},
|
||||||
"inherits": {
|
"inherits": {
|
||||||
"type": "belongsTo",
|
"type": "belongsTo",
|
||||||
"model": "Role",
|
"model": "VnRole",
|
||||||
"foreignKey": "inheritsFrom"
|
"foreignKey": "inheritsFrom"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,8 @@ const execFile = require('child_process').execFile;
|
||||||
* https://docs.microsoft.com/en-us/troubleshoot/windows-server/identity/useraccountcontrol-manipulate-account-properties
|
* https://docs.microsoft.com/en-us/troubleshoot/windows-server/identity/useraccountcontrol-manipulate-account-properties
|
||||||
*/
|
*/
|
||||||
const UserAccountControlFlags = {
|
const UserAccountControlFlags = {
|
||||||
ACCOUNTDISABLE: 2
|
ACCOUNTDISABLE: 0x2,
|
||||||
|
DONT_EXPIRE_PASSWD: 0x10000
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = Self => {
|
module.exports = Self => {
|
||||||
|
@ -118,7 +119,8 @@ module.exports = Self => {
|
||||||
}
|
}
|
||||||
|
|
||||||
entry = {
|
entry = {
|
||||||
userAccountControl: sambaUser.userAccountControl
|
userAccountControl: (sambaUser.userAccountControl
|
||||||
|
| UserAccountControlFlags.DONT_EXPIRE_PASSWD)
|
||||||
& ~UserAccountControlFlags.ACCOUNTDISABLE,
|
& ~UserAccountControlFlags.ACCOUNTDISABLE,
|
||||||
uidNumber: info.uidNumber,
|
uidNumber: info.uidNumber,
|
||||||
accountExpires: 0,
|
accountExpires: 0,
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
<vn-autocomplete
|
<vn-autocomplete
|
||||||
label="Role"
|
label="Role"
|
||||||
ng-model="$ctrl.acl.principalId"
|
ng-model="$ctrl.acl.principalId"
|
||||||
url="Roles"
|
url="VnRoles"
|
||||||
id-field="name"
|
id-field="name"
|
||||||
value-field="name"
|
value-field="name"
|
||||||
vn-focus>
|
vn-focus>
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
<vn-autocomplete
|
<vn-autocomplete
|
||||||
label="Role"
|
label="Role"
|
||||||
ng-model="filter.principalId"
|
ng-model="filter.principalId"
|
||||||
url="Roles"
|
url="VnRoles"
|
||||||
value-field="name">
|
value-field="name">
|
||||||
</vn-autocomplete>
|
</vn-autocomplete>
|
||||||
<vn-autocomplete
|
<vn-autocomplete
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
<vn-autocomplete
|
<vn-autocomplete
|
||||||
label="Role"
|
label="Role"
|
||||||
ng-model="$ctrl.user.roleFk"
|
ng-model="$ctrl.user.roleFk"
|
||||||
url="Roles"
|
url="VnRoles"
|
||||||
rule="VnUser">
|
rule="VnUser">
|
||||||
</vn-autocomplete>
|
</vn-autocomplete>
|
||||||
<vn-textfield
|
<vn-textfield
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
<vn-autocomplete
|
<vn-autocomplete
|
||||||
label="Role"
|
label="Role"
|
||||||
ng-model="$ctrl.user.roleFk"
|
ng-model="$ctrl.user.roleFk"
|
||||||
url="Roles">
|
url="VnRoles">
|
||||||
</vn-autocomplete>
|
</vn-autocomplete>
|
||||||
</vn-vertical>
|
</vn-vertical>
|
||||||
</vn-card>
|
</vn-card>
|
||||||
|
|
|
@ -1,25 +1,27 @@
|
||||||
<vn-watcher
|
<vn-watcher
|
||||||
vn-id="watcher"
|
vn-id="watcher"
|
||||||
url="Roles"
|
url="VnRoles"
|
||||||
data="$ctrl.role"
|
data="$ctrl.role"
|
||||||
form="form">
|
form="form">
|
||||||
</vn-watcher>
|
</vn-watcher>
|
||||||
<form
|
<form
|
||||||
name="form"
|
name="form"
|
||||||
ng-submit="watcher.submit()"
|
ng-submit="watcher.submit()"
|
||||||
|
|
||||||
class="vn-w-md">
|
class="vn-w-md">
|
||||||
<vn-card class="vn-pa-lg">
|
<vn-card class="vn-pa-lg">
|
||||||
<vn-vertical>
|
<vn-vertical>
|
||||||
<vn-textfield
|
<vn-textfield
|
||||||
label="Name"
|
label="Name"
|
||||||
ng-model="$ctrl.role.name"
|
ng-model="$ctrl.role.name"
|
||||||
rule
|
rule="VnRole.name"
|
||||||
vn-focus>
|
vn-focus>
|
||||||
</vn-textfield>
|
</vn-textfield>
|
||||||
<vn-textfield
|
<vn-textfield
|
||||||
label="Description"
|
label="Description"
|
||||||
ng-model="$ctrl.role.description"
|
ng-model="$ctrl.role.description"
|
||||||
rule>
|
rule="VnRole.description"
|
||||||
|
>
|
||||||
</vn-textfield>
|
</vn-textfield>
|
||||||
</vn-vertical>
|
</vn-vertical>
|
||||||
</vn-card>
|
</vn-card>
|
||||||
|
|
|
@ -3,7 +3,7 @@ import ModuleCard from 'salix/components/module-card';
|
||||||
|
|
||||||
class Controller extends ModuleCard {
|
class Controller extends ModuleCard {
|
||||||
reload() {
|
reload() {
|
||||||
this.$http.get(`Roles/${this.$params.id}`)
|
this.$http.get(`VnRoles/${this.$params.id}`)
|
||||||
.then(res => this.role = res.data);
|
.then(res => this.role = res.data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import './index';
|
import './index';
|
||||||
|
|
||||||
describe('component vnRoleCard', () => {
|
fdescribe('component vnRoleCard', () => {
|
||||||
let controller;
|
let controller;
|
||||||
let $httpBackend;
|
let $httpBackend;
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ describe('component vnRoleCard', () => {
|
||||||
it('should reload the controller data', () => {
|
it('should reload the controller data', () => {
|
||||||
controller.$params.id = 1;
|
controller.$params.id = 1;
|
||||||
|
|
||||||
$httpBackend.expectGET('Roles/1').respond('foo');
|
$httpBackend.expectGET('VnRoles/1').respond('foo');
|
||||||
controller.reload();
|
controller.reload();
|
||||||
$httpBackend.flush();
|
$httpBackend.flush();
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<vn-watcher
|
<vn-watcher
|
||||||
vn-id="watcher"
|
vn-id="watcher"
|
||||||
url="Roles"
|
url="VnRoles"
|
||||||
data="$ctrl.role"
|
data="$ctrl.role"
|
||||||
insert-mode="true"
|
insert-mode="true"
|
||||||
form="form">
|
form="form">
|
||||||
|
@ -14,13 +14,13 @@
|
||||||
<vn-textfield
|
<vn-textfield
|
||||||
label="Name"
|
label="Name"
|
||||||
ng-model="$ctrl.role.name"
|
ng-model="$ctrl.role.name"
|
||||||
rule
|
rule="VnRole.name"
|
||||||
vn-focus>
|
vn-focus>
|
||||||
</vn-textfield>
|
</vn-textfield>
|
||||||
<vn-textfield
|
<vn-textfield
|
||||||
label="Description"
|
label="Description"
|
||||||
ng-model="$ctrl.role.description"
|
ng-model="$ctrl.role.description"
|
||||||
rule>
|
rule="VnRole.description">
|
||||||
</vn-textfield>
|
</vn-textfield>
|
||||||
</vn-vertical>
|
</vn-vertical>
|
||||||
</vn-card>
|
</vn-card>
|
||||||
|
|
|
@ -11,7 +11,7 @@ class Controller extends Descriptor {
|
||||||
}
|
}
|
||||||
|
|
||||||
onDelete() {
|
onDelete() {
|
||||||
return this.$http.delete(`Roles/${this.id}`)
|
return this.$http.delete(`VnRoles/${this.id}`)
|
||||||
.then(() => this.$state.go('account.role'))
|
.then(() => this.$state.go('account.role'))
|
||||||
.then(() => this.vnApp.showSuccess(this.$t('Role removed')));
|
.then(() => this.vnApp.showSuccess(this.$t('Role removed')));
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import './index';
|
import './index';
|
||||||
|
|
||||||
describe('component vnRoleDescriptor', () => {
|
fdescribe('component vnRoleDescriptor', () => {
|
||||||
let controller;
|
let controller;
|
||||||
let $httpBackend;
|
let $httpBackend;
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ describe('component vnRoleDescriptor', () => {
|
||||||
controller.$state.go = jest.fn();
|
controller.$state.go = jest.fn();
|
||||||
jest.spyOn(controller.vnApp, 'showSuccess');
|
jest.spyOn(controller.vnApp, 'showSuccess');
|
||||||
|
|
||||||
$httpBackend.expectDELETE('Roles/1').respond();
|
$httpBackend.expectDELETE('VnRoles/1').respond();
|
||||||
controller.onDelete();
|
controller.onDelete();
|
||||||
$httpBackend.flush();
|
$httpBackend.flush();
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<vn-crud-model
|
<vn-crud-model
|
||||||
vn-id="model"
|
vn-id="model"
|
||||||
url="Roles"
|
url="VnRoles"
|
||||||
filter="::$ctrl.filter"
|
filter="::$ctrl.filter"
|
||||||
limit="20">
|
limit="20">
|
||||||
</vn-crud-model>
|
</vn-crud-model>
|
||||||
|
|
|
@ -40,7 +40,7 @@
|
||||||
<vn-autocomplete
|
<vn-autocomplete
|
||||||
label="Role"
|
label="Role"
|
||||||
ng-model="$ctrl.addData.inheritsFrom"
|
ng-model="$ctrl.addData.inheritsFrom"
|
||||||
url="Roles"
|
url="VnRoles"
|
||||||
vn-focus>
|
vn-focus>
|
||||||
</vn-autocomplete>
|
</vn-autocomplete>
|
||||||
</tpl-body>
|
</tpl-body>
|
||||||
|
|
|
@ -6,7 +6,7 @@ class Controller extends Component {
|
||||||
this._role = value;
|
this._role = value;
|
||||||
this.$.summary = null;
|
this.$.summary = null;
|
||||||
if (!value) return;
|
if (!value) return;
|
||||||
this.$http.get(`Roles/${value.id}`)
|
this.$http.get(`VnRoles/${value.id}`)
|
||||||
.then(res => this.$.summary = res.data);
|
.then(res => this.$.summary = res.data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
vn-one
|
vn-one
|
||||||
label="Role"
|
label="Role"
|
||||||
ng-model="filter.roleFk"
|
ng-model="filter.roleFk"
|
||||||
url="Roles"
|
url="VnRoles"
|
||||||
value-field="id"
|
value-field="id"
|
||||||
show-field="name">
|
show-field="name">
|
||||||
</vn-autocomplete>
|
</vn-autocomplete>
|
||||||
|
|
|
@ -120,7 +120,7 @@ module.exports = Self => {
|
||||||
observationTypeFk: obsevationType.id
|
observationTypeFk: obsevationType.id
|
||||||
}, myOptions);
|
}, myOptions);
|
||||||
|
|
||||||
await models.TicketTracking.create({
|
await models.Ticket.state(ctx, {
|
||||||
ticketFk: newRefundTicket.id,
|
ticketFk: newRefundTicket.id,
|
||||||
stateFk: state.id,
|
stateFk: state.id,
|
||||||
userFk: worker.id
|
userFk: worker.id
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
const app = require('vn-loopback/server/server');
|
const app = require('vn-loopback/server/server');
|
||||||
const LoopBackContext = require('loopback-context');
|
const LoopBackContext = require('loopback-context');
|
||||||
|
const i18n = require('i18n');
|
||||||
describe('Update Claim', () => {
|
describe('Update Claim', () => {
|
||||||
let url;
|
let url;
|
||||||
|
let claimStatesMap = {};
|
||||||
beforeAll(async() => {
|
beforeAll(async() => {
|
||||||
url = await app.models.Url.getUrl();
|
url = await app.models.Url.getUrl();
|
||||||
const activeCtx = {
|
const activeCtx = {
|
||||||
|
@ -16,6 +17,8 @@ describe('Update Claim', () => {
|
||||||
spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({
|
spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({
|
||||||
active: activeCtx
|
active: activeCtx
|
||||||
});
|
});
|
||||||
|
const claimStates = await app.models.ClaimState.find();
|
||||||
|
claimStatesMap = claimStates.reduce((acc, state) => ({...acc, [state.code]: state.id}), {});
|
||||||
});
|
});
|
||||||
const newDate = Date.vnNew();
|
const newDate = Date.vnNew();
|
||||||
const originalData = {
|
const originalData = {
|
||||||
|
@ -62,6 +65,123 @@ describe('Update Claim', () => {
|
||||||
expect(error.message).toEqual(`You don't have enough privileges to change that field`);
|
expect(error.message).toEqual(`You don't have enough privileges to change that field`);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it(`should success to update the claimState to 'pending' and send a rocket message`, async() => {
|
||||||
|
const tx = await app.models.Claim.beginTransaction({});
|
||||||
|
|
||||||
|
try {
|
||||||
|
const options = {transaction: tx};
|
||||||
|
|
||||||
|
const newClaim = await app.models.Claim.create(originalData, options);
|
||||||
|
|
||||||
|
const chatModel = app.models.Chat;
|
||||||
|
spyOn(chatModel, 'sendCheckingPresence').and.callThrough();
|
||||||
|
|
||||||
|
const pendingState = claimStatesMap.pending;
|
||||||
|
const claimManagerId = 72;
|
||||||
|
const ctx = {
|
||||||
|
req: {
|
||||||
|
accessToken: {userId: claimManagerId},
|
||||||
|
headers: {origin: url}
|
||||||
|
},
|
||||||
|
args: {
|
||||||
|
observation: 'valid observation',
|
||||||
|
claimStateFk: pendingState,
|
||||||
|
hasToPickUp: false
|
||||||
|
}
|
||||||
|
};
|
||||||
|
ctx.req.__ = i18n.__;
|
||||||
|
await app.models.Claim.updateClaim(ctx, newClaim.id, options);
|
||||||
|
|
||||||
|
let updatedClaim = await app.models.Claim.findById(newClaim.id, null, options);
|
||||||
|
|
||||||
|
expect(updatedClaim.observation).toEqual(ctx.args.observation);
|
||||||
|
expect(chatModel.sendCheckingPresence).toHaveBeenCalled();
|
||||||
|
|
||||||
|
await tx.rollback();
|
||||||
|
} catch (e) {
|
||||||
|
await tx.rollback();
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
it(`should success to update the claimState to 'managed' and send a rocket message`, async() => {
|
||||||
|
const tx = await app.models.Claim.beginTransaction({});
|
||||||
|
|
||||||
|
try {
|
||||||
|
const options = {transaction: tx};
|
||||||
|
|
||||||
|
const newClaim = await app.models.Claim.create(originalData, options);
|
||||||
|
|
||||||
|
const chatModel = app.models.Chat;
|
||||||
|
spyOn(chatModel, 'sendCheckingPresence').and.callThrough();
|
||||||
|
|
||||||
|
const managedState = claimStatesMap.managed;
|
||||||
|
const claimManagerId = 72;
|
||||||
|
const ctx = {
|
||||||
|
req: {
|
||||||
|
accessToken: {userId: claimManagerId},
|
||||||
|
headers: {origin: url}
|
||||||
|
},
|
||||||
|
args: {
|
||||||
|
observation: 'valid observation',
|
||||||
|
claimStateFk: managedState,
|
||||||
|
hasToPickUp: false
|
||||||
|
}
|
||||||
|
};
|
||||||
|
ctx.req.__ = i18n.__;
|
||||||
|
await app.models.Claim.updateClaim(ctx, newClaim.id, options);
|
||||||
|
|
||||||
|
let updatedClaim = await app.models.Claim.findById(newClaim.id, null, options);
|
||||||
|
|
||||||
|
expect(updatedClaim.observation).toEqual(ctx.args.observation);
|
||||||
|
expect(chatModel.sendCheckingPresence).toHaveBeenCalled();
|
||||||
|
|
||||||
|
await tx.rollback();
|
||||||
|
} catch (e) {
|
||||||
|
await tx.rollback();
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
it(`should success to update the claimState to 'resolved' and send a rocket message`, async() => {
|
||||||
|
const tx = await app.models.Claim.beginTransaction({});
|
||||||
|
|
||||||
|
try {
|
||||||
|
const options = {transaction: tx};
|
||||||
|
|
||||||
|
const newClaim = await app.models.Claim.create(originalData, options);
|
||||||
|
|
||||||
|
const chatModel = app.models.Chat;
|
||||||
|
spyOn(chatModel, 'sendCheckingPresence').and.callThrough();
|
||||||
|
|
||||||
|
const resolvedState = claimStatesMap.resolved;
|
||||||
|
const claimManagerId = 72;
|
||||||
|
const ctx = {
|
||||||
|
req: {
|
||||||
|
accessToken: {userId: claimManagerId},
|
||||||
|
headers: {origin: url}
|
||||||
|
},
|
||||||
|
args: {
|
||||||
|
observation: 'valid observation',
|
||||||
|
claimStateFk: resolvedState,
|
||||||
|
hasToPickUp: false
|
||||||
|
}
|
||||||
|
};
|
||||||
|
ctx.req.__ = i18n.__;
|
||||||
|
await app.models.Claim.updateClaim(ctx, newClaim.id, options);
|
||||||
|
|
||||||
|
let updatedClaim = await app.models.Claim.findById(newClaim.id, null, options);
|
||||||
|
|
||||||
|
expect(updatedClaim.observation).toEqual(ctx.args.observation);
|
||||||
|
expect(chatModel.sendCheckingPresence).toHaveBeenCalled();
|
||||||
|
|
||||||
|
await tx.rollback();
|
||||||
|
} catch (e) {
|
||||||
|
await tx.rollback();
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
it(`should success to update the claimState to 'canceled' and send a rocket message`, async() => {
|
it(`should success to update the claimState to 'canceled' and send a rocket message`, async() => {
|
||||||
const tx = await app.models.Claim.beginTransaction({});
|
const tx = await app.models.Claim.beginTransaction({});
|
||||||
|
|
||||||
|
@ -73,7 +193,7 @@ describe('Update Claim', () => {
|
||||||
const chatModel = app.models.Chat;
|
const chatModel = app.models.Chat;
|
||||||
spyOn(chatModel, 'sendCheckingPresence').and.callThrough();
|
spyOn(chatModel, 'sendCheckingPresence').and.callThrough();
|
||||||
|
|
||||||
const canceledState = 4;
|
const canceledState = claimStatesMap.canceled;
|
||||||
const claimManagerId = 72;
|
const claimManagerId = 72;
|
||||||
const ctx = {
|
const ctx = {
|
||||||
req: {
|
req: {
|
||||||
|
@ -86,9 +206,7 @@ describe('Update Claim', () => {
|
||||||
hasToPickUp: false
|
hasToPickUp: false
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
ctx.req.__ = (value, params) => {
|
ctx.req.__ = i18n.__;
|
||||||
return params.nickname;
|
|
||||||
};
|
|
||||||
await app.models.Claim.updateClaim(ctx, newClaim.id, options);
|
await app.models.Claim.updateClaim(ctx, newClaim.id, options);
|
||||||
|
|
||||||
let updatedClaim = await app.models.Claim.findById(newClaim.id, null, options);
|
let updatedClaim = await app.models.Claim.findById(newClaim.id, null, options);
|
||||||
|
@ -127,9 +245,7 @@ describe('Update Claim', () => {
|
||||||
hasToPickUp: false
|
hasToPickUp: false
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
ctx.req.__ = (value, params) => {
|
ctx.req.__ = i18n.__;
|
||||||
return params.nickname;
|
|
||||||
};
|
|
||||||
await app.models.Claim.updateClaim(ctx, newClaim.id, options);
|
await app.models.Claim.updateClaim(ctx, newClaim.id, options);
|
||||||
|
|
||||||
let updatedClaim = await app.models.Claim.findById(newClaim.id, null, options);
|
let updatedClaim = await app.models.Claim.findById(newClaim.id, null, options);
|
||||||
|
@ -168,9 +284,7 @@ describe('Update Claim', () => {
|
||||||
hasToPickUp: true
|
hasToPickUp: true
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
ctx.req.__ = (value, params) => {
|
ctx.req.__ = i18n.__;
|
||||||
return params.nickname;
|
|
||||||
};
|
|
||||||
await app.models.Claim.updateClaim(ctx, newClaim.id, options);
|
await app.models.Claim.updateClaim(ctx, newClaim.id, options);
|
||||||
|
|
||||||
let updatedClaim = await app.models.Claim.findById(newClaim.id, null, options);
|
let updatedClaim = await app.models.Claim.findById(newClaim.id, null, options);
|
||||||
|
|
|
@ -96,13 +96,10 @@ module.exports = Self => {
|
||||||
// When claimState has been changed
|
// When claimState has been changed
|
||||||
if (args.claimStateFk) {
|
if (args.claimStateFk) {
|
||||||
const newState = await models.ClaimState.findById(args.claimStateFk, null, myOptions);
|
const newState = await models.ClaimState.findById(args.claimStateFk, null, myOptions);
|
||||||
if (newState.hasToNotify) {
|
|
||||||
if (newState.code == 'incomplete')
|
|
||||||
await notifyStateChange(ctx, salesPerson.id, claim, newState.code);
|
await notifyStateChange(ctx, salesPerson.id, claim, newState.code);
|
||||||
if (newState.code == 'canceled')
|
if (newState.code == 'canceled')
|
||||||
await notifyStateChange(ctx, claim.workerFk, claim, newState.code);
|
await notifyStateChange(ctx, claim.workerFk, claim, newState.code);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (tx) await tx.commit();
|
if (tx) await tx.commit();
|
||||||
|
|
||||||
|
@ -113,15 +110,16 @@ module.exports = Self => {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
async function notifyStateChange(ctx, workerId, claim, state) {
|
async function notifyStateChange(ctx, workerId, claim, newState) {
|
||||||
const models = Self.app.models;
|
const models = Self.app.models;
|
||||||
const url = await models.Url.getUrl();
|
const url = await models.Url.getUrl();
|
||||||
const $t = ctx.req.__; // $translate
|
const $t = ctx.req.__; // $translate
|
||||||
|
|
||||||
const message = $t(`Claim state has changed to ${state}`, {
|
const message = $t(`Claim state has changed to`, {
|
||||||
claimId: claim.id,
|
claimId: claim.id,
|
||||||
clientName: claim.client().name,
|
clientName: claim.client().name,
|
||||||
claimUrl: `${url}claim/${claim.id}/summary`
|
claimUrl: `${url}claim/${claim.id}/summary`,
|
||||||
|
newState
|
||||||
});
|
});
|
||||||
await models.Chat.sendCheckingPresence(ctx, workerId, message);
|
await models.Chat.sendCheckingPresence(ctx, workerId, message);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
{
|
{
|
||||||
"name": "ClaimBeginning",
|
"name": "ClaimBeginning",
|
||||||
"base": "Loggable",
|
"base": "VnModel",
|
||||||
|
"mixins": {
|
||||||
|
"Loggable": true
|
||||||
|
},
|
||||||
"options": {
|
"options": {
|
||||||
"mysql": {
|
"mysql": {
|
||||||
"table": "claimBeginning"
|
"table": "claimBeginning"
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
{
|
{
|
||||||
"name": "ClaimDevelopment",
|
"name": "ClaimDevelopment",
|
||||||
"base": "Loggable",
|
"base": "VnModel",
|
||||||
|
"mixins": {
|
||||||
|
"Loggable": true
|
||||||
|
},
|
||||||
"options": {
|
"options": {
|
||||||
"mysql": {
|
"mysql": {
|
||||||
"table": "claimDevelopment"
|
"table": "claimDevelopment"
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
{
|
{
|
||||||
"name": "ClaimDms",
|
"name": "ClaimDms",
|
||||||
"base": "Loggable",
|
"base": "VnModel",
|
||||||
|
"mixins": {
|
||||||
|
"Loggable": true
|
||||||
|
},
|
||||||
"options": {
|
"options": {
|
||||||
"mysql": {
|
"mysql": {
|
||||||
"table": "claimDms"
|
"table": "claimDms"
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
{
|
{
|
||||||
"name": "ClaimEnd",
|
"name": "ClaimEnd",
|
||||||
"base": "Loggable",
|
"base": "VnModel",
|
||||||
|
"mixins": {
|
||||||
|
"Loggable": true
|
||||||
|
},
|
||||||
"options": {
|
"options": {
|
||||||
"mysql": {
|
"mysql": {
|
||||||
"table": "claimEnd"
|
"table": "claimEnd"
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
{
|
{
|
||||||
"name": "ClaimObservation",
|
"name": "ClaimObservation",
|
||||||
"base": "Loggable",
|
"base": "VnModel",
|
||||||
|
"mixins": {
|
||||||
|
"Loggable": true
|
||||||
|
},
|
||||||
"options": {
|
"options": {
|
||||||
"mysql": {
|
"mysql": {
|
||||||
"table": "claimObservation"
|
"table": "claimObservation"
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
{
|
{
|
||||||
"name": "ClaimState",
|
"name": "ClaimState",
|
||||||
"base": "Loggable",
|
"base": "VnModel",
|
||||||
|
"mixins": {
|
||||||
|
"Loggable": true
|
||||||
|
},
|
||||||
"options": {
|
"options": {
|
||||||
"mysql": {
|
"mysql": {
|
||||||
"table": "claimState"
|
"table": "claimState"
|
||||||
|
@ -32,7 +35,7 @@
|
||||||
"relations": {
|
"relations": {
|
||||||
"writeRole": {
|
"writeRole": {
|
||||||
"type": "belongsTo",
|
"type": "belongsTo",
|
||||||
"model": "Role",
|
"model": "VnRole",
|
||||||
"foreignKey": "roleFk"
|
"foreignKey": "roleFk"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
{
|
{
|
||||||
"name": "Claim",
|
"name": "Claim",
|
||||||
"base": "Loggable",
|
"base": "VnModel",
|
||||||
|
"mixins": {
|
||||||
|
"Loggable": true
|
||||||
|
},
|
||||||
"options": {
|
"options": {
|
||||||
"mysql": {
|
"mysql": {
|
||||||
"table": "claim"
|
"table": "claim"
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
const UserError = require('vn-loopback/util/user-error');
|
const UserError = require('vn-loopback/util/user-error');
|
||||||
|
|
||||||
module.exports = function(Self) {
|
module.exports = function(Self) {
|
||||||
Self.remoteMethodCtx('canBeInvoiced', {
|
Self.remoteMethod('canBeInvoiced', {
|
||||||
description: 'Change property isEqualizated in all client addresses',
|
description: 'Change property isEqualizated in all client addresses',
|
||||||
accessType: 'READ',
|
accessType: 'READ',
|
||||||
accepts: [
|
accepts: [
|
||||||
|
|
|
@ -16,7 +16,7 @@ describe('client consumption() filter', () => {
|
||||||
};
|
};
|
||||||
const result = await models.Client.consumption(ctx, filter, options);
|
const result = await models.Client.consumption(ctx, filter, options);
|
||||||
|
|
||||||
expect(result.length).toEqual(10);
|
expect(result.length).toEqual(11);
|
||||||
|
|
||||||
await tx.rollback();
|
await tx.rollback();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
@ -49,7 +49,7 @@ describe('client consumption() filter', () => {
|
||||||
const thirdRow = result[2];
|
const thirdRow = result[2];
|
||||||
|
|
||||||
expect(result.length).toEqual(3);
|
expect(result.length).toEqual(3);
|
||||||
expect(firstRow.quantity).toEqual(10);
|
expect(firstRow.quantity).toEqual(11);
|
||||||
expect(secondRow.quantity).toEqual(15);
|
expect(secondRow.quantity).toEqual(15);
|
||||||
expect(thirdRow.quantity).toEqual(20);
|
expect(thirdRow.quantity).toEqual(20);
|
||||||
|
|
||||||
|
|
|
@ -113,9 +113,6 @@
|
||||||
"SageTransactionType": {
|
"SageTransactionType": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
},
|
},
|
||||||
"TicketSms": {
|
|
||||||
"dataSource": "vn"
|
|
||||||
},
|
|
||||||
"TpvError": {
|
"TpvError": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,7 +1,10 @@
|
||||||
{
|
{
|
||||||
"name": "Address",
|
"name": "Address",
|
||||||
"description": "Client addresses",
|
"description": "Client addresses",
|
||||||
"base": "Loggable",
|
"base": "VnModel",
|
||||||
|
"mixins": {
|
||||||
|
"Loggable": true
|
||||||
|
},
|
||||||
"options": {
|
"options": {
|
||||||
"mysql": {
|
"mysql": {
|
||||||
"table": "address"
|
"table": "address"
|
||||||
|
|
|
@ -1,7 +1,10 @@
|
||||||
{
|
{
|
||||||
"name": "ClientContact",
|
"name": "ClientContact",
|
||||||
"description": "Client phone contacts",
|
"description": "Client phone contacts",
|
||||||
"base": "Loggable",
|
"base": "VnModel",
|
||||||
|
"mixins": {
|
||||||
|
"Loggable": true
|
||||||
|
},
|
||||||
"options": {
|
"options": {
|
||||||
"mysql": {
|
"mysql": {
|
||||||
"table": "clientContact"
|
"table": "clientContact"
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
{
|
{
|
||||||
"name": "ClientDms",
|
"name": "ClientDms",
|
||||||
"base": "Loggable",
|
"base": "VnModel",
|
||||||
|
"mixins": {
|
||||||
|
"Loggable": true
|
||||||
|
},
|
||||||
"options": {
|
"options": {
|
||||||
"mysql": {
|
"mysql": {
|
||||||
"table": "clientDms"
|
"table": "clientDms"
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
{
|
{
|
||||||
"name": "ClientInforma",
|
"name": "ClientInforma",
|
||||||
"base": "Loggable",
|
"base": "VnModel",
|
||||||
|
"mixins": {
|
||||||
|
"Loggable": true
|
||||||
|
},
|
||||||
"log": {
|
"log": {
|
||||||
"model":"ClientLog",
|
"model":"ClientLog",
|
||||||
"relation": "client",
|
"relation": "client",
|
||||||
|
|
|
@ -1,7 +1,10 @@
|
||||||
{
|
{
|
||||||
"name": "ClientObservation",
|
"name": "ClientObservation",
|
||||||
"description": "Client notes",
|
"description": "Client notes",
|
||||||
"base": "Loggable",
|
"base": "VnModel",
|
||||||
|
"mixins": {
|
||||||
|
"Loggable": true
|
||||||
|
},
|
||||||
"options": {
|
"options": {
|
||||||
"mysql": {
|
"mysql": {
|
||||||
"table": "clientObservation"
|
"table": "clientObservation"
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
{
|
{
|
||||||
"name": "ClientSample",
|
"name": "ClientSample",
|
||||||
"base": "Loggable",
|
"base": "VnModel",
|
||||||
|
"mixins": {
|
||||||
|
"Loggable": true
|
||||||
|
},
|
||||||
"options": {
|
"options": {
|
||||||
"mysql": {
|
"mysql": {
|
||||||
"table": "clientSample"
|
"table": "clientSample"
|
||||||
|
|
|
@ -21,6 +21,11 @@
|
||||||
"type": "belongsTo",
|
"type": "belongsTo",
|
||||||
"model": "Sms",
|
"model": "Sms",
|
||||||
"foreignKey": "smsFk"
|
"foreignKey": "smsFk"
|
||||||
|
},
|
||||||
|
"ticket": {
|
||||||
|
"type": "belongsTo",
|
||||||
|
"model": "Ticket",
|
||||||
|
"foreignKey": "ticketFk"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
{
|
{
|
||||||
"name": "Client",
|
"name": "Client",
|
||||||
"base": "Loggable",
|
"base": "VnModel",
|
||||||
|
"mixins": {
|
||||||
|
"Loggable": true
|
||||||
|
},
|
||||||
"options": {
|
"options": {
|
||||||
"mysql": {
|
"mysql": {
|
||||||
"table": "client"
|
"table": "client"
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
{
|
{
|
||||||
"name": "Greuge",
|
"name": "Greuge",
|
||||||
"base": "Loggable",
|
"base": "VnModel",
|
||||||
|
"mixins": {
|
||||||
|
"Loggable": true
|
||||||
|
},
|
||||||
"options": {
|
"options": {
|
||||||
"mysql": {
|
"mysql": {
|
||||||
"table": "greuge"
|
"table": "greuge"
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
{
|
{
|
||||||
"name": "Recovery",
|
"name": "Recovery",
|
||||||
"base": "Loggable",
|
"base": "VnModel",
|
||||||
|
"mixins": {
|
||||||
|
"Loggable": true
|
||||||
|
},
|
||||||
"options": {
|
"options": {
|
||||||
"mysql": {
|
"mysql": {
|
||||||
"table": "recovery"
|
"table": "recovery"
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
"relations": {
|
"relations": {
|
||||||
"role": {
|
"role": {
|
||||||
"type": "belongsTo",
|
"type": "belongsTo",
|
||||||
"model": "Role",
|
"model": "VnRole",
|
||||||
"foreignKey": "roleFk"
|
"foreignKey": "roleFk"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue