7565-testToMaster #2567
|
@ -5,6 +5,14 @@ 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).
|
||||||
|
|
||||||
|
## [2414.01] - 2024-04-04
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
## [2408.01] - 2024-02-22
|
## [2408.01] - 2024-02-22
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
|
@ -29,7 +29,8 @@ module.exports = Self => {
|
||||||
http: {
|
http: {
|
||||||
path: `/:id/downloadFile`,
|
path: `/:id/downloadFile`,
|
||||||
verb: 'GET'
|
verb: 'GET'
|
||||||
}
|
},
|
||||||
|
accessScopes: ['read:multimedia']
|
||||||
});
|
});
|
||||||
|
|
||||||
Self.downloadFile = async function(ctx, id) {
|
Self.downloadFile = async function(ctx, id) {
|
||||||
|
|
|
@ -42,7 +42,8 @@ module.exports = Self => {
|
||||||
http: {
|
http: {
|
||||||
path: `/:id/download`,
|
path: `/:id/download`,
|
||||||
verb: 'GET'
|
verb: 'GET'
|
||||||
}
|
},
|
||||||
|
accessScopes: ['read:multimedia']
|
||||||
});
|
});
|
||||||
|
|
||||||
Self.download = async function(id, fileCabinet, filter) {
|
Self.download = async function(id, fileCabinet, filter) {
|
||||||
|
|
|
@ -47,7 +47,8 @@ module.exports = Self => {
|
||||||
http: {
|
http: {
|
||||||
path: `/:collection/:size/:id/download`,
|
path: `/:collection/:size/:id/download`,
|
||||||
verb: 'GET'
|
verb: 'GET'
|
||||||
}
|
},
|
||||||
|
accessScopes: ['read:multimedia']
|
||||||
});
|
});
|
||||||
|
|
||||||
Self.download = async function(ctx, collection, size, id) {
|
Self.download = async function(ctx, collection, size, id) {
|
||||||
|
|
|
@ -0,0 +1,27 @@
|
||||||
|
|
||||||
|
module.exports = Self => {
|
||||||
|
Self.remoteMethodCtx('shareToken', {
|
||||||
|
description: 'Returns token to view files or images and share it',
|
||||||
|
accessType: 'WRITE',
|
||||||
|
accepts: [],
|
||||||
|
returns: {
|
||||||
|
type: 'Object',
|
||||||
|
root: true
|
||||||
|
},
|
||||||
|
http: {
|
||||||
|
path: `/shareToken`,
|
||||||
|
verb: 'GET'
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Self.shareToken = async function(ctx) {
|
||||||
|
const {accessToken: token} = ctx.req;
|
||||||
|
|
||||||
|
const user = await Self.findById(token.userId);
|
||||||
|
const multimediaToken = await user.accessTokens.create({
|
||||||
|
scopes: ['read:multimedia']
|
||||||
|
});
|
||||||
|
|
||||||
|
return {multimediaToken};
|
||||||
|
};
|
||||||
|
};
|
|
@ -0,0 +1,27 @@
|
||||||
|
const {models} = require('vn-loopback/server/server');
|
||||||
|
describe('Share Token', () => {
|
||||||
|
let ctx = null;
|
||||||
|
beforeAll(async() => {
|
||||||
|
const unAuthCtx = {
|
||||||
|
req: {
|
||||||
|
headers: {},
|
||||||
|
connection: {
|
||||||
|
remoteAddress: '127.0.0.1'
|
||||||
|
},
|
||||||
|
getLocale: () => 'en'
|
||||||
|
},
|
||||||
|
args: {}
|
||||||
|
};
|
||||||
|
let login = await models.VnUser.signIn(unAuthCtx, 'salesAssistant', 'nightmare');
|
||||||
|
let accessToken = await models.AccessToken.findById(login.token);
|
||||||
|
ctx = {req: {accessToken: accessToken}};
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should renew token', async() => {
|
||||||
|
const multimediaToken = await models.VnUser.shareToken(ctx);
|
||||||
|
|
||||||
|
expect(Object.keys(multimediaToken).length).toEqual(1);
|
||||||
|
expect(multimediaToken.multimediaToken.userId).toEqual(ctx.req.accessToken.userId);
|
||||||
|
expect(multimediaToken.multimediaToken.scopes[0]).toEqual('read:multimedia');
|
||||||
|
});
|
||||||
|
});
|
|
@ -16,7 +16,7 @@
|
||||||
"Accounting": {
|
"Accounting": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
},
|
},
|
||||||
"Buyer": {
|
"Buyer": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
},
|
},
|
||||||
"Campaign": {
|
"Campaign": {
|
||||||
|
@ -94,6 +94,9 @@
|
||||||
"Module": {
|
"Module": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
},
|
},
|
||||||
|
"MrwConfig": {
|
||||||
|
"dataSource": "vn"
|
||||||
|
},
|
||||||
"Notification": {
|
"Notification": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
},
|
},
|
||||||
|
@ -166,10 +169,10 @@
|
||||||
"VnRole": {
|
"VnRole": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
},
|
},
|
||||||
"MrwConfig": {
|
"WorkerActivity": {
|
||||||
|
"dataSource": "vn"
|
||||||
|
},
|
||||||
|
"WorkerActivityType": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,7 @@ module.exports = function(Self) {
|
||||||
require('../methods/vn-user/privileges')(Self);
|
require('../methods/vn-user/privileges')(Self);
|
||||||
require('../methods/vn-user/validate-auth')(Self);
|
require('../methods/vn-user/validate-auth')(Self);
|
||||||
require('../methods/vn-user/renew-token')(Self);
|
require('../methods/vn-user/renew-token')(Self);
|
||||||
|
require('../methods/vn-user/share-token')(Self);
|
||||||
require('../methods/vn-user/update-user')(Self);
|
require('../methods/vn-user/update-user')(Self);
|
||||||
|
|
||||||
Self.definition.settings.acls = Self.definition.settings.acls.filter(acl => acl.property !== 'create');
|
Self.definition.settings.acls = Self.definition.settings.acls.filter(acl => acl.property !== 'create');
|
||||||
|
|
|
@ -1,129 +1,140 @@
|
||||||
{
|
{
|
||||||
"name": "VnUser",
|
"name": "VnUser",
|
||||||
"base": "User",
|
"base": "User",
|
||||||
"validateUpsert": true,
|
"validateUpsert": true,
|
||||||
"options": {
|
"options": {
|
||||||
"mysql": {
|
"mysql": {
|
||||||
"table": "account.user"
|
"table": "account.user"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"mixins": {
|
"mixins": {
|
||||||
"Loggable": true
|
"Loggable": true
|
||||||
},
|
},
|
||||||
"resetPasswordTokenTTL": "604800",
|
"resetPasswordTokenTTL": "604800",
|
||||||
"properties": {
|
"properties": {
|
||||||
"id": {
|
"id": {
|
||||||
"type": "number",
|
"type": "number",
|
||||||
"id": true
|
"id": true
|
||||||
},
|
},
|
||||||
"name": {
|
"name": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"required": true
|
"required": true
|
||||||
},
|
},
|
||||||
"username": {
|
"username": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"roleFk": {
|
"roleFk": {
|
||||||
"type": "number",
|
"type": "number",
|
||||||
"mysql": {
|
"mysql": {
|
||||||
"columnName": "role"
|
"columnName": "role"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"nickname": {
|
"nickname": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"lang": {
|
"lang": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"active": {
|
"active": {
|
||||||
"type": "boolean"
|
"type": "boolean"
|
||||||
},
|
},
|
||||||
"email": {
|
"email": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"emailVerified": {
|
"emailVerified": {
|
||||||
"type": "boolean"
|
"type": "boolean"
|
||||||
},
|
},
|
||||||
"created": {
|
"created": {
|
||||||
"type": "date"
|
"type": "date"
|
||||||
},
|
},
|
||||||
"updated": {
|
"updated": {
|
||||||
"type": "date"
|
"type": "date"
|
||||||
},
|
},
|
||||||
"image": {
|
"image": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"hasGrant": {
|
"hasGrant": {
|
||||||
"type": "boolean"
|
"type": "boolean"
|
||||||
},
|
},
|
||||||
"passExpired": {
|
"passExpired": {
|
||||||
"type": "date"
|
"type": "date"
|
||||||
},
|
},
|
||||||
"twoFactor": {
|
"twoFactor": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"relations": {
|
"relations": {
|
||||||
"role": {
|
"role": {
|
||||||
"type": "belongsTo",
|
"type": "belongsTo",
|
||||||
"model": "VnRole",
|
"model": "VnRole",
|
||||||
"foreignKey": "roleFk"
|
"foreignKey": "roleFk"
|
||||||
},
|
},
|
||||||
"roles": {
|
"roles": {
|
||||||
"type": "hasMany",
|
"type": "hasMany",
|
||||||
"model": "RoleRole",
|
"model": "RoleRole",
|
||||||
"foreignKey": "role",
|
"foreignKey": "role",
|
||||||
"primaryKey": "roleFk"
|
"primaryKey": "roleFk"
|
||||||
},
|
},
|
||||||
"emailUser": {
|
"emailUser": {
|
||||||
"type": "hasOne",
|
"type": "hasOne",
|
||||||
"model": "EmailUser",
|
"model": "EmailUser",
|
||||||
"foreignKey": "userFk"
|
"foreignKey": "userFk"
|
||||||
},
|
},
|
||||||
"worker": {
|
"worker": {
|
||||||
"type": "hasOne",
|
"type": "hasOne",
|
||||||
"model": "Worker",
|
"model": "Worker",
|
||||||
"foreignKey": "id"
|
"foreignKey": "id"
|
||||||
},
|
},
|
||||||
"userConfig": {
|
"userConfig": {
|
||||||
"type": "hasOne",
|
"type": "hasOne",
|
||||||
"model": "UserConfig",
|
"model": "UserConfig",
|
||||||
"foreignKey": "userFk"
|
"foreignKey": "userFk"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"acls": [
|
"acls": [
|
||||||
{
|
{
|
||||||
"property": "signIn",
|
"property": "signIn",
|
||||||
"accessType": "EXECUTE",
|
"accessType": "EXECUTE",
|
||||||
"principalType": "ROLE",
|
"principalType": "ROLE",
|
||||||
"principalId": "$everyone",
|
"principalId": "$everyone",
|
||||||
"permission": "ALLOW"
|
"permission": "ALLOW"
|
||||||
}, {
|
},
|
||||||
"property": "recoverPassword",
|
{
|
||||||
"accessType": "EXECUTE",
|
"property": "recoverPassword",
|
||||||
"principalType": "ROLE",
|
"accessType": "EXECUTE",
|
||||||
"principalId": "$everyone",
|
"principalType": "ROLE",
|
||||||
"permission": "ALLOW"
|
"principalId": "$everyone",
|
||||||
}, {
|
"permission": "ALLOW"
|
||||||
"property": "validateAuth",
|
},
|
||||||
"accessType": "EXECUTE",
|
{
|
||||||
"principalType": "ROLE",
|
"property": "validateAuth",
|
||||||
"principalId": "$everyone",
|
"accessType": "EXECUTE",
|
||||||
"permission": "ALLOW"
|
"principalType": "ROLE",
|
||||||
}, {
|
"principalId": "$everyone",
|
||||||
"property": "privileges",
|
"permission": "ALLOW"
|
||||||
"accessType": "*",
|
},
|
||||||
"principalType": "ROLE",
|
{
|
||||||
"principalId": "$authenticated",
|
"property": "privileges",
|
||||||
"permission": "ALLOW"
|
"accessType": "*",
|
||||||
}, {
|
"principalType": "ROLE",
|
||||||
"property": "renewToken",
|
"principalId": "$authenticated",
|
||||||
"accessType": "WRITE",
|
"permission": "ALLOW"
|
||||||
"principalType": "ROLE",
|
},
|
||||||
"principalId": "$authenticated",
|
{
|
||||||
"permission": "ALLOW"
|
"property": "renewToken",
|
||||||
}
|
"accessType": "WRITE",
|
||||||
],
|
"principalType": "ROLE",
|
||||||
|
"principalId": "$authenticated",
|
||||||
|
"permission": "ALLOW"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"property": "shareToken",
|
||||||
|
"accessType": "WRITE",
|
||||||
|
"principalType": "ROLE",
|
||||||
|
"principalId": "$authenticated",
|
||||||
|
"permission": "ALLOW"
|
||||||
|
}
|
||||||
|
],
|
||||||
"scopes": {
|
"scopes": {
|
||||||
"preview": {
|
"preview": {
|
||||||
"fields": [
|
"fields": [
|
||||||
|
@ -140,7 +151,7 @@
|
||||||
"hasGrant",
|
"hasGrant",
|
||||||
"realm",
|
"realm",
|
||||||
"email",
|
"email",
|
||||||
"emailVerified"
|
"emailVerified"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,39 @@
|
||||||
|
{
|
||||||
|
"name": "WorkerActivity",
|
||||||
|
"base": "VnModel",
|
||||||
|
"options": {
|
||||||
|
"mysql": {
|
||||||
|
"table": "workerActivity"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"properties": {
|
||||||
|
"id": {
|
||||||
|
"id": true,
|
||||||
|
"type": "number"
|
||||||
|
},
|
||||||
|
"created": {
|
||||||
|
"type": "date"
|
||||||
|
},
|
||||||
|
"model": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"event": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"description": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"relations": {
|
||||||
|
"workerFk": {
|
||||||
|
"type": "belongsTo",
|
||||||
|
"model": "Worker",
|
||||||
|
"foreignKey": "workerFk"
|
||||||
|
},
|
||||||
|
"workerActivityTypeFk": {
|
||||||
|
"type": "belongsTo",
|
||||||
|
"model": "WorkerActivityType",
|
||||||
|
"foreignKey": "workerActivityTypeFk"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,19 @@
|
||||||
|
{
|
||||||
|
"name": "WorkerActivityType",
|
||||||
|
"base": "VnModel",
|
||||||
|
"options": {
|
||||||
|
"mysql": {
|
||||||
|
"table": "workerActivityType"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"properties": {
|
||||||
|
"code": {
|
||||||
|
"id": true,
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"description": {
|
||||||
|
"type": "string",
|
||||||
|
"required": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -3068,18 +3068,16 @@ INSERT INTO `vn`.`cmr` (id,truckPlate,observations,senderInstruccions,paymentIns
|
||||||
UPDATE `vn`.`department`
|
UPDATE `vn`.`department`
|
||||||
SET workerFk = null;
|
SET workerFk = null;
|
||||||
|
|
||||||
-- NEW WAREHOUSE
|
|
||||||
|
|
||||||
INSERT INTO vn.packaging
|
INSERT INTO vn.packaging
|
||||||
VALUES('--', 2745600.00, 100.00, 120.00, 220.00, 0.00, 1, '2001-01-01 00:00:00.000', NULL, NULL, NULL, 0.00, 16, 0.00, 0, NULL, 0.00, NULL, NULL, 0, NULL, 0, 0);
|
VALUES('--', 2745600.00, 100.00, 120.00, 220.00, 0.00, 1, '2001-01-01 00:00:00.000', NULL, NULL, NULL, 0.00, 16, 0.00, 0, NULL, 0.00, NULL, NULL, 0, NULL, 0, 0);
|
||||||
|
|
||||||
|
|
||||||
INSERT IGNORE INTO vn.intrastat
|
INSERT IGNORE INTO vn.intrastat
|
||||||
SET id = 44219999,
|
SET id = 44219999,
|
||||||
description = 'Manufacturas de madera',
|
description = 'Manufacturas de madera',
|
||||||
taxClassFk = 1,
|
taxClassFk = 1,
|
||||||
taxCodeFk = 1;
|
taxCodeFk = 1;
|
||||||
|
|
||||||
INSERT IGNORE INTO vn.warehouse
|
INSERT IGNORE INTO vn.warehouse
|
||||||
SET id = 999,
|
SET id = 999,
|
||||||
name = 'TestingWarehouse',
|
name = 'TestingWarehouse',
|
||||||
|
@ -3090,33 +3088,33 @@ INSERT IGNORE INTO vn.warehouse
|
||||||
hasProduction = TRUE;
|
hasProduction = TRUE;
|
||||||
|
|
||||||
INSERT IGNORE INTO vn.sector
|
INSERT IGNORE INTO vn.sector
|
||||||
SET id = 9991,
|
SET id = 9991,
|
||||||
description = 'NormalSector',
|
description = 'NormalSector',
|
||||||
warehouseFk = 999,
|
warehouseFk = 999,
|
||||||
code = 'NS',
|
code = 'NS',
|
||||||
isPackagingArea = FALSE,
|
isPackagingArea = FALSE,
|
||||||
sonFk = NULL,
|
sonFk = NULL,
|
||||||
isMain = TRUE,
|
isMain = TRUE,
|
||||||
itemPackingTypeFk = NULL;
|
itemPackingTypeFk = NULL;
|
||||||
|
|
||||||
INSERT IGNORE INTO vn.sector
|
INSERT IGNORE INTO vn.sector
|
||||||
SET id = 9992,
|
SET id = 9992,
|
||||||
description = 'PreviousSector',
|
description = 'PreviousSector',
|
||||||
warehouseFk = 999,
|
warehouseFk = 999,
|
||||||
code = 'PS',
|
code = 'PS',
|
||||||
isPackagingArea = FALSE,
|
isPackagingArea = FALSE,
|
||||||
sonFk = NULL,
|
sonFk = NULL,
|
||||||
isMain = TRUE,
|
isMain = TRUE,
|
||||||
itemPackingTypeFk = NULL;
|
itemPackingTypeFk = NULL;
|
||||||
|
|
||||||
INSERT IGNORE INTO vn.sector
|
INSERT IGNORE INTO vn.sector
|
||||||
SET id = 9993,
|
SET id = 9993,
|
||||||
description = 'MezaninneSector',
|
description = 'MezaninneSector',
|
||||||
warehouseFk = 999,
|
warehouseFk = 999,
|
||||||
code = 'MS',
|
code = 'MS',
|
||||||
isPackagingArea = FALSE,
|
isPackagingArea = FALSE,
|
||||||
sonFk = 9991,
|
sonFk = 9991,
|
||||||
isMain = TRUE,
|
isMain = TRUE,
|
||||||
itemPackingTypeFk = NULL;
|
itemPackingTypeFk = NULL;
|
||||||
|
|
||||||
|
|
||||||
|
@ -3150,58 +3148,58 @@ INSERT IGNORE INTO vn.itemType
|
||||||
SET id = 999,
|
SET id = 999,
|
||||||
code = 'WOO',
|
code = 'WOO',
|
||||||
name = 'Wood Objects',
|
name = 'Wood Objects',
|
||||||
categoryFk = 3,
|
categoryFk = 3,
|
||||||
workerFk = 103,
|
workerFk = 103,
|
||||||
isInventory = TRUE,
|
isInventory = TRUE,
|
||||||
life = 10,
|
life = 10,
|
||||||
density = 250,
|
density = 250,
|
||||||
itemPackingTypeFk = NULL,
|
itemPackingTypeFk = NULL,
|
||||||
temperatureFk = 'warm';
|
temperatureFk = 'warm';
|
||||||
|
|
||||||
INSERT IGNORE INTO vn.travel
|
INSERT IGNORE INTO vn.travel
|
||||||
SET id = 99,
|
SET id = 99,
|
||||||
shipped = CURDATE(),
|
shipped = CURDATE(),
|
||||||
landed = CURDATE(),
|
landed = CURDATE(),
|
||||||
warehouseInFk = 999,
|
warehouseInFk = 999,
|
||||||
warehouseOutFk = 1,
|
warehouseOutFk = 1,
|
||||||
isReceived = TRUE;
|
isReceived = TRUE;
|
||||||
|
|
||||||
INSERT INTO vn.entry
|
INSERT INTO vn.entry
|
||||||
SET id = 999,
|
SET id = 999,
|
||||||
supplierFk = 791,
|
supplierFk = 791,
|
||||||
isConfirmed = TRUE,
|
isConfirmed = TRUE,
|
||||||
dated = CURDATE(),
|
dated = CURDATE(),
|
||||||
travelFk = 99,
|
travelFk = 99,
|
||||||
companyFk = 442;
|
companyFk = 442;
|
||||||
|
|
||||||
INSERT INTO vn.ticket
|
INSERT INTO vn.ticket
|
||||||
SET id = 999999,
|
SET id = 999999,
|
||||||
clientFk = 2,
|
clientFk = 2,
|
||||||
warehouseFk = 999,
|
warehouseFk = 999,
|
||||||
shipped = CURDATE(),
|
shipped = CURDATE(),
|
||||||
nickname = 'Cliente',
|
nickname = 'Cliente',
|
||||||
addressFk = 1,
|
addressFk = 1,
|
||||||
companyFk = 442,
|
companyFk = 442,
|
||||||
agencyModeFk = 10,
|
agencyModeFk = 10,
|
||||||
landed = CURDATE();
|
landed = CURDATE();
|
||||||
|
|
||||||
INSERT INTO vn.collection
|
INSERT INTO vn.collection
|
||||||
SET id = 10101010,
|
SET id = 10101010,
|
||||||
workerFk = 9;
|
workerFk = 9;
|
||||||
|
|
||||||
INSERT IGNORE INTO vn.ticketCollection
|
INSERT IGNORE INTO vn.ticketCollection
|
||||||
SET id = 10101010,
|
SET id = 10101010,
|
||||||
ticketFk = 999999,
|
ticketFk = 999999,
|
||||||
collectionFk = 10101010;
|
collectionFk = 10101010;
|
||||||
|
|
||||||
INSERT INTO vn.item
|
INSERT INTO vn.item
|
||||||
SET id = 999991,
|
SET id = 999991,
|
||||||
name = 'Palito para pinchos',
|
name = 'Palito para pinchos',
|
||||||
`size` = 25,
|
`size` = 25,
|
||||||
stems = NULL,
|
stems = NULL,
|
||||||
category = 'EXT',
|
category = 'EXT',
|
||||||
typeFk = 999,
|
typeFk = 999,
|
||||||
longName = 'Palito para pinchos',
|
longName = 'Palito para pinchos',
|
||||||
itemPackingTypeFk = NULL,
|
itemPackingTypeFk = NULL,
|
||||||
originFk = 1,
|
originFk = 1,
|
||||||
weightByPiece = 6,
|
weightByPiece = 6,
|
||||||
|
@ -3228,19 +3226,19 @@ INSERT INTO vn.sale
|
||||||
SET id = 99991,
|
SET id = 99991,
|
||||||
itemFk = 999991,
|
itemFk = 999991,
|
||||||
ticketFk = 999999,
|
ticketFk = 999999,
|
||||||
concept = 'Palito para pinchos',
|
concept = 'Palito para pinchos',
|
||||||
quantity = 3,
|
quantity = 3,
|
||||||
price = 1,
|
price = 1,
|
||||||
discount = 0;
|
discount = 0;
|
||||||
|
|
||||||
INSERT INTO vn.item
|
INSERT INTO vn.item
|
||||||
SET id = 999992,
|
SET id = 999992,
|
||||||
name = 'Madera verde',
|
name = 'Madera verde',
|
||||||
`size` = 10,
|
`size` = 10,
|
||||||
stems = NULL,
|
stems = NULL,
|
||||||
category = 'EXT',
|
category = 'EXT',
|
||||||
typeFk = 999,
|
typeFk = 999,
|
||||||
longName = 'Madera verde',
|
longName = 'Madera verde',
|
||||||
itemPackingTypeFk = NULL,
|
itemPackingTypeFk = NULL,
|
||||||
originFk = 1,
|
originFk = 1,
|
||||||
weightByPiece = 50,
|
weightByPiece = 50,
|
||||||
|
@ -3267,19 +3265,19 @@ INSERT INTO vn.sale
|
||||||
SET id = 99992,
|
SET id = 99992,
|
||||||
itemFk = 999992,
|
itemFk = 999992,
|
||||||
ticketFk = 999999,
|
ticketFk = 999999,
|
||||||
concept = 'Madera Verde',
|
concept = 'Madera Verde',
|
||||||
quantity = 10,
|
quantity = 10,
|
||||||
price = 1,
|
price = 1,
|
||||||
discount = 0;
|
discount = 0;
|
||||||
|
|
||||||
INSERT INTO vn.item
|
INSERT INTO vn.item
|
||||||
SET id = 999993,
|
SET id = 999993,
|
||||||
name = 'Madera Roja/Morada',
|
name = 'Madera Roja/Morada',
|
||||||
`size` = 12,
|
`size` = 12,
|
||||||
stems = 2,
|
stems = 2,
|
||||||
category = 'EXT',
|
category = 'EXT',
|
||||||
typeFk = 999,
|
typeFk = 999,
|
||||||
longName = 'Madera Roja/Morada',
|
longName = 'Madera Roja/Morada',
|
||||||
itemPackingTypeFk = NULL,
|
itemPackingTypeFk = NULL,
|
||||||
originFk = 1,
|
originFk = 1,
|
||||||
weightByPiece = 35,
|
weightByPiece = 35,
|
||||||
|
@ -3303,30 +3301,30 @@ INSERT INTO vn.buy
|
||||||
weight = 25;
|
weight = 25;
|
||||||
|
|
||||||
INSERT INTO vn.itemShelving
|
INSERT INTO vn.itemShelving
|
||||||
SET id = 9931,
|
SET id = 9931,
|
||||||
itemFk = 999993,
|
itemFk = 999993,
|
||||||
shelvingFk = 'NCC',
|
shelvingFk = 'NCC',
|
||||||
visible = 10,
|
visible = 10,
|
||||||
`grouping` = 5,
|
`grouping` = 5,
|
||||||
packing = 10;
|
packing = 10;
|
||||||
|
|
||||||
INSERT INTO vn.sale
|
INSERT INTO vn.sale
|
||||||
SET id = 99993,
|
SET id = 99993,
|
||||||
itemFk = 999993,
|
itemFk = 999993,
|
||||||
ticketFk = 999999,
|
ticketFk = 999999,
|
||||||
concept = 'Madera Roja/Morada',
|
concept = 'Madera Roja/Morada',
|
||||||
quantity = 15,
|
quantity = 15,
|
||||||
price = 1,
|
price = 1,
|
||||||
discount = 0;
|
discount = 0;
|
||||||
|
|
||||||
INSERT INTO vn.item
|
INSERT INTO vn.item
|
||||||
SET id = 999994,
|
SET id = 999994,
|
||||||
name = 'Madera Naranja',
|
name = 'Madera Naranja',
|
||||||
`size` = 18,
|
`size` = 18,
|
||||||
stems = 1,
|
stems = 1,
|
||||||
category = 'EXT',
|
category = 'EXT',
|
||||||
typeFk = 999,
|
typeFk = 999,
|
||||||
longName = 'Madera Naranja',
|
longName = 'Madera Naranja',
|
||||||
itemPackingTypeFk = NULL,
|
itemPackingTypeFk = NULL,
|
||||||
originFk = 1,
|
originFk = 1,
|
||||||
weightByPiece = 160,
|
weightByPiece = 160,
|
||||||
|
@ -3353,19 +3351,19 @@ INSERT INTO vn.sale
|
||||||
SET id = 99994,
|
SET id = 99994,
|
||||||
itemFk = 999994,
|
itemFk = 999994,
|
||||||
ticketFk = 999999,
|
ticketFk = 999999,
|
||||||
concept = 'Madera Naranja',
|
concept = 'Madera Naranja',
|
||||||
quantity = 4,
|
quantity = 4,
|
||||||
price = 1,
|
price = 1,
|
||||||
discount = 0;
|
discount = 0;
|
||||||
|
|
||||||
INSERT INTO vn.item
|
INSERT INTO vn.item
|
||||||
SET id = 999995,
|
SET id = 999995,
|
||||||
name = 'Madera Amarilla',
|
name = 'Madera Amarilla',
|
||||||
`size` = 11,
|
`size` = 11,
|
||||||
stems = 5,
|
stems = 5,
|
||||||
category = 'EXT',
|
category = 'EXT',
|
||||||
typeFk = 999,
|
typeFk = 999,
|
||||||
longName = 'Madera Amarilla',
|
longName = 'Madera Amarilla',
|
||||||
itemPackingTypeFk = NULL,
|
itemPackingTypeFk = NULL,
|
||||||
originFk = 1,
|
originFk = 1,
|
||||||
weightByPiece = 78,
|
weightByPiece = 78,
|
||||||
|
@ -3392,20 +3390,20 @@ INSERT INTO vn.sale
|
||||||
SET id = 99995,
|
SET id = 99995,
|
||||||
itemFk = 999995,
|
itemFk = 999995,
|
||||||
ticketFk = 999999,
|
ticketFk = 999999,
|
||||||
concept = 'Madera Amarilla',
|
concept = 'Madera Amarilla',
|
||||||
quantity = 5,
|
quantity = 5,
|
||||||
price = 1,
|
price = 1,
|
||||||
discount = 0;
|
discount = 0;
|
||||||
|
|
||||||
-- Palito naranja
|
-- Palito naranja
|
||||||
INSERT INTO vn.item
|
INSERT INTO vn.item
|
||||||
SET id = 999998,
|
SET id = 999998,
|
||||||
name = 'Palito naranja',
|
name = 'Palito naranja',
|
||||||
`size` = 11,
|
`size` = 11,
|
||||||
stems = 1,
|
stems = 1,
|
||||||
category = 'EXT',
|
category = 'EXT',
|
||||||
typeFk = 999,
|
typeFk = 999,
|
||||||
longName = 'Palito naranja',
|
longName = 'Palito naranja',
|
||||||
itemPackingTypeFk = NULL,
|
itemPackingTypeFk = NULL,
|
||||||
originFk = 1,
|
originFk = 1,
|
||||||
weightByPiece = 78,
|
weightByPiece = 78,
|
||||||
|
@ -3432,20 +3430,20 @@ INSERT INTO vn.sale
|
||||||
SET id = 99998,
|
SET id = 99998,
|
||||||
itemFk = 999998,
|
itemFk = 999998,
|
||||||
ticketFk = 999999,
|
ticketFk = 999999,
|
||||||
concept = 'Palito naranja',
|
concept = 'Palito naranja',
|
||||||
quantity = 60,
|
quantity = 60,
|
||||||
price = 1,
|
price = 1,
|
||||||
discount = 0;
|
discount = 0;
|
||||||
|
|
||||||
-- Palito amarillo
|
-- Palito amarillo
|
||||||
INSERT INTO vn.item
|
INSERT INTO vn.item
|
||||||
SET id = 999999,
|
SET id = 999999,
|
||||||
name = 'Palito amarillo',
|
name = 'Palito amarillo',
|
||||||
`size` = 11,
|
`size` = 11,
|
||||||
stems = 1,
|
stems = 1,
|
||||||
category = 'EXT',
|
category = 'EXT',
|
||||||
typeFk = 999,
|
typeFk = 999,
|
||||||
longName = 'Palito amarillo',
|
longName = 'Palito amarillo',
|
||||||
itemPackingTypeFk = NULL,
|
itemPackingTypeFk = NULL,
|
||||||
originFk = 1,
|
originFk = 1,
|
||||||
weightByPiece = 78,
|
weightByPiece = 78,
|
||||||
|
@ -3472,20 +3470,20 @@ INSERT INTO vn.sale
|
||||||
SET id = 99999,
|
SET id = 99999,
|
||||||
itemFk = 999999,
|
itemFk = 999999,
|
||||||
ticketFk = 999999,
|
ticketFk = 999999,
|
||||||
concept = 'Palito amarillo',
|
concept = 'Palito amarillo',
|
||||||
quantity = 50,
|
quantity = 50,
|
||||||
price = 1,
|
price = 1,
|
||||||
discount = 0;
|
discount = 0;
|
||||||
|
|
||||||
-- Palito azul
|
-- Palito azul
|
||||||
INSERT INTO vn.item
|
INSERT INTO vn.item
|
||||||
SET id = 1000000,
|
SET id = 1000000,
|
||||||
name = 'Palito azul',
|
name = 'Palito azul',
|
||||||
`size` = 10,
|
`size` = 10,
|
||||||
stems = 1,
|
stems = 1,
|
||||||
category = 'EXT',
|
category = 'EXT',
|
||||||
typeFk = 999,
|
typeFk = 999,
|
||||||
longName = 'Palito azul',
|
longName = 'Palito azul',
|
||||||
itemPackingTypeFk = NULL,
|
itemPackingTypeFk = NULL,
|
||||||
originFk = 1,
|
originFk = 1,
|
||||||
weightByPiece = 78,
|
weightByPiece = 78,
|
||||||
|
@ -3512,20 +3510,20 @@ INSERT INTO vn.sale
|
||||||
SET id = 100000,
|
SET id = 100000,
|
||||||
itemFk = 1000000,
|
itemFk = 1000000,
|
||||||
ticketFk = 999999,
|
ticketFk = 999999,
|
||||||
concept = 'Palito azul',
|
concept = 'Palito azul',
|
||||||
quantity = 50,
|
quantity = 50,
|
||||||
price = 1,
|
price = 1,
|
||||||
discount = 0;
|
discount = 0;
|
||||||
|
|
||||||
-- Palito rojo
|
-- Palito rojo
|
||||||
INSERT INTO vn.item
|
INSERT INTO vn.item
|
||||||
SET id = 1000001,
|
SET id = 1000001,
|
||||||
name = 'Palito rojo',
|
name = 'Palito rojo',
|
||||||
`size` = 10,
|
`size` = 10,
|
||||||
stems = NULL,
|
stems = NULL,
|
||||||
category = 'EXT',
|
category = 'EXT',
|
||||||
typeFk = 999,
|
typeFk = 999,
|
||||||
longName = 'Palito rojo',
|
longName = 'Palito rojo',
|
||||||
itemPackingTypeFk = NULL,
|
itemPackingTypeFk = NULL,
|
||||||
originFk = 1,
|
originFk = 1,
|
||||||
weightByPiece = 78,
|
weightByPiece = 78,
|
||||||
|
@ -3553,20 +3551,20 @@ INSERT INTO vn.sale
|
||||||
SET id = 100001,
|
SET id = 100001,
|
||||||
itemFk = 1000001,
|
itemFk = 1000001,
|
||||||
ticketFk = 999999,
|
ticketFk = 999999,
|
||||||
concept = 'Palito rojo',
|
concept = 'Palito rojo',
|
||||||
quantity = 10,
|
quantity = 10,
|
||||||
price = 1,
|
price = 1,
|
||||||
discount = 0;
|
discount = 0;
|
||||||
|
|
||||||
-- Previa
|
-- Previa
|
||||||
INSERT IGNORE INTO vn.item
|
INSERT IGNORE INTO vn.item
|
||||||
SET id = 999996,
|
SET id = 999996,
|
||||||
name = 'Bolas de madera',
|
name = 'Bolas de madera',
|
||||||
`size` = 2,
|
`size` = 2,
|
||||||
stems = 4,
|
stems = 4,
|
||||||
category = 'EXT',
|
category = 'EXT',
|
||||||
typeFk = 999,
|
typeFk = 999,
|
||||||
longName = 'Bolas de madera',
|
longName = 'Bolas de madera',
|
||||||
itemPackingTypeFk = NULL,
|
itemPackingTypeFk = NULL,
|
||||||
originFk = 1,
|
originFk = 1,
|
||||||
weightByPiece = 20,
|
weightByPiece = 20,
|
||||||
|
@ -3593,20 +3591,20 @@ INSERT vn.sale
|
||||||
SET id = 99996,
|
SET id = 99996,
|
||||||
itemFk = 999996,
|
itemFk = 999996,
|
||||||
ticketFk = 999999,
|
ticketFk = 999999,
|
||||||
concept = 'Bolas de madera',
|
concept = 'Bolas de madera',
|
||||||
quantity = 4,
|
quantity = 4,
|
||||||
price = 7,
|
price = 7,
|
||||||
discount = 0,
|
discount = 0,
|
||||||
isPicked = TRUE;
|
isPicked = TRUE;
|
||||||
|
|
||||||
INSERT IGNORE INTO vn.item
|
INSERT IGNORE INTO vn.item
|
||||||
SET id = 999997,
|
SET id = 999997,
|
||||||
name = 'Palitos de polo MIX',
|
name = 'Palitos de polo MIX',
|
||||||
`size` = 14,
|
`size` = 14,
|
||||||
stems = NULL,
|
stems = NULL,
|
||||||
category = 'EXT',
|
category = 'EXT',
|
||||||
typeFk = 999,
|
typeFk = 999,
|
||||||
longName = 'Palitos de polo MIX',
|
longName = 'Palitos de polo MIX',
|
||||||
itemPackingTypeFk = NULL,
|
itemPackingTypeFk = NULL,
|
||||||
originFk = 1,
|
originFk = 1,
|
||||||
weightByPiece = 20,
|
weightByPiece = 20,
|
||||||
|
@ -3633,9 +3631,9 @@ INSERT vn.sale
|
||||||
SET id = 99997,
|
SET id = 99997,
|
||||||
itemFk = 999997,
|
itemFk = 999997,
|
||||||
ticketFk = 999999,
|
ticketFk = 999999,
|
||||||
concept = 'Palitos de polo MIX',
|
concept = 'Palitos de polo MIX',
|
||||||
quantity = 5,
|
quantity = 5,
|
||||||
price = 7,
|
price = 7,
|
||||||
discount = 0;
|
discount = 0;
|
||||||
|
|
||||||
USE vn;
|
USE vn;
|
||||||
|
@ -3668,38 +3666,38 @@ VALUES
|
||||||
|
|
||||||
-- Previous for Bolas de madera
|
-- Previous for Bolas de madera
|
||||||
INSERT IGNORE INTO vn.sectorCollection
|
INSERT IGNORE INTO vn.sectorCollection
|
||||||
SET id = 99,
|
SET id = 99,
|
||||||
userFk = 1,
|
userFk = 1,
|
||||||
sectorFk = 9992;
|
sectorFk = 9992;
|
||||||
|
|
||||||
INSERT IGNORE INTO vn.saleGroup
|
INSERT IGNORE INTO vn.saleGroup
|
||||||
SET id = 4,
|
SET id = 4,
|
||||||
userFk = 1,
|
userFk = 1,
|
||||||
parkingFk = 9,
|
parkingFk = 9,
|
||||||
sectorFk = 9992;
|
sectorFk = 9992;
|
||||||
|
|
||||||
INSERT IGNORE INTO vn.sectorCollectionSaleGroup
|
INSERT IGNORE INTO vn.sectorCollectionSaleGroup
|
||||||
SET id = 9999,
|
SET id = 9999,
|
||||||
sectorCollectionFk = 99,
|
sectorCollectionFk = 99,
|
||||||
saleGroupFk = 999;
|
saleGroupFk = 999;
|
||||||
|
|
||||||
INSERT vn.saleGroupDetail
|
INSERT vn.saleGroupDetail
|
||||||
SET id = 99991,
|
SET id = 99991,
|
||||||
saleFk = 99996,
|
saleFk = 99996,
|
||||||
saleGroupFk = 999;
|
saleGroupFk = 999;
|
||||||
|
|
||||||
INSERT INTO vn.saleTracking
|
INSERT INTO vn.saleTracking
|
||||||
SET id = 7,
|
SET id = 7,
|
||||||
saleFk = 99996,
|
saleFk = 99996,
|
||||||
isChecked = TRUE,
|
isChecked = TRUE,
|
||||||
workerFk = 103,
|
workerFk = 103,
|
||||||
stateFk = 28;
|
stateFk = 28;
|
||||||
|
|
||||||
INSERT IGNORE INTO vn.itemShelvingSale
|
INSERT IGNORE INTO vn.itemShelvingSale
|
||||||
SET id = 991,
|
SET id = 991,
|
||||||
itemShelvingFk = 9962,
|
itemShelvingFk = 9962,
|
||||||
saleFk = 99996,
|
saleFk = 99996,
|
||||||
quantity = 5,
|
quantity = 5,
|
||||||
userFk = 1;
|
userFk = 1;
|
||||||
|
|
||||||
UPDATE vn.ticket
|
UPDATE vn.ticket
|
||||||
|
@ -3734,4 +3732,8 @@ INSERT INTO vn.report (name) VALUES ('LabelCollection');
|
||||||
INSERT INTO vn.parkingLog(originFk, userFk, `action`, creationDate, description, changedModel,oldInstance, newInstance, changedModelId, changedModelValue)
|
INSERT INTO vn.parkingLog(originFk, userFk, `action`, creationDate, description, changedModel,oldInstance, newInstance, changedModelId, changedModelValue)
|
||||||
VALUES(1, 18, 'update', util.VN_CURDATE(), NULL, 'SaleGroup', '{"parkingFk":null}', '{"parkingFk":1}', 1, NULL);
|
VALUES(1, 18, 'update', util.VN_CURDATE(), NULL, 'SaleGroup', '{"parkingFk":null}', '{"parkingFk":1}', 1, NULL);
|
||||||
|
|
||||||
INSERT INTO `vn`.`ledgerConfig` (lastBookEntry, maxTolerance) VALUES (2,0.01);
|
INSERT INTO vn.ticketLog (originFk,userFk,`action`,creationDate,changedModel,newInstance,changedModelId,changedModelValue)
|
||||||
|
VALUES (18,9,'insert','2001-01-01 11:01:00.000','Ticket','{"isDeleted":true}',45,'Super Man');
|
||||||
|
|
||||||
|
INSERT INTO `vn`.`ledgerConfig` (lastBookEntry, maxTolerance) VALUES (2,0.01);
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@ BEGIN
|
||||||
LEFT JOIN origin o ON o.id = i.originFk
|
LEFT JOIN origin o ON o.id = i.originFk
|
||||||
) ON it.id = i.typeFk
|
) ON it.id = i.typeFk
|
||||||
LEFT JOIN edi.ekt ek ON b.ektFk = ek.id
|
LEFT JOIN edi.ekt ek ON b.ektFk = ek.id
|
||||||
WHERE (b.packagingFk = "--" OR b.price2 = 0 OR b.packing = 0 OR b.buyingValue = 0) AND tr.landed > util.firstDayOfMonth(TIMESTAMPADD(MONTH,-1,util.VN_CURDATE())) AND s.name = 'INVENTARIO';
|
WHERE (b.packagingFk = "--" OR b.price2 = 0 OR b.buyingValue = 0) AND tr.landed > util.firstDayOfMonth(TIMESTAMPADD(MONTH,-1,util.VN_CURDATE())) AND s.name = 'INVENTARIO';
|
||||||
|
|
||||||
DROP TEMPORARY TABLE IF EXISTS tmp.lastEntryOk;
|
DROP TEMPORARY TABLE IF EXISTS tmp.lastEntryOk;
|
||||||
CREATE TEMPORARY TABLE tmp.lastEntryOk
|
CREATE TEMPORARY TABLE tmp.lastEntryOk
|
||||||
|
@ -94,11 +94,6 @@ BEGIN
|
||||||
JOIN tmp.lastEntryOkGroup eo ON eo.itemFk = lt.itemFk AND eo.warehouseFk = lt.warehouseFk
|
JOIN tmp.lastEntryOkGroup eo ON eo.itemFk = lt.itemFk AND eo.warehouseFk = lt.warehouseFk
|
||||||
SET b.price2 = eo.price2 WHERE b.price2 = 0 ;
|
SET b.price2 = eo.price2 WHERE b.price2 = 0 ;
|
||||||
|
|
||||||
UPDATE buy b
|
|
||||||
JOIN tmp.lastEntry lt ON lt.buyFk = b.id
|
|
||||||
JOIN tmp.lastEntryOkGroup eo ON eo.itemFk = lt.itemFk AND eo.warehouseFk = lt.warehouseFk
|
|
||||||
SET b.packing = eo.packing WHERE b.packing = 0;
|
|
||||||
|
|
||||||
UPDATE buy b
|
UPDATE buy b
|
||||||
JOIN tmp.lastEntry lt ON lt.buyFk = b.id
|
JOIN tmp.lastEntry lt ON lt.buyFk = b.id
|
||||||
JOIN tmp.lastEntryOkGroup eo ON eo.itemFk = lt.itemFk AND eo.warehouseFk = lt.warehouseFk
|
JOIN tmp.lastEntryOkGroup eo ON eo.itemFk = lt.itemFk AND eo.warehouseFk = lt.warehouseFk
|
||||||
|
|
|
@ -1,8 +1,11 @@
|
||||||
DELIMITER $$
|
DELIMITER $$
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`invoiceInTaxMakeByDua`(vDuaFk INT)
|
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`invoiceInTaxMakeByDua`(
|
||||||
|
vDuaFk INT
|
||||||
|
)
|
||||||
BEGIN
|
BEGIN
|
||||||
/**
|
/**
|
||||||
* Borra los valores de duaTax y sus vctos. y los vuelve a crear en base a la tabla duaEntry
|
* Borra los valores de duaTax y sus vctos. y los vuelve a
|
||||||
|
* crear en base a la tabla duaEntry.
|
||||||
*
|
*
|
||||||
* @param vDuaFk Id del dua a recalcular
|
* @param vDuaFk Id del dua a recalcular
|
||||||
*/
|
*/
|
||||||
|
@ -26,7 +29,7 @@ BEGIN
|
||||||
LEAVE l;
|
LEAVE l;
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
CALL vn2008.recibidaIvaInsert(vInvoiceInFk);
|
CALL invoiceInTax_recalc(vInvoiceInFk);
|
||||||
CALL invoiceInDueDay_recalc(vInvoiceInFk);
|
CALL invoiceInDueDay_recalc(vInvoiceInFk);
|
||||||
|
|
||||||
END LOOP;
|
END LOOP;
|
||||||
|
|
|
@ -0,0 +1,62 @@
|
||||||
|
DELIMITER $$
|
||||||
|
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`invoiceInTax_recalc`(
|
||||||
|
vInvoiceInFk INT
|
||||||
|
)
|
||||||
|
BEGIN
|
||||||
|
/**
|
||||||
|
* Recalcula y actualiza los impuestos de la factura
|
||||||
|
* usando la última tasa de cambio y detalles de compra.
|
||||||
|
*
|
||||||
|
* @param vInvoiceInFk Id de factura recibida
|
||||||
|
*/
|
||||||
|
DECLARE vRate DOUBLE DEFAULT 1;
|
||||||
|
DECLARE vDated DATE;
|
||||||
|
DECLARE vExpenseFk INT;
|
||||||
|
|
||||||
|
SELECT MAX(rr.dated) INTO vDated
|
||||||
|
FROM referenceRate rr
|
||||||
|
JOIN invoiceIn ii ON ii.id = vInvoiceInFk
|
||||||
|
WHERE rr.dated <= ii.issued
|
||||||
|
AND rr.currencyFk = ii.currencyFk;
|
||||||
|
|
||||||
|
IF vDated THEN
|
||||||
|
SELECT `value` INTO vRate
|
||||||
|
FROM referenceRate
|
||||||
|
WHERE dated = vDated;
|
||||||
|
END IF;
|
||||||
|
|
||||||
|
DELETE FROM invoiceInTax WHERE invoiceInFk = vInvoiceInFk;
|
||||||
|
|
||||||
|
SELECT id INTO vExpenseFk
|
||||||
|
FROM expense
|
||||||
|
WHERE code = 'extraCommGoodsAcquisition';
|
||||||
|
|
||||||
|
IF vExpenseFk IS NULL THEN
|
||||||
|
CALL util.throw('Expense extraCommGoodsAcquisition not exists');
|
||||||
|
END IF;
|
||||||
|
|
||||||
|
INSERT INTO invoiceInTax(
|
||||||
|
invoiceInFk,
|
||||||
|
taxableBase,
|
||||||
|
expenseFk,
|
||||||
|
foreignValue,
|
||||||
|
taxTypeSageFk,
|
||||||
|
transactionTypeSageFk
|
||||||
|
)
|
||||||
|
SELECT ii.id,
|
||||||
|
SUM(b.buyingValue * b.quantity) / vRate bi,
|
||||||
|
vExpenseFk,
|
||||||
|
IF(c.code = 'EUR', NULL, SUM(b.buyingValue * b.quantity)),
|
||||||
|
s.taxTypeSageFk,
|
||||||
|
s.transactionTypeSageFk
|
||||||
|
FROM invoiceIn ii
|
||||||
|
JOIN currency c ON c.id = ii.currencyFk
|
||||||
|
JOIN `entry` e ON e.invoiceInFk = ii.id
|
||||||
|
JOIN supplier s ON s.id = e.supplierFk
|
||||||
|
JOIN buy b ON b.entryFk = e.id
|
||||||
|
LEFT JOIN referenceRate rr ON rr.currencyFk = ii.currencyFk
|
||||||
|
AND rr.dated = ii.issued
|
||||||
|
WHERE ii.id = vInvoiceInFk
|
||||||
|
HAVING bi IS NOT NULL;
|
||||||
|
END$$
|
||||||
|
DELIMITER ;
|
|
@ -1,25 +0,0 @@
|
||||||
DELIMITER $$
|
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn2008`.`ListaTicketsEncajados`(IN intId_Trabajador int)
|
|
||||||
BEGIN
|
|
||||||
|
|
||||||
SELECT Agencia,
|
|
||||||
Consignatario,
|
|
||||||
ti.Id_Ticket,
|
|
||||||
ts.userFk Id_Trabajador,
|
|
||||||
IFNULL(ncajas,0) AS ncajas,
|
|
||||||
IFNULL(nbultos,0) AS nbultos,
|
|
||||||
IFNULL(notros,0) AS notros,
|
|
||||||
ts.code AS Estado
|
|
||||||
FROM Tickets ti
|
|
||||||
INNER JOIN Consignatarios ON ti.Id_Consigna = Consignatarios.Id_consigna
|
|
||||||
INNER JOIN Agencias ON ti.Id_Agencia = Agencias.Id_Agencia
|
|
||||||
LEFT JOIN (SELECT ticketFk,count(*) AS ncajas FROM vn.expedition WHERE packagingFk=94 GROUP BY ticketFk) sub1 ON ti.Id_Ticket=sub1.ticketFk
|
|
||||||
LEFT JOIN (SELECT ticketFk,count(*) AS nbultos FROM vn.expedition WHERE packagingFk IS NULL GROUP BY ticketFk) sub2 ON ti.Id_Ticket=sub2.ticketFk
|
|
||||||
LEFT JOIN (SELECT ticketFk,count(*) AS notros FROM vn.expedition WHERE packagingFk >0 GROUP BY ticketFk) sub3 ON ti.Id_Ticket=sub3.ticketFk
|
|
||||||
INNER JOIN vn.ticketState ts ON ti.Id_ticket = ts.ticketFk
|
|
||||||
WHERE ti.Fecha=util.VN_CURDATE() AND
|
|
||||||
ts.userFk=intId_Trabajador
|
|
||||||
GROUP BY ti.Id_Ticket;
|
|
||||||
|
|
||||||
END$$
|
|
||||||
DELIMITER ;
|
|
|
@ -1,49 +0,0 @@
|
||||||
DELIMITER $$
|
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn2008`.`customerDebtEvolution`(IN vCustomer INT)
|
|
||||||
BEGIN
|
|
||||||
|
|
||||||
SELECT * FROM
|
|
||||||
(
|
|
||||||
SELECT day, date, @s:= round(IFNULL(Euros,0) + @s,2) as Saldo, Euros, Credito, 0 as Cero
|
|
||||||
FROM
|
|
||||||
(
|
|
||||||
SELECT day, date, IFNULL(Euros,0) as Euros, Credito
|
|
||||||
FROM time
|
|
||||||
JOIN (SELECT @s:= 0, - Credito as Credito FROM Clientes WHERE Id_Cliente = vCustomer) c
|
|
||||||
LEFT JOIN
|
|
||||||
(SELECT Euros, date(Fecha) as Fecha FROM
|
|
||||||
(
|
|
||||||
SELECT Fechacobro as Fecha, Entregado as Euros
|
|
||||||
FROM Recibos
|
|
||||||
WHERE Id_Cliente = vCustomer
|
|
||||||
AND Fechacobro >= '2017-01-01'
|
|
||||||
UNION ALL
|
|
||||||
SELECT vn.getDueDate(io.issued,c.Vencimiento), - io.amount
|
|
||||||
FROM vn.invoiceOut io
|
|
||||||
JOIN Clientes c ON io.clientFk = c.Id_Cliente
|
|
||||||
WHERE io.clientFk = vCustomer
|
|
||||||
AND io.issued >= '2017-01-01'
|
|
||||||
UNION ALL
|
|
||||||
SELECT '2016-12-31', Debt
|
|
||||||
FROM bi.customerDebtInventory
|
|
||||||
WHERE Id_Cliente = vCustomer
|
|
||||||
UNION ALL
|
|
||||||
SELECT Fecha, - SUM(Cantidad * Preu * (100 - Descuento ) * 1.10 / 100)
|
|
||||||
FROM Tickets t
|
|
||||||
JOIN Movimientos m on m.Id_Ticket = t.Id_Ticket
|
|
||||||
WHERE Id_Cliente = vCustomer
|
|
||||||
AND Factura IS NULL
|
|
||||||
AND Fecha >= '2017-01-01'
|
|
||||||
GROUP BY Fecha
|
|
||||||
) sub2
|
|
||||||
ORDER BY Fecha
|
|
||||||
)sub ON time.date = sub.Fecha
|
|
||||||
WHERE time.date BETWEEN '2016-12-31' AND util.VN_CURDATE()
|
|
||||||
ORDER BY date
|
|
||||||
) sub3
|
|
||||||
)sub4
|
|
||||||
;
|
|
||||||
|
|
||||||
|
|
||||||
END$$
|
|
||||||
DELIMITER ;
|
|
|
@ -1,22 +0,0 @@
|
||||||
DELIMITER $$
|
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn2008`.`preOrdenarRuta`(IN vRutaId INT)
|
|
||||||
BEGIN
|
|
||||||
/* Usa los valores del ultimo año para adivinar el orden de los tickets en la ruta
|
|
||||||
* vRutaId id ruta
|
|
||||||
* DEPRECATED use vn.routeGressPriority
|
|
||||||
*/
|
|
||||||
|
|
||||||
UPDATE Tickets mt
|
|
||||||
JOIN (
|
|
||||||
SELECT tt.Id_Consigna, round(ifnull(avg(t.Prioridad),0),0) as Prioridad
|
|
||||||
from Tickets t
|
|
||||||
JOIN Tickets tt on tt.Id_Consigna = t.Id_Consigna
|
|
||||||
where t.Fecha > TIMESTAMPADD(YEAR,-1,util.VN_CURDATE())
|
|
||||||
AND tt.Id_Ruta = vRutaId
|
|
||||||
GROUP BY Id_Consigna
|
|
||||||
) sub ON sub.Id_Consigna = mt.Id_Consigna
|
|
||||||
SET mt.Prioridad = sub.Prioridad
|
|
||||||
WHERE mt.Id_Ruta = vRutaId;
|
|
||||||
|
|
||||||
END$$
|
|
||||||
DELIMITER ;
|
|
|
@ -1,22 +0,0 @@
|
||||||
DELIMITER $$
|
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn2008`.`prepare_ticket_list`(vStartingDate DATETIME, vEndingDate DATETIME)
|
|
||||||
BEGIN
|
|
||||||
DROP TEMPORARY TABLE IF EXISTS tmp.ticket_list;
|
|
||||||
CREATE TEMPORARY TABLE tmp.ticket_list
|
|
||||||
(PRIMARY KEY (Id_Ticket))
|
|
||||||
ENGINE = MEMORY
|
|
||||||
SELECT t.Id_Ticket, c.Id_Cliente
|
|
||||||
FROM Tickets t
|
|
||||||
LEFT JOIN vn.ticketState ts ON ts.ticketFk = t.Id_Ticket
|
|
||||||
JOIN Clientes c ON c.Id_Cliente = t.Id_Cliente
|
|
||||||
WHERE c.typeFk IN ('normal','handMaking','internalUse')
|
|
||||||
AND (
|
|
||||||
Fecha BETWEEN util.today() AND vEndingDate
|
|
||||||
OR (
|
|
||||||
ts.alertLevel < 3
|
|
||||||
AND t.Fecha >= vStartingDate
|
|
||||||
AND t.Fecha < util.today()
|
|
||||||
)
|
|
||||||
);
|
|
||||||
END$$
|
|
||||||
DELIMITER ;
|
|
|
@ -1,39 +0,0 @@
|
||||||
DELIMITER $$
|
|
||||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn2008`.`recibidaIvaInsert`(IN vId INT)
|
|
||||||
BEGIN
|
|
||||||
|
|
||||||
DECLARE vRate DOUBLE DEFAULT 1;
|
|
||||||
DECLARE vDated DATE;
|
|
||||||
|
|
||||||
SELECT MAX(rr.date) INTO vDated
|
|
||||||
FROM reference_rate rr
|
|
||||||
JOIN recibida r ON r.id = vId
|
|
||||||
WHERE rr.date <= r.fecha
|
|
||||||
AND rr.moneda_id = r.moneda_id ;
|
|
||||||
|
|
||||||
IF vDated THEN
|
|
||||||
|
|
||||||
SELECT rate INTO vRate
|
|
||||||
FROM reference_rate
|
|
||||||
WHERE `date` = vDated;
|
|
||||||
END IF;
|
|
||||||
|
|
||||||
DELETE FROM recibida_iva WHERE recibida_id = vId;
|
|
||||||
|
|
||||||
INSERT INTO recibida_iva(recibida_id, bi, gastos_id, divisa, taxTypeSageFk, transactionTypeSageFk)
|
|
||||||
SELECT r.id,
|
|
||||||
SUM(Costefijo * Cantidad) / IFNULL(vRate,1) bi,
|
|
||||||
6003000000,
|
|
||||||
IF(r.moneda_id = 1,NULL,SUM(Costefijo * Cantidad )) divisa,
|
|
||||||
taxTypeSageFk,
|
|
||||||
transactionTypeSageFk
|
|
||||||
FROM recibida r
|
|
||||||
JOIN Entradas e ON e.recibida_id = r.id
|
|
||||||
JOIN Proveedores p ON p.Id_Proveedor = e.Id_Proveedor
|
|
||||||
JOIN Compres c ON c.Id_Entrada = e.Id_Entrada
|
|
||||||
LEFT JOIN reference_rate rr ON rr.moneda_id = r.moneda_id AND rr.date = r.fecha
|
|
||||||
WHERE r.id = vId
|
|
||||||
HAVING bi IS NOT NULL;
|
|
||||||
|
|
||||||
END$$
|
|
||||||
DELIMITER ;
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
SET @isTriggerDisabled := TRUE;
|
||||||
|
|
||||||
|
UPDATE vn.buy
|
||||||
|
SET packing = 1
|
||||||
|
WHERE packing IS NULL
|
||||||
|
OR packing <= 0;
|
||||||
|
|
||||||
|
UPDATE vn.itemShelving
|
||||||
|
SET packing = 1
|
||||||
|
WHERE packing IS NULL
|
||||||
|
OR NOT packing;
|
||||||
|
|
||||||
|
SET @isTriggerDisabled := FALSE;
|
||||||
|
|
||||||
|
ALTER TABLE vn.buy MODIFY COLUMN packing int(11) NOT NULL CHECK(packing > 0);
|
||||||
|
ALTER TABLE vn.itemShelving MODIFY COLUMN packing int(11) NOT NULL CHECK(packing > 0);
|
||||||
|
|
||||||
|
-- Antes tenia '0=sin obligar 1=groping 2=packing' (groping → grouping)
|
||||||
|
ALTER TABLE vn.buy MODIFY COLUMN groupingMode tinyint(4) DEFAULT 0 NOT NULL COMMENT '0=sin obligar 1=grouping 2=packing';
|
|
@ -0,0 +1,36 @@
|
||||||
|
USE vn;
|
||||||
|
|
||||||
|
CREATE OR REPLACE TABLE vn.workerActivityType (
|
||||||
|
`code` varchar(20) NOT NULL,
|
||||||
|
`description` varchar(45) NOT NULL,
|
||||||
|
PRIMARY KEY (`code`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
|
||||||
|
|
||||||
|
ALTER TABLE vn.department ADD workerActivityTypeFk varchar(20) NULL COMMENT 'Indica la actitividad que desempeña por defecto ese departamento';
|
||||||
|
ALTER TABLE vn.department ADD CONSTRAINT department_workerActivityType_FK FOREIGN KEY (workerActivityTypeFk) REFERENCES vn.workerActivityType(code) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
INSERT INTO vn.workerActivityType (code, description) VALUES('ON_CHECKING', 'REVISION');
|
||||||
|
INSERT INTO vn.workerActivityType (code, description) VALUES('PREVIOUS_CAM', 'CAMARA');
|
||||||
|
INSERT INTO vn.workerActivityType (code, description) VALUES('PREVIOUS_ART', 'ARTIFICIAL');
|
||||||
|
INSERT INTO vn.workerActivityType (code, description) VALUES('ON_PREPARATION', 'SACADO');
|
||||||
|
INSERT INTO vn.workerActivityType (code, description) VALUES('PACKING', 'ENCAJADO');
|
||||||
|
INSERT INTO vn.workerActivityType (code, description) VALUES('FIELD', 'CAMPOS');
|
||||||
|
INSERT INTO vn.workerActivityType (code, description) VALUES('DELIVERY', 'REPARTO');
|
||||||
|
INSERT INTO vn.workerActivityType (code, description) VALUES('STORAGE', 'ALMACENAJE');
|
||||||
|
INSERT INTO vn.workerActivityType (code, description) VALUES('PALLETIZING', 'PALETIZADO');
|
||||||
|
INSERT INTO vn.workerActivityType (code, description) VALUES('STOP', 'PARADA');
|
||||||
|
|
||||||
|
|
||||||
|
INSERT INTO salix.ACL ( model, property, accessType, permission, principalType, principalId) VALUES('WorkerActivityType', '*', 'READ', 'ALLOW', 'ROLE', 'production');
|
||||||
|
INSERT INTO salix.ACL ( model, property, accessType, permission, principalType, principalId) VALUES('WorkerActivity', '*', '*', 'ALLOW', 'ROLE', 'production');
|
||||||
|
|
||||||
|
|
||||||
|
ALTER TABLE vn.workerActivity MODIFY COLUMN event enum('open','close','insert','delete','update','refresh') CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci NULL;
|
||||||
|
ALTER TABLE vn.workerActivity MODIFY COLUMN model enum('COM','ENT','TPV','ENC','LAB','ETI','APP') CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci NOT NULL;
|
||||||
|
|
||||||
|
|
||||||
|
ALTER TABLE vn.workerActivity ADD workerActivityTypeFk varchar(20) NULL;
|
||||||
|
ALTER TABLE vn.workerActivity ADD CONSTRAINT workerActivity_workerActivityType_FK FOREIGN KEY (workerActivityTypeFk) REFERENCES vn.workerActivityType(code) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
-- Place your SQL code here
|
||||||
|
|
||||||
|
|
|
@ -83,22 +83,27 @@ export default class Auth {
|
||||||
}
|
}
|
||||||
|
|
||||||
onLoginOk(json, now, remember) {
|
onLoginOk(json, now, remember) {
|
||||||
this.vnToken.set(json.data.token, now, json.data.ttl, remember);
|
return this.$http.get('VnUsers/ShareToken', {
|
||||||
|
headers: {Authorization: json.data.token}
|
||||||
return this.loadAcls().then(() => {
|
}).then(({data}) => {
|
||||||
let continueHash = this.$state.params.continue;
|
this.vnToken.set(json.data.token, data.multimediaToken.id, now, json.data.ttl, remember);
|
||||||
if (continueHash)
|
this.loadAcls().then(() => {
|
||||||
this.$window.location = continueHash;
|
let continueHash = this.$state.params.continue;
|
||||||
else
|
if (continueHash)
|
||||||
this.$state.go('home');
|
this.$window.location = continueHash;
|
||||||
});
|
else
|
||||||
|
this.$state.go('home');
|
||||||
|
});
|
||||||
|
}).catch(() => {});
|
||||||
}
|
}
|
||||||
|
|
||||||
logout() {
|
logout() {
|
||||||
|
this.$http.post('Accounts/logout', null, {headers: {'Authorization': this.vnToken.tokenMultimedia},
|
||||||
|
}).catch(() => {});
|
||||||
|
|
||||||
let promise = this.$http.post('VnUsers/logout', null, {
|
let promise = this.$http.post('VnUsers/logout', null, {
|
||||||
headers: {Authorization: this.vnToken.token}
|
headers: {Authorization: this.vnToken.token}
|
||||||
}).catch(() => {});
|
}).catch(() => {});
|
||||||
|
|
||||||
this.vnToken.unset();
|
this.vnToken.unset();
|
||||||
this.loggedIn = false;
|
this.loggedIn = false;
|
||||||
this.vnModules.reset();
|
this.vnModules.reset();
|
||||||
|
|
|
@ -19,7 +19,7 @@ function interceptor($q, vnApp, $translate) {
|
||||||
|
|
||||||
if (config.url.charAt(0) !== '/' && apiPath)
|
if (config.url.charAt(0) !== '/' && apiPath)
|
||||||
config.url = `${apiPath}${config.url}`;
|
config.url = `${apiPath}${config.url}`;
|
||||||
if (token)
|
if (token && !config.headers.Authorization)
|
||||||
config.headers.Authorization = token;
|
config.headers.Authorization = token;
|
||||||
if ($translate.use())
|
if ($translate.use())
|
||||||
config.headers['Accept-Language'] = $translate.use();
|
config.headers['Accept-Language'] = $translate.use();
|
||||||
|
|
|
@ -24,21 +24,22 @@ export default class Token {
|
||||||
} catch (e) {}
|
} catch (e) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
set(token, created, ttl, remember) {
|
set(token, tokenMultimedia, created, ttl, remember) {
|
||||||
this.unset();
|
this.unset();
|
||||||
|
|
||||||
Object.assign(this, {
|
Object.assign(this, {
|
||||||
token,
|
token,
|
||||||
|
tokenMultimedia,
|
||||||
created,
|
created,
|
||||||
ttl,
|
ttl,
|
||||||
remember
|
remember
|
||||||
});
|
});
|
||||||
this.vnInterceptor.setToken(token);
|
this.vnInterceptor.setToken(token, tokenMultimedia);
|
||||||
try {
|
try {
|
||||||
if (remember)
|
if (remember)
|
||||||
this.setStorage(localStorage, token, created, ttl);
|
this.setStorage(localStorage, token, tokenMultimedia, created, ttl);
|
||||||
else
|
else
|
||||||
this.setStorage(sessionStorage, token, created, ttl);
|
this.setStorage(sessionStorage, token, tokenMultimedia, created, ttl);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
}
|
}
|
||||||
|
@ -46,6 +47,7 @@ export default class Token {
|
||||||
|
|
||||||
unset() {
|
unset() {
|
||||||
this.token = null;
|
this.token = null;
|
||||||
|
this.tokenMultimedia = null;
|
||||||
this.created = null;
|
this.created = null;
|
||||||
this.ttl = null;
|
this.ttl = null;
|
||||||
this.remember = null;
|
this.remember = null;
|
||||||
|
@ -57,13 +59,15 @@ export default class Token {
|
||||||
|
|
||||||
getStorage(storage) {
|
getStorage(storage) {
|
||||||
this.token = storage.getItem('vnToken');
|
this.token = storage.getItem('vnToken');
|
||||||
|
this.tokenMultimedia = storage.getItem('vnTokenMultimedia');
|
||||||
if (!this.token) return;
|
if (!this.token) return;
|
||||||
const created = storage.getItem('vnTokenCreated');
|
const created = storage.getItem('vnTokenCreated');
|
||||||
this.created = created && new Date(created);
|
this.created = created && new Date(created);
|
||||||
this.ttl = storage.getItem('vnTokenTtl');
|
this.ttl = storage.getItem('vnTokenTtl');
|
||||||
}
|
}
|
||||||
|
|
||||||
setStorage(storage, token, created, ttl) {
|
setStorage(storage, token, tokenMultimedia, created, ttl) {
|
||||||
|
storage.setItem('vnTokenMultimedia', tokenMultimedia);
|
||||||
storage.setItem('vnToken', token);
|
storage.setItem('vnToken', token);
|
||||||
storage.setItem('vnTokenCreated', created.toJSON());
|
storage.setItem('vnTokenCreated', created.toJSON());
|
||||||
storage.setItem('vnTokenTtl', ttl);
|
storage.setItem('vnTokenTtl', ttl);
|
||||||
|
@ -71,6 +75,7 @@ export default class Token {
|
||||||
|
|
||||||
removeStorage(storage) {
|
removeStorage(storage) {
|
||||||
storage.removeItem('vnToken');
|
storage.removeItem('vnToken');
|
||||||
|
storage.removeItem('vnTokenMultimedia');
|
||||||
storage.removeItem('vnTokenCreated');
|
storage.removeItem('vnTokenCreated');
|
||||||
storage.removeItem('vnTokenTtl');
|
storage.removeItem('vnTokenTtl');
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,8 +23,7 @@ export class Layout extends Component {
|
||||||
if (!this.$.$root.user) return;
|
if (!this.$.$root.user) return;
|
||||||
|
|
||||||
const userId = this.$.$root.user.id;
|
const userId = this.$.$root.user.id;
|
||||||
const token = this.vnToken.token;
|
return `/api/Images/user/160x160/${userId}/download?access_token=${this.vnToken.tokenMultimedia}`;
|
||||||
return `/api/Images/user/160x160/${userId}/download?access_token=${token}`;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
refresh() {
|
refresh() {
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
ng-click="$ctrl.showDescriptor($event, userLog)">
|
ng-click="$ctrl.showDescriptor($event, userLog)">
|
||||||
<img
|
<img
|
||||||
ng-if="::userLog.user.image"
|
ng-if="::userLog.user.image"
|
||||||
ng-src="/api/Images/user/160x160/{{::userLog.userFk}}/download?access_token={{::$ctrl.vnToken.token}}">
|
ng-src="/api/Images/user/160x160/{{::userLog.userFk}}/download?access_token={{::$ctrl.vnToken.tokenMultimedia}}">
|
||||||
</img>
|
</img>
|
||||||
</vn-avatar>
|
</vn-avatar>
|
||||||
</div>
|
</div>
|
||||||
|
@ -181,7 +181,7 @@
|
||||||
val="{{::nickname}}">
|
val="{{::nickname}}">
|
||||||
<img
|
<img
|
||||||
ng-if="::image"
|
ng-if="::image"
|
||||||
ng-src="/api/Images/user/160x160/{{::id}}/download?access_token={{::$ctrl.vnToken.token}}">
|
ng-src="/api/Images/user/160x160/{{::id}}/download?access_token={{::$ctrl.vnToken.tokenMultimedia}}">
|
||||||
</img>
|
</img>
|
||||||
</vn-avatar>
|
</vn-avatar>
|
||||||
<div>
|
<div>
|
||||||
|
|
|
@ -13,7 +13,7 @@ export function run($window, $rootScope, vnAuth, vnApp, vnToken, $state) {
|
||||||
if (!collection || !size || !id) return;
|
if (!collection || !size || !id) return;
|
||||||
|
|
||||||
const basePath = `/api/Images/${collection}/${size}/${id}`;
|
const basePath = `/api/Images/${collection}/${size}/${id}`;
|
||||||
return `${basePath}/download?access_token=${vnToken.token}`;
|
return `${basePath}/download?access_token=${vnToken.tokenMultimedia}`;
|
||||||
};
|
};
|
||||||
|
|
||||||
$window.validations = {};
|
$window.validations = {};
|
||||||
|
|
|
@ -15,7 +15,8 @@ module.exports = Self => {
|
||||||
http: {
|
http: {
|
||||||
path: `/logout`,
|
path: `/logout`,
|
||||||
verb: 'POST'
|
verb: 'POST'
|
||||||
}
|
},
|
||||||
|
accessScopes: ['DEFAULT', 'read:multimedia']
|
||||||
});
|
});
|
||||||
|
|
||||||
Self.logout = async ctx => Self.app.models.VnUser.logout(ctx.req.accessToken.id);
|
Self.logout = async ctx => Self.app.models.VnUser.logout(ctx.req.accessToken.id);
|
||||||
|
|
|
@ -32,7 +32,8 @@ module.exports = Self => {
|
||||||
http: {
|
http: {
|
||||||
path: `/:id/downloadFile`,
|
path: `/:id/downloadFile`,
|
||||||
verb: 'GET'
|
verb: 'GET'
|
||||||
}
|
},
|
||||||
|
accessScopes: ['read:multimedia']
|
||||||
});
|
});
|
||||||
|
|
||||||
Self.downloadFile = async function(ctx, id) {
|
Self.downloadFile = async function(ctx, id) {
|
||||||
|
|
|
@ -114,7 +114,7 @@
|
||||||
<vn-td center shrink>
|
<vn-td center shrink>
|
||||||
<a ng-show="balance.hasPdf"
|
<a ng-show="balance.hasPdf"
|
||||||
target="_blank"
|
target="_blank"
|
||||||
href="api/InvoiceOuts/{{::balance.id}}/download?access_token={{::$ctrl.vnToken.token}}">
|
href="api/InvoiceOuts/{{::balance.id}}/download?access_token={{::$ctrl.vnToken.tokenMultimedia}}">
|
||||||
<vn-icon-button
|
<vn-icon-button
|
||||||
icon="cloud_download"
|
icon="cloud_download"
|
||||||
title="{{'Download PDF' | translate}}">
|
title="{{'Download PDF' | translate}}">
|
||||||
|
|
|
@ -31,7 +31,8 @@ module.exports = Self => {
|
||||||
http: {
|
http: {
|
||||||
path: '/:id/download',
|
path: '/:id/download',
|
||||||
verb: 'GET'
|
verb: 'GET'
|
||||||
}
|
},
|
||||||
|
accessScopes: ['read:multimedia']
|
||||||
});
|
});
|
||||||
|
|
||||||
Self.download = async function(ctx, id, options) {
|
Self.download = async function(ctx, id, options) {
|
||||||
|
|
|
@ -31,7 +31,8 @@ module.exports = Self => {
|
||||||
http: {
|
http: {
|
||||||
path: '/downloadZip',
|
path: '/downloadZip',
|
||||||
verb: 'GET'
|
verb: 'GET'
|
||||||
}
|
},
|
||||||
|
accessScopes: ['read:multimedia']
|
||||||
});
|
});
|
||||||
|
|
||||||
Self.downloadZip = async function(ctx, ids, options) {
|
Self.downloadZip = async function(ctx, ids, options) {
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
<vn-menu vn-id="showInvoiceMenu">
|
<vn-menu vn-id="showInvoiceMenu">
|
||||||
<vn-list>
|
<vn-list>
|
||||||
<a class="vn-item"
|
<a class="vn-item"
|
||||||
href="api/InvoiceOuts/{{$ctrl.id}}/download?access_token={{$ctrl.vnToken.token}}"
|
href="api/InvoiceOuts/{{$ctrl.id}}/download?access_token={{$ctrl.vnToken.tokenMultimedia}}"
|
||||||
target="_blank"
|
target="_blank"
|
||||||
name="showInvoicePdf"
|
name="showInvoicePdf"
|
||||||
translate>
|
translate>
|
||||||
|
@ -102,7 +102,7 @@
|
||||||
</vn-item>
|
</vn-item>
|
||||||
<vn-item class="dropdown"
|
<vn-item class="dropdown"
|
||||||
vn-click-stop="refundMenu.show($event, 'left')"
|
vn-click-stop="refundMenu.show($event, 'left')"
|
||||||
vn-tooltip="Create a single ticket with all the content of the current invoice"
|
vn-tooltip="Create a refund ticket for each ticket on the current invoice"
|
||||||
vn-acl="invoicing, claimManager, salesAssistant"
|
vn-acl="invoicing, claimManager, salesAssistant"
|
||||||
vn-acl-action="remove"
|
vn-acl-action="remove"
|
||||||
translate>
|
translate>
|
||||||
|
|
|
@ -118,11 +118,14 @@ class Controller extends Section {
|
||||||
const query = 'InvoiceOuts/refund';
|
const query = 'InvoiceOuts/refund';
|
||||||
const params = {ref: this.invoiceOut.ref, withWarehouse: withWarehouse};
|
const params = {ref: this.invoiceOut.ref, withWarehouse: withWarehouse};
|
||||||
this.$http.post(query, params).then(res => {
|
this.$http.post(query, params).then(res => {
|
||||||
const refundTicket = res.data;
|
const tickets = res.data;
|
||||||
this.vnApp.showSuccess(this.$t('The following refund ticket have been created', {
|
const refundTickets = tickets.map(ticket => ticket.id);
|
||||||
ticketId: refundTicket.id
|
|
||||||
|
this.vnApp.showSuccess(this.$t('The following refund tickets have been created', {
|
||||||
|
ticketId: refundTickets.join(',')
|
||||||
}));
|
}));
|
||||||
this.$state.go('ticket.card.sale', {id: refundTicket.id});
|
if (refundTickets.length == 1)
|
||||||
|
this.$state.go('ticket.card.sale', {id: refundTickets[0]});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ Are you sure you want to clone this invoice?: Estas seguro de clonar esta factur
|
||||||
InvoiceOut booked: Factura asentada
|
InvoiceOut booked: Factura asentada
|
||||||
Are you sure you want to book this invoice?: Estas seguro de querer asentar esta factura?
|
Are you sure you want to book this invoice?: Estas seguro de querer asentar esta factura?
|
||||||
Are you sure you want to refund this invoice?: Estas seguro de querer abonar esta factura?
|
Are you sure you want to refund this invoice?: Estas seguro de querer abonar esta factura?
|
||||||
Create a single ticket with all the content of the current invoice: Crear un ticket unico con todo el contenido de la factura actual
|
Create a refund ticket for each ticket on the current invoice: Crear un ticket abono por cada ticket de la factura actual
|
||||||
Regenerate PDF invoice: Regenerar PDF factura
|
Regenerate PDF invoice: Regenerar PDF factura
|
||||||
The invoice PDF document has been regenerated: El documento PDF de la factura ha sido regenerado
|
The invoice PDF document has been regenerated: El documento PDF de la factura ha sido regenerado
|
||||||
The email can't be empty: El correo no puede estar vacío
|
The email can't be empty: El correo no puede estar vacío
|
||||||
|
|
|
@ -25,7 +25,7 @@ export default class Controller extends Section {
|
||||||
openPdf() {
|
openPdf() {
|
||||||
if (this.checked.length <= 1) {
|
if (this.checked.length <= 1) {
|
||||||
const [invoiceOutId] = this.checked;
|
const [invoiceOutId] = this.checked;
|
||||||
const url = `api/InvoiceOuts/${invoiceOutId}/download?access_token=${this.vnToken.token}`;
|
const url = `api/InvoiceOuts/${invoiceOutId}/download?access_token=${this.vnToken.tokenMultimedia}`;
|
||||||
window.open(url, '_blank');
|
window.open(url, '_blank');
|
||||||
} else {
|
} else {
|
||||||
const invoiceOutIds = this.checked;
|
const invoiceOutIds = this.checked;
|
||||||
|
|
|
@ -11,6 +11,7 @@ module.exports = Self => {
|
||||||
path: `/download`,
|
path: `/download`,
|
||||||
verb: 'POST',
|
verb: 'POST',
|
||||||
},
|
},
|
||||||
|
accessScopes: ['read:multimedia']
|
||||||
});
|
});
|
||||||
|
|
||||||
Self.download = async() => {
|
Self.download = async() => {
|
||||||
|
|
|
@ -29,7 +29,8 @@ module.exports = Self => {
|
||||||
http: {
|
http: {
|
||||||
path: '/downloadCmrsZip',
|
path: '/downloadCmrsZip',
|
||||||
verb: 'GET'
|
verb: 'GET'
|
||||||
}
|
},
|
||||||
|
accessScopes: ['read:multimedia']
|
||||||
});
|
});
|
||||||
|
|
||||||
Self.downloadCmrsZip = async function(ctx, ids, options) {
|
Self.downloadCmrsZip = async function(ctx, ids, options) {
|
||||||
|
|
|
@ -29,7 +29,8 @@ module.exports = Self => {
|
||||||
http: {
|
http: {
|
||||||
path: '/downloadZip',
|
path: '/downloadZip',
|
||||||
verb: 'GET'
|
verb: 'GET'
|
||||||
}
|
},
|
||||||
|
accessScopes: ['read:multimedia']
|
||||||
});
|
});
|
||||||
|
|
||||||
Self.downloadZip = async function(ctx, id, options) {
|
Self.downloadZip = async function(ctx, id, options) {
|
||||||
|
|
|
@ -34,7 +34,9 @@ module.exports = Self => {
|
||||||
http: {
|
http: {
|
||||||
path: '/:id/driver-route-pdf',
|
path: '/:id/driver-route-pdf',
|
||||||
verb: 'GET'
|
verb: 'GET'
|
||||||
}
|
},
|
||||||
|
accessScopes: ['read:multimedia']
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
Self.driverRoutePdf = (ctx, id) => Self.printReport(ctx, id, 'driver-route');
|
Self.driverRoutePdf = (ctx, id) => Self.printReport(ctx, id, 'driver-route');
|
||||||
|
|
|
@ -30,9 +30,11 @@ module.exports = Self => {
|
||||||
});
|
});
|
||||||
|
|
||||||
function validateDistance(err) {
|
function validateDistance(err) {
|
||||||
const routeTotalKm = this.kmEnd - this.kmStart;
|
if (this.kmEnd) {
|
||||||
const routeMaxKm = 4000;
|
const routeTotalKm = this.kmEnd - this.kmStart;
|
||||||
if (routeTotalKm > routeMaxKm || this.kmStart > this.kmEnd)
|
const routeMaxKm = 4000;
|
||||||
err();
|
if (routeTotalKm > routeMaxKm || this.kmStart > this.kmEnd)
|
||||||
|
err();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -40,7 +40,7 @@ export default class Controller extends Section {
|
||||||
const stringRoutesIds = routesIds.join(',');
|
const stringRoutesIds = routesIds.join(',');
|
||||||
|
|
||||||
if (this.checked.length <= 1) {
|
if (this.checked.length <= 1) {
|
||||||
const url = `api/Routes/${stringRoutesIds}/driver-route-pdf?access_token=${this.vnToken.token}`;
|
const url = `api/Routes/${stringRoutesIds}/driver-route-pdf?access_token=${this.vnToken.tokenMultimedia}`;
|
||||||
window.open(url, '_blank');
|
window.open(url, '_blank');
|
||||||
} else {
|
} else {
|
||||||
const serializedParams = this.$httpParamSerializer({
|
const serializedParams = this.$httpParamSerializer({
|
||||||
|
|
|
@ -9,8 +9,8 @@ describe('ticketLog getChanges()', () => {
|
||||||
it('should return the changes in the sales of a ticket', async() => {
|
it('should return the changes in the sales of a ticket', async() => {
|
||||||
const ticketId = 16;
|
const ticketId = 16;
|
||||||
|
|
||||||
const changues = await models.TicketLog.getChanges(ctx, ticketId);
|
const changes = await models.TicketLog.getChanges(ctx, ticketId);
|
||||||
|
|
||||||
expect(changues).toContain(`Change quantity`);
|
expect(changes).toContain(`Change quantity`);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -29,6 +29,15 @@ module.exports = Self => {
|
||||||
if (typeof options == 'object')
|
if (typeof options == 'object')
|
||||||
Object.assign(myOptions, options);
|
Object.assign(myOptions, options);
|
||||||
|
|
||||||
|
const ticketLog = await models.TicketLog.findOne({
|
||||||
|
fields: ['originFk', 'creationDate', 'newInstance'],
|
||||||
|
where: {
|
||||||
|
originFk: id,
|
||||||
|
newInstance: {like: '%"isDeleted":true%'}
|
||||||
|
},
|
||||||
|
order: 'creationDate DESC'
|
||||||
|
}, myOptions);
|
||||||
|
|
||||||
const ticket = await models.Ticket.findById(id, {
|
const ticket = await models.Ticket.findById(id, {
|
||||||
include: [{
|
include: [{
|
||||||
relation: 'client',
|
relation: 'client',
|
||||||
|
@ -39,10 +48,9 @@ module.exports = Self => {
|
||||||
}, myOptions);
|
}, myOptions);
|
||||||
|
|
||||||
const now = Date.vnNew();
|
const now = Date.vnNew();
|
||||||
const maxDate = new Date(ticket.updated);
|
const maxDate = new Date(ticketLog?.creationDate);
|
||||||
maxDate.setHours(maxDate.getHours() + 1);
|
maxDate.setHours(maxDate.getHours() + 1);
|
||||||
|
if (!ticketLog || now > maxDate)
|
||||||
if (now > maxDate)
|
|
||||||
throw new UserError(`You can only restore a ticket within the first hour after deletion`);
|
throw new UserError(`You can only restore a ticket within the first hour after deletion`);
|
||||||
|
|
||||||
// Send notification to salesPerson
|
// Send notification to salesPerson
|
||||||
|
|
|
@ -4,7 +4,7 @@ const models = app.models;
|
||||||
|
|
||||||
describe('ticket restore()', () => {
|
describe('ticket restore()', () => {
|
||||||
const employeeUser = 1110;
|
const employeeUser = 1110;
|
||||||
const ticketId = 18;
|
const ticketId = 9;
|
||||||
const activeCtx = {
|
const activeCtx = {
|
||||||
accessToken: {userId: employeeUser},
|
accessToken: {userId: employeeUser},
|
||||||
headers: {
|
headers: {
|
||||||
|
@ -30,10 +30,21 @@ describe('ticket restore()', () => {
|
||||||
try {
|
try {
|
||||||
const options = {transaction: tx};
|
const options = {transaction: tx};
|
||||||
const ticket = await models.Ticket.findById(ticketId, null, options);
|
const ticket = await models.Ticket.findById(ticketId, null, options);
|
||||||
|
|
||||||
await ticket.updateAttributes({
|
await ticket.updateAttributes({
|
||||||
isDeleted: true,
|
isDeleted: true,
|
||||||
updated: now
|
updated: now
|
||||||
}, options);
|
}, options);
|
||||||
|
|
||||||
|
await models.TicketLog.create({
|
||||||
|
originFk: ticketId,
|
||||||
|
userFk: employeeUser,
|
||||||
|
action: 'update',
|
||||||
|
changedModel: 'Ticket',
|
||||||
|
creationDate: new Date('2001-01-01 10:59:00'),
|
||||||
|
newInstance: '{"isDeleted":true}'
|
||||||
|
}, options);
|
||||||
|
|
||||||
await app.models.Ticket.restore(ctx, ticketId, options);
|
await app.models.Ticket.restore(ctx, ticketId, options);
|
||||||
await tx.rollback();
|
await tx.rollback();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
@ -52,11 +63,21 @@ describe('ticket restore()', () => {
|
||||||
const options = {transaction: tx};
|
const options = {transaction: tx};
|
||||||
|
|
||||||
const ticketBeforeUpdate = await models.Ticket.findById(ticketId, null, options);
|
const ticketBeforeUpdate = await models.Ticket.findById(ticketId, null, options);
|
||||||
|
|
||||||
await ticketBeforeUpdate.updateAttributes({
|
await ticketBeforeUpdate.updateAttributes({
|
||||||
isDeleted: true,
|
isDeleted: true,
|
||||||
updated: now
|
updated: now
|
||||||
}, options);
|
}, options);
|
||||||
|
|
||||||
|
await models.TicketLog.create({
|
||||||
|
originFk: ticketId,
|
||||||
|
userFk: employeeUser,
|
||||||
|
action: 'update',
|
||||||
|
changedModel: 'Ticket',
|
||||||
|
creationDate: new Date('2001-01-01 11:01:00'),
|
||||||
|
newInstance: '{"isDeleted":true}'
|
||||||
|
}, options);
|
||||||
|
|
||||||
const ticketAfterUpdate = await models.Ticket.findById(ticketId, null, options);
|
const ticketAfterUpdate = await models.Ticket.findById(ticketId, null, options);
|
||||||
|
|
||||||
expect(ticketAfterUpdate.isDeleted).toBeTruthy();
|
expect(ticketAfterUpdate.isDeleted).toBeTruthy();
|
||||||
|
@ -65,7 +86,9 @@ describe('ticket restore()', () => {
|
||||||
const ticketAfterRestore = await models.Ticket.findById(ticketId, null, options);
|
const ticketAfterRestore = await models.Ticket.findById(ticketId, null, options);
|
||||||
|
|
||||||
const fullYear = now.getFullYear();
|
const fullYear = now.getFullYear();
|
||||||
|
|
||||||
const shippedFullYear = ticketAfterRestore.shipped.getFullYear();
|
const shippedFullYear = ticketAfterRestore.shipped.getFullYear();
|
||||||
|
|
||||||
const landedFullYear = ticketAfterRestore.landed.getFullYear();
|
const landedFullYear = ticketAfterRestore.landed.getFullYear();
|
||||||
|
|
||||||
expect(ticketAfterRestore.isDeleted).toBeFalsy();
|
expect(ticketAfterRestore.isDeleted).toBeFalsy();
|
||||||
|
|
|
@ -5,5 +5,40 @@
|
||||||
"mysql": {
|
"mysql": {
|
||||||
"table": "ticketLog"
|
"table": "ticketLog"
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
"properties": {
|
||||||
|
"id": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"originFk": {
|
||||||
|
"type": "number"
|
||||||
|
},
|
||||||
|
"userFk": {
|
||||||
|
"type":"number"
|
||||||
|
},
|
||||||
|
"action": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"creationDate": {
|
||||||
|
"type": "date"
|
||||||
|
},
|
||||||
|
"description": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"changedModel": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"oldInstance": {
|
||||||
|
"type": "any"
|
||||||
|
},
|
||||||
|
"newInstance": {
|
||||||
|
"type": "any"
|
||||||
|
},
|
||||||
|
"changedModelId": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"changedModelValue": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,6 +35,29 @@ class Controller extends Section {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const filter = {
|
||||||
|
fields: ['originFk', 'creationDate', 'newInstance'],
|
||||||
|
where: {
|
||||||
|
originFk: value,
|
||||||
|
newInstance: {like: '%"isDeleted":true%'}
|
||||||
|
},
|
||||||
|
order: 'creationDate DESC'
|
||||||
|
};
|
||||||
|
this.$http.get(`TicketLogs/findOne`, {filter})
|
||||||
|
.then(res => {
|
||||||
|
if (res && res.data) {
|
||||||
|
const now = Date.vnNew();
|
||||||
|
const maxDate = new Date(res.data.creationDate);
|
||||||
|
maxDate.setHours(maxDate.getHours() + 1);
|
||||||
|
if (now <= maxDate)
|
||||||
|
return this.canRestoreTicket = true;
|
||||||
|
}
|
||||||
|
this.canRestoreTicket = false;
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
this.canRestoreTicket = false;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
get isInvoiced() {
|
get isInvoiced() {
|
||||||
|
@ -171,15 +194,6 @@ class Controller extends Section {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
get canRestoreTicket() {
|
|
||||||
const isDeleted = this.ticket.isDeleted;
|
|
||||||
const now = Date.vnNew();
|
|
||||||
const maxDate = new Date(this.ticket.updated);
|
|
||||||
maxDate.setHours(maxDate.getHours() + 1);
|
|
||||||
|
|
||||||
return isDeleted && (now <= maxDate);
|
|
||||||
}
|
|
||||||
|
|
||||||
restoreTicket() {
|
restoreTicket() {
|
||||||
return this.$http.post(`Tickets/${this.id}/restore`)
|
return this.$http.post(`Tickets/${this.id}/restore`)
|
||||||
.then(() => this.reload())
|
.then(() => this.reload())
|
||||||
|
|
|
@ -40,29 +40,6 @@ describe('Ticket Component vnTicketDescriptorMenu', () => {
|
||||||
controller.ticket = ticket;
|
controller.ticket = ticket;
|
||||||
}));
|
}));
|
||||||
|
|
||||||
describe('canRestoreTicket() getter', () => {
|
|
||||||
it('should return true for a ticket deleted within the last hour', () => {
|
|
||||||
controller.ticket.isDeleted = true;
|
|
||||||
controller.ticket.updated = Date.vnNew();
|
|
||||||
|
|
||||||
const result = controller.canRestoreTicket;
|
|
||||||
|
|
||||||
expect(result).toBeTruthy();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should return false for a ticket deleted more than one hour ago', () => {
|
|
||||||
const pastHour = Date.vnNew();
|
|
||||||
pastHour.setHours(pastHour.getHours() - 2);
|
|
||||||
|
|
||||||
controller.ticket.isDeleted = true;
|
|
||||||
controller.ticket.updated = pastHour;
|
|
||||||
|
|
||||||
const result = controller.canRestoreTicket;
|
|
||||||
|
|
||||||
expect(result).toBeFalsy();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('addTurn()', () => {
|
describe('addTurn()', () => {
|
||||||
it('should make a query and call $.addTurn.hide() and vnApp.showSuccess()', () => {
|
it('should make a query and call $.addTurn.hide() and vnApp.showSuccess()', () => {
|
||||||
controller.$.addTurn = {hide: () => {}};
|
controller.$.addTurn = {hide: () => {}};
|
||||||
|
@ -105,20 +82,6 @@ describe('Ticket Component vnTicketDescriptorMenu', () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('restoreTicket()', () => {
|
|
||||||
it('should make a query to restore the ticket and call vnApp.showSuccess()', () => {
|
|
||||||
jest.spyOn(controller, 'reload').mockReturnThis();
|
|
||||||
jest.spyOn(controller.vnApp, 'showSuccess');
|
|
||||||
|
|
||||||
$httpBackend.expectPOST(`Tickets/${ticket.id}/restore`).respond();
|
|
||||||
controller.restoreTicket();
|
|
||||||
$httpBackend.flush();
|
|
||||||
|
|
||||||
expect(controller.reload).toHaveBeenCalled();
|
|
||||||
expect(controller.vnApp.showSuccess).toHaveBeenCalled();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('showPdfDeliveryNote()', () => {
|
describe('showPdfDeliveryNote()', () => {
|
||||||
it('should open a new window showing a delivery note PDF document', () => {
|
it('should open a new window showing a delivery note PDF document', () => {
|
||||||
jest.spyOn(window, 'open').mockReturnThis();
|
jest.spyOn(window, 'open').mockReturnThis();
|
||||||
|
|
|
@ -14,7 +14,8 @@ Refund all...: Abonar todo...
|
||||||
with warehouse: con almacén
|
with warehouse: con almacén
|
||||||
without warehouse: sin almacén
|
without warehouse: sin almacén
|
||||||
Invoice sent: Factura enviada
|
Invoice sent: Factura enviada
|
||||||
The following refund ticket have been created: "Se ha creado siguiente ticket de abono: {{ticketId}}"
|
The following refund ticket have been created: "Se ha creado el siguiente ticket de abono: {{ticketId}}"
|
||||||
|
The following refund tickets have been created: "Se han creado los siguientes tickets de abono: {{ticketId}}"
|
||||||
Transfer client: Transferir cliente
|
Transfer client: Transferir cliente
|
||||||
Send SMS...: Enviar SMS...
|
Send SMS...: Enviar SMS...
|
||||||
Notify changes: Notificar cambios
|
Notify changes: Notificar cambios
|
||||||
|
|
|
@ -29,7 +29,8 @@ module.exports = Self => {
|
||||||
http: {
|
http: {
|
||||||
path: `/:id/downloadFile`,
|
path: `/:id/downloadFile`,
|
||||||
verb: 'GET'
|
verb: 'GET'
|
||||||
}
|
},
|
||||||
|
accessScopes: ['read:multimedia']
|
||||||
});
|
});
|
||||||
|
|
||||||
Self.downloadFile = async function(ctx, id) {
|
Self.downloadFile = async function(ctx, id) {
|
||||||
|
|
|
@ -62,6 +62,11 @@
|
||||||
"type": "belongsTo",
|
"type": "belongsTo",
|
||||||
"model": "Worker",
|
"model": "Worker",
|
||||||
"foreignKey": "workerFk"
|
"foreignKey": "workerFk"
|
||||||
|
},
|
||||||
|
"workerActivity": {
|
||||||
|
"type": "belongsTo",
|
||||||
|
"model": "Worker",
|
||||||
|
"foreignKey": "workerActivityTypeFk"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "salix-back",
|
"name": "salix-back",
|
||||||
"version": "24.12.0",
|
"version": "24.14.0",
|
||||||
"author": "Verdnatura Levante SL",
|
"author": "Verdnatura Levante SL",
|
||||||
"description": "Salix backend",
|
"description": "Salix backend",
|
||||||
"license": "GPL-3.0",
|
"license": "GPL-3.0",
|
||||||
|
|
Loading…
Reference in New Issue