7565-testToMaster #2567
|
@ -1,3 +1,5 @@
|
||||||
|
const isProduction = require('vn-loopback/server/boot/isProduction');
|
||||||
|
|
||||||
module.exports = Self => {
|
module.exports = Self => {
|
||||||
Self.remoteMethodCtx('sendCheckingPresence', {
|
Self.remoteMethodCtx('sendCheckingPresence', {
|
||||||
description: 'Creates a message in the chat model checking the user status',
|
description: 'Creates a message in the chat model checking the user status',
|
||||||
|
@ -37,7 +39,7 @@ module.exports = Self => {
|
||||||
if (!recipient)
|
if (!recipient)
|
||||||
throw new Error(`Could not send message "${message}" to worker id ${recipientId} from user ${userId}`);
|
throw new Error(`Could not send message "${message}" to worker id ${recipientId} from user ${userId}`);
|
||||||
|
|
||||||
if (process.env.NODE_ENV == 'test')
|
if (!isProduction())
|
||||||
message = `[Test:Environment to user ${userId}] ` + message;
|
message = `[Test:Environment to user ${userId}] ` + message;
|
||||||
|
|
||||||
const chat = await models.Chat.create({
|
const chat = await models.Chat.create({
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
const axios = require('axios');
|
const axios = require('axios');
|
||||||
|
const isProduction = require('vn-loopback/server/boot/isProduction');
|
||||||
|
|
||||||
module.exports = Self => {
|
module.exports = Self => {
|
||||||
Self.remoteMethodCtx('sendQueued', {
|
Self.remoteMethodCtx('sendQueued', {
|
||||||
description: 'Send a RocketChat message',
|
description: 'Send a RocketChat message',
|
||||||
|
@ -94,7 +96,7 @@ module.exports = Self => {
|
||||||
* @return {Promise} - The request promise
|
* @return {Promise} - The request promise
|
||||||
*/
|
*/
|
||||||
Self.sendMessage = async function sendMessage(senderFk, recipient, message) {
|
Self.sendMessage = async function sendMessage(senderFk, recipient, message) {
|
||||||
if (process.env.NODE_ENV !== 'production') {
|
if (!isProduction(false)) {
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
return resolve({
|
return resolve({
|
||||||
statusCode: 200,
|
statusCode: 200,
|
||||||
|
@ -149,7 +151,7 @@ module.exports = Self => {
|
||||||
* @return {Promise} - The request promise
|
* @return {Promise} - The request promise
|
||||||
*/
|
*/
|
||||||
Self.getUserStatus = async function getUserStatus(username) {
|
Self.getUserStatus = async function getUserStatus(username) {
|
||||||
if (process.env.NODE_ENV !== 'production') {
|
if (!isProduction(false)) {
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
return resolve({
|
return resolve({
|
||||||
data: {
|
data: {
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
const UserError = require('vn-loopback/util/user-error');
|
const UserError = require('vn-loopback/util/user-error');
|
||||||
const fs = require('fs-extra');
|
const fs = require('fs-extra');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
const isProduction = require('vn-loopback/server/boot/isProduction');
|
||||||
|
|
||||||
module.exports = Self => {
|
module.exports = Self => {
|
||||||
Self.remoteMethod('deleteTrashFiles', {
|
Self.remoteMethod('deleteTrashFiles', {
|
||||||
|
@ -22,7 +23,7 @@ module.exports = Self => {
|
||||||
if (typeof options == 'object')
|
if (typeof options == 'object')
|
||||||
Object.assign(myOptions, options);
|
Object.assign(myOptions, options);
|
||||||
|
|
||||||
if (process.env.NODE_ENV == 'test')
|
if (!isProduction())
|
||||||
throw new UserError(`Action not allowed on the test environment`);
|
throw new UserError(`Action not allowed on the test environment`);
|
||||||
|
|
||||||
const models = Self.app.models;
|
const models = Self.app.models;
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
const UserError = require('vn-loopback/util/user-error');
|
const UserError = require('vn-loopback/util/user-error');
|
||||||
const axios = require('axios');
|
const axios = require('axios');
|
||||||
|
const isProduction = require('vn-loopback/server/boot/isProduction');
|
||||||
|
|
||||||
module.exports = Self => {
|
module.exports = Self => {
|
||||||
Self.remoteMethodCtx('upload', {
|
Self.remoteMethodCtx('upload', {
|
||||||
|
@ -119,7 +120,7 @@ module.exports = Self => {
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
if (process.env.NODE_ENV != 'production')
|
if (!isProduction(false))
|
||||||
throw new UserError('Action not allowed on the test environment');
|
throw new UserError('Action not allowed on the test environment');
|
||||||
|
|
||||||
// delete old
|
// delete old
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
const fs = require('fs-extra');
|
const fs = require('fs-extra');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const UserError = require('vn-loopback/util/user-error');
|
const UserError = require('vn-loopback/util/user-error');
|
||||||
|
const isProduction = require('vn-loopback/server/boot/isProduction');
|
||||||
|
|
||||||
module.exports = Self => {
|
module.exports = Self => {
|
||||||
Self.remoteMethod('scrub', {
|
Self.remoteMethod('scrub', {
|
||||||
|
@ -43,8 +44,7 @@ module.exports = Self => {
|
||||||
Self.scrub = async function(collection, remove, limit, dryRun, skipLock) {
|
Self.scrub = async function(collection, remove, limit, dryRun, skipLock) {
|
||||||
const $ = Self.app.models;
|
const $ = Self.app.models;
|
||||||
|
|
||||||
const env = process.env.NODE_ENV;
|
dryRun = dryRun || !isProduction(false);
|
||||||
dryRun = dryRun || (env && env !== 'production');
|
|
||||||
|
|
||||||
const instance = await $.ImageCollection.findOne({
|
const instance = await $.ImageCollection.findOne({
|
||||||
fields: ['id'],
|
fields: ['id'],
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
const UserError = require('vn-loopback/util/user-error');
|
const UserError = require('vn-loopback/util/user-error');
|
||||||
const fs = require('fs/promises');
|
const fs = require('fs/promises');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
const isProduction = require('vn-loopback/server/boot/isProduction');
|
||||||
|
|
||||||
module.exports = Self => {
|
module.exports = Self => {
|
||||||
Self.remoteMethodCtx('upload', {
|
Self.remoteMethodCtx('upload', {
|
||||||
|
@ -41,7 +42,7 @@ module.exports = Self => {
|
||||||
if (!hasWriteRole)
|
if (!hasWriteRole)
|
||||||
throw new UserError(`You don't have enough privileges`);
|
throw new UserError(`You don't have enough privileges`);
|
||||||
|
|
||||||
if (process.env.NODE_ENV == 'test')
|
if (!isProduction())
|
||||||
throw new UserError(`Action not allowed on the test environment`);
|
throw new UserError(`Action not allowed on the test environment`);
|
||||||
|
|
||||||
// Upload file to temporary path
|
// Upload file to temporary path
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
const {Email} = require('vn-print');
|
const {Email} = require('vn-print');
|
||||||
|
const isProduction = require('vn-loopback/server/boot/isProduction');
|
||||||
|
|
||||||
module.exports = Self => {
|
module.exports = Self => {
|
||||||
Self.remoteMethod('send', {
|
Self.remoteMethod('send', {
|
||||||
|
@ -70,7 +71,7 @@ module.exports = Self => {
|
||||||
const newParams = Object.assign({}, queueParams, sendParams);
|
const newParams = Object.assign({}, queueParams, sendParams);
|
||||||
const email = new Email(queueName, newParams);
|
const email = new Email(queueName, newParams);
|
||||||
|
|
||||||
if (process.env.NODE_ENV != 'test')
|
if (isProduction())
|
||||||
await email.send();
|
await email.send();
|
||||||
|
|
||||||
await queue.updateAttribute('status', statusSent);
|
await queue.updateAttribute('status', statusSent);
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
},
|
},
|
||||||
"vn": {
|
"vn": {
|
||||||
"view": {
|
"view": {
|
||||||
"expeditionPallet_Print": "288cbd6e8289df083ed5eb1a2c808f7a82ba4c90c8ad9781104808a7a54471fb"
|
"expeditionPallet_Print": "06613719475fcdba8309607c38cc78efc2e348cca7bc96b48dc3ae3c12426f54"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,22 +23,19 @@ BEGIN
|
||||||
DECLARE vXtraLongAgj INT;
|
DECLARE vXtraLongAgj INT;
|
||||||
DECLARE vDefaultKlo INT;
|
DECLARE vDefaultKlo INT;
|
||||||
|
|
||||||
SELECT
|
SELECT usefulAuctionLeftSegmentLength,
|
||||||
ec.usefulAuctionLeftSegmentLength,
|
standardBarcodeLength,
|
||||||
ec.standardBarcodeLength,
|
floridayBarcodeLength,
|
||||||
ec.floridayBarcodeLength,
|
floramondoBarcodeLength,
|
||||||
ec.floramondoBarcodeLength,
|
defaultKlo
|
||||||
ec.defaultKlo
|
INTO vUsefulAuctionLeftSegmentLength,
|
||||||
INTO
|
|
||||||
vUsefulAuctionLeftSegmentLength,
|
|
||||||
vStandardBarcodeLength,
|
vStandardBarcodeLength,
|
||||||
vFloridayBarcodeLength,
|
vFloridayBarcodeLength,
|
||||||
vFloramondoBarcodeLength,
|
vFloramondoBarcodeLength,
|
||||||
vDefaultKlo
|
vDefaultKlo
|
||||||
FROM edi.ektConfig ec;
|
FROM ektConfig;
|
||||||
|
|
||||||
DROP TEMPORARY TABLE IF EXISTS tmp.ekt;
|
CREATE OR REPLACE TEMPORARY TABLE tmp.ekt
|
||||||
CREATE TEMPORARY TABLE tmp.ekt
|
|
||||||
ENGINE = MEMORY
|
ENGINE = MEMORY
|
||||||
SELECT id ektFk FROM ekt LIMIT 0;
|
SELECT id ektFk FROM ekt LIMIT 0;
|
||||||
|
|
||||||
|
@ -46,19 +43,19 @@ BEGIN
|
||||||
WHEN LENGTH(vBarcode) <= vFloridayBarcodeLength THEN
|
WHEN LENGTH(vBarcode) <= vFloridayBarcodeLength THEN
|
||||||
INSERT INTO tmp.ekt
|
INSERT INTO tmp.ekt
|
||||||
SELECT id
|
SELECT id
|
||||||
FROM edi.ektRecent e
|
FROM ektRecent e
|
||||||
WHERE e.cps = vBarcode
|
WHERE e.cps = vBarcode
|
||||||
OR e.batchNumber = vBarcode;
|
OR e.batchNumber = vBarcode;
|
||||||
|
|
||||||
WHEN LENGTH(vBarcode) = vFloramondoBarcodeLength THEN
|
WHEN LENGTH(vBarcode) = vFloramondoBarcodeLength THEN
|
||||||
INSERT INTO tmp.ekt
|
INSERT INTO tmp.ekt
|
||||||
SELECT e.id
|
SELECT e.id
|
||||||
FROM edi.ektRecent e
|
FROM ektRecent e
|
||||||
WHERE e.pro = MID(vBarcode,2,6)
|
WHERE e.pro = MID(vBarcode,2,6)
|
||||||
AND CAST(e.ptd AS SIGNED) = MID(vBarcode,8,5);
|
AND CAST(e.ptd AS SIGNED) = MID(vBarcode, 8, 5);
|
||||||
|
|
||||||
ELSE
|
ELSE
|
||||||
SET vBarcode = LPAD(vBarcode,vStandardBarcodeLength,'0');
|
SET vBarcode = LPAD(vBarcode, vStandardBarcodeLength, '0');
|
||||||
SET vAuction = MID(vBarcode, 1, 3);
|
SET vAuction = MID(vBarcode, 1, 3);
|
||||||
SET vKlo = MID(vBarcode, 4, 2);
|
SET vKlo = MID(vBarcode, 4, 2);
|
||||||
SET vFec = MAKEDATE(YEAR(util.VN_CURDATE()), MID(vBarcode, 6, 3));
|
SET vFec = MAKEDATE(YEAR(util.VN_CURDATE()), MID(vBarcode, 6, 3));
|
||||||
|
@ -74,13 +71,15 @@ BEGIN
|
||||||
SELECT id
|
SELECT id
|
||||||
FROM ekt
|
FROM ekt
|
||||||
WHERE fec >= vFec - INTERVAL 1 DAY
|
WHERE fec >= vFec - INTERVAL 1 DAY
|
||||||
AND ((
|
AND (
|
||||||
vKlo = vDefaultKlo
|
(vKlo = vDefaultKlo
|
||||||
AND (klo = vKlo OR klo IS NULL OR klo = 0)
|
AND (klo = vKlo OR klo IS NULL OR klo = 0)
|
||||||
AND agj IN (vShortAgj, vLongAgj, vXtraLongAgj))
|
AND agj IN (vShortAgj, vLongAgj, vXtraLongAgj)
|
||||||
OR (klo = vKlo
|
) OR (
|
||||||
|
klo = vKlo
|
||||||
AND auction = vAuction
|
AND auction = vAuction
|
||||||
AND agj = vShortAgj)
|
AND agj = vShortAgj
|
||||||
|
)
|
||||||
)
|
)
|
||||||
ORDER BY agj DESC, fec DESC
|
ORDER BY agj DESC, fec DESC
|
||||||
LIMIT 1;
|
LIMIT 1;
|
||||||
|
@ -91,9 +90,11 @@ BEGIN
|
||||||
IF NOT vIsFound THEN
|
IF NOT vIsFound THEN
|
||||||
INSERT INTO tmp.ekt
|
INSERT INTO tmp.ekt
|
||||||
SELECT id
|
SELECT id
|
||||||
FROM edi.ektRecent e
|
FROM ektRecent e
|
||||||
WHERE e.batchNumber
|
WHERE e.batchNumber = LEFT(
|
||||||
= LEFT(vBarcode,vUsefulAuctionLeftSegmentLength)
|
vBarcode,
|
||||||
|
vUsefulAuctionLeftSegmentLength
|
||||||
|
)
|
||||||
AND e.batchNumber > 0;
|
AND e.batchNumber > 0;
|
||||||
|
|
||||||
SELECT COUNT(*) FROM tmp.ekt INTO vIsFound;
|
SELECT COUNT(*) FROM tmp.ekt INTO vIsFound;
|
||||||
|
@ -103,7 +104,7 @@ BEGIN
|
||||||
IF NOT vIsFound THEN
|
IF NOT vIsFound THEN
|
||||||
INSERT INTO tmp.ekt
|
INSERT INTO tmp.ekt
|
||||||
SELECT id
|
SELECT id
|
||||||
FROM edi.ektRecent e
|
FROM ektRecent e
|
||||||
WHERE e.putOrderFk = vBarcode;
|
WHERE e.putOrderFk = vBarcode;
|
||||||
|
|
||||||
SELECT COUNT(*) FROM tmp.ekt INTO vIsFound;
|
SELECT COUNT(*) FROM tmp.ekt INTO vIsFound;
|
||||||
|
@ -113,13 +114,23 @@ BEGIN
|
||||||
IF NOT vIsFound THEN
|
IF NOT vIsFound THEN
|
||||||
INSERT INTO tmp.ekt
|
INSERT INTO tmp.ekt
|
||||||
SELECT id
|
SELECT id
|
||||||
FROM edi.ektRecent e
|
FROM ektRecent e
|
||||||
WHERE e.deliveryNumber
|
WHERE e.deliveryNumber = MID(vBarcode, 4, 13)
|
||||||
= MID(vBarcode, 4, 13)
|
|
||||||
AND e.deliveryNumber > 0;
|
AND e.deliveryNumber > 0;
|
||||||
|
|
||||||
SELECT COUNT(*) FROM tmp.ekt INTO vIsFound;
|
SELECT COUNT(*) FROM tmp.ekt INTO vIsFound;
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
|
-- Solo campo agj
|
||||||
|
IF NOT vIsFound THEN
|
||||||
|
INSERT INTO tmp.ekt
|
||||||
|
SELECT id
|
||||||
|
FROM ektRecent
|
||||||
|
WHERE agj = vShortAgj;
|
||||||
|
|
||||||
|
SELECT COUNT(*) FROM tmp.ekt INTO vIsFound;
|
||||||
|
END IF;
|
||||||
|
|
||||||
END CASE;
|
END CASE;
|
||||||
|
|
||||||
IF vIsFound THEN
|
IF vIsFound THEN
|
||||||
|
|
|
@ -19,7 +19,6 @@ BEGIN
|
||||||
packing,
|
packing,
|
||||||
`grouping`,
|
`grouping`,
|
||||||
groupingMode,
|
groupingMode,
|
||||||
containerFk,
|
|
||||||
comissionValue,
|
comissionValue,
|
||||||
packageValue,
|
packageValue,
|
||||||
price1,
|
price1,
|
||||||
|
@ -41,7 +40,6 @@ BEGIN
|
||||||
b.packing,
|
b.packing,
|
||||||
b.`grouping`,
|
b.`grouping`,
|
||||||
b.groupingMode,
|
b.groupingMode,
|
||||||
b.containerFk,
|
|
||||||
b.comissionValue,
|
b.comissionValue,
|
||||||
b.packageValue,
|
b.packageValue,
|
||||||
b.price1,
|
b.price1,
|
||||||
|
|
|
@ -26,7 +26,6 @@ BEGIN
|
||||||
packing,
|
packing,
|
||||||
`grouping`,
|
`grouping`,
|
||||||
groupingMode,
|
groupingMode,
|
||||||
containerFk,
|
|
||||||
comissionValue,
|
comissionValue,
|
||||||
packageValue,
|
packageValue,
|
||||||
location,
|
location,
|
||||||
|
@ -46,7 +45,6 @@ BEGIN
|
||||||
packing,
|
packing,
|
||||||
`grouping`,
|
`grouping`,
|
||||||
groupingMode,
|
groupingMode,
|
||||||
containerFk,
|
|
||||||
comissionValue,
|
comissionValue,
|
||||||
packageValue,
|
packageValue,
|
||||||
location,
|
location,
|
||||||
|
|
|
@ -56,7 +56,6 @@ BEGIN
|
||||||
packing,
|
packing,
|
||||||
`grouping`,
|
`grouping`,
|
||||||
groupingMode,
|
groupingMode,
|
||||||
containerFk,
|
|
||||||
comissionValue,
|
comissionValue,
|
||||||
packageValue,
|
packageValue,
|
||||||
packagingFk,
|
packagingFk,
|
||||||
|
@ -77,7 +76,6 @@ BEGIN
|
||||||
packing,
|
packing,
|
||||||
`grouping`,
|
`grouping`,
|
||||||
groupingMode,
|
groupingMode,
|
||||||
containerFk,
|
|
||||||
comissionValue,
|
comissionValue,
|
||||||
packageValue,
|
packageValue,
|
||||||
packagingFk,
|
packagingFk,
|
||||||
|
@ -114,7 +112,6 @@ BEGIN
|
||||||
packing,
|
packing,
|
||||||
`grouping`,
|
`grouping`,
|
||||||
groupingMode,
|
groupingMode,
|
||||||
containerFk,
|
|
||||||
comissionValue,
|
comissionValue,
|
||||||
packageValue,
|
packageValue,
|
||||||
location,
|
location,
|
||||||
|
@ -133,7 +130,6 @@ BEGIN
|
||||||
packing,
|
packing,
|
||||||
`grouping`,
|
`grouping`,
|
||||||
groupingMode,
|
groupingMode,
|
||||||
containerFk,
|
|
||||||
comissionValue,
|
comissionValue,
|
||||||
packageValue,
|
packageValue,
|
||||||
location,
|
location,
|
||||||
|
|
|
@ -76,7 +76,6 @@ BEGIN
|
||||||
packing,
|
packing,
|
||||||
`grouping`,
|
`grouping`,
|
||||||
groupingMode,
|
groupingMode,
|
||||||
containerFk,
|
|
||||||
comissionValue,
|
comissionValue,
|
||||||
packageValue,
|
packageValue,
|
||||||
location,
|
location,
|
||||||
|
@ -103,7 +102,6 @@ BEGIN
|
||||||
packing,
|
packing,
|
||||||
`grouping`,
|
`grouping`,
|
||||||
groupingMode,
|
groupingMode,
|
||||||
containerFk,
|
|
||||||
comissionValue,
|
comissionValue,
|
||||||
packageValue,
|
packageValue,
|
||||||
location,
|
location,
|
||||||
|
|
|
@ -18,11 +18,12 @@ BEGIN
|
||||||
JOIN vn.parking p ON p.id = sh.parkingFk
|
JOIN vn.parking p ON p.id = sh.parkingFk
|
||||||
JOIN vn.sector sc ON sc.id = p.sectorFk
|
JOIN vn.sector sc ON sc.id = p.sectorFk
|
||||||
JOIN vn.warehouse w ON w.id = sc.warehouseFk
|
JOIN vn.warehouse w ON w.id = sc.warehouseFk
|
||||||
WHERE sc.id = vSectorFk
|
WHERE ish.visible > 0
|
||||||
AND ish.visible > 0
|
|
||||||
AND ish.itemFk = vItemFk
|
AND ish.itemFk = vItemFk
|
||||||
GROUP BY ish.id
|
GROUP BY ish.id
|
||||||
ORDER BY sh.priority DESC,
|
ORDER BY
|
||||||
|
(sc.id = vSectorFk) DESC,
|
||||||
|
sh.priority DESC,
|
||||||
ish.created,
|
ish.created,
|
||||||
p.pickingOrder;
|
p.pickingOrder;
|
||||||
END$$
|
END$$
|
||||||
|
|
|
@ -319,7 +319,6 @@ BEGIN
|
||||||
packing,
|
packing,
|
||||||
`grouping`,
|
`grouping`,
|
||||||
groupingMode,
|
groupingMode,
|
||||||
containerFk,
|
|
||||||
comissionValue,
|
comissionValue,
|
||||||
packageValue,
|
packageValue,
|
||||||
price1,
|
price1,
|
||||||
|
@ -341,7 +340,6 @@ BEGIN
|
||||||
packing,
|
packing,
|
||||||
`grouping`,
|
`grouping`,
|
||||||
groupingMode,
|
groupingMode,
|
||||||
containerFk,
|
|
||||||
comissionValue,
|
comissionValue,
|
||||||
packageValue,
|
packageValue,
|
||||||
price1,
|
price1,
|
||||||
|
@ -366,7 +364,6 @@ BEGIN
|
||||||
packing,
|
packing,
|
||||||
`grouping`,
|
`grouping`,
|
||||||
groupingMode,
|
groupingMode,
|
||||||
containerFk,
|
|
||||||
comissionValue,
|
comissionValue,
|
||||||
packageValue,
|
packageValue,
|
||||||
price1,
|
price1,
|
||||||
|
|
|
@ -27,7 +27,10 @@ BEGIN
|
||||||
SELECT DISTINCT clientFk
|
SELECT DISTINCT clientFk
|
||||||
FROM (
|
FROM (
|
||||||
SELECT clientFk, SUM(quantity) totalQuantity
|
SELECT clientFk, SUM(quantity) totalQuantity
|
||||||
FROM tmp.packagingToInvoice
|
FROM tmp.packagingToInvoice tpi
|
||||||
|
JOIN client c ON c.id = tpi.clientFk
|
||||||
|
LEFT JOIN supplier s ON s.nif = c.fi
|
||||||
|
WHERE s.id IS NULL
|
||||||
GROUP BY itemFk, clientFk
|
GROUP BY itemFk, clientFk
|
||||||
HAVING totalQuantity > 0)sub;
|
HAVING totalQuantity > 0)sub;
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
DROP TABLE IF EXISTS vn2008.scanTree__;
|
DROP TABLE IF EXISTS vn2008.scanTree__;
|
||||||
DROP TABLE IF EXISTS vn2008.payroll_embargos__;
|
DROP TABLE IF EXISTS vn2008.payroll_embargos__;
|
||||||
DROP TABLE IF EXISTS vn2008.unary_source__;
|
DROP TABLE IF EXISTS vn2008.unary_source__;
|
||||||
DROP TABLE IF EXISTS vn2008.unary_scan__;
|
|
||||||
DROP TABLE IF EXISTS vn2008.unary_scan_line_buy__;
|
DROP TABLE IF EXISTS vn2008.unary_scan_line_buy__;
|
||||||
DROP TABLE IF EXISTS vn2008.unary_scan_line__;
|
DROP TABLE IF EXISTS vn2008.unary_scan_line__;
|
||||||
|
DROP TABLE IF EXISTS vn2008.unary_scan__;
|
||||||
DROP TABLE IF EXISTS vn2008.scan_line__;
|
DROP TABLE IF EXISTS vn2008.scan_line__;
|
||||||
DROP TABLE IF EXISTS vn2008.Familias__;
|
DROP TABLE IF EXISTS vn2008.Familias__;
|
||||||
DROP TABLE IF EXISTS vn2008.language__;
|
DROP TABLE IF EXISTS vn2008.language__;
|
||||||
|
|
|
@ -1,41 +0,0 @@
|
||||||
import selectors from '../../helpers/selectors.js';
|
|
||||||
import getBrowser from '../../helpers/puppeteer';
|
|
||||||
|
|
||||||
describe('Worker pda path', () => {
|
|
||||||
let browser;
|
|
||||||
let page;
|
|
||||||
beforeAll(async() => {
|
|
||||||
browser = await getBrowser();
|
|
||||||
page = browser.page;
|
|
||||||
await page.loginAndModule('hr', 'worker');
|
|
||||||
await page.accessToSearchResult('employeeNick');
|
|
||||||
await page.accessToSection('worker.card.pda');
|
|
||||||
});
|
|
||||||
|
|
||||||
afterAll(async() => {
|
|
||||||
await browser.close();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should check if worker has already a PDA allocated', async() => {
|
|
||||||
expect(await page.waitToGetProperty(selectors.workerPda.currentPDA, 'value')).toContain('serialNumber1');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should deallocate the PDA', async() => {
|
|
||||||
await page.waitToClick(selectors.workerPda.delete);
|
|
||||||
let message = await page.waitForSnackbar();
|
|
||||||
|
|
||||||
expect(message.text).toContain('PDA deallocated');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should allocate a new PDA', async() => {
|
|
||||||
await page.autocompleteSearch(selectors.workerPda.newPDA, 'serialNumber2');
|
|
||||||
await page.waitToClick(selectors.workerPda.submit);
|
|
||||||
let message = await page.waitForSnackbar();
|
|
||||||
|
|
||||||
expect(message.text).toContain('PDA allocated');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should check if a new PDA has been allocated', async() => {
|
|
||||||
expect(await page.waitToGetProperty(selectors.workerPda.currentPDA, 'value')).toContain('serialNumber2');
|
|
||||||
});
|
|
||||||
});
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
module.exports = function(Self) {
|
module.exports = function(Self) {
|
||||||
require('../methods/application/status')(Self);
|
require('../methods/application/status')(Self);
|
||||||
require('../methods/application/post')(Self);
|
require('../methods/application/post')(Self);
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
module.exports = (localAsProduction = true) => {
|
||||||
|
return (!process.env.NODE_ENV && localAsProduction) || process.env.NODE_ENV == 'production';
|
||||||
|
};
|
|
@ -3,9 +3,10 @@ const app = require('vn-loopback/server/server');
|
||||||
const ldap = require('../util/ldapjs-extra');
|
const ldap = require('../util/ldapjs-extra');
|
||||||
const crypto = require('crypto');
|
const crypto = require('crypto');
|
||||||
const nthash = require('smbhash').nthash;
|
const nthash = require('smbhash').nthash;
|
||||||
|
const isProduction = require('vn-loopback/server/boot/isProduction');
|
||||||
|
|
||||||
module.exports = Self => {
|
module.exports = Self => {
|
||||||
const shouldSync = process.env.NODE_ENV !== 'test';
|
const shouldSync = isProduction();
|
||||||
|
|
||||||
Self.getLinker = async function() {
|
Self.getLinker = async function() {
|
||||||
return await Self.findOne({
|
return await Self.findOne({
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
|
|
||||||
const ldap = require('../util/ldapjs-extra');
|
const ldap = require('../util/ldapjs-extra');
|
||||||
const execFile = require('child_process').execFile;
|
const execFile = require('child_process').execFile;
|
||||||
|
const isProduction = require('vn-loopback/server/boot/isProduction');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Summary of userAccountControl flags:
|
* Summary of userAccountControl flags:
|
||||||
|
@ -12,7 +13,7 @@ const UserAccountControlFlags = {
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = Self => {
|
module.exports = Self => {
|
||||||
const shouldSync = process.env.NODE_ENV !== 'test';
|
const shouldSync = isProduction();
|
||||||
|
|
||||||
Self.getLinker = async function() {
|
Self.getLinker = async function() {
|
||||||
return await Self.findOne({
|
return await Self.findOne({
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
const got = require('got');
|
const got = require('got');
|
||||||
const UserError = require('vn-loopback/util/user-error');
|
const UserError = require('vn-loopback/util/user-error');
|
||||||
|
const isProduction = require('vn-loopback/server/boot/isProduction');
|
||||||
|
|
||||||
module.exports = Self => {
|
module.exports = Self => {
|
||||||
Self.remoteMethod('send', {
|
Self.remoteMethod('send', {
|
||||||
|
@ -47,7 +48,7 @@ module.exports = Self => {
|
||||||
|
|
||||||
let response;
|
let response;
|
||||||
try {
|
try {
|
||||||
if (process.env.NODE_ENV !== 'production')
|
if (!isProduction(false))
|
||||||
response = {result: [{status: 'ok'}]};
|
response = {result: [{status: 'ok'}]};
|
||||||
else {
|
else {
|
||||||
const jsonTest = {
|
const jsonTest = {
|
||||||
|
|
|
@ -76,7 +76,6 @@ module.exports = Self => {
|
||||||
packing: buyUltimate.packing,
|
packing: buyUltimate.packing,
|
||||||
grouping: buyUltimate.grouping,
|
grouping: buyUltimate.grouping,
|
||||||
groupingMode: buyUltimate.groupingMode,
|
groupingMode: buyUltimate.groupingMode,
|
||||||
containerFk: buyUltimate.containerFk,
|
|
||||||
comissionValue: buyUltimate.comissionValue,
|
comissionValue: buyUltimate.comissionValue,
|
||||||
packageValue: buyUltimate.packageValue,
|
packageValue: buyUltimate.packageValue,
|
||||||
location: buyUltimate.location,
|
location: buyUltimate.location,
|
||||||
|
|
|
@ -63,9 +63,6 @@
|
||||||
"isIgnored": {
|
"isIgnored": {
|
||||||
"type": "boolean"
|
"type": "boolean"
|
||||||
},
|
},
|
||||||
"containerFk": {
|
|
||||||
"type": "number"
|
|
||||||
},
|
|
||||||
"location": {
|
"location": {
|
||||||
"type": "number"
|
"type": "number"
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
const fs = require('fs-extra');
|
const fs = require('fs-extra');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
const isProduction = require('vn-loopback/server/boot/isProduction');
|
||||||
|
|
||||||
module.exports = Self => {
|
module.exports = Self => {
|
||||||
Self.remoteMethodCtx('download', {
|
Self.remoteMethodCtx('download', {
|
||||||
|
@ -66,7 +67,7 @@ module.exports = Self => {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
});
|
});
|
||||||
|
|
||||||
if (process.env.NODE_ENV == 'test') {
|
if (!isProduction()) {
|
||||||
try {
|
try {
|
||||||
await fs.access(file.path);
|
await fs.access(file.path);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
const print = require('vn-print');
|
const print = require('vn-print');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const UserError = require('vn-loopback/util/user-error');
|
const UserError = require('vn-loopback/util/user-error');
|
||||||
|
const isProduction = require('vn-loopback/server/boot/isProduction');
|
||||||
|
|
||||||
module.exports = Self => {
|
module.exports = Self => {
|
||||||
require('../methods/invoiceOut/filter')(Self);
|
require('../methods/invoiceOut/filter')(Self);
|
||||||
|
@ -59,7 +60,7 @@ module.exports = Self => {
|
||||||
hasPdf: true
|
hasPdf: true
|
||||||
}, options);
|
}, options);
|
||||||
|
|
||||||
if (process.env.NODE_ENV !== 'test') {
|
if (isProduction()) {
|
||||||
await print.storage.write(buffer, {
|
await print.storage.write(buffer, {
|
||||||
type: 'invoice',
|
type: 'invoice',
|
||||||
path: pdfFile.path,
|
path: pdfFile.path,
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
const fs = require('fs-extra');
|
const fs = require('fs-extra');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const UserError = require('vn-loopback/util/user-error');
|
const UserError = require('vn-loopback/util/user-error');
|
||||||
|
const isProduction = require('vn-loopback/server/boot/isProduction');
|
||||||
|
|
||||||
module.exports = Self => {
|
module.exports = Self => {
|
||||||
Self.remoteMethodCtx('upload', {
|
Self.remoteMethodCtx('upload', {
|
||||||
|
@ -111,7 +112,7 @@ module.exports = Self => {
|
||||||
const destinationFile = path.join(
|
const destinationFile = path.join(
|
||||||
accessContainer.client.root, accessContainer.name, appName, `${toVersion}.7z`);
|
accessContainer.client.root, accessContainer.name, appName, `${toVersion}.7z`);
|
||||||
|
|
||||||
if (process.env.NODE_ENV == 'test')
|
if (!isProduction())
|
||||||
await fs.unlink(srcFile);
|
await fs.unlink(srcFile);
|
||||||
else {
|
else {
|
||||||
await fs.move(srcFile, destinationFile, {
|
await fs.move(srcFile, destinationFile, {
|
||||||
|
|
|
@ -138,9 +138,12 @@ module.exports = Self => {
|
||||||
JOIN alertLevel al ON al.id = ts.alertLevel
|
JOIN alertLevel al ON al.id = ts.alertLevel
|
||||||
JOIN agencyMode am ON am.id = t.agencyModeFk
|
JOIN agencyMode am ON am.id = t.agencyModeFk
|
||||||
JOIN deliveryMethod dm ON dm.id = am.deliveryMethodFk
|
JOIN deliveryMethod dm ON dm.id = am.deliveryMethodFk
|
||||||
|
LEFT JOIN ticketObservation tob ON tob.ticketFk = t.id
|
||||||
SET t.routeFk = NULL
|
SET t.routeFk = NULL
|
||||||
WHERE DATE(t.shipped) BETWEEN ? - INTERVAL 2 DAY AND util.dayEnd(?)
|
WHERE DATE(t.shipped) BETWEEN ? - INTERVAL 2 DAY AND util.dayEnd(?)
|
||||||
AND al.code NOT IN ('DELIVERED', 'PACKED')
|
AND al.code NOT IN ('DELIVERED', 'PACKED')
|
||||||
|
AND NOT t.packages
|
||||||
|
AND tob.id IS NULL
|
||||||
AND t.routeFk`, [toDate, toDate], {userId: ctx.req.accessToken.userId});
|
AND t.routeFk`, [toDate, toDate], {userId: ctx.req.accessToken.userId});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -1,50 +0,0 @@
|
||||||
<div class="vn-w-md" ng-show="$ctrl.currentPDA">
|
|
||||||
<vn-card class="vn-pa-lg">
|
|
||||||
<vn-horizontal>
|
|
||||||
<vn-textfield
|
|
||||||
label="Current PDA"
|
|
||||||
ng-model="$ctrl.currentPDA.description"
|
|
||||||
disabled="true">
|
|
||||||
<append>
|
|
||||||
<vn-icon-button
|
|
||||||
icon="delete"
|
|
||||||
vn-tooltip="Deallocate PDA"
|
|
||||||
ng-click="$ctrl.deallocatePDA()"
|
|
||||||
vn-acl="hr, productionAssi">
|
|
||||||
</vn-icon-button>
|
|
||||||
</append>
|
|
||||||
</vn-textfield>
|
|
||||||
</vn-horizontal>
|
|
||||||
</vn-card>
|
|
||||||
</div>
|
|
||||||
<form name="form" ng-show="!$ctrl.currentPDA" ng-submit="$ctrl.allocatePDA()" class="vn-w-md">
|
|
||||||
<vn-card class="vn-pa-lg">
|
|
||||||
<vn-horizontal>
|
|
||||||
<vn-autocomplete
|
|
||||||
vn-acl="hr, productionAssi"
|
|
||||||
ng-model="$ctrl.newPDA"
|
|
||||||
url="DeviceProductions"
|
|
||||||
fields="['id', 'modelFk', 'serialNumber']"
|
|
||||||
where="{'stateFk': 'idle'}"
|
|
||||||
label="New PDA"
|
|
||||||
order="id"
|
|
||||||
value-field="id"
|
|
||||||
show-field="serialNumber">
|
|
||||||
<tpl-item>
|
|
||||||
<div>
|
|
||||||
ID: {{id}}
|
|
||||||
</div>
|
|
||||||
<div class="text-caption text-grey">
|
|
||||||
{{modelFk}}, {{serialNumber}}
|
|
||||||
</div>
|
|
||||||
</tpl-item>
|
|
||||||
</vn-autocomplete>
|
|
||||||
</vn-horizontal>
|
|
||||||
</vn-card>
|
|
||||||
<vn-button-bar>
|
|
||||||
<vn-submit
|
|
||||||
disabled="!$ctrl.newPDA"
|
|
||||||
label="Assign">
|
|
||||||
</vn-submit>
|
|
||||||
</vn-button-bar>
|
|
||||||
</form>
|
|
|
@ -1,53 +1,18 @@
|
||||||
import ngModule from '../module';
|
import ngModule from '../module';
|
||||||
import Section from 'salix/components/section';
|
import Section from 'salix/components/section';
|
||||||
import './style.scss';
|
|
||||||
|
|
||||||
class Controller extends Section {
|
class Controller extends Section {
|
||||||
constructor($element, $) {
|
constructor($element, $) {
|
||||||
super($element, $);
|
super($element, $);
|
||||||
const filter = {
|
|
||||||
where: {userFk: this.$params.id},
|
|
||||||
include: {relation: 'deviceProduction'}
|
|
||||||
};
|
|
||||||
this.$http.get('DeviceProductionUsers', {filter}).
|
|
||||||
then(res => {
|
|
||||||
if (res.data && res.data.length > 0)
|
|
||||||
this.setCurrentPDA(res.data[0]);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
deallocatePDA() {
|
async $onInit() {
|
||||||
this.$http.post(`Workers/${this.$params.id}/deallocatePDA`, {pda: this.currentPDA.deviceProductionFk})
|
const url = await this.vnApp.getUrl(`worker/${this.$params.id}/pda`);
|
||||||
.then(() => {
|
this.$state.go('worker.card.summary', {id: this.$params.id});
|
||||||
this.vnApp.showSuccess(this.$t('PDA deallocated'));
|
window.location.href = url;
|
||||||
delete this.currentPDA;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
allocatePDA() {
|
|
||||||
this.$http.post(`Workers/${this.$params.id}/allocatePDA`, {pda: this.newPDA})
|
|
||||||
.then(res => {
|
|
||||||
if (res.data)
|
|
||||||
this.setCurrentPDA(res.data);
|
|
||||||
|
|
||||||
this.vnApp.showSuccess(this.$t('PDA allocated'));
|
|
||||||
delete this.newPDA;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
setCurrentPDA(data) {
|
|
||||||
this.currentPDA = data;
|
|
||||||
this.currentPDA.description = [];
|
|
||||||
this.currentPDA.description.push(`ID: ${this.currentPDA.deviceProductionFk}`);
|
|
||||||
this.currentPDA.description.push(`${this.$t('Model')}: ${this.currentPDA.deviceProduction.modelFk}`);
|
|
||||||
this.currentPDA.description.push(`${this.$t('Serial Number')}: ${this.currentPDA.deviceProduction.serialNumber}`);
|
|
||||||
this.currentPDA.description = this.currentPDA.description.join(' ');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Controller.$inject = ['$element', '$scope'];
|
|
||||||
|
|
||||||
ngModule.vnComponent('vnWorkerPda', {
|
ngModule.vnComponent('vnWorkerPda', {
|
||||||
template: require('./index.html'),
|
controller: Controller
|
||||||
controller: Controller,
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,72 +0,0 @@
|
||||||
import './index';
|
|
||||||
|
|
||||||
describe('Worker', () => {
|
|
||||||
describe('Component vnWorkerPda', () => {
|
|
||||||
let $httpBackend;
|
|
||||||
let $scope;
|
|
||||||
let $element;
|
|
||||||
let controller;
|
|
||||||
|
|
||||||
beforeEach(ngModule('worker'));
|
|
||||||
|
|
||||||
beforeEach(inject(($componentController, $rootScope, _$httpBackend_) => {
|
|
||||||
$httpBackend = _$httpBackend_;
|
|
||||||
$scope = $rootScope.$new();
|
|
||||||
$element = angular.element('<vn-worker-pda></vn-worker-pda>');
|
|
||||||
controller = $componentController('vnWorkerPda', {$element, $scope});
|
|
||||||
$httpBackend.expectGET(`DeviceProductionUsers`).respond();
|
|
||||||
}));
|
|
||||||
|
|
||||||
describe('deallocatePDA()', () => {
|
|
||||||
it('should make an HTTP Post query to deallocatePDA', () => {
|
|
||||||
jest.spyOn(controller.vnApp, 'showSuccess');
|
|
||||||
controller.currentPDA = {deviceProductionFk: 1};
|
|
||||||
controller.$params.id = 1;
|
|
||||||
|
|
||||||
$httpBackend
|
|
||||||
.expectPOST(`Workers/${controller.$params.id}/deallocatePDA`,
|
|
||||||
{pda: controller.currentPDA.deviceProductionFk})
|
|
||||||
.respond();
|
|
||||||
controller.deallocatePDA();
|
|
||||||
$httpBackend.flush();
|
|
||||||
|
|
||||||
expect(controller.vnApp.showSuccess).toHaveBeenCalled();
|
|
||||||
expect(controller.currentPDA).toBeUndefined();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('allocatePDA()', () => {
|
|
||||||
it('should make an HTTP Post query to allocatePDA', () => {
|
|
||||||
jest.spyOn(controller.vnApp, 'showSuccess');
|
|
||||||
controller.newPDA = 4;
|
|
||||||
controller.$params.id = 1;
|
|
||||||
|
|
||||||
$httpBackend
|
|
||||||
.expectPOST(`Workers/${controller.$params.id}/allocatePDA`,
|
|
||||||
{pda: controller.newPDA})
|
|
||||||
.respond();
|
|
||||||
controller.allocatePDA();
|
|
||||||
$httpBackend.flush();
|
|
||||||
|
|
||||||
expect(controller.vnApp.showSuccess).toHaveBeenCalled();
|
|
||||||
expect(controller.newPDA).toBeUndefined();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('setCurrentPDA()', () => {
|
|
||||||
it('should set CurrentPDA', () => {
|
|
||||||
const data = {
|
|
||||||
deviceProductionFk: 1,
|
|
||||||
deviceProduction: {
|
|
||||||
modelFk: 1,
|
|
||||||
serialNumber: 1
|
|
||||||
}
|
|
||||||
};
|
|
||||||
controller.setCurrentPDA(data);
|
|
||||||
|
|
||||||
expect(controller.currentPDA).toBeDefined();
|
|
||||||
expect(controller.currentPDA.description).toBeDefined();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
|
@ -1,6 +0,0 @@
|
||||||
@import "./variables";
|
|
||||||
|
|
||||||
.text-grey {
|
|
||||||
color: $color-font-light;
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "salix-back",
|
"name": "salix-back",
|
||||||
"version": "24.22.0",
|
"version": "24.24.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