refs #6119 microsip link added #1729
|
@ -5,6 +5,11 @@ 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).
|
||||||
|
|
||||||
|
## [2342.01] - 2023-10-19
|
||||||
|
|
||||||
|
### Added
|
||||||
|
### Changed
|
||||||
|
### Fixed
|
||||||
|
|
||||||
## [2340.01] - 2023-10-05
|
## [2340.01] - 2023-10-05
|
||||||
|
|
||||||
|
@ -17,6 +22,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
- (Ticket -> Servicios) Se pueden abonar servicios
|
- (Ticket -> Servicios) Se pueden abonar servicios
|
||||||
|
- (Facturas -> Datos básicos) Muestra valores por defecto
|
||||||
|
- (Facturas -> Borrado) Notificación al borrar un asiento ya enlazado en Sage
|
||||||
### Changed
|
### Changed
|
||||||
- (Trabajadores -> Calendario) Icono de check arreglado cuando pulsas un tipo de dia
|
- (Trabajadores -> Calendario) Icono de check arreglado cuando pulsas un tipo de dia
|
||||||
|
|
||||||
|
|
|
@ -139,7 +139,7 @@ module.exports = Self => {
|
||||||
ftpClient.exec((err, response) => {
|
ftpClient.exec((err, response) => {
|
||||||
if (err || response.error) {
|
if (err || response.error) {
|
||||||
console.debug(`Error downloading checksum file... ${response.error}`);
|
console.debug(`Error downloading checksum file... ${response.error}`);
|
||||||
return reject(err);
|
return reject(response.error || err);
|
||||||
}
|
}
|
||||||
|
|
||||||
resolve(response);
|
resolve(response);
|
||||||
|
|
|
@ -84,7 +84,7 @@
|
||||||
"worker": {
|
"worker": {
|
||||||
"type": "hasOne",
|
"type": "hasOne",
|
||||||
"model": "Worker",
|
"model": "Worker",
|
||||||
"foreignKey": "userFk"
|
"foreignKey": "id"
|
||||||
},
|
},
|
||||||
"userConfig": {
|
"userConfig": {
|
||||||
"type": "hasOne",
|
"type": "hasOne",
|
||||||
|
|
|
@ -34,7 +34,7 @@ BEGIN
|
||||||
isAllowedToWork
|
isAllowedToWork
|
||||||
FROM(SELECT t.dated,
|
FROM(SELECT t.dated,
|
||||||
b.id businessFk,
|
b.id businessFk,
|
||||||
w.userFk,
|
w.id,
|
||||||
b.departmentFk,
|
b.departmentFk,
|
||||||
IF(j.start = NULL, NULL, GROUP_CONCAT(DISTINCT LEFT(j.start,5) ORDER BY j.start ASC SEPARATOR ' - ')) hourStart ,
|
IF(j.start = NULL, NULL, GROUP_CONCAT(DISTINCT LEFT(j.start,5) ORDER BY j.start ASC SEPARATOR ' - ')) hourStart ,
|
||||||
IF(j.start = NULL, NULL, GROUP_CONCAT(DISTINCT LEFT(j.end,5) ORDER BY j.end ASC SEPARATOR ' - ')) hourEnd,
|
IF(j.start = NULL, NULL, GROUP_CONCAT(DISTINCT LEFT(j.end,5) ORDER BY j.end ASC SEPARATOR ' - ')) hourEnd,
|
||||||
|
@ -48,14 +48,14 @@ BEGIN
|
||||||
FROM time t
|
FROM time t
|
||||||
LEFT JOIN business b ON t.dated BETWEEN b.started AND IFNULL(b.ended, vDatedTo)
|
LEFT JOIN business b ON t.dated BETWEEN b.started AND IFNULL(b.ended, vDatedTo)
|
||||||
LEFT JOIN worker w ON w.id = b.workerFk
|
LEFT JOIN worker w ON w.id = b.workerFk
|
||||||
JOIN tmp.`user` u ON u.userFK = w.userFK
|
JOIN tmp.`user` u ON u.userFK = w.id
|
||||||
LEFT JOIN workCenter wc ON wc.id = b.workcenterFK
|
LEFT JOIN workCenter wc ON wc.id = b.workcenterFK
|
||||||
LEFT JOIN postgresql.calendar_labour_type cl ON cl.calendar_labour_type_id = b.calendarTypeFk
|
LEFT JOIN postgresql.calendar_labour_type cl ON cl.calendar_labour_type_id = b.calendarTypeFk
|
||||||
LEFT JOIN postgresql.journey j ON j.business_id = b.id AND j.day_id = WEEKDAY(t.dated) + 1
|
LEFT JOIN postgresql.journey j ON j.business_id = b.id AND j.day_id = WEEKDAY(t.dated) + 1
|
||||||
LEFT JOIN postgresql.calendar_employee ce ON ce.businessFk = b.id AND ce.date = t.dated
|
LEFT JOIN postgresql.calendar_employee ce ON ce.businessFk = b.id AND ce.date = t.dated
|
||||||
LEFT JOIN absenceType at2 ON at2.id = ce.calendar_state_id
|
LEFT JOIN absenceType at2 ON at2.id = ce.calendar_state_id
|
||||||
WHERE t.dated BETWEEN vDatedFrom AND vDatedTo
|
WHERE t.dated BETWEEN vDatedFrom AND vDatedTo
|
||||||
GROUP BY w.userFk, t.dated
|
GROUP BY w.id, t.dated
|
||||||
)sub;
|
)sub;
|
||||||
|
|
||||||
UPDATE tmp.timeBusinessCalculate t
|
UPDATE tmp.timeBusinessCalculate t
|
||||||
|
|
|
@ -46,7 +46,7 @@ BEGIN
|
||||||
CONCAT('Cliente ', NEW.id),
|
CONCAT('Cliente ', NEW.id),
|
||||||
CONCAT('Recibida la documentación: ', vText)
|
CONCAT('Recibida la documentación: ', vText)
|
||||||
FROM worker w
|
FROM worker w
|
||||||
LEFT JOIN account.user u ON w.userFk = u.id AND u.active
|
LEFT JOIN account.user u ON w.id = u.id AND u.active
|
||||||
LEFT JOIN account.account ac ON ac.id = u.id
|
LEFT JOIN account.account ac ON ac.id = u.id
|
||||||
WHERE w.id = NEW.salesPersonFk;
|
WHERE w.id = NEW.salesPersonFk;
|
||||||
END IF;
|
END IF;
|
||||||
|
|
|
@ -3,11 +3,11 @@ INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `pri
|
||||||
('Ticket', 'editDiscount', 'WRITE', 'ALLOW', 'ROLE', 'claimManager'),
|
('Ticket', 'editDiscount', 'WRITE', 'ALLOW', 'ROLE', 'claimManager'),
|
||||||
('Ticket', 'editDiscount', 'WRITE', 'ALLOW', 'ROLE', 'salesPerson'),
|
('Ticket', 'editDiscount', 'WRITE', 'ALLOW', 'ROLE', 'salesPerson'),
|
||||||
('Ticket', 'isRoleAdvanced', '*', 'ALLOW', 'ROLE', 'salesAssistant'),
|
('Ticket', 'isRoleAdvanced', '*', 'ALLOW', 'ROLE', 'salesAssistant'),
|
||||||
('Ticket', 'isRoleAdvanced', '*', 'ALLOW', 'ROLE', 'deliveryBoss'),
|
('Ticket', 'isRoleAdvanced', '*', 'ALLOW', 'ROLE', 'deliveryAssistant'),
|
||||||
('Ticket', 'isRoleAdvanced', '*', 'ALLOW', 'ROLE', 'buyer'),
|
('Ticket', 'isRoleAdvanced', '*', 'ALLOW', 'ROLE', 'buyer'),
|
||||||
('Ticket', 'isRoleAdvanced', '*', 'ALLOW', 'ROLE', 'claimManager'),
|
('Ticket', 'isRoleAdvanced', '*', 'ALLOW', 'ROLE', 'claimManager'),
|
||||||
('Ticket', 'deleteTicketWithPartPrepared', 'WRITE', 'ALLOW', 'ROLE', 'salesAssistant'),
|
('Ticket', 'deleteTicketWithPartPrepared', 'WRITE', 'ALLOW', 'ROLE', 'salesAssistant'),
|
||||||
('Ticket', 'editZone', 'WRITE', 'ALLOW', 'ROLE', 'deliveryBoss'),
|
('Ticket', 'editZone', 'WRITE', 'ALLOW', 'ROLE', 'deliveryAssistant'),
|
||||||
('State', 'editableStates', 'READ', 'ALLOW', 'ROLE', 'employee'),
|
('State', 'editableStates', 'READ', 'ALLOW', 'ROLE', 'employee'),
|
||||||
('State', 'seeEditableStates', 'READ', 'ALLOW', 'ROLE', 'administrative'),
|
('State', 'seeEditableStates', 'READ', 'ALLOW', 'ROLE', 'administrative'),
|
||||||
('State', 'seeEditableStates', 'READ', 'ALLOW', 'ROLE', 'production'),
|
('State', 'seeEditableStates', 'READ', 'ALLOW', 'ROLE', 'production'),
|
|
@ -1,6 +1,6 @@
|
||||||
|
|
||||||
ALTER TABLE `vn`.`deviceLog` ADD serialNumber varchar(45) DEFAULT NULL NULL;
|
-- ALTER TABLE `vn`.`deviceLog` ADD serialNumber varchar(45) DEFAULT NULL NULL;
|
||||||
|
|
||||||
INSERT INTO `salix`.`ACL` ( model, property, accessType, permission, principalType, principalId)
|
-- INSERT INTO `salix`.`ACL` ( model, property, accessType, permission, principalType, principalId)
|
||||||
VALUES( 'DeviceLog', 'create', 'WRITE', 'ALLOW', 'ROLE', 'employee');
|
-- VALUES( 'DeviceLog', 'create', 'WRITE', 'ALLOW', 'ROLE', 'employee');
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,42 @@
|
||||||
|
-- No encuentro este back
|
||||||
|
DELETE FROM `salix`.`ACL` WHERE property = 'activeWorkersWithRole';
|
||||||
|
DELETE FROM `salix`.`ACL` WHERE model = 'Client' AND property = '*';
|
||||||
|
|
||||||
|
INSERT INTO `salix`.`ACL` (model,property,accessType,permission,principalType,principalId)
|
||||||
|
VALUES ('Client','findOne','READ','ALLOW','ROLE','employee');
|
||||||
|
INSERT INTO `salix`.`ACL` (model,property,accessType,permission,principalType,principalId)
|
||||||
|
VALUES ('Client','findById','READ','ALLOW','ROLE','employee');
|
||||||
|
INSERT INTO `salix`.`ACL` (model,property,accessType,permission,principalType,principalId)
|
||||||
|
VALUES ('Client','find','READ','ALLOW','ROLE','employee');
|
||||||
|
INSERT INTO `salix`.`ACL` (model,property,accessType,permission,principalType,principalId)
|
||||||
|
VALUES ('Client','exists','READ','ALLOW','ROLE','employee');
|
||||||
|
INSERT INTO `salix`.`ACL` (model,property,accessType,permission,principalType,principalId)
|
||||||
|
VALUES ('Client','__get__addresses','READ','ALLOW','ROLE','employee');
|
||||||
|
|
||||||
|
DELETE FROM `salix`.`ACL` WHERE model = 'Client' AND property = '*' AND accessType IN (
|
||||||
|
'campaignMetricsEmail',
|
||||||
|
'campaignMetricsPdf',
|
||||||
|
'clientDebtStatementEmail',
|
||||||
|
'clientDebtStatementHtml',
|
||||||
|
'clientDebtStatementPdf',
|
||||||
|
'clientWelcomeEmail',
|
||||||
|
'clientWelcomeHtml',
|
||||||
|
'consumptionSendQueued',
|
||||||
|
'creditRequestEmail',
|
||||||
|
'creditRequestHtml',
|
||||||
|
'creditRequestPdf',
|
||||||
|
'getClientOrSupplierReference',
|
||||||
|
'incotermsAuthorizationEmail',
|
||||||
|
'incotermsAuthorizationHtml',
|
||||||
|
'incotermsAuthorizationPdf',
|
||||||
|
'letterDebtorNdEmail',
|
||||||
|
'letterDebtorNdHtml',
|
||||||
|
'letterDebtorPdf',
|
||||||
|
'letterDebtorStEmail',
|
||||||
|
'letterDebtorStHtml',
|
||||||
|
'printerSetupEmail',
|
||||||
|
'printerSetupHtml',
|
||||||
|
'sepaCoreEmail',
|
||||||
|
'setPassword',
|
||||||
|
'updateUser',
|
||||||
|
'uploadFile');
|
|
@ -0,0 +1,4 @@
|
||||||
|
ALTER TABLE `vn`.`worker` DROP KEY `user_id_UNIQUE`;
|
||||||
|
|
||||||
|
ALTER TABLE `vn`.`worker` DROP COLUMN `userFk`;
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
INSERT INTO `salix`.`ACL` ( model, property, accessType, permission, principalType, principalId)
|
||||||
|
VALUES
|
||||||
|
('ExpeditionMistakeType', '*', 'READ', 'ALLOW', 'ROLE', 'employee'),
|
||||||
|
('WorkerMistakeType', '*', 'READ', 'ALLOW', 'ROLE', 'employee'),
|
||||||
|
('ExpeditionMistake','*','WRITE','ALLOW','ROLE','employee'),
|
||||||
|
('WorkerMistake', '*', 'WRITE', 'ALLOW', 'ROLE', 'coolerBoss'),
|
||||||
|
('MistakesTypes', '*', 'WRITE', 'ALLOW', 'ROLE', 'coolerBoss'),
|
||||||
|
('MistakeType','*','READ','ALLOW','ROLE','employee'),
|
||||||
|
('MachineWorker', '*', 'READ', 'ALLOW', 'ROLE', 'coolerAssist'),
|
||||||
|
('Printer','*','READ','ALLOW','ROLE','employee'),
|
||||||
|
('SaleMistake', '*', 'WRITE', 'ALLOW', 'ROLE', 'production');
|
|
@ -0,0 +1,86 @@
|
||||||
|
DELIMITER $$
|
||||||
|
$$
|
||||||
|
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`timeBusiness_calculate`(vDatedFrom DATETIME, vDatedTo DATETIME)
|
||||||
|
BEGIN
|
||||||
|
/**
|
||||||
|
* Horas que debe trabajar un empleado según contrato y día.
|
||||||
|
* @param vDatedFrom workerTimeControl
|
||||||
|
* @param vDatedTo workerTimeControl
|
||||||
|
* @table tmp.user(userFk)
|
||||||
|
* @return tmp.timeBusinessCalculate
|
||||||
|
*/
|
||||||
|
DROP TEMPORARY TABLE IF EXISTS tmp.timeBusinessCalculate;
|
||||||
|
CREATE TEMPORARY TABLE tmp.timeBusinessCalculate
|
||||||
|
(INDEX (departmentFk))
|
||||||
|
SELECT dated,
|
||||||
|
businessFk,
|
||||||
|
sub.id userFk,
|
||||||
|
departmentFk,
|
||||||
|
hourStart,
|
||||||
|
hourEnd,
|
||||||
|
timeTable,
|
||||||
|
timeWorkSeconds,
|
||||||
|
SEC_TO_TIME(timeWorkSeconds) timeWorkSexagesimal,
|
||||||
|
timeWorkSeconds / 3600 timeWorkDecimal,
|
||||||
|
timeWorkSeconds timeBusinessSeconds,
|
||||||
|
SEC_TO_TIME(timeWorkSeconds) timeBusinessSexagesimal,
|
||||||
|
timeWorkSeconds / 3600 timeBusinessDecimal,
|
||||||
|
name type,
|
||||||
|
permissionRate,
|
||||||
|
hoursWeek,
|
||||||
|
discountRate,
|
||||||
|
isAllowedToWork
|
||||||
|
FROM(SELECT t.dated,
|
||||||
|
b.id businessFk,
|
||||||
|
w.id,
|
||||||
|
b.departmentFk,
|
||||||
|
IF(bs.started = NULL, NULL, GROUP_CONCAT(DISTINCT LEFT(bs.started,5) ORDER BY bs.started ASC SEPARATOR ' - ')) hourStart ,
|
||||||
|
IF(bs.started = NULL, NULL, GROUP_CONCAT(DISTINCT LEFT(bs.ended,5) ORDER BY bs.ended ASC SEPARATOR ' - ')) hourEnd,
|
||||||
|
IF(bs.started = NULL, NULL, GROUP_CONCAT(DISTINCT LEFT(bs.started,5), " - ", LEFT(bs.ended,5) ORDER BY bs.ended ASC SEPARATOR ' - ')) timeTable,
|
||||||
|
IF(bs.started = NULL, 0, IFNULL(SUM(TIME_TO_SEC(bs.ended)) - SUM(TIME_TO_SEC(bs.started)), 0)) timeWorkSeconds,
|
||||||
|
at2.name,
|
||||||
|
at2.permissionRate,
|
||||||
|
at2.discountRate,
|
||||||
|
ct.hoursWeek hoursWeek,
|
||||||
|
at2.isAllowedToWork
|
||||||
|
FROM time t
|
||||||
|
LEFT JOIN business b ON t.dated BETWEEN b.started AND IFNULL(b.ended, vDatedTo)
|
||||||
|
LEFT JOIN worker w ON w.id = b.workerFk
|
||||||
|
JOIN tmp.`user` u ON u.userFK = w.id
|
||||||
|
LEFT JOIN workCenter wc ON wc.id = b.workcenterFK
|
||||||
|
LEFT JOIN calendarType ct ON ct.id = b.calendarTypeFk
|
||||||
|
LEFT JOIN businessSchedule bs ON bs.businessFk = b.id AND bs.weekday = WEEKDAY(t.dated) + 1
|
||||||
|
LEFT JOIN calendar c ON c.businessFk = b.id AND c.dated = t.dated
|
||||||
|
LEFT JOIN absenceType at2 ON at2.id = c.dayOffTypeFk
|
||||||
|
WHERE t.dated BETWEEN vDatedFrom AND vDatedTo
|
||||||
|
GROUP BY w.id, t.dated
|
||||||
|
)sub;
|
||||||
|
|
||||||
|
UPDATE tmp.timeBusinessCalculate t
|
||||||
|
LEFT JOIN businessSchedule bs ON bs.businessFk = t.businessFk
|
||||||
|
SET t.timeWorkSeconds = t.hoursWeek / 5 * 3600,
|
||||||
|
t.timeWorkSexagesimal = SEC_TO_TIME( t.hoursWeek / 5 * 3600),
|
||||||
|
t.timeWorkDecimal = t.hoursWeek / 5,
|
||||||
|
t.timeBusinessSeconds = t.hoursWeek / 5 * 3600,
|
||||||
|
t.timeBusinessSexagesimal = SEC_TO_TIME( t.hoursWeek / 5 * 3600),
|
||||||
|
t.timeBusinessDecimal = t.hoursWeek / 5
|
||||||
|
WHERE DAYOFWEEK(t.dated) IN(2,3,4,5,6) AND bs.id IS NULL ;
|
||||||
|
|
||||||
|
UPDATE tmp.timeBusinessCalculate t
|
||||||
|
SET t.timeWorkSeconds = t.timeWorkSeconds - (t.timeWorkSeconds * permissionRate) ,
|
||||||
|
t.timeWorkSexagesimal = SEC_TO_TIME ((t.timeWorkDecimal - (t.timeWorkDecimal * permissionRate)) * 3600),
|
||||||
|
t.timeWorkDecimal = t.timeWorkDecimal - (t.timeWorkDecimal * permissionRate)
|
||||||
|
WHERE permissionRate <> 0;
|
||||||
|
|
||||||
|
UPDATE tmp.timeBusinessCalculate t
|
||||||
|
JOIN calendarHolidays ch ON ch.dated = t.dated
|
||||||
|
JOIN business b ON b.id = t.businessFk
|
||||||
|
AND b.workcenterFk = ch.workcenterFk
|
||||||
|
SET t.timeWorkSeconds = 0,
|
||||||
|
t.timeWorkSexagesimal = 0,
|
||||||
|
t.timeWorkDecimal = 0,
|
||||||
|
t.permissionrate = 1,
|
||||||
|
t.type = 'Festivo'
|
||||||
|
WHERE t.type IS NULL;
|
||||||
|
END$$
|
||||||
|
DELIMITER ;
|
|
@ -0,0 +1,57 @@
|
||||||
|
DELIMITER $$
|
||||||
|
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `account`.`account_enable`(vSelf INT)
|
||||||
|
BEGIN
|
||||||
|
/**
|
||||||
|
* Enables a worker's account and sets up email configurations.
|
||||||
|
*/
|
||||||
|
UPDATE user
|
||||||
|
SET active = TRUE
|
||||||
|
WHERE id = vSelf;
|
||||||
|
|
||||||
|
INSERT IGNORE INTO account
|
||||||
|
SET id = vSelf;
|
||||||
|
|
||||||
|
INSERT IGNORE INTO mailAliasAccount (mailAlias, account)
|
||||||
|
SELECT id, vSelf
|
||||||
|
FROM mailAlias
|
||||||
|
WHERE alias = 'general';
|
||||||
|
|
||||||
|
INSERT IGNORE INTO mailForward (account, forwardTo)
|
||||||
|
SELECT vSelf, email
|
||||||
|
FROM user
|
||||||
|
WHERE id = vSelf;
|
||||||
|
END$$
|
||||||
|
DELIMITER ;
|
||||||
|
|
||||||
|
DELIMITER $$
|
||||||
|
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`worker_updateBusiness`(vSelf INT)
|
||||||
|
BEGIN
|
||||||
|
/**
|
||||||
|
* Activates an account and configures its email settings.
|
||||||
|
*
|
||||||
|
* @param vSelf account id.
|
||||||
|
*/
|
||||||
|
DECLARE vOldBusinessFk INT;
|
||||||
|
DECLARE vNewBusinessFk INT;
|
||||||
|
|
||||||
|
SELECT businessFk INTO vOldBusinessFk FROM worker WHERE id = vSelf;
|
||||||
|
|
||||||
|
SELECT id INTO vNewBusinessFk
|
||||||
|
FROM business
|
||||||
|
WHERE workerFk = vSelf
|
||||||
|
AND util.VN_CURDATE() BETWEEN started AND IFNULL(ended, util.VN_CURDATE());
|
||||||
|
|
||||||
|
UPDATE worker
|
||||||
|
SET businessFk = vNewBusinessFk
|
||||||
|
WHERE id = vSelf;
|
||||||
|
|
||||||
|
IF NOT (vOldBusinessFk <=> vNewBusinessFk) THEN
|
||||||
|
IF vNewBusinessFk IS NULL THEN
|
||||||
|
CALL workerDisable(vSelf);
|
||||||
|
END IF;
|
||||||
|
IF vOldBusinessFk IS NULL THEN
|
||||||
|
CALL account.account_enable(vSelf);
|
||||||
|
END IF;
|
||||||
|
END IF;
|
||||||
|
END$$
|
||||||
|
DELIMITER ;
|
|
@ -0,0 +1,10 @@
|
||||||
|
DELETE FROM `salix`.`ACL` WHERE model = 'Account' AND property = '*' AND principalId = 'employee';
|
||||||
|
|
||||||
|
INSERT INTO `salix`.`ACL` (model,property,accessType,permission,principalType,principalId)
|
||||||
|
VALUES ('Account','findOne','READ','ALLOW','ROLE','employee');
|
||||||
|
INSERT INTO `salix`.`ACL` (model,property,accessType,permission,principalType,principalId)
|
||||||
|
VALUES ('Account','findById','READ','ALLOW','ROLE','employee');
|
||||||
|
INSERT INTO `salix`.`ACL` (model,property,accessType,permission,principalType,principalId)
|
||||||
|
VALUES ('Account','find','READ','ALLOW','ROLE','employee');
|
||||||
|
INSERT INTO `salix`.`ACL` (model,property,accessType,permission,principalType,principalId)
|
||||||
|
VALUES ('Account','exists','READ','ALLOW','ROLE','employee');
|
|
@ -0,0 +1,21 @@
|
||||||
|
-- Auto-generated SQL script. Actual values for binary/complex data types may differ - what you see is the default string representation of values.
|
||||||
|
INSERT INTO `account`.`role` (name, description)
|
||||||
|
VALUES ('deliveryAssistant','Jefe auxiliar repartos');
|
||||||
|
|
||||||
|
INSERT INTO `account`.`roleInherit` (role, inheritsFrom)
|
||||||
|
SELECT (SELECT id FROM account.role r1 WHERE r1.name = 'deliveryAssistant'), ri.inheritsFrom
|
||||||
|
FROM account.roleInherit ri
|
||||||
|
JOIN account.role r2 ON r2.id = ri.`role`
|
||||||
|
WHERE r2.name = 'deliveryBoss';
|
||||||
|
|
||||||
|
DELETE `account`.`roleInherit` FROM `account`.`roleInherit`
|
||||||
|
JOIN `account`.`role` r ON `account`.`roleInherit`.role = r.id
|
||||||
|
WHERE r.name = 'deliveryBoss';
|
||||||
|
|
||||||
|
INSERT INTO `account`.`roleInherit` (role, inheritsFrom)
|
||||||
|
SELECT (SELECT id FROM account.role WHERE name = 'deliveryBoss') role,
|
||||||
|
(SELECT id FROM account.role WHERE name = 'deliveryAssistant') roleInherit;
|
||||||
|
|
||||||
|
UPDATE `salix`.`ACL`
|
||||||
|
SET principalId='deliveryAssistant'
|
||||||
|
WHERE principalId='deliveryBoss';
|
|
@ -0,0 +1,20 @@
|
||||||
|
DELIMITER $$
|
||||||
|
$$
|
||||||
|
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`workerCreate`(
|
||||||
|
vFirstname VARCHAR(50),
|
||||||
|
vLastName VARCHAR(50),
|
||||||
|
vCode CHAR(3),
|
||||||
|
vBossFk INT,
|
||||||
|
vUserFk INT,
|
||||||
|
vFi VARCHAR(15) ,
|
||||||
|
vBirth DATE
|
||||||
|
)
|
||||||
|
BEGIN
|
||||||
|
/**
|
||||||
|
* Create new worker
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
INSERT INTO worker(id, code, firstName, lastName, bossFk, fi, birth)
|
||||||
|
VALUES (vUserFk, vCode, vFirstname, vLastName, vBossFk, vFi, vBirth);
|
||||||
|
END$$
|
||||||
|
DELIMITER ;
|
|
@ -0,0 +1,2 @@
|
||||||
|
-- Locally it fails because it is executed before the fixtures and the roleConfig table is empty
|
||||||
|
CALL `account`.`role_syncPrivileges`();
|
|
@ -87,8 +87,8 @@ INSERT INTO `vn`.`educationLevel` (`id`, `name`)
|
||||||
(1, 'ESTUDIOS PRIMARIOS COMPLETOS'),
|
(1, 'ESTUDIOS PRIMARIOS COMPLETOS'),
|
||||||
(2, 'ENSEÑANZAS DE BACHILLERATO');
|
(2, 'ENSEÑANZAS DE BACHILLERATO');
|
||||||
|
|
||||||
INSERT INTO `vn`.`worker`(`id`,`code`, `firstName`, `lastName`, `userFk`, `bossFk`)
|
INSERT INTO `vn`.`worker`(`id`,`code`, `firstName`, `lastName`, `bossFk`)
|
||||||
SELECT id,UPPER(LPAD(role, 3, '0')), name, name, id, 9
|
SELECT id,UPPER(LPAD(role, 3, '0')), name, name, 9
|
||||||
FROM `account`.`user`;
|
FROM `account`.`user`;
|
||||||
|
|
||||||
UPDATE `vn`.`worker` SET bossFk = NULL WHERE id = 20;
|
UPDATE `vn`.`worker` SET bossFk = NULL WHERE id = 20;
|
||||||
|
@ -188,13 +188,13 @@ INSERT INTO `vn`.`printer` (`id`, `name`, `path`, `isLabeler`, `sectorFk`, `ipAd
|
||||||
|
|
||||||
UPDATE `vn`.`sector` SET mainPrinterFk = 1 WHERE id = 1;
|
UPDATE `vn`.`sector` SET mainPrinterFk = 1 WHERE id = 1;
|
||||||
|
|
||||||
INSERT INTO `vn`.`worker`(`id`, `code`, `firstName`, `lastName`, `userFk`,`bossFk`, `phone`)
|
INSERT INTO `vn`.`worker`(`id`, `code`, `firstName`, `lastName`,`bossFk`, `phone`)
|
||||||
VALUES
|
VALUES
|
||||||
(1106, 'LGN', 'David Charles', 'Haller', 1106, 19, 432978106),
|
(1106, 'LGN', 'David Charles', 'Haller', 19, 432978106),
|
||||||
(1107, 'ANT', 'Hank' , 'Pym' , 1107, 19, 432978107),
|
(1107, 'ANT', 'Hank' , 'Pym' , 19, 432978107),
|
||||||
(1108, 'DCX', 'Charles' , 'Xavier', 1108, 19, 432978108),
|
(1108, 'DCX', 'Charles' , 'Xavier', 19, 432978108),
|
||||||
(1109, 'HLK', 'Bruce' , 'Banner', 1109, 19, 432978109),
|
(1109, 'HLK', 'Bruce' , 'Banner', 19, 432978109),
|
||||||
(1110, 'JJJ', 'Jessica' , 'Jones' , 1110, 19, 432978110);
|
(1110, 'JJJ', 'Jessica' , 'Jones' , 19, 432978110);
|
||||||
|
|
||||||
INSERT INTO `vn`.`parking` (`id`, `column`, `row`, `sectorFk`, `code`, `pickingOrder`)
|
INSERT INTO `vn`.`parking` (`id`, `column`, `row`, `sectorFk`, `code`, `pickingOrder`)
|
||||||
VALUES
|
VALUES
|
||||||
|
@ -1013,7 +1013,7 @@ INSERT INTO `vn`.`sale`(`id`, `itemFk`, `ticketFk`, `concept`, `quantity`, `pric
|
||||||
(4, 4, 1, 'Melee weapon heavy shield 100cm', 20, 1.69, 0, 0, 0, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH)),
|
(4, 4, 1, 'Melee weapon heavy shield 100cm', 20, 1.69, 0, 0, 0, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH)),
|
||||||
(5, 1, 2, 'Ranged weapon longbow 200cm', 1, 110.33, 0, 0, 0, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH)),
|
(5, 1, 2, 'Ranged weapon longbow 200cm', 1, 110.33, 0, 0, 0, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH)),
|
||||||
(6, 1, 3, 'Ranged weapon longbow 200cm', 1, 110.33, 0, 0, 0, DATE_ADD(util.VN_CURDATE(), INTERVAL -2 MONTH)),
|
(6, 1, 3, 'Ranged weapon longbow 200cm', 1, 110.33, 0, 0, 0, DATE_ADD(util.VN_CURDATE(), INTERVAL -2 MONTH)),
|
||||||
(7, 2, 11, 'Melee weapon combat fist 15cm', 15, 7.44, 0, 0, 0, util.VN_CURDATE()),
|
(7, 2, 11, 'Melee weapon combat fist 15cm', 15, 7.74, 0, 0, 0, util.VN_CURDATE()),
|
||||||
(8, 4, 11, 'Melee weapon heavy shield 100cm', 10, 1.79, 0, 0, 0, util.VN_CURDATE()),
|
(8, 4, 11, 'Melee weapon heavy shield 100cm', 10, 1.79, 0, 0, 0, util.VN_CURDATE()),
|
||||||
(9, 1, 16, 'Ranged weapon longbow 200cm', 1, 103.49, 0, 0, 0, util.VN_CURDATE()),
|
(9, 1, 16, 'Ranged weapon longbow 200cm', 1, 103.49, 0, 0, 0, util.VN_CURDATE()),
|
||||||
(10, 2, 16, 'Melee weapon combat fist 15cm', 10, 7.09, 0, 0, 0, util.VN_CURDATE()),
|
(10, 2, 16, 'Melee weapon combat fist 15cm', 10, 7.09, 0, 0, 0, util.VN_CURDATE()),
|
||||||
|
@ -2975,4 +2975,6 @@ INSERT INTO vn.XDiario (id, ASIEN, FECHA, SUBCTA, CONTRA, CONCEPTO, EURODEBE, EU
|
||||||
(5, 2.0, util.VN_CURDATE(), '2000000000', '4300001104', 'n/fra T4444444 Tony Stark', NULL, 8.07, NULL, NULL, '0', NULL, 0.00, NULL, NULL, NULL, NULL, NULL, '2', NULL, 1, 2, 'I.F.', 'Nombre Importador', 1, 0, 0, util.VN_CURDATE(), 0, 442, 0, 0, 0.00, NULL, NULL, util.VN_CURDATE(), NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, 0),
|
(5, 2.0, util.VN_CURDATE(), '2000000000', '4300001104', 'n/fra T4444444 Tony Stark', NULL, 8.07, NULL, NULL, '0', NULL, 0.00, NULL, NULL, NULL, NULL, NULL, '2', NULL, 1, 2, 'I.F.', 'Nombre Importador', 1, 0, 0, util.VN_CURDATE(), 0, 442, 0, 0, 0.00, NULL, NULL, util.VN_CURDATE(), NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, 0),
|
||||||
(6, 2.0, util.VN_CURDATE(), '4770000010', '4300001104', 'Inmovilizado pendiente : n/fra T4444444 Tony Stark', NULL, 0.81, 8.07, 'T', '4444444', 10.00, NULL, NULL, NULL, NULL, NULL, '', '2', '', 1, 1, '06089160W', 'IRON MAN', 1, 1, 0, util.VN_CURDATE(), 0, 442, 0, 0, 0.00, NULL, NULL, util.VN_CURDATE(), NULL, 1, 1, 1, 1, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, 0);
|
(6, 2.0, util.VN_CURDATE(), '4770000010', '4300001104', 'Inmovilizado pendiente : n/fra T4444444 Tony Stark', NULL, 0.81, 8.07, 'T', '4444444', 10.00, NULL, NULL, NULL, NULL, NULL, '', '2', '', 1, 1, '06089160W', 'IRON MAN', 1, 1, 0, util.VN_CURDATE(), 0, 442, 0, 0, 0.00, NULL, NULL, util.VN_CURDATE(), NULL, 1, 1, 1, 1, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, 0);
|
||||||
|
|
||||||
|
INSERT INTO `vn`.`mistakeType` (`id`, `description`)
|
||||||
|
VALUES
|
||||||
|
(1, 'Incorrect quantity');
|
||||||
|
|
|
@ -26556,6 +26556,7 @@ CREATE TABLE `deviceLog` (
|
||||||
`created` timestamp NOT NULL DEFAULT current_timestamp(),
|
`created` timestamp NOT NULL DEFAULT current_timestamp(),
|
||||||
`nameApp` varchar(45) DEFAULT NULL,
|
`nameApp` varchar(45) DEFAULT NULL,
|
||||||
`versionApp` varchar(45) DEFAULT NULL,
|
`versionApp` varchar(45) DEFAULT NULL,
|
||||||
|
`serialNumber` varchar(45) DEFAULT NULL,
|
||||||
PRIMARY KEY (`id`),
|
PRIMARY KEY (`id`),
|
||||||
KEY `deviceLog_FK` (`userFk`),
|
KEY `deviceLog_FK` (`userFk`),
|
||||||
CONSTRAINT `deviceLog_FK` FOREIGN KEY (`userFk`) REFERENCES `worker` (`id`) ON UPDATE CASCADE
|
CONSTRAINT `deviceLog_FK` FOREIGN KEY (`userFk`) REFERENCES `worker` (`id`) ON UPDATE CASCADE
|
||||||
|
|
|
@ -6,13 +6,13 @@ describe('item_getBalance()', () => {
|
||||||
let stmts = [];
|
let stmts = [];
|
||||||
|
|
||||||
let params = {
|
let params = {
|
||||||
warehouseFk: 1,
|
itemFk: 1,
|
||||||
itemFk: 1
|
warehouseFk: 1
|
||||||
};
|
};
|
||||||
|
|
||||||
const conn = await app.models.Item.dataSource.connector;
|
const conn = await app.models.Item.dataSource.connector;
|
||||||
|
|
||||||
stmts.push(new ParameterizedSQL('CALL vn.item_getBalance(?, ?)', [
|
stmts.push(new ParameterizedSQL('CALL vn.item_getBalance(?, ?, NULL)', [
|
||||||
params.warehouseFk,
|
params.warehouseFk,
|
||||||
params.itemFk
|
params.itemFk
|
||||||
]));
|
]));
|
||||||
|
|
|
@ -1,42 +0,0 @@
|
||||||
const app = require('vn-loopback/server/server');
|
|
||||||
const ParameterizedSQL = require('loopback-connector').ParameterizedSQL;
|
|
||||||
|
|
||||||
describe('logAddWithUser()', () => {
|
|
||||||
it('should log any action taken by the user in a table ending in Log', async() => {
|
|
||||||
let stmts = [];
|
|
||||||
let stmt;
|
|
||||||
|
|
||||||
stmts.push('START TRANSACTION');
|
|
||||||
|
|
||||||
let params = {
|
|
||||||
ticketFk: 1,
|
|
||||||
userId: 9,
|
|
||||||
actionCode: 'update',
|
|
||||||
targetEntity: 'ticket',
|
|
||||||
description: 'we are testing stuff'
|
|
||||||
};
|
|
||||||
|
|
||||||
stmt = new ParameterizedSQL('CALL vn.logAddWithUser(?, ?, ?, ?, ?)', [
|
|
||||||
params.ticketFk,
|
|
||||||
params.userId,
|
|
||||||
params.actionCode,
|
|
||||||
params.targetEntity,
|
|
||||||
params.description
|
|
||||||
]);
|
|
||||||
stmts.push(stmt);
|
|
||||||
|
|
||||||
stmt = new ParameterizedSQL('SELECT * FROM vn.ticketLog WHERE description = ?', [
|
|
||||||
params.description
|
|
||||||
]);
|
|
||||||
let ticketLogIndex = stmts.push(stmt) - 1;
|
|
||||||
|
|
||||||
stmts.push('ROLLBACK');
|
|
||||||
|
|
||||||
let sql = ParameterizedSQL.join(stmts, ';');
|
|
||||||
let result = await app.models.Ticket.rawStmt(sql);
|
|
||||||
|
|
||||||
savedDescription = result[ticketLogIndex][0].description;
|
|
||||||
|
|
||||||
expect(savedDescription).toEqual(params.description);
|
|
||||||
});
|
|
||||||
});
|
|
|
@ -14,14 +14,6 @@ describe('timeControl_calculateByUser()', () => {
|
||||||
let stmts = [];
|
let stmts = [];
|
||||||
let stmt;
|
let stmt;
|
||||||
|
|
||||||
stmts.push('START TRANSACTION');
|
|
||||||
|
|
||||||
stmts.push(`
|
|
||||||
DROP TEMPORARY TABLE IF EXISTS
|
|
||||||
tmp.timeControlCalculate,
|
|
||||||
tmp.timeBusinessCalculate
|
|
||||||
`);
|
|
||||||
|
|
||||||
let params = {
|
let params = {
|
||||||
workerID: 1106,
|
workerID: 1106,
|
||||||
start: start,
|
start: start,
|
||||||
|
@ -37,17 +29,15 @@ describe('timeControl_calculateByUser()', () => {
|
||||||
|
|
||||||
let tableIndex = stmts.push('SELECT * FROM tmp.timeControlCalculate') - 1;
|
let tableIndex = stmts.push('SELECT * FROM tmp.timeControlCalculate') - 1;
|
||||||
|
|
||||||
stmts.push('ROLLBACK');
|
|
||||||
|
|
||||||
let sql = ParameterizedSQL.join(stmts, ';');
|
let sql = ParameterizedSQL.join(stmts, ';');
|
||||||
let result = await app.models.Ticket.rawStmt(sql);
|
let result = await app.models.Ticket.rawStmt(sql);
|
||||||
|
|
||||||
let [timeControlCalculateTable] = result[tableIndex];
|
let [timeControlCalculateTable] = result[tableIndex];
|
||||||
|
|
||||||
expect(timeControlCalculateTable.timeWorkSeconds).toEqual(29400);
|
expect(timeControlCalculateTable.timeWorkSeconds).toEqual(28200);
|
||||||
});
|
});
|
||||||
|
// #2261
|
||||||
it(`should return the worked hours between last sunday and monday`, async() => {
|
xit(`should return the worked hours between last sunday and monday`, async() => {
|
||||||
let lastSunday = Date.vnNew();
|
let lastSunday = Date.vnNew();
|
||||||
let daysSinceSunday = lastSunday.getDay();
|
let daysSinceSunday = lastSunday.getDay();
|
||||||
if (daysSinceSunday === 0) // this means today is sunday but you need the previous sunday :)
|
if (daysSinceSunday === 0) // this means today is sunday but you need the previous sunday :)
|
||||||
|
@ -65,13 +55,7 @@ describe('timeControl_calculateByUser()', () => {
|
||||||
|
|
||||||
stmts.push('START TRANSACTION');
|
stmts.push('START TRANSACTION');
|
||||||
|
|
||||||
stmts.push(`
|
const workerID = 1108;
|
||||||
DROP TEMPORARY TABLE IF EXISTS
|
|
||||||
tmp.timeControlCalculate,
|
|
||||||
tmp.timeBusinessCalculate
|
|
||||||
`);
|
|
||||||
|
|
||||||
const workerID = 1107;
|
|
||||||
|
|
||||||
stmt = new ParameterizedSQL(`
|
stmt = new ParameterizedSQL(`
|
||||||
INSERT INTO vn.workerTimeControl(userFk, timed, manual, direction)
|
INSERT INTO vn.workerTimeControl(userFk, timed, manual, direction)
|
||||||
|
|
|
@ -7,7 +7,7 @@ describe('zone zone_getFromGeo()', () => {
|
||||||
let stmt;
|
let stmt;
|
||||||
|
|
||||||
stmts.push('START TRANSACTION');
|
stmts.push('START TRANSACTION');
|
||||||
let geoFk = 17;
|
let geoFk = 16;
|
||||||
|
|
||||||
stmt = new ParameterizedSQL('CALL zone_getFromGeo(?)', [
|
stmt = new ParameterizedSQL('CALL zone_getFromGeo(?)', [
|
||||||
geoFk,
|
geoFk,
|
||||||
|
|
|
@ -8,7 +8,7 @@ describe('Client create path', () => {
|
||||||
beforeAll(async() => {
|
beforeAll(async() => {
|
||||||
browser = await getBrowser();
|
browser = await getBrowser();
|
||||||
page = browser.page;
|
page = browser.page;
|
||||||
await page.loginAndModule(' deliveryBoss', 'client');
|
await page.loginAndModule('deliveryAssistant', 'client');
|
||||||
});
|
});
|
||||||
|
|
||||||
afterAll(async() => {
|
afterAll(async() => {
|
||||||
|
|
|
@ -45,7 +45,7 @@ describe('Worker create path', () => {
|
||||||
|
|
||||||
// should create a new worker and go to worker basic data'
|
// should create a new worker and go to worker basic data'
|
||||||
await page.pickDate(selectors.workerCreate.birth, new Date(1962, 8, 5));
|
await page.pickDate(selectors.workerCreate.birth, new Date(1962, 8, 5));
|
||||||
await page.autocompleteSearch(selectors.workerCreate.boss, 'deliveryBoss');
|
await page.autocompleteSearch(selectors.workerCreate.boss, 'deliveryAssistant');
|
||||||
await page.waitToClick(selectors.workerCreate.createButton);
|
await page.waitToClick(selectors.workerCreate.createButton);
|
||||||
message = await page.waitForSnackbar();
|
message = await page.waitForSnackbar();
|
||||||
await page.waitForState('worker.card.basicData');
|
await page.waitForState('worker.card.basicData');
|
||||||
|
|
|
@ -75,7 +75,7 @@ describe('Ticket Edit basic data path', () => {
|
||||||
const result = await page
|
const result = await page
|
||||||
.waitToGetProperty(selectors.ticketBasicData.stepTwoTotalPriceDif, 'innerText');
|
.waitToGetProperty(selectors.ticketBasicData.stepTwoTotalPriceDif, 'innerText');
|
||||||
|
|
||||||
expect(result).toContain('-€232.75');
|
expect(result).toContain('-€228.25');
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should select a new reason for the changes made then click on finalize`, async() => {
|
it(`should select a new reason for the changes made then click on finalize`, async() => {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import selectors from '../../helpers/selectors.js';
|
import selectors from '../../helpers/selectors.js';
|
||||||
import getBrowser from '../../helpers/puppeteer';
|
import getBrowser from '../../helpers/puppeteer.js';
|
||||||
|
|
||||||
// #1528 e2e claim/detail
|
// #1528 e2e claim/detail
|
||||||
xdescribe('Claim detail', () => {
|
xdescribe('Claim detail', () => {
|
|
@ -1,97 +0,0 @@
|
||||||
import selectors from '../../helpers/selectors.js';
|
|
||||||
import getBrowser from '../../helpers/puppeteer';
|
|
||||||
|
|
||||||
describe('Claim development', () => {
|
|
||||||
let browser;
|
|
||||||
let page;
|
|
||||||
|
|
||||||
beforeAll(async() => {
|
|
||||||
browser = await getBrowser();
|
|
||||||
page = browser.page;
|
|
||||||
await page.loginAndModule('claimManager', 'claim');
|
|
||||||
await page.accessToSearchResult('1');
|
|
||||||
await page.accessToSection('claim.card.development');
|
|
||||||
});
|
|
||||||
|
|
||||||
afterAll(async() => {
|
|
||||||
await browser.close();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should delete a development and create a new one', async() => {
|
|
||||||
await page.waitToClick(selectors.claimDevelopment.firstDeleteDevelopmentButton);
|
|
||||||
await page.waitToClick(selectors.claimDevelopment.addDevelopmentButton);
|
|
||||||
await page.autocompleteSearch(selectors.claimDevelopment.secondClaimReason, 'Baja calidad');
|
|
||||||
await page.autocompleteSearch(selectors.claimDevelopment.secondClaimResult, 'Deshidratacion');
|
|
||||||
await page.autocompleteSearch(selectors.claimDevelopment.secondClaimResponsible, 'Calidad general');
|
|
||||||
await page.autocompleteSearch(selectors.claimDevelopment.secondClaimWorker, 'deliveryNick');
|
|
||||||
await page.autocompleteSearch(selectors.claimDevelopment.secondClaimRedelivery, 'Reparto');
|
|
||||||
await page.waitToClick(selectors.claimDevelopment.saveDevelopmentButton);
|
|
||||||
const message = await page.waitForSnackbar();
|
|
||||||
|
|
||||||
expect(message.text).toContain('Data saved!');
|
|
||||||
});
|
|
||||||
|
|
||||||
it(`should redirect to the next section of claims as the role is claimManager`, async() => {
|
|
||||||
await page.waitForState('claim.card.action');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should edit a development', async() => {
|
|
||||||
await page.reloadSection('claim.card.development');
|
|
||||||
await page.autocompleteSearch(selectors.claimDevelopment.firstClaimReason, 'Calor');
|
|
||||||
await page.autocompleteSearch(selectors.claimDevelopment.firstClaimResult, 'Cocido');
|
|
||||||
await page.autocompleteSearch(selectors.claimDevelopment.firstClaimResponsible, 'Calidad general');
|
|
||||||
await page.autocompleteSearch(selectors.claimDevelopment.firstClaimWorker, 'adminAssistantNick');
|
|
||||||
await page.autocompleteSearch(selectors.claimDevelopment.firstClaimRedelivery, 'Cliente');
|
|
||||||
await page.waitToClick(selectors.claimDevelopment.saveDevelopmentButton);
|
|
||||||
const message = await page.waitForSnackbar();
|
|
||||||
|
|
||||||
expect(message.text).toContain('Data saved!');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should confirm the first development is the expected one', async() => {
|
|
||||||
await page.reloadSection('claim.card.development');
|
|
||||||
const reason = await page
|
|
||||||
.waitToGetProperty(selectors.claimDevelopment.firstClaimReason, 'value');
|
|
||||||
|
|
||||||
const result = await page
|
|
||||||
.waitToGetProperty(selectors.claimDevelopment.firstClaimResult, 'value');
|
|
||||||
|
|
||||||
const responsible = await page
|
|
||||||
.waitToGetProperty(selectors.claimDevelopment.firstClaimResponsible, 'value');
|
|
||||||
|
|
||||||
const worker = await page
|
|
||||||
.waitToGetProperty(selectors.claimDevelopment.firstClaimWorker, 'value');
|
|
||||||
|
|
||||||
const redelivery = await page
|
|
||||||
.waitToGetProperty(selectors.claimDevelopment.firstClaimRedelivery, 'value');
|
|
||||||
|
|
||||||
expect(reason).toEqual('Calor');
|
|
||||||
expect(result).toEqual('Baboso/Cocido');
|
|
||||||
expect(responsible).toEqual('Calidad general');
|
|
||||||
expect(worker).toEqual('adminAssistantNick');
|
|
||||||
expect(redelivery).toEqual('Cliente');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should confirm the second development is the expected one', async() => {
|
|
||||||
const reason = await page
|
|
||||||
.waitToGetProperty(selectors.claimDevelopment.secondClaimReason, 'value');
|
|
||||||
|
|
||||||
const result = await page
|
|
||||||
.waitToGetProperty(selectors.claimDevelopment.secondClaimResult, 'value');
|
|
||||||
|
|
||||||
const responsible = await page
|
|
||||||
.waitToGetProperty(selectors.claimDevelopment.secondClaimResponsible, 'value');
|
|
||||||
|
|
||||||
const worker = await page
|
|
||||||
.waitToGetProperty(selectors.claimDevelopment.secondClaimWorker, 'value');
|
|
||||||
|
|
||||||
const redelivery = await page
|
|
||||||
.waitToGetProperty(selectors.claimDevelopment.secondClaimRedelivery, 'value');
|
|
||||||
|
|
||||||
expect(reason).toEqual('Baja calidad');
|
|
||||||
expect(result).toEqual('Deshidratacion');
|
|
||||||
expect(responsible).toEqual('Calidad general');
|
|
||||||
expect(worker).toEqual('deliveryNick');
|
|
||||||
expect(redelivery).toEqual('Reparto');
|
|
||||||
});
|
|
||||||
});
|
|
|
@ -1,5 +1,5 @@
|
||||||
import selectors from '../../helpers/selectors.js';
|
import selectors from '../../helpers/selectors.js';
|
||||||
import getBrowser from '../../helpers/puppeteer';
|
import getBrowser from '../../helpers/puppeteer.js';
|
||||||
|
|
||||||
describe('Claim action path', () => {
|
describe('Claim action path', () => {
|
||||||
let browser;
|
let browser;
|
|
@ -1,6 +1,6 @@
|
||||||
|
|
||||||
import selectors from '../../helpers/selectors.js';
|
import selectors from '../../helpers/selectors.js';
|
||||||
import getBrowser from '../../helpers/puppeteer';
|
import getBrowser from '../../helpers/puppeteer.js';
|
||||||
|
|
||||||
describe('Claim summary path', () => {
|
describe('Claim summary path', () => {
|
||||||
let browser;
|
let browser;
|
|
@ -1,5 +1,5 @@
|
||||||
import selectors from '../../helpers/selectors.js';
|
import selectors from '../../helpers/selectors.js';
|
||||||
import getBrowser from '../../helpers/puppeteer';
|
import getBrowser from '../../helpers/puppeteer.js';
|
||||||
|
|
||||||
describe('Claim descriptor path', () => {
|
describe('Claim descriptor path', () => {
|
||||||
let browser;
|
let browser;
|
|
@ -8,7 +8,9 @@ describe('Zone basic data path', () => {
|
||||||
beforeAll(async() => {
|
beforeAll(async() => {
|
||||||
browser = await getBrowser();
|
browser = await getBrowser();
|
||||||
page = browser.page;
|
page = browser.page;
|
||||||
await page.loginAndModule('deliveryBoss', 'zone'); // turns up the zone module name and route aint the same lol
|
|
||||||
|
await page.loginAndModule('deliveryAssistant',
|
||||||
|
'zone'); // turns up the zone module name and route aint the same lol
|
||||||
await page.accessToSearchResult('10');
|
await page.accessToSearchResult('10');
|
||||||
await page.accessToSection('zone.card.basicData');
|
await page.accessToSection('zone.card.basicData');
|
||||||
});
|
});
|
||||||
|
|
|
@ -8,7 +8,7 @@ describe('Zone descriptor path', () => {
|
||||||
beforeAll(async() => {
|
beforeAll(async() => {
|
||||||
browser = await getBrowser();
|
browser = await getBrowser();
|
||||||
page = browser.page;
|
page = browser.page;
|
||||||
await page.loginAndModule('deliveryBoss', 'zone');
|
await page.loginAndModule('deliveryAssistant', 'zone');
|
||||||
await page.accessToSearchResult('13');
|
await page.accessToSearchResult('13');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -316,5 +316,6 @@
|
||||||
"The ticket doesn't exist.": "No existe el ticket.",
|
"The ticket doesn't exist.": "No existe el ticket.",
|
||||||
"Social name should be uppercase": "La razón social debe ir en mayúscula",
|
"Social name should be uppercase": "La razón social debe ir en mayúscula",
|
||||||
"Street should be uppercase": "La dirección fiscal debe ir en mayúscula",
|
"Street should be uppercase": "La dirección fiscal debe ir en mayúscula",
|
||||||
|
"The response is not a PDF": "La respuesta no es un PDF",
|
||||||
"Ticket without Route": "Ticket sin ruta"
|
"Ticket without Route": "Ticket sin ruta"
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,7 +75,7 @@ module.exports = Self => {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const worker = await models.Worker.findOne({
|
const worker = await models.Worker.findOne({
|
||||||
where: {userFk: userId}
|
where: {id: userId}
|
||||||
}, myOptions);
|
}, myOptions);
|
||||||
|
|
||||||
const obsevationType = await models.ObservationType.findOne({
|
const obsevationType = await models.ObservationType.findOne({
|
||||||
|
|
|
@ -35,7 +35,7 @@ module.exports = Self => {
|
||||||
{
|
{
|
||||||
relation: 'worker',
|
relation: 'worker',
|
||||||
scope: {
|
scope: {
|
||||||
fields: ['userFk'],
|
fields: ['id'],
|
||||||
include: {
|
include: {
|
||||||
relation: 'user',
|
relation: 'user',
|
||||||
scope: {
|
scope: {
|
||||||
|
@ -109,7 +109,7 @@ module.exports = Self => {
|
||||||
{
|
{
|
||||||
relation: 'worker',
|
relation: 'worker',
|
||||||
scope: {
|
scope: {
|
||||||
fields: ['userFk'],
|
fields: ['id'],
|
||||||
include: {
|
include: {
|
||||||
relation: 'user',
|
relation: 'user',
|
||||||
scope: {
|
scope: {
|
||||||
|
|
|
@ -8,7 +8,7 @@ class Controller extends ModuleCard {
|
||||||
{
|
{
|
||||||
relation: 'worker',
|
relation: 'worker',
|
||||||
scope: {
|
scope: {
|
||||||
fields: ['userFk'],
|
fields: ['id'],
|
||||||
include: {
|
include: {
|
||||||
relation: 'user',
|
relation: 'user',
|
||||||
scope: {
|
scope: {
|
||||||
|
|
|
@ -45,7 +45,7 @@
|
||||||
<vn-label-value
|
<vn-label-value
|
||||||
label="Attended by">
|
label="Attended by">
|
||||||
<span
|
<span
|
||||||
ng-click="workerDescriptor.show($event, $ctrl.claim.worker.userFk)"
|
ng-click="workerDescriptor.show($event, $ctrl.claim.worker.id)"
|
||||||
class="link">
|
class="link">
|
||||||
{{$ctrl.claim.worker.user.name}}
|
{{$ctrl.claim.worker.user.name}}
|
||||||
</span>
|
</span>
|
||||||
|
|
|
@ -1,116 +1,2 @@
|
||||||
<vn-crud-model
|
<vn-card>
|
||||||
vn-id="model"
|
|
||||||
url="ClaimDevelopments"
|
|
||||||
fields="['id', 'claimFk', 'claimReasonFk', 'claimResultFk', 'claimResponsibleFk', 'workerFk', 'claimRedeliveryFk']"
|
|
||||||
link="{claimFk: $ctrl.$params.id}"
|
|
||||||
filter="$ctrl.filter"
|
|
||||||
data="claimDevelopments"
|
|
||||||
auto-load="true">
|
|
||||||
</vn-crud-model>
|
|
||||||
<vn-crud-model
|
|
||||||
url="ClaimReasons"
|
|
||||||
data="claimReasons"
|
|
||||||
order="description"
|
|
||||||
auto-load="true">
|
|
||||||
</vn-crud-model>
|
|
||||||
<vn-crud-model
|
|
||||||
url="ClaimResults"
|
|
||||||
data="claimResults"
|
|
||||||
order="description"
|
|
||||||
auto-load="true">
|
|
||||||
</vn-crud-model>
|
|
||||||
<vn-crud-model
|
|
||||||
url="ClaimResponsibles"
|
|
||||||
data="claimResponsibles"
|
|
||||||
order="description"
|
|
||||||
auto-load="true">
|
|
||||||
</vn-crud-model>
|
|
||||||
<vn-crud-model
|
|
||||||
url="ClaimRedeliveries"
|
|
||||||
data="claimRedeliveries"
|
|
||||||
order="description"
|
|
||||||
auto-load="true">
|
|
||||||
</vn-crud-model>
|
|
||||||
<vn-watcher
|
|
||||||
vn-id="watcher"
|
|
||||||
data="claimDevelopments"
|
|
||||||
form="form">
|
|
||||||
</vn-watcher>
|
|
||||||
<vn-vertical class="vn-w-lg">
|
|
||||||
<vn-card class="vn-pa-lg">
|
|
||||||
<vn-vertical>
|
|
||||||
<form name="form">
|
|
||||||
<vn-horizontal ng-repeat="claimDevelopment in claimDevelopments">
|
|
||||||
<vn-autocomplete
|
|
||||||
vn-focus
|
|
||||||
label="Reason"
|
|
||||||
ng-model="claimDevelopment.claimReasonFk"
|
|
||||||
data="claimReasons"
|
|
||||||
fields="['id', 'description']"
|
|
||||||
show-field="description"
|
|
||||||
rule>
|
|
||||||
</vn-autocomplete>
|
|
||||||
<vn-autocomplete
|
|
||||||
label="Result"
|
|
||||||
ng-model="claimDevelopment.claimResultFk"
|
|
||||||
data="claimResults"
|
|
||||||
fields="['id', 'description']"
|
|
||||||
show-field="description"
|
|
||||||
rule>
|
|
||||||
</vn-autocomplete>
|
|
||||||
<vn-autocomplete
|
|
||||||
label="Responsible"
|
|
||||||
ng-model="claimDevelopment.claimResponsibleFk"
|
|
||||||
data="claimResponsibles"
|
|
||||||
fields="['id', 'description']"
|
|
||||||
show-field="description"
|
|
||||||
rule>
|
|
||||||
</vn-autocomplete>
|
|
||||||
<vn-worker-autocomplete
|
|
||||||
ng-model="claimDevelopment.workerFk"
|
|
||||||
show-field="nickname"
|
|
||||||
rule>
|
|
||||||
</vn-worker-autocomplete>
|
|
||||||
<vn-autocomplete
|
|
||||||
label="Redelivery"
|
|
||||||
ng-model="claimDevelopment.claimRedeliveryFk"
|
|
||||||
data="claimRedeliveries"
|
|
||||||
fields="['id', 'description']"
|
|
||||||
show-field="description"
|
|
||||||
rule>
|
|
||||||
</vn-autocomplete>
|
|
||||||
<vn-icon-button
|
|
||||||
vn-none
|
|
||||||
class="vn-my-md"
|
|
||||||
vn-tooltip="Remove sale"
|
|
||||||
icon="delete"
|
|
||||||
ng-click="model.remove($index)"
|
|
||||||
tabindex="-1">
|
|
||||||
</vn-icon-button>
|
|
||||||
</vn-horizontal>
|
|
||||||
</form>
|
|
||||||
<vn-one class="vn-pt-md">
|
|
||||||
<vn-icon-button
|
|
||||||
vn-bind="+"
|
|
||||||
vn-tooltip="Add sale"
|
|
||||||
icon="add_circle"
|
|
||||||
ng-click="model.insert()">
|
|
||||||
</vn-icon-button>
|
|
||||||
</vn-one>
|
|
||||||
</vn-vertical>
|
|
||||||
</vn-card>
|
</vn-card>
|
||||||
<vn-button-bar>
|
|
||||||
<vn-submit
|
|
||||||
disabled="!watcher.dataChanged()"
|
|
||||||
ng-click="$ctrl.onSubmit()"
|
|
||||||
label="Save">
|
|
||||||
</vn-submit>
|
|
||||||
<!-- # #2680 Undo changes button bugs -->
|
|
||||||
<!-- <vn-button
|
|
||||||
class="cancel"
|
|
||||||
label="Undo changes"
|
|
||||||
disabled="!watcher.dataChanged()"
|
|
||||||
ng-click="watcher.loadOriginalData()">
|
|
||||||
</vn-button> -->
|
|
||||||
</vn-button-bar>
|
|
||||||
</vn-vertical>
|
|
||||||
|
|
|
@ -1,17 +1,14 @@
|
||||||
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 {
|
||||||
onSubmit() {
|
constructor($element, $) {
|
||||||
this.$.watcher.check();
|
super($element, $);
|
||||||
this.$.model.save().then(() => {
|
}
|
||||||
this.$.watcher.notifySaved();
|
|
||||||
this.$.watcher.updateOriginalData();
|
|
||||||
|
|
||||||
if (this.aclService.hasAny(['claimManager']))
|
async $onInit() {
|
||||||
this.$state.go('claim.card.action');
|
this.$state.go('claim.card.summary', {id: this.$params.id});
|
||||||
});
|
window.location.href = await this.vnApp.getUrl(`claim/${this.$params.id}/development`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,31 +0,0 @@
|
||||||
import './index.js';
|
|
||||||
import watcher from 'core/mocks/watcher';
|
|
||||||
import crudModel from 'core/mocks/crud-model';
|
|
||||||
|
|
||||||
describe('Claim', () => {
|
|
||||||
describe('Component vnClaimDevelopment', () => {
|
|
||||||
let controller;
|
|
||||||
let $scope;
|
|
||||||
|
|
||||||
beforeEach(ngModule('claim'));
|
|
||||||
|
|
||||||
beforeEach(inject(($componentController, $rootScope) => {
|
|
||||||
$scope = $rootScope.$new();
|
|
||||||
$scope.watcher = watcher;
|
|
||||||
$scope.model = crudModel;
|
|
||||||
const $element = angular.element('<vn-claim-development></vn-claim-development>');
|
|
||||||
controller = $componentController('vnClaimDevelopment', {$element, $scope});
|
|
||||||
}));
|
|
||||||
|
|
||||||
describe('onSubmit()', () => {
|
|
||||||
it(`should redirect to 'claim.card.action' state`, () => {
|
|
||||||
jest.spyOn(controller.aclService, 'hasAny').mockReturnValue(true);
|
|
||||||
jest.spyOn(controller.$state, 'go');
|
|
||||||
|
|
||||||
controller.onSubmit();
|
|
||||||
|
|
||||||
expect(controller.$state.go).toHaveBeenCalledWith('claim.card.action');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
|
@ -1,8 +0,0 @@
|
||||||
Destination: Destino
|
|
||||||
Development: Trazabilidad
|
|
||||||
Reason: Motivo
|
|
||||||
Result: Consecuencia
|
|
||||||
Responsible: Responsable
|
|
||||||
Worker: Trabajador
|
|
||||||
Redelivery: Devolución
|
|
||||||
Add line: Añadir Linea
|
|
|
@ -80,10 +80,15 @@ module.exports = Self => {
|
||||||
Object.assign(myOptions, options);
|
Object.assign(myOptions, options);
|
||||||
|
|
||||||
if (args.zoneFk) {
|
if (args.zoneFk) {
|
||||||
query = `CALL vn.zone_getPostalCode(?)`;
|
let stmts = [];
|
||||||
const [geos] = await Self.rawSql(query, [args.zoneFk]);
|
stmts.push(new ParameterizedSQL('CALL vn.zone_getPostalCode(?)', [args.zoneFk]));
|
||||||
for (let geo of geos)
|
stmts.push(`SELECT name FROM tmp.zoneNodes`);
|
||||||
postalCode.push(geo.name);
|
stmts.push(`DROP TEMPORARY TABLE tmp.zoneNodes`);
|
||||||
|
const sql = ParameterizedSQL.join(stmts, ';');
|
||||||
|
const [results] = await conn.executeStmt(sql);
|
||||||
|
|
||||||
|
for (let result of results)
|
||||||
|
postalCode.push(result.name);
|
||||||
}
|
}
|
||||||
|
|
||||||
const where = buildFilter(ctx.args, (param, value) => {
|
const where = buildFilter(ctx.args, (param, value) => {
|
||||||
|
|
|
@ -60,7 +60,7 @@ module.exports = Self => {
|
||||||
at2.id IS NOT NULL as isCompensation
|
at2.id IS NOT NULL as isCompensation
|
||||||
FROM vn.receipt r
|
FROM vn.receipt r
|
||||||
LEFT JOIN vn.worker w ON w.id = r.workerFk
|
LEFT JOIN vn.worker w ON w.id = r.workerFk
|
||||||
LEFT JOIN account.user u ON u.id = w.userFk
|
LEFT JOIN account.user u ON u.id = w.id
|
||||||
JOIN vn.company c ON c.id = r.companyFk
|
JOIN vn.company c ON c.id = r.companyFk
|
||||||
LEFT JOIN vn.accounting a ON a.id = r.bankFk
|
LEFT JOIN vn.accounting a ON a.id = r.bankFk
|
||||||
LEFT JOIN vn.accountingType at2 ON at2.id = a.accountingTypeFk AND at2.code = 'compensation'
|
LEFT JOIN vn.accountingType at2 ON at2.id = a.accountingTypeFk AND at2.code = 'compensation'
|
||||||
|
|
|
@ -9,7 +9,7 @@ module.exports = function(Self) {
|
||||||
let token = ctx.options.accessToken;
|
let token = ctx.options.accessToken;
|
||||||
let userId = token && token.userId;
|
let userId = token && token.userId;
|
||||||
|
|
||||||
Self.app.models.Worker.findOne({where: {userFk: userId}}, (err, user) => {
|
Self.app.models.Worker.findOne({where: {id: userId}}, (err, user) => {
|
||||||
if (err) return next(err);
|
if (err) return next(err);
|
||||||
ctx.instance.workerFk = user.id;
|
ctx.instance.workerFk = user.id;
|
||||||
next();
|
next();
|
||||||
|
|
|
@ -41,7 +41,7 @@
|
||||||
"include": {
|
"include": {
|
||||||
"relation": "worker",
|
"relation": "worker",
|
||||||
"scope": {
|
"scope": {
|
||||||
"fields": ["userFk"],
|
"fields": ["id"],
|
||||||
"include": {
|
"include": {
|
||||||
"relation": "user",
|
"relation": "user",
|
||||||
"scope": {
|
"scope": {
|
||||||
|
|
|
@ -68,7 +68,7 @@
|
||||||
icon="add_circle"
|
icon="add_circle"
|
||||||
vn-tooltip="New postcode"
|
vn-tooltip="New postcode"
|
||||||
ng-click="postcode.open()"
|
ng-click="postcode.open()"
|
||||||
vn-acl="deliveryBoss"
|
vn-acl="deliveryAssistant"
|
||||||
vn-acl-action="remove">
|
vn-acl-action="remove">
|
||||||
</vn-icon-button>
|
</vn-icon-button>
|
||||||
</append>
|
</append>
|
||||||
|
|
|
@ -81,7 +81,7 @@
|
||||||
icon="add_circle"
|
icon="add_circle"
|
||||||
vn-tooltip="New postcode"
|
vn-tooltip="New postcode"
|
||||||
ng-click="postcode.open()"
|
ng-click="postcode.open()"
|
||||||
vn-acl="deliveryBoss"
|
vn-acl="deliveryAssistant"
|
||||||
vn-acl-action="remove">
|
vn-acl-action="remove">
|
||||||
</vn-icon-button>
|
</vn-icon-button>
|
||||||
</append>
|
</append>
|
||||||
|
|
|
@ -73,7 +73,7 @@
|
||||||
icon="add_circle"
|
icon="add_circle"
|
||||||
vn-tooltip="New postcode"
|
vn-tooltip="New postcode"
|
||||||
ng-click="postcode.open()"
|
ng-click="postcode.open()"
|
||||||
vn-acl="deliveryBoss"
|
vn-acl="deliveryAssistant"
|
||||||
vn-acl-action="remove">
|
vn-acl-action="remove">
|
||||||
</vn-icon-button>
|
</vn-icon-button>
|
||||||
</append>
|
</append>
|
||||||
|
|
|
@ -9,7 +9,7 @@ export default class Controller extends Section {
|
||||||
include: [{
|
include: [{
|
||||||
relation: 'worker',
|
relation: 'worker',
|
||||||
scope: {
|
scope: {
|
||||||
fields: ['userFk'],
|
fields: ['id'],
|
||||||
include: {
|
include: {
|
||||||
relation: 'user',
|
relation: 'user',
|
||||||
scope: {
|
scope: {
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
<vn-td shrink-datetime>{{::credit.created | date:'dd/MM/yyyy HH:mm'}}</vn-td>
|
<vn-td shrink-datetime>{{::credit.created | date:'dd/MM/yyyy HH:mm'}}</vn-td>
|
||||||
<vn-td>
|
<vn-td>
|
||||||
<span
|
<span
|
||||||
ng-click="workerDescriptor.show($event, credit.worker.userFk)"
|
ng-click="workerDescriptor.show($event, credit.worker.id)"
|
||||||
class="link">
|
class="link">
|
||||||
{{::credit.worker.user.name}}
|
{{::credit.worker.user.name}}
|
||||||
</span>
|
</span>
|
||||||
|
|
|
@ -9,7 +9,7 @@ class Controller extends Section {
|
||||||
{
|
{
|
||||||
relation: 'worker',
|
relation: 'worker',
|
||||||
scope: {
|
scope: {
|
||||||
fields: ['userFk'],
|
fields: ['id'],
|
||||||
include: {
|
include: {
|
||||||
relation: 'user',
|
relation: 'user',
|
||||||
scope: {
|
scope: {
|
||||||
|
|
|
@ -28,7 +28,7 @@ class Controller extends Section {
|
||||||
}, {
|
}, {
|
||||||
relation: 'worker',
|
relation: 'worker',
|
||||||
scope: {
|
scope: {
|
||||||
fields: ['userFk'],
|
fields: ['id'],
|
||||||
include: {
|
include: {
|
||||||
relation: 'user',
|
relation: 'user',
|
||||||
scope: {
|
scope: {
|
||||||
|
|
|
@ -94,7 +94,7 @@
|
||||||
icon="add_circle"
|
icon="add_circle"
|
||||||
vn-tooltip="New postcode"
|
vn-tooltip="New postcode"
|
||||||
ng-click="postcode.open()"
|
ng-click="postcode.open()"
|
||||||
vn-acl="deliveryBoss"
|
vn-acl="deliveryAssistant"
|
||||||
vn-acl-action="remove">
|
vn-acl-action="remove">
|
||||||
</vn-icon-button>
|
</vn-icon-button>
|
||||||
</append>
|
</append>
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
icon="add_circle"
|
icon="add_circle"
|
||||||
vn-tooltip="New city"
|
vn-tooltip="New city"
|
||||||
ng-click="city.open($event)"
|
ng-click="city.open($event)"
|
||||||
vn-acl="deliveryBoss"
|
vn-acl="deliveryAssistant"
|
||||||
vn-acl-action="remove">
|
vn-acl-action="remove">
|
||||||
</vn-icon-button>
|
</vn-icon-button>
|
||||||
</append>
|
</append>
|
||||||
|
@ -45,7 +45,7 @@
|
||||||
icon="add_circle"
|
icon="add_circle"
|
||||||
vn-tooltip="New province"
|
vn-tooltip="New province"
|
||||||
ng-click="province.open($event)"
|
ng-click="province.open($event)"
|
||||||
vn-acl="deliveryBoss"
|
vn-acl="deliveryAssistant"
|
||||||
vn-acl-action="remove">
|
vn-acl-action="remove">
|
||||||
</vn-icon-button>
|
</vn-icon-button>
|
||||||
</append>
|
</append>
|
||||||
|
|
|
@ -18,6 +18,13 @@
|
||||||
"isLabeler": {
|
"isLabeler": {
|
||||||
"type": "boolean"
|
"type": "boolean"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"relations": {
|
||||||
|
"sector": {
|
||||||
|
"type": "belongsTo",
|
||||||
|
"model": "Sector",
|
||||||
|
"foreignKey": "sectorFk"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"acls": [{
|
"acls": [{
|
||||||
"accessType": "READ",
|
"accessType": "READ",
|
||||||
|
|
|
@ -180,7 +180,7 @@ module.exports = Self => {
|
||||||
LEFT JOIN itemType it ON it.id = i.typeFk
|
LEFT JOIN itemType it ON it.id = i.typeFk
|
||||||
LEFT JOIN itemCategory ic ON ic.id = it.categoryFk
|
LEFT JOIN itemCategory ic ON ic.id = it.categoryFk
|
||||||
LEFT JOIN worker w ON w.id = it.workerFk
|
LEFT JOIN worker w ON w.id = it.workerFk
|
||||||
LEFT JOIN account.user u ON u.id = w.userFk
|
LEFT JOIN account.user u ON u.id = w.id
|
||||||
LEFT JOIN intrastat intr ON intr.id = i.intrastatFk
|
LEFT JOIN intrastat intr ON intr.id = i.intrastatFk
|
||||||
LEFT JOIN producer pr ON pr.id = i.producerFk
|
LEFT JOIN producer pr ON pr.id = i.producerFk
|
||||||
LEFT JOIN origin ori ON ori.id = i.originFk
|
LEFT JOIN origin ori ON ori.id = i.originFk
|
||||||
|
|
|
@ -34,7 +34,7 @@ module.exports = Self => {
|
||||||
include: [{
|
include: [{
|
||||||
relation: 'worker',
|
relation: 'worker',
|
||||||
scope: {
|
scope: {
|
||||||
fields: ['userFk'],
|
fields: ['id'],
|
||||||
include: {
|
include: {
|
||||||
relation: 'user',
|
relation: 'user',
|
||||||
scope: {
|
scope: {
|
||||||
|
|
|
@ -38,7 +38,7 @@ module.exports = Self => {
|
||||||
include: [{
|
include: [{
|
||||||
relation: 'worker',
|
relation: 'worker',
|
||||||
scope: {
|
scope: {
|
||||||
fields: ['userFk'],
|
fields: ['id'],
|
||||||
include: {
|
include: {
|
||||||
relation: 'user',
|
relation: 'user',
|
||||||
scope: {
|
scope: {
|
||||||
|
|
|
@ -32,6 +32,6 @@ module.exports = Self => {
|
||||||
|
|
||||||
Self.setVisibleDiscard = async(ctx, itemFk, warehouseFk, quantity, addressFk) => {
|
Self.setVisibleDiscard = async(ctx, itemFk, warehouseFk, quantity, addressFk) => {
|
||||||
const query = `CALL vn.item_setVisibleDiscard(?, ?, ?, ?)`;
|
const query = `CALL vn.item_setVisibleDiscard(?, ?, ?, ?)`;
|
||||||
await Self.rawSql(query, [itemFk, warehouseFk, quantity, addressFk]);
|
await Self.rawSql(query, [itemFk, warehouseFk, quantity, addressFk], {userId: ctx.req.accessToken.userId});
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -26,11 +26,17 @@
|
||||||
"shelving": {
|
"shelving": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
|
"subName": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
"packing": {
|
"packing": {
|
||||||
"type": "number"
|
"type": "number"
|
||||||
},
|
},
|
||||||
"stock": {
|
"stock": {
|
||||||
"type": "number"
|
"type": "number"
|
||||||
|
},
|
||||||
|
"size": {
|
||||||
|
"type": "number"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -20,10 +20,16 @@
|
||||||
},
|
},
|
||||||
"created": {
|
"created": {
|
||||||
"type": "date"
|
"type": "date"
|
||||||
|
},
|
||||||
|
"grouping": {
|
||||||
|
"type": "number"
|
||||||
},
|
},
|
||||||
"isChecked": {
|
"isChecked": {
|
||||||
"type": "boolean"
|
"type": "boolean"
|
||||||
},
|
},
|
||||||
|
"packing": {
|
||||||
|
"type": "number"
|
||||||
|
},
|
||||||
"visible": {
|
"visible": {
|
||||||
"type": "number"
|
"type": "number"
|
||||||
},
|
},
|
||||||
|
|
|
@ -58,7 +58,7 @@
|
||||||
<vn-label-value
|
<vn-label-value
|
||||||
label="Buyer">
|
label="Buyer">
|
||||||
<span
|
<span
|
||||||
ng-click="workerDescriptor.show($event, $ctrl.item.itemType.worker.userFk)"
|
ng-click="workerDescriptor.show($event, $ctrl.item.itemType.worker.id)"
|
||||||
class="link">
|
class="link">
|
||||||
{{$ctrl.item.itemType.worker.user.name}}
|
{{$ctrl.item.itemType.worker.user.name}}
|
||||||
</span>
|
</span>
|
||||||
|
|
|
@ -70,7 +70,7 @@
|
||||||
</vn-label-value>
|
</vn-label-value>
|
||||||
<vn-label-value label="Buyer">
|
<vn-label-value label="Buyer">
|
||||||
<span
|
<span
|
||||||
ng-click="workerDescriptor.show($event, $ctrl.summary.item.itemType.worker.userFk)"
|
ng-click="workerDescriptor.show($event, $ctrl.summary.item.itemType.worker.id)"
|
||||||
class="link">
|
class="link">
|
||||||
{{$ctrl.summary.item.itemType.worker.user.name}}
|
{{$ctrl.summary.item.itemType.worker.user.name}}
|
||||||
</span>
|
</span>
|
||||||
|
|
|
@ -215,7 +215,7 @@ module.exports = Self => {
|
||||||
LEFT JOIN state st ON st.id = ts.stateFk
|
LEFT JOIN state st ON st.id = ts.stateFk
|
||||||
LEFT JOIN client c ON c.id = t.clientFk
|
LEFT JOIN client c ON c.id = t.clientFk
|
||||||
LEFT JOIN worker wk ON wk.id = c.salesPersonFk
|
LEFT JOIN worker wk ON wk.id = c.salesPersonFk
|
||||||
LEFT JOIN account.user u ON u.id = wk.userFk
|
LEFT JOIN account.user u ON u.id = wk.id
|
||||||
LEFT JOIN zoneEstimatedDelivery zed ON zed.zoneFk = t.zoneFk`);
|
LEFT JOIN zoneEstimatedDelivery zed ON zed.zoneFk = t.zoneFk`);
|
||||||
|
|
||||||
if (args.orderFk) {
|
if (args.orderFk) {
|
||||||
|
|
|
@ -169,7 +169,7 @@ module.exports = Self => {
|
||||||
LEFT JOIN agencyMode am ON am.id = o.agency_id
|
LEFT JOIN agencyMode am ON am.id = o.agency_id
|
||||||
LEFT JOIN client c ON c.id = o.customer_id
|
LEFT JOIN client c ON c.id = o.customer_id
|
||||||
LEFT JOIN worker wk ON wk.id = c.salesPersonFk
|
LEFT JOIN worker wk ON wk.id = c.salesPersonFk
|
||||||
LEFT JOIN account.user u ON u.id = wk.userFk
|
LEFT JOIN account.user u ON u.id = wk.id
|
||||||
LEFT JOIN company co ON co.id = o.company_id
|
LEFT JOIN company co ON co.id = o.company_id
|
||||||
LEFT JOIN orderTicket ot ON ot.orderFk = o.id
|
LEFT JOIN orderTicket ot ON ot.orderFk = o.id
|
||||||
LEFT JOIN ticket t ON t.id = ot.ticketFk
|
LEFT JOIN ticket t ON t.id = ot.ticketFk
|
||||||
|
|
|
@ -0,0 +1,71 @@
|
||||||
|
const JSZip = require('jszip');
|
||||||
|
const axios = require('axios');
|
||||||
|
const UserError = require('vn-loopback/util/user-error');
|
||||||
|
|
||||||
|
module.exports = Self => {
|
||||||
|
Self.remoteMethodCtx('downloadCmrsZip', {
|
||||||
|
description: 'Download a zip file with multiple cmrs pdfs',
|
||||||
|
accessType: 'READ',
|
||||||
|
accepts: [
|
||||||
|
{
|
||||||
|
arg: 'ids',
|
||||||
|
type: 'string',
|
||||||
|
description: 'The cmrs ids',
|
||||||
|
}
|
||||||
|
],
|
||||||
|
returns: [
|
||||||
|
{
|
||||||
|
arg: 'body',
|
||||||
|
type: 'file',
|
||||||
|
root: true
|
||||||
|
}, {
|
||||||
|
arg: 'Content-Type',
|
||||||
|
type: 'string',
|
||||||
|
http: {target: 'header'}
|
||||||
|
}, {
|
||||||
|
arg: 'Content-Disposition',
|
||||||
|
type: 'string',
|
||||||
|
http: {target: 'header'}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
http: {
|
||||||
|
path: '/downloadCmrsZip',
|
||||||
|
verb: 'GET'
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Self.downloadCmrsZip = async function(ctx, ids, options) {
|
||||||
|
const models = Self.app.models;
|
||||||
|
const myOptions = {};
|
||||||
|
const token = ctx.req.accessToken;
|
||||||
|
const zip = new JSZip();
|
||||||
|
|
||||||
|
if (typeof options == 'object')
|
||||||
|
Object.assign(myOptions, options);
|
||||||
|
|
||||||
|
const zipConfig = await models.ZipConfig.findOne(null, myOptions);
|
||||||
|
let totalSize = 0;
|
||||||
|
ids = ids.split(',');
|
||||||
|
try {
|
||||||
|
for (let id of ids) {
|
||||||
|
if (zipConfig && totalSize > zipConfig.maxSize) throw new UserError('Files are too large');
|
||||||
|
const response = await axios.get(
|
||||||
|
`${ctx.req.headers.referer}api/Routes/${id}/cmr?access_token=${token.id}`, {
|
||||||
|
...myOptions,
|
||||||
|
responseType: 'arraybuffer',
|
||||||
|
});
|
||||||
|
|
||||||
|
if (response.headers['content-type'] !== 'application/pdf')
|
||||||
|
throw new UserError(`The response is not a PDF`);
|
||||||
|
|
||||||
|
zip.file(`${id}.pdf`, response.data, { binary: true });
|
||||||
|
}
|
||||||
|
|
||||||
|
const zipStream = zip.generateNodeStream({ streamFiles: true });
|
||||||
|
|
||||||
|
return [zipStream, 'application/zip', `filename="cmrs.zip"`];
|
||||||
|
} catch (e) {
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
|
@ -134,7 +134,7 @@ module.exports = Self => {
|
||||||
LEFT JOIN agencyMode am ON am.id = r.agencyModeFk
|
LEFT JOIN agencyMode am ON am.id = r.agencyModeFk
|
||||||
LEFT JOIN vehicle v ON v.id = r.vehicleFk
|
LEFT JOIN vehicle v ON v.id = r.vehicleFk
|
||||||
LEFT JOIN worker w ON w.id = r.workerFk
|
LEFT JOIN worker w ON w.id = r.workerFk
|
||||||
LEFT JOIN account.user u ON u.id = w.userFk`
|
LEFT JOIN account.user u ON u.id = w.id`
|
||||||
);
|
);
|
||||||
|
|
||||||
stmt.merge(conn.makeSuffix(filter));
|
stmt.merge(conn.makeSuffix(filter));
|
||||||
|
|
|
@ -22,6 +22,11 @@ module.exports = Self => {
|
||||||
type: 'integer',
|
type: 'integer',
|
||||||
description: 'The worker id',
|
description: 'The worker id',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
arg: 'routeFk',
|
||||||
|
type: 'integer',
|
||||||
|
description: 'The route id',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
arg: 'country',
|
arg: 'country',
|
||||||
type: 'string',
|
type: 'string',
|
||||||
|
@ -57,6 +62,7 @@ module.exports = Self => {
|
||||||
filter,
|
filter,
|
||||||
cmrFk,
|
cmrFk,
|
||||||
ticketFk,
|
ticketFk,
|
||||||
|
routeFk,
|
||||||
country,
|
country,
|
||||||
clientFk,
|
clientFk,
|
||||||
hasCmrDms,
|
hasCmrDms,
|
||||||
|
@ -66,6 +72,7 @@ module.exports = Self => {
|
||||||
const params = {
|
const params = {
|
||||||
cmrFk,
|
cmrFk,
|
||||||
ticketFk,
|
ticketFk,
|
||||||
|
routeFk,
|
||||||
country,
|
country,
|
||||||
clientFk,
|
clientFk,
|
||||||
hasCmrDms,
|
hasCmrDms,
|
||||||
|
@ -93,6 +100,7 @@ module.exports = Self => {
|
||||||
FROM (
|
FROM (
|
||||||
SELECT t.cmrFk,
|
SELECT t.cmrFk,
|
||||||
t.id ticketFk,
|
t.id ticketFk,
|
||||||
|
t.routeFk,
|
||||||
co.country,
|
co.country,
|
||||||
t.clientFk,
|
t.clientFk,
|
||||||
IF(sub.id, TRUE, FALSE) hasCmrDms,
|
IF(sub.id, TRUE, FALSE) hasCmrDms,
|
||||||
|
|
|
@ -33,7 +33,7 @@ module.exports = Self => {
|
||||||
}, {
|
}, {
|
||||||
relation: 'worker',
|
relation: 'worker',
|
||||||
scope: {
|
scope: {
|
||||||
fields: ['id', 'userFk'],
|
fields: ['id'],
|
||||||
include: [
|
include: [
|
||||||
{
|
{
|
||||||
relation: 'user',
|
relation: 'user',
|
||||||
|
|
|
@ -47,7 +47,7 @@
|
||||||
"worker": {
|
"worker": {
|
||||||
"type": "belongsTo",
|
"type": "belongsTo",
|
||||||
"model": "Worker",
|
"model": "Worker",
|
||||||
"foreignKey": "userFk"
|
"foreignKey": "id"
|
||||||
},
|
},
|
||||||
"supplier": {
|
"supplier": {
|
||||||
"type": "belongsTo",
|
"type": "belongsTo",
|
||||||
|
|
|
@ -16,6 +16,7 @@ module.exports = Self => {
|
||||||
require('../methods/route/downloadZip')(Self);
|
require('../methods/route/downloadZip')(Self);
|
||||||
require('../methods/route/cmr')(Self);
|
require('../methods/route/cmr')(Self);
|
||||||
require('../methods/route/getExternalCmrs')(Self);
|
require('../methods/route/getExternalCmrs')(Self);
|
||||||
|
require('../methods/route/downloadCmrsZip')(Self);
|
||||||
|
|
||||||
Self.validate('kmStart', validateDistance, {
|
Self.validate('kmStart', validateDistance, {
|
||||||
message: 'Distance must be lesser than 1000'
|
message: 'Distance must be lesser than 1000'
|
||||||
|
|
|
@ -41,7 +41,7 @@ class Controller extends ModuleCard {
|
||||||
{
|
{
|
||||||
relation: 'worker',
|
relation: 'worker',
|
||||||
scope: {
|
scope: {
|
||||||
fields: ['userFk'],
|
fields: ['id'],
|
||||||
include: {
|
include: {
|
||||||
relation: 'user',
|
relation: 'user',
|
||||||
scope: {
|
scope: {
|
||||||
|
|
|
@ -15,14 +15,14 @@
|
||||||
</vn-item>
|
</vn-item>
|
||||||
<vn-item
|
<vn-item
|
||||||
ng-click="updateVolumeConfirmation.show()"
|
ng-click="updateVolumeConfirmation.show()"
|
||||||
vn-acl="deliveryBoss"
|
vn-acl="deliveryAssistant"
|
||||||
vn-acl-action="remove"
|
vn-acl-action="remove"
|
||||||
translate>
|
translate>
|
||||||
Update volume
|
Update volume
|
||||||
</vn-item>
|
</vn-item>
|
||||||
<vn-item
|
<vn-item
|
||||||
ng-click="$ctrl.deleteCurrentRoute()"
|
ng-click="$ctrl.deleteCurrentRoute()"
|
||||||
vn-acl="deliveryBoss"
|
vn-acl="deliveryAssistant"
|
||||||
vn-acl-action="remove"
|
vn-acl-action="remove"
|
||||||
translate>
|
translate>
|
||||||
Delete route
|
Delete route
|
||||||
|
|
|
@ -79,7 +79,7 @@ class Controller extends Descriptor {
|
||||||
}, {
|
}, {
|
||||||
relation: 'worker',
|
relation: 'worker',
|
||||||
scope: {
|
scope: {
|
||||||
fields: ['userFk'],
|
fields: ['id'],
|
||||||
include: {
|
include: {
|
||||||
relation: 'user',
|
relation: 'user',
|
||||||
scope: {
|
scope: {
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
icon="format_list_numbered">
|
icon="format_list_numbered">
|
||||||
</vn-button>
|
</vn-button>
|
||||||
<vn-button
|
<vn-button
|
||||||
vn-acl="deliveryBoss"
|
vn-acl="deliveryAssistant"
|
||||||
vn-acl-action="remove"
|
vn-acl-action="remove"
|
||||||
disabled="!$ctrl.isChecked"
|
disabled="!$ctrl.isChecked"
|
||||||
icon="sms"
|
icon="sms"
|
||||||
|
|
|
@ -35,7 +35,7 @@ module.exports = Self => {
|
||||||
{
|
{
|
||||||
relation: 'worker',
|
relation: 'worker',
|
||||||
scope: {
|
scope: {
|
||||||
fields: ['id', 'userFk'],
|
fields: ['id'],
|
||||||
include: {
|
include: {
|
||||||
relation: 'user',
|
relation: 'user',
|
||||||
scope: {
|
scope: {
|
||||||
|
|
|
@ -10,5 +10,8 @@
|
||||||
},
|
},
|
||||||
"Sector": {
|
"Sector": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
|
},
|
||||||
|
"Train": {
|
||||||
|
"dataSource": "vn"
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -9,12 +9,11 @@
|
||||||
"properties": {
|
"properties": {
|
||||||
"id": {
|
"id": {
|
||||||
"type": "number",
|
"type": "number",
|
||||||
"id": true,
|
"description": "Identifier",
|
||||||
"description": "Identifier"
|
"id": true
|
||||||
},
|
},
|
||||||
"code": {
|
"code": {
|
||||||
"type": "string",
|
"type": "string"
|
||||||
"required": true
|
|
||||||
},
|
},
|
||||||
"parkingFk": {
|
"parkingFk": {
|
||||||
"type": "number"
|
"type": "number"
|
||||||
|
@ -41,7 +40,7 @@
|
||||||
"worker": {
|
"worker": {
|
||||||
"type": "belongsTo",
|
"type": "belongsTo",
|
||||||
"model": "Worker",
|
"model": "Worker",
|
||||||
"foreignKey": "userFk"
|
"foreignKey": "id"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
{
|
||||||
|
"name": "Train",
|
||||||
|
"options": {
|
||||||
|
"mysql": {
|
||||||
|
"table": "train"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"properties": {
|
||||||
|
"id": {
|
||||||
|
"type": "number",
|
||||||
|
"id": true
|
||||||
|
},
|
||||||
|
"name": {
|
||||||
|
"type": "string",
|
||||||
|
"required": true
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -7,7 +7,7 @@ class Controller extends ModuleCard {
|
||||||
include: [
|
include: [
|
||||||
{relation: 'worker',
|
{relation: 'worker',
|
||||||
scope: {
|
scope: {
|
||||||
fields: ['userFk'],
|
fields: ['id'],
|
||||||
include: {
|
include: {
|
||||||
relation: 'user',
|
relation: 'user',
|
||||||
scope: {
|
scope: {
|
||||||
|
|
|
@ -12,7 +12,7 @@ class Controller extends Summary {
|
||||||
include: [
|
include: [
|
||||||
{relation: 'worker',
|
{relation: 'worker',
|
||||||
scope: {
|
scope: {
|
||||||
fields: ['userFk'],
|
fields: ['id'],
|
||||||
include: {
|
include: {
|
||||||
relation: 'user',
|
relation: 'user',
|
||||||
scope: {
|
scope: {
|
||||||
|
|
|
@ -91,7 +91,7 @@ module.exports = Self => {
|
||||||
{
|
{
|
||||||
relation: 'worker',
|
relation: 'worker',
|
||||||
scope: {
|
scope: {
|
||||||
fields: ['userFk'],
|
fields: ['id'],
|
||||||
include: {
|
include: {
|
||||||
relation: 'user',
|
relation: 'user',
|
||||||
scope: {
|
scope: {
|
||||||
|
|
|
@ -50,7 +50,7 @@
|
||||||
icon="add_circle"
|
icon="add_circle"
|
||||||
vn-tooltip="New postcode"
|
vn-tooltip="New postcode"
|
||||||
ng-click="postcode.open()"
|
ng-click="postcode.open()"
|
||||||
vn-acl="deliveryBoss"
|
vn-acl="deliveryAssistant"
|
||||||
vn-acl-action="remove">
|
vn-acl-action="remove">
|
||||||
</vn-icon-button>
|
</vn-icon-button>
|
||||||
</append>
|
</append>
|
||||||
|
|
|
@ -48,7 +48,7 @@
|
||||||
icon="add_circle"
|
icon="add_circle"
|
||||||
vn-tooltip="New postcode"
|
vn-tooltip="New postcode"
|
||||||
ng-click="postcode.open()"
|
ng-click="postcode.open()"
|
||||||
vn-acl="deliveryBoss"
|
vn-acl="deliveryAssistant"
|
||||||
vn-acl-action="remove">
|
vn-acl-action="remove">
|
||||||
</vn-icon-button>
|
</vn-icon-button>
|
||||||
</append>
|
</append>
|
||||||
|
|
|
@ -150,7 +150,7 @@
|
||||||
icon="add_circle"
|
icon="add_circle"
|
||||||
vn-tooltip="New postcode"
|
vn-tooltip="New postcode"
|
||||||
ng-click="postcode.open()"
|
ng-click="postcode.open()"
|
||||||
vn-acl="deliveryBoss"
|
vn-acl="deliveryAssistant"
|
||||||
vn-acl-action="remove">
|
vn-acl-action="remove">
|
||||||
</vn-icon-button>
|
</vn-icon-button>
|
||||||
</append>
|
</append>
|
||||||
|
|
|
@ -41,7 +41,7 @@ module.exports = Self => {
|
||||||
FROM saleTracking st
|
FROM saleTracking st
|
||||||
JOIN sale s ON s.id = st.saleFk
|
JOIN sale s ON s.id = st.saleFk
|
||||||
JOIN worker w ON w.id = st.workerFk
|
JOIN worker w ON w.id = st.workerFk
|
||||||
JOIN account.user u ON u.id = w.userFk
|
JOIN account.user u ON u.id = w.id
|
||||||
JOIN state ste ON ste.id = st.stateFk`);
|
JOIN state ste ON ste.id = st.stateFk`);
|
||||||
|
|
||||||
stmt.merge(Self.makeSuffix(filter));
|
stmt.merge(Self.makeSuffix(filter));
|
||||||
|
|
|
@ -108,7 +108,7 @@ describe('sale updatePrice()', () => {
|
||||||
}}, options);
|
}}, options);
|
||||||
|
|
||||||
expect(updatedSale.price).toBe(price);
|
expect(updatedSale.price).toBe(price);
|
||||||
expect(createdSaleComponent.value).toEqual(-2.04);
|
expect(createdSaleComponent.value).toEqual(-2.34);
|
||||||
|
|
||||||
const updatedSalesPersonMana = await models.WorkerMana.findById(18, null, options);
|
const updatedSalesPersonMana = await models.WorkerMana.findById(18, null, options);
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@ module.exports = Self => {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const userId = ctx.req.accessToken.userId;
|
const userId = ctx.req.accessToken.userId;
|
||||||
const worker = await Self.app.models.Worker.findOne({where: {userFk: userId}}, myOptions);
|
const worker = await Self.app.models.Worker.findOne({where: {id: userId}}, myOptions);
|
||||||
|
|
||||||
const params = {
|
const params = {
|
||||||
isOk: false,
|
isOk: false,
|
||||||
|
|
|
@ -153,9 +153,9 @@ module.exports = Self => {
|
||||||
LEFT JOIN item i ON i.id = tr.itemFk
|
LEFT JOIN item i ON i.id = tr.itemFk
|
||||||
LEFT JOIN sale s ON s.id = tr.saleFk
|
LEFT JOIN sale s ON s.id = tr.saleFk
|
||||||
LEFT JOIN worker wk ON wk.id = c.salesPersonFk
|
LEFT JOIN worker wk ON wk.id = c.salesPersonFk
|
||||||
LEFT JOIN account.user u ON u.id = wk.userFk
|
LEFT JOIN account.user u ON u.id = wk.id
|
||||||
LEFT JOIN worker wka ON wka.id = tr.attenderFk
|
LEFT JOIN worker wka ON wka.id = tr.attenderFk
|
||||||
LEFT JOIN account.user ua ON ua.id = wka.userFk`);
|
LEFT JOIN account.user ua ON ua.id = wka.id`);
|
||||||
stmt.merge(conn.makeSuffix(filter));
|
stmt.merge(conn.makeSuffix(filter));
|
||||||
|
|
||||||
return conn.executeStmt(stmt, myOptions);
|
return conn.executeStmt(stmt, myOptions);
|
||||||
|
|
|
@ -53,7 +53,7 @@ module.exports = Self => {
|
||||||
|
|
||||||
if (!params.workerFk) {
|
if (!params.workerFk) {
|
||||||
const worker = await models.Worker.findOne({
|
const worker = await models.Worker.findOne({
|
||||||
where: {userFk: userId}
|
where: {id: userId}
|
||||||
}, myOptions);
|
}, myOptions);
|
||||||
|
|
||||||
params.workerFk = worker.id;
|
params.workerFk = worker.id;
|
||||||
|
|
|
@ -43,7 +43,7 @@ module.exports = Self => {
|
||||||
fields: ['id', 'name', 'alertLevel', 'code']
|
fields: ['id', 'name', 'alertLevel', 'code']
|
||||||
}, myOptions);
|
}, myOptions);
|
||||||
|
|
||||||
const worker = await models.Worker.findOne({where: {userFk: userId}}, myOptions);
|
const worker = await models.Worker.findOne({where: {id: userId}}, myOptions);
|
||||||
|
|
||||||
const promises = [];
|
const promises = [];
|
||||||
for (const id of ticketIds) {
|
for (const id of ticketIds) {
|
||||||
|
|
|
@ -272,7 +272,7 @@ module.exports = Self => {
|
||||||
LEFT JOIN state st ON st.id = ts.stateFk
|
LEFT JOIN state st ON st.id = ts.stateFk
|
||||||
LEFT JOIN client c ON c.id = t.clientFk
|
LEFT JOIN client c ON c.id = t.clientFk
|
||||||
LEFT JOIN worker wk ON wk.id = c.salesPersonFk
|
LEFT JOIN worker wk ON wk.id = c.salesPersonFk
|
||||||
LEFT JOIN account.user u ON u.id = wk.userFk
|
LEFT JOIN account.user u ON u.id = wk.id
|
||||||
LEFT JOIN route r ON r.id = t.routeFk`);
|
LEFT JOIN route r ON r.id = t.routeFk`);
|
||||||
|
|
||||||
if (args.orderFk) {
|
if (args.orderFk) {
|
||||||
|
|
|
@ -118,7 +118,7 @@ module.exports = Self => {
|
||||||
|
|
||||||
// Send notification to salesPerson
|
// Send notification to salesPerson
|
||||||
const salesPersonUser = ticket.client().salesPersonUser();
|
const salesPersonUser = ticket.client().salesPersonUser();
|
||||||
if (salesPersonUser) {
|
if (salesPersonUser && sales.length) {
|
||||||
const origin = ctx.req.headers.origin;
|
const origin = ctx.req.headers.origin;
|
||||||
const message = $t(`I have deleted the ticket id`, {
|
const message = $t(`I have deleted the ticket id`, {
|
||||||
id: id,
|
id: id,
|
||||||
|
|
|
@ -49,7 +49,7 @@ describe('ticket merge()', () => {
|
||||||
|
|
||||||
expect(deletedTicket.isDeleted).toEqual(true);
|
expect(deletedTicket.isDeleted).toEqual(true);
|
||||||
expect(salesTicketFuture.length).toEqual(2);
|
expect(salesTicketFuture.length).toEqual(2);
|
||||||
expect(chatNotificationBeforeMerge.length).toEqual(chatNotificationAfterMerge.length - 2);
|
expect(chatNotificationBeforeMerge.length).toEqual(chatNotificationAfterMerge.length - 1);
|
||||||
|
|
||||||
await tx.rollback();
|
await tx.rollback();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
|
@ -17,6 +17,12 @@
|
||||||
"Expedition": {
|
"Expedition": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
},
|
},
|
||||||
|
"ExpeditionPallet": {
|
||||||
|
"dataSource": "vn"
|
||||||
|
},
|
||||||
|
"ExpeditionScan": {
|
||||||
|
"dataSource": "vn"
|
||||||
|
},
|
||||||
"ExpeditionState": {
|
"ExpeditionState": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
},
|
},
|
||||||
|
@ -32,6 +38,9 @@
|
||||||
"ExpeditionMistake": {
|
"ExpeditionMistake": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
},
|
},
|
||||||
|
"ExpeditionMistakeType": {
|
||||||
|
"dataSource": "vn"
|
||||||
|
},
|
||||||
"PrintServerQueue": {
|
"PrintServerQueue": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
},
|
},
|
||||||
|
@ -47,6 +56,9 @@
|
||||||
"SaleGroup": {
|
"SaleGroup": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
},
|
},
|
||||||
|
"SaleMistake": {
|
||||||
|
"dataSource": "vn"
|
||||||
|
},
|
||||||
"SaleGroupDetail": {
|
"SaleGroupDetail": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
},
|
},
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue