Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 1466-print_refactor
gitea/salix/1466-print_refactor This commit looks good Details

This commit is contained in:
Joan Sanchez 2019-11-13 08:09:54 +01:00
commit 308c4dfb88
62 changed files with 2764 additions and 1447 deletions

View File

@ -0,0 +1,88 @@
const request = require('request-promise-native');
module.exports = Self => {
Self.remoteMethodCtx('sendMessage', {
description: 'Send a RocketChat message',
accessType: 'WRITE',
accepts: [{
arg: 'to',
type: 'String',
required: true,
description: 'user (@) or channel (#) to send the message'
}, {
arg: 'message',
type: 'String',
required: true,
description: 'The message'
}],
returns: {
type: 'Object',
root: true
},
http: {
path: `/sendMessage`,
verb: 'POST'
}
});
Self.sendMessage = async(ctx, to, message) => {
const models = Self.app.models;
const accessToken = ctx.req.accessToken;
const sender = await models.Account.findById(accessToken.userId);
return sendMessage(to, `@${sender.name}: ${message}`);
};
async function sendMessage(name, message) {
const models = Self.app.models;
const chatConfig = await models.ChatConfig.findOne();
if (!Self.token)
Self.token = await login();
const uri = `${chatConfig.uri}/chat.postMessage`;
return send(uri, {
'channel': name,
'text': message
}).catch(async error => {
if (error.statusCode === 401 && !Self.loginAttempted) {
Self.token = await login();
Self.loginAttempted = true;
return sendMessage(name, message);
}
throw new Error(error.message);
});
}
/**
* Returns a rocketchat token
* @return {Object} userId and authToken
*/
async function login() {
const models = Self.app.models;
const chatConfig = await models.ChatConfig.findOne();
const uri = `${chatConfig.uri}/login`;
return send(uri, {
user: chatConfig.user,
password: chatConfig.password
}).then(res => res.data);
}
function send(uri, body) {
const options = {
method: 'POST',
uri: uri,
body: body,
headers: {'content-type': 'application/json'},
json: true
};
if (Self.token) {
options.headers['X-Auth-Token'] = Self.token.authToken;
options.headers['X-User-Id'] = Self.token.userId;
}
return request(options);
}
};

View File

@ -14,6 +14,12 @@
"Container": {
"dataSource": "storage"
},
"Chat": {
"dataSource": "vn"
},
"ChatConfig": {
"dataSource": "vn"
},
"Delivery": {
"dataSource": "vn"
},

View File

@ -0,0 +1,32 @@
{
"name": "ChatConfig",
"description": "Chat API config",
"base": "VnModel",
"options": {
"mysql": {
"table": "chatConfig"
}
},
"properties": {
"id": {
"id": true,
"type": "Number",
"description": "Identifier"
},
"uri": {
"type": "String"
},
"user": {
"type": "String"
},
"password": {
"type": "String"
}
},
"acls": [{
"accessType": "READ",
"principalType": "ROLE",
"principalId": "$everyone",
"permission": "ALLOW"
}]
}

3
back/models/chat.js Normal file
View File

@ -0,0 +1,3 @@
module.exports = Self => {
require('../methods/chat/sendMessage')(Self);
};

12
back/models/chat.json Normal file
View File

@ -0,0 +1,12 @@
{
"name": "Chat",
"base": "VnModel",
"acls": [{
"property": "validations",
"accessType": "EXECUTE",
"principalType": "ROLE",
"principalId": "$everyone",
"permission": "ALLOW"
}]
}

View File

@ -21,43 +21,3 @@ ADD CONSTRAINT `fgnUserFk`
ON DELETE CASCADE
ON UPDATE CASCADE;
insert into vn.userPhone(userFk,typeFk,phone)
select id,'personalPhone', phone
from vn.client
where phone is not null;
insert into vn.userPhone(userFk,typeFk,phone)
select id,'businessPhone', phone
from vn.worker
where phone is not null AND phone > '';
insert into vn.userPhone(userFk,typeFk,phone)
SELECT
`w`.`userFk`,
'businessPhone',
`m`.`value` AS `mediaValue`
FROM
(((((`postgresql`.`person` `p`
JOIN `postgresql`.`profile` `po` ON ((`po`.`person_id` = `p`.`person_id`)))
JOIN `postgresql`.`profile_media` `pom` ON ((`pom`.`profile_id` = `po`.`profile_id`)))
JOIN `postgresql`.`media` `m` ON ((`m`.`media_id` = `pom`.`media_id`)))
JOIN `postgresql`.`media_type` `mt` ON ((`mt`.`media_type_id` = `m`.`media_type_id`)))
JOIN `vn`.`worker` `w` ON ((`w`.`id` = `p`.`id_trabajador`)))
WHERE
(`mt`.`name` = 'movil empresa');
insert into vn.userPhone(userFk,typeFk,phone)
SELECT
`w`.`userFk`,
'personalPhone',
`m`.`value` AS `mediaValue`
FROM
(((((`postgresql`.`person` `p`
JOIN `postgresql`.`profile` `po` ON ((`po`.`person_id` = `p`.`person_id`)))
JOIN `postgresql`.`profile_media` `pom` ON ((`pom`.`profile_id` = `po`.`profile_id`)))
JOIN `postgresql`.`media` `m` ON ((`m`.`media_id` = `pom`.`media_id`)))
JOIN `postgresql`.`media_type` `mt` ON ((`mt`.`media_type_id` = `m`.`media_type_id`)))
JOIN `vn`.`worker` `w` ON ((`w`.`id` = `p`.`id_trabajador`)))
WHERE
(`mt`.`name` = 'movil personal')

View File

@ -0,0 +1,11 @@
USE `vn`;
CREATE TABLE `vn`.`chatConfig` (
`id` INT NOT NULL AUTO_INCREMENT,
`uri` VARCHAR(255) NOT NULL,
`user` VARCHAR(50) NOT NULL,
`password` VARCHAR(50) NOT NULL,
PRIMARY KEY (`id`));
INSERT INTO `vn`.`chatConfig` (`uri`, `user`, `password`) VALUES ('https://chat.verdnatura.es/api/v1', 'VnBot', 'Ub606cux7op.');

View File

@ -0,0 +1,119 @@
USE `vn`;
DROP procedure IF EXISTS `itemDiary`;
DELIMITER $$
USE `vn`$$
CREATE DEFINER=`root`@`%` PROCEDURE `itemDiary`(IN vItemId INT, IN vWarehouse INT)
BEGIN
DECLARE vDateInventory DATETIME;
DECLARE vCurdate DATE DEFAULT CURDATE();
DECLARE vDayEnd DATETIME DEFAULT util.dayEnd(vCurdate);
-- traduccion: date, alertLevel, origin, reference, name, In, Out, Balance
SELECT Fechainventario INTO vDateInventory FROM vn2008.tblContadores;
SET @a = 0;
SELECT DATE(date) AS date,
alertLevel,
stateName,
origin,
reference,
clientFk,
name,
`in`,
`out`,
@a := @a + IFNULL(`in`,0) - IFNULL(`out`,0) as balance,
isPicked,
isTicket
FROM
( SELECT tr.landed as date,
b.quantity as `in`,
NULL as `out`,
IF(tr.isReceived != FALSE,3, IF(tr.isDelivered,1,0)) as alertLevel,
st.name AS stateName,
s.name as name,
e.ref as reference,
e.id as origin,
s.id as clientFk,
TRUE isPicked,
FALSE AS isTicket
FROM vn.buy b
JOIN vn.entry e ON e.id = b.entryFk
JOIN vn.travel tr ON tr.id = e.travelFk
JOIN vn.supplier s ON s.id = e.supplierFk
JOIN vn.alertLevel al ON al.alertLevel =
CASE
WHEN tr.isReceived != FALSE THEN 3
WHEN tr.isDelivered THEN 1
ELSE 0
END
JOIN vn.state st ON st.code = al.code
WHERE tr.landed >= vDateInventory
AND vWarehouse = tr.warehouseInFk
AND b.itemFk = vItemId
AND e.isInventory = 0
AND e.isRaid = 0
UNION ALL
SELECT tr.shipped as date,
NULL as `in`,
b.quantity as `out`,
IF(tr.isReceived != FALSE,3, IF(tr.isDelivered,1,0)) as alertLevel,
st.name AS stateName,
s.name as name,
e.ref as reference,
e.id as origin,
s.id as clientFk,
TRUE isPicked,
FALSE AS isTicket
FROM vn.buy b
JOIN vn.entry e ON e.id = b.entryFk
JOIN vn.travel tr ON tr.id = e.travelFk
JOIN vn.warehouse w ON w.id = tr.warehouseOutFk
JOIN vn.supplier s ON s.id = e.supplierFk
JOIN vn.alertLevel al ON al.alertLevel =
CASE
WHEN tr.isReceived != FALSE THEN 3
WHEN tr.isDelivered THEN 1
ELSE 0
END
JOIN vn.state st ON st.code = al.code
WHERE tr.shipped >= vDateInventory
AND vWarehouse =tr.warehouseOutFk
AND s.id <> 4
AND b.itemFk = vItemId
AND e.isInventory = 0
AND w.isFeedStock = 0
AND e.isRaid = 0
UNION ALL
SELECT t.shipped as date,
NULL as `in`,
s.quantity as `out`,
al.alertLevel as alertLevel,
st.name AS stateName,
t.nickname as name,
t.refFk as reference,
t.id as origin,
t.clientFk,
stk.id as isPicked, -- TRUE as isPicked
TRUE as isTicket
FROM vn.sale s
JOIN vn.ticket t ON t.id = s.ticketFk
LEFT JOIN vn.ticketState ts ON ts.ticket = t.id
LEFT JOIN vn.state st ON st.code = ts.code
JOIN vn.client c ON c.id = t.clientFk
JOIN vn.alertLevel al ON al.alertLevel =
CASE
WHEN t.shipped < vCurdate THEN 3
WHEN t.shipped > vDayEnd THEN 0
ELSE IFNULL(ts.alertLevel, 0)
END
LEFT JOIN vn.saleTracking stk ON stk.saleFk = s.id AND stk.stateFk = 14 -- comentar
WHERE t.shipped >= vDateInventory
AND s.itemFk = vItemId
AND vWarehouse =t.warehouseFk
) AS itemDiary
ORDER BY date, isTicket, alertLevel DESC, isPicked DESC, `in` DESC, `out` DESC;
END$$
DELIMITER ;

View File

@ -36,7 +36,7 @@ UNLOCK TABLES;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2019-10-29 8:19:03
-- Dump completed on 2019-11-12 10:01:42
USE `account`;
-- MySQL dump 10.13 Distrib 5.7.27, for Linux (x86_64)
--
@ -71,7 +71,7 @@ UNLOCK TABLES;
LOCK TABLES `roleInherit` WRITE;
/*!40000 ALTER TABLE `roleInherit` DISABLE KEYS */;
INSERT INTO `roleInherit` VALUES (9,0),(66,0),(5,1),(13,1),(18,1),(31,1),(32,1),(34,1),(35,1),(37,1),(40,1),(42,1),(44,1),(47,1),(51,1),(53,1),(54,1),(56,1),(58,1),(1,2),(1,3),(30,5),(39,5),(60,5),(11,6),(1,11),(2,11),(3,11),(16,13),(20,13),(21,13),(22,13),(34,13),(41,13),(43,13),(45,13),(48,13),(50,13),(52,13),(55,13),(57,13),(59,13),(61,13),(16,15),(20,16),(21,18),(52,19),(65,19),(17,20),(30,20),(5,21),(19,21),(22,21),(39,21),(30,22),(5,33),(34,33),(15,35),(41,35),(52,35),(49,36),(61,36),(17,37),(38,37),(17,39),(41,40),(43,42),(36,44),(45,44),(36,47),(48,47),(50,49),(60,50),(65,50),(52,51),(21,53),(30,53),(55,54),(57,56),(39,57),(50,57),(60,57),(49,58),(59,58),(50,59),(17,64),(30,64),(38,64),(20,65);
INSERT INTO `roleInherit` VALUES (9,0),(66,0),(5,1),(13,1),(18,1),(31,1),(32,1),(34,1),(35,1),(37,1),(40,1),(42,1),(44,1),(47,1),(51,1),(53,1),(54,1),(56,1),(58,1),(1,2),(1,3),(30,5),(39,5),(60,5),(11,6),(1,11),(2,11),(3,11),(16,13),(20,13),(21,13),(22,13),(34,13),(41,13),(43,13),(45,13),(48,13),(50,13),(52,13),(55,13),(57,13),(59,13),(61,13),(16,15),(20,16),(21,18),(52,19),(65,19),(17,20),(30,20),(5,21),(19,21),(22,21),(39,21),(30,22),(5,33),(34,33),(15,35),(41,35),(52,35),(65,35),(49,36),(61,36),(17,37),(38,37),(17,39),(41,40),(43,42),(36,44),(45,44),(36,47),(48,47),(50,49),(60,50),(65,50),(52,51),(21,53),(30,53),(55,54),(57,56),(39,57),(50,57),(60,57),(49,58),(59,58),(50,59),(17,64),(30,64),(38,64),(20,65);
/*!40000 ALTER TABLE `roleInherit` ENABLE KEYS */;
UNLOCK TABLES;
@ -81,7 +81,7 @@ UNLOCK TABLES;
LOCK TABLES `roleRole` WRITE;
/*!40000 ALTER TABLE `roleRole` DISABLE KEYS */;
INSERT INTO `roleRole` VALUES (0,0),(0,1),(0,2),(0,3),(0,5),(0,6),(0,9),(0,11),(0,13),(0,15),(0,16),(0,17),(0,18),(0,19),(0,20),(0,21),(0,22),(0,30),(0,31),(0,32),(0,33),(0,34),(0,35),(0,36),(0,37),(0,38),(0,39),(0,40),(0,41),(0,42),(0,43),(0,44),(0,45),(0,47),(0,48),(0,49),(0,50),(0,51),(0,52),(0,53),(0,54),(0,55),(0,56),(0,57),(0,58),(0,59),(0,60),(0,61),(0,62),(0,64),(0,65),(0,66),(1,1),(1,2),(1,3),(1,6),(1,11),(2,2),(2,6),(2,11),(3,3),(3,6),(3,11),(5,1),(5,2),(5,3),(5,5),(5,6),(5,11),(5,13),(5,18),(5,21),(5,33),(5,53),(6,6),(9,0),(9,1),(9,2),(9,3),(9,5),(9,6),(9,9),(9,11),(9,13),(9,15),(9,16),(9,17),(9,18),(9,19),(9,20),(9,21),(9,22),(9,30),(9,31),(9,32),(9,33),(9,34),(9,35),(9,36),(9,37),(9,38),(9,39),(9,40),(9,41),(9,42),(9,43),(9,44),(9,45),(9,47),(9,48),(9,49),(9,50),(9,51),(9,52),(9,53),(9,54),(9,55),(9,56),(9,57),(9,58),(9,59),(9,60),(9,61),(9,62),(9,64),(9,65),(9,66),(11,6),(11,11),(13,1),(13,2),(13,3),(13,6),(13,11),(13,13),(15,1),(15,2),(15,3),(15,6),(15,11),(15,15),(15,35),(16,1),(16,2),(16,3),(16,6),(16,11),(16,13),(16,15),(16,16),(16,35),(17,1),(17,2),(17,3),(17,5),(17,6),(17,11),(17,13),(17,15),(17,16),(17,17),(17,18),(17,19),(17,20),(17,21),(17,33),(17,35),(17,36),(17,37),(17,39),(17,44),(17,47),(17,49),(17,50),(17,53),(17,56),(17,57),(17,58),(17,59),(17,64),(17,65),(18,1),(18,2),(18,3),(18,6),(18,11),(18,18),(19,1),(19,2),(19,3),(19,6),(19,11),(19,13),(19,18),(19,19),(19,21),(19,53),(20,1),(20,2),(20,3),(20,6),(20,11),(20,13),(20,15),(20,16),(20,18),(20,19),(20,20),(20,21),(20,35),(20,36),(20,44),(20,47),(20,49),(20,50),(20,53),(20,56),(20,57),(20,58),(20,59),(20,65),(21,1),(21,2),(21,3),(21,6),(21,11),(21,13),(21,18),(21,21),(21,53),(22,1),(22,2),(22,3),(22,6),(22,11),(22,13),(22,18),(22,21),(22,22),(22,53),(30,1),(30,2),(30,3),(30,5),(30,6),(30,11),(30,13),(30,15),(30,16),(30,18),(30,19),(30,20),(30,21),(30,22),(30,30),(30,33),(30,35),(30,36),(30,44),(30,47),(30,49),(30,50),(30,53),(30,56),(30,57),(30,58),(30,59),(30,64),(30,65),(31,1),(31,2),(31,3),(31,6),(31,11),(31,31),(32,1),(32,2),(32,3),(32,6),(32,11),(32,32),(33,33),(34,1),(34,2),(34,3),(34,6),(34,11),(34,13),(34,33),(34,34),(35,1),(35,2),(35,3),(35,6),(35,11),(35,35),(36,1),(36,2),(36,3),(36,6),(36,11),(36,36),(36,44),(36,47),(37,1),(37,2),(37,3),(37,6),(37,11),(37,37),(38,1),(38,2),(38,3),(38,6),(38,11),(38,37),(38,38),(38,64),(39,1),(39,2),(39,3),(39,5),(39,6),(39,11),(39,13),(39,18),(39,21),(39,33),(39,39),(39,53),(39,56),(39,57),(40,1),(40,2),(40,3),(40,6),(40,11),(40,40),(41,1),(41,2),(41,3),(41,6),(41,11),(41,13),(41,35),(41,40),(41,41),(42,1),(42,2),(42,3),(42,6),(42,11),(42,42),(43,1),(43,2),(43,3),(43,6),(43,11),(43,13),(43,42),(43,43),(44,1),(44,2),(44,3),(44,6),(44,11),(44,44),(45,1),(45,2),(45,3),(45,6),(45,11),(45,13),(45,44),(45,45),(47,1),(47,2),(47,3),(47,6),(47,11),(47,47),(48,1),(48,2),(48,3),(48,6),(48,11),(48,13),(48,47),(48,48),(49,1),(49,2),(49,3),(49,6),(49,11),(49,36),(49,44),(49,47),(49,49),(49,58),(50,1),(50,2),(50,3),(50,6),(50,11),(50,13),(50,36),(50,44),(50,47),(50,49),(50,50),(50,56),(50,57),(50,58),(50,59),(51,1),(51,2),(51,3),(51,6),(51,11),(51,51),(52,1),(52,2),(52,3),(52,6),(52,11),(52,13),(52,18),(52,19),(52,21),(52,35),(52,51),(52,52),(52,53),(53,1),(53,2),(53,3),(53,6),(53,11),(53,53),(54,1),(54,2),(54,3),(54,6),(54,11),(54,54),(55,1),(55,2),(55,3),(55,6),(55,11),(55,13),(55,54),(55,55),(56,1),(56,2),(56,3),(56,6),(56,11),(56,56),(57,1),(57,2),(57,3),(57,6),(57,11),(57,13),(57,56),(57,57),(58,1),(58,2),(58,3),(58,6),(58,11),(58,58),(59,1),(59,2),(59,3),(59,6),(59,11),(59,13),(59,58),(59,59),(60,1),(60,2),(60,3),(60,5),(60,6),(60,11),(60,13),(60,18),(60,21),(60,33),(60,36),(60,44),(60,47),(60,49),(60,50),(60,53),(60,56),(60,57),(60,58),(60,59),(60,60),(61,1),(61,2),(61,3),(61,6),(61,11),(61,13),(61,36),(61,44),(61,47),(61,61),(62,62),(64,64),(65,1),(65,2),(65,3),(65,6),(65,11),(65,13),(65,18),(65,19),(65,21),(65,36),(65,44),(65,47),(65,49),(65,50),(65,53),(65,56),(65,57),(65,58),(65,59),(65,65),(66,0),(66,1),(66,2),(66,3),(66,5),(66,6),(66,9),(66,11),(66,13),(66,15),(66,16),(66,17),(66,18),(66,19),(66,20),(66,21),(66,22),(66,30),(66,31),(66,32),(66,33),(66,34),(66,35),(66,36),(66,37),(66,38),(66,39),(66,40),(66,41),(66,42),(66,43),(66,44),(66,45),(66,47),(66,48),(66,49),(66,50),(66,51),(66,52),(66,53),(66,54),(66,55),(66,56),(66,57),(66,58),(66,59),(66,60),(66,61),(66,62),(66,64),(66,65),(66,66);
INSERT INTO `roleRole` VALUES (0,0),(0,1),(0,2),(0,3),(0,5),(0,6),(0,9),(0,11),(0,13),(0,15),(0,16),(0,17),(0,18),(0,19),(0,20),(0,21),(0,22),(0,30),(0,31),(0,32),(0,33),(0,34),(0,35),(0,36),(0,37),(0,38),(0,39),(0,40),(0,41),(0,42),(0,43),(0,44),(0,45),(0,47),(0,48),(0,49),(0,50),(0,51),(0,52),(0,53),(0,54),(0,55),(0,56),(0,57),(0,58),(0,59),(0,60),(0,61),(0,62),(0,64),(0,65),(0,66),(1,1),(1,2),(1,3),(1,6),(1,11),(2,2),(2,6),(2,11),(3,3),(3,6),(3,11),(5,1),(5,2),(5,3),(5,5),(5,6),(5,11),(5,13),(5,18),(5,21),(5,33),(5,53),(6,6),(9,0),(9,1),(9,2),(9,3),(9,5),(9,6),(9,9),(9,11),(9,13),(9,15),(9,16),(9,17),(9,18),(9,19),(9,20),(9,21),(9,22),(9,30),(9,31),(9,32),(9,33),(9,34),(9,35),(9,36),(9,37),(9,38),(9,39),(9,40),(9,41),(9,42),(9,43),(9,44),(9,45),(9,47),(9,48),(9,49),(9,50),(9,51),(9,52),(9,53),(9,54),(9,55),(9,56),(9,57),(9,58),(9,59),(9,60),(9,61),(9,62),(9,64),(9,65),(9,66),(11,6),(11,11),(13,1),(13,2),(13,3),(13,6),(13,11),(13,13),(15,1),(15,2),(15,3),(15,6),(15,11),(15,15),(15,35),(16,1),(16,2),(16,3),(16,6),(16,11),(16,13),(16,15),(16,16),(16,35),(17,1),(17,2),(17,3),(17,5),(17,6),(17,11),(17,13),(17,15),(17,16),(17,17),(17,18),(17,19),(17,20),(17,21),(17,33),(17,35),(17,36),(17,37),(17,39),(17,44),(17,47),(17,49),(17,50),(17,53),(17,56),(17,57),(17,58),(17,59),(17,64),(17,65),(18,1),(18,2),(18,3),(18,6),(18,11),(18,18),(19,1),(19,2),(19,3),(19,6),(19,11),(19,13),(19,18),(19,19),(19,21),(19,53),(20,1),(20,2),(20,3),(20,6),(20,11),(20,13),(20,15),(20,16),(20,18),(20,19),(20,20),(20,21),(20,35),(20,36),(20,44),(20,47),(20,49),(20,50),(20,53),(20,56),(20,57),(20,58),(20,59),(20,65),(21,1),(21,2),(21,3),(21,6),(21,11),(21,13),(21,18),(21,21),(21,53),(22,1),(22,2),(22,3),(22,6),(22,11),(22,13),(22,18),(22,21),(22,22),(22,53),(30,1),(30,2),(30,3),(30,5),(30,6),(30,11),(30,13),(30,15),(30,16),(30,18),(30,19),(30,20),(30,21),(30,22),(30,30),(30,33),(30,35),(30,36),(30,44),(30,47),(30,49),(30,50),(30,53),(30,56),(30,57),(30,58),(30,59),(30,64),(30,65),(31,1),(31,2),(31,3),(31,6),(31,11),(31,31),(32,1),(32,2),(32,3),(32,6),(32,11),(32,32),(33,33),(34,1),(34,2),(34,3),(34,6),(34,11),(34,13),(34,33),(34,34),(35,1),(35,2),(35,3),(35,6),(35,11),(35,35),(36,1),(36,2),(36,3),(36,6),(36,11),(36,36),(36,44),(36,47),(37,1),(37,2),(37,3),(37,6),(37,11),(37,37),(38,1),(38,2),(38,3),(38,6),(38,11),(38,37),(38,38),(38,64),(39,1),(39,2),(39,3),(39,5),(39,6),(39,11),(39,13),(39,18),(39,21),(39,33),(39,39),(39,53),(39,56),(39,57),(40,1),(40,2),(40,3),(40,6),(40,11),(40,40),(41,1),(41,2),(41,3),(41,6),(41,11),(41,13),(41,35),(41,40),(41,41),(42,1),(42,2),(42,3),(42,6),(42,11),(42,42),(43,1),(43,2),(43,3),(43,6),(43,11),(43,13),(43,42),(43,43),(44,1),(44,2),(44,3),(44,6),(44,11),(44,44),(45,1),(45,2),(45,3),(45,6),(45,11),(45,13),(45,44),(45,45),(47,1),(47,2),(47,3),(47,6),(47,11),(47,47),(48,1),(48,2),(48,3),(48,6),(48,11),(48,13),(48,47),(48,48),(49,1),(49,2),(49,3),(49,6),(49,11),(49,36),(49,44),(49,47),(49,49),(49,58),(50,1),(50,2),(50,3),(50,6),(50,11),(50,13),(50,36),(50,44),(50,47),(50,49),(50,50),(50,56),(50,57),(50,58),(50,59),(51,1),(51,2),(51,3),(51,6),(51,11),(51,51),(52,1),(52,2),(52,3),(52,6),(52,11),(52,13),(52,18),(52,19),(52,21),(52,35),(52,51),(52,52),(52,53),(53,1),(53,2),(53,3),(53,6),(53,11),(53,53),(54,1),(54,2),(54,3),(54,6),(54,11),(54,54),(55,1),(55,2),(55,3),(55,6),(55,11),(55,13),(55,54),(55,55),(56,1),(56,2),(56,3),(56,6),(56,11),(56,56),(57,1),(57,2),(57,3),(57,6),(57,11),(57,13),(57,56),(57,57),(58,1),(58,2),(58,3),(58,6),(58,11),(58,58),(59,1),(59,2),(59,3),(59,6),(59,11),(59,13),(59,58),(59,59),(60,1),(60,2),(60,3),(60,5),(60,6),(60,11),(60,13),(60,18),(60,21),(60,33),(60,36),(60,44),(60,47),(60,49),(60,50),(60,53),(60,56),(60,57),(60,58),(60,59),(60,60),(61,1),(61,2),(61,3),(61,6),(61,11),(61,13),(61,36),(61,44),(61,47),(61,61),(62,62),(64,64),(65,1),(65,2),(65,3),(65,6),(65,11),(65,13),(65,18),(65,19),(65,21),(65,35),(65,36),(65,44),(65,47),(65,49),(65,50),(65,53),(65,56),(65,57),(65,58),(65,59),(65,65),(66,0),(66,1),(66,2),(66,3),(66,5),(66,6),(66,9),(66,11),(66,13),(66,15),(66,16),(66,17),(66,18),(66,19),(66,20),(66,21),(66,22),(66,30),(66,31),(66,32),(66,33),(66,34),(66,35),(66,36),(66,37),(66,38),(66,39),(66,40),(66,41),(66,42),(66,43),(66,44),(66,45),(66,47),(66,48),(66,49),(66,50),(66,51),(66,52),(66,53),(66,54),(66,55),(66,56),(66,57),(66,58),(66,59),(66,60),(66,61),(66,62),(66,64),(66,65),(66,66);
/*!40000 ALTER TABLE `roleRole` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
@ -94,7 +94,7 @@ UNLOCK TABLES;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2019-10-29 8:19:04
-- Dump completed on 2019-11-12 10:01:42
USE `salix`;
-- MySQL dump 10.13 Distrib 5.7.27, for Linux (x86_64)
--
@ -142,7 +142,7 @@ UNLOCK TABLES;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2019-10-29 8:19:04
-- Dump completed on 2019-11-12 10:01:42
USE `vn`;
-- MySQL dump 10.13 Distrib 5.7.27, for Linux (x86_64)
--
@ -300,7 +300,7 @@ UNLOCK TABLES;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2019-10-29 8:19:05
-- Dump completed on 2019-11-12 10:01:42
USE `vn2008`;
-- MySQL dump 10.13 Distrib 5.7.27, for Linux (x86_64)
--
@ -345,7 +345,7 @@ UNLOCK TABLES;
LOCK TABLES `department` WRITE;
/*!40000 ALTER TABLE `department` DISABLE KEYS */;
INSERT INTO `department` VALUES (1,'VERDNATURA',1,78,1,0,NULL,NULL,NULL,0,0,0,0),(22,'COMPRAS',65,66,NULL,72,596,2,5,0,0,1,0),(23,'CAMARA',41,42,NULL,72,604,2,6,1,0,0,0),(31,'INFORMATICA',11,12,NULL,72,127,3,9,0,0,0,0),(34,'CONTABILIDAD',4,5,NULL,0,NULL,NULL,NULL,0,0,0,0),(35,'FINANZAS',6,7,NULL,0,NULL,NULL,NULL,0,0,0,0),(36,'LABORAL',8,9,NULL,0,NULL,NULL,NULL,0,0,0,0),(37,'PRODUCCION',15,24,NULL,72,230,3,11,0,0,0,0),(38,'SACADO',20,21,NULL,72,230,4,14,1,0,0,0),(39,'ENCAJADO',22,23,NULL,72,230,4,12,1,0,0,0),(41,'ADMINISTRACION',3,10,NULL,72,599,3,8,0,0,0,0),(43,'VENTAS',51,64,NULL,0,NULL,NULL,NULL,0,0,0,0),(44,'GERENCIA',2,25,NULL,72,300,2,7,0,0,0,0),(45,'LOGISTICA',26,37,NULL,72,596,3,19,0,0,0,0),(46,'REPARTO',38,39,NULL,72,659,3,10,0,0,0,0),(48,'ALMACENAJE',40,47,NULL,0,NULL,NULL,NULL,0,0,0,0),(49,'PROPIEDAD',48,75,NULL,72,1008,1,1,0,0,0,0),(52,'CARGA AEREA',27,28,NULL,72,163,4,28,0,0,0,0),(53,'MARKETING Y COMUNICACIÓN',60,61,NULL,72,1238,0,0,0,0,0,0),(54,'ORNAMENTALES',76,77,NULL,72,433,3,21,0,0,0,0),(55,'TALLER NATURAL',68,69,NULL,72,695,2,23,0,0,0,0),(56,'TALLER ARTIFICIAL',70,71,NULL,72,1780,2,24,0,0,0,0),(58,'CAMPOS',73,74,NULL,72,225,2,2,0,0,0,0),(59,'MANTENIMIENTO',49,50,NULL,72,1907,4,16,0,0,0,0),(60,'RECLAMACIONES',58,59,NULL,72,563,3,20,0,0,0,0),(61,'VNH',35,36,NULL,73,1297,3,17,0,0,0,0),(63,'VENTAS FRANCIA',62,63,NULL,72,277,2,27,0,0,0,0),(66,'VERDNAMADRID',31,32,NULL,72,163,3,18,0,0,0,0),(68,'COMPLEMENTOS',43,44,NULL,72,617,3,26,1,0,0,0),(69,'VERDNABARNA',33,34,NULL,74,432,3,22,0,0,0,0),(77,'PALETIZADO',18,19,NULL,72,230,4,15,1,0,0,0),(80,'EQUIPO J VALLES',56,57,NULL,72,693,3,4,0,0,0,0),(86,'LIMPIEZA',13,14,NULL,72,599,0,0,0,0,0,0),(89,'COORDINACION',16,17,NULL,0,NULL,NULL,NULL,1,0,0,0),(90,'TRAILER',29,30,NULL,0,NULL,NULL,NULL,0,0,0,0),(91,'ARTIFICIAL',45,46,NULL,0,NULL,NULL,NULL,1,0,0,0),(92,'EQUIPO SILVERIO',54,55,NULL,0,NULL,NULL,NULL,0,0,0,0),(93,'CONFECCION',67,72,NULL,0,NULL,NULL,NULL,0,0,0,0),(94,'EQUIPO J BROCAL',52,53,NULL,0,NULL,NULL,NULL,0,0,1,0);
INSERT INTO `department` VALUES (1,'VERDNATURA',1,78,763,0,NULL,NULL,NULL,0,0,0,0),(22,'COMPRAS',65,66,NULL,72,596,2,5,0,0,1,0),(23,'CAMARA',41,42,NULL,72,604,2,6,1,0,0,0),(31,'INFORMATICA',11,12,NULL,72,127,3,9,0,0,0,0),(34,'CONTABILIDAD',4,5,NULL,0,NULL,NULL,NULL,0,0,0,0),(35,'FINANZAS',6,7,NULL,0,NULL,NULL,NULL,0,0,0,0),(36,'LABORAL',8,9,NULL,0,NULL,NULL,NULL,0,0,0,0),(37,'PRODUCCION',15,24,NULL,72,230,3,11,0,0,0,0),(38,'SACADO',20,21,NULL,72,230,4,14,1,0,0,0),(39,'ENCAJADO',22,23,NULL,72,230,4,12,1,0,0,0),(41,'ADMINISTRACION',3,10,NULL,72,599,3,8,0,0,0,0),(43,'VENTAS',51,64,NULL,0,NULL,NULL,NULL,0,0,0,0),(44,'GERENCIA',2,25,NULL,72,300,2,7,0,0,0,0),(45,'LOGISTICA',26,37,NULL,72,596,3,19,0,0,0,0),(46,'REPARTO',38,39,NULL,72,659,3,10,0,0,0,0),(48,'ALMACENAJE',40,47,NULL,0,NULL,NULL,NULL,0,0,0,0),(49,'PROPIEDAD',48,75,NULL,72,1008,1,1,0,0,0,0),(52,'CARGA AEREA',27,28,NULL,72,163,4,28,0,0,0,0),(53,'MARKETING Y COMUNICACIÓN',60,61,NULL,72,1238,0,0,0,0,0,0),(54,'ORNAMENTALES',76,77,NULL,72,433,3,21,0,0,0,0),(55,'TALLER NATURAL',68,69,NULL,72,695,2,23,0,0,0,0),(56,'TALLER ARTIFICIAL',70,71,NULL,72,1780,2,24,0,0,0,0),(58,'CAMPOS',73,74,NULL,72,225,2,2,0,0,0,0),(59,'MANTENIMIENTO',49,50,NULL,72,1907,4,16,0,0,0,0),(60,'RECLAMACIONES',58,59,NULL,72,563,3,20,0,0,0,0),(61,'VNH',35,36,NULL,73,1297,3,17,0,0,0,0),(63,'VENTAS FRANCIA',62,63,NULL,72,277,2,27,0,0,0,0),(66,'VERDNAMADRID',31,32,NULL,72,163,3,18,0,0,0,0),(68,'COMPLEMENTOS',43,44,NULL,72,617,3,26,1,0,0,0),(69,'VERDNABARNA',33,34,NULL,74,432,3,22,0,0,0,0),(77,'PALETIZADO',18,19,NULL,72,230,4,15,1,0,0,0),(80,'EQUIPO J VALLES',56,57,NULL,72,693,3,4,0,0,0,0),(86,'LIMPIEZA',13,14,NULL,72,599,0,0,0,0,0,0),(89,'COORDINACION',16,17,NULL,0,NULL,NULL,NULL,1,0,0,0),(90,'TRAILER',29,30,NULL,0,NULL,NULL,NULL,0,0,0,0),(91,'ARTIFICIAL',45,46,NULL,0,NULL,NULL,NULL,1,0,0,0),(92,'EQUIPO SILVERIO',54,55,NULL,0,NULL,NULL,NULL,0,0,0,0),(93,'CONFECCION',67,72,NULL,0,NULL,NULL,NULL,0,0,0,0),(94,'EQUIPO J BROCAL',52,53,NULL,0,NULL,NULL,NULL,0,0,1,0);
/*!40000 ALTER TABLE `department` ENABLE KEYS */;
UNLOCK TABLES;
@ -368,7 +368,7 @@ UNLOCK TABLES;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2019-10-29 8:19:05
-- Dump completed on 2019-11-12 10:01:42
USE `bi`;
-- MySQL dump 10.13 Distrib 5.7.27, for Linux (x86_64)
--
@ -403,7 +403,7 @@ UNLOCK TABLES;
LOCK TABLES `tarifa_componentes_series` WRITE;
/*!40000 ALTER TABLE `tarifa_componentes_series` DISABLE KEYS */;
INSERT INTO `tarifa_componentes_series` VALUES (1,'coste',1,0),(2,'com ventas',1,1),(3,'com compras',1,1),(4,'empresa',1,1),(5,'cliente',0,0),(6,'agencia',0,0),(7,'cartera_comercial',0,1),(8,'cartera_producto',0,1),(9,'maniobra',1,1),(10,'cartera_comprador',0,1),(11,'errores',0,0),(12,'otros',0,0);
INSERT INTO `tarifa_componentes_series` VALUES (1,'coste',1,0),(2,'com ventas',1,1),(3,'com compras',1,1),(4,'empresa',1,1),(5,'cliente',0,0),(6,'agencia',0,0),(7,'cartera_comercial',0,1),(8,'cartera_producto',0,1),(9,'maniobra',1,1),(10,'cartera_comprador',0,1),(11,'errores',0,1),(12,'otros',0,1);
/*!40000 ALTER TABLE `tarifa_componentes_series` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
@ -416,7 +416,7 @@ UNLOCK TABLES;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2019-10-29 8:19:05
-- Dump completed on 2019-11-12 10:01:43
USE `cache`;
-- MySQL dump 10.13 Distrib 5.7.27, for Linux (x86_64)
--
@ -454,7 +454,7 @@ UNLOCK TABLES;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2019-10-29 8:19:05
-- Dump completed on 2019-11-12 10:01:43
USE `hedera`;
-- MySQL dump 10.13 Distrib 5.7.27, for Linux (x86_64)
--
@ -483,16 +483,6 @@ INSERT INTO `imageCollection` VALUES (1,'catalog','Artículo',3840,2160,'Item','
/*!40000 ALTER TABLE `imageCollection` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Dumping data for table `tpvConfig`
--
LOCK TABLES `tpvConfig` WRITE;
/*!40000 ALTER TABLE `tpvConfig` DISABLE KEYS */;
INSERT INTO `tpvConfig` VALUES (1,978,1,0,2000,4,'https://sis.redsys.es/sis/realizarPago',0,'https://sis-t.redsys.es:25443/sis/realizarPago','sq7HjrUOBfKmC576ILgskD5srU870gJ7',NULL);
/*!40000 ALTER TABLE `tpvConfig` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Dumping data for table `tpvError`
--
@ -522,7 +512,7 @@ UNLOCK TABLES;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2019-10-29 8:19:05
-- Dump completed on 2019-11-12 10:01:43
USE `postgresql`;
-- MySQL dump 10.13 Distrib 5.7.27, for Linux (x86_64)
--
@ -547,7 +537,7 @@ USE `postgresql`;
LOCK TABLES `calendar_labour_type` WRITE;
/*!40000 ALTER TABLE `calendar_labour_type` DISABLE KEYS */;
INSERT INTO `calendar_labour_type` VALUES (1,'Horario general','00:20:00',40),(2,'Horario 35h/semana','00:20:00',35),(3,'Horario 20h/semana','00:00:00',20),(4,'Festivo y Fin de semana','00:00:00',0),(5,'Horario 30h/semana','00:20:00',30),(6,'Horario 25h/semana','00:20:00',25),(7,'Vacaciones trabajadas','00:00:00',0),(8,'Vacaciones','00:00:00',0),(9,'Horario 26h/semana','00:20:00',26),(10,'Horario 28h/semana','00:20:00',28),(11,'Horario 8h/semana','00:00:00',8),(12,'Horario 16h/semana','00:00:00',16),(13,'Horario 32h/semana','00:20:00',32),(14,'Horario 24h/semana','00:20:00',24),(15,'Horario 10h/semana','00:00:00',10),(16,'Horario 27,5h/semana','00:20:00',28),(17,'Horario 13,5h/semana','00:20:00',14),(18,'Horario 31h/semana',NULL,31),(19,'Horario 21,5h/semana',NULL,22),(20,'Horario 34h/semana',NULL,34),(21,'Horario 17h/semana',NULL,17),(22,'Horario 18h/semana',NULL,18),(23,'Horario 37,5 h/semana',NULL,38),(24,'Horario 29 h/semana',NULL,29),(25,'Horario 12h/semana',NULL,12),(26,'Horario 10h/semana',NULL,10),(27,'Horario 15h/semana',NULL,15),(28,'Horario 9h/semana',NULL,9),(29,'Horario 23h/semana',NULL,23),(30,'Horario 21h/semana',NULL,21),(31,'Horario 39h/semana',NULL,39),(32,'Horario 22/semana',NULL,22);
INSERT INTO `calendar_labour_type` VALUES (1,'Horario general','00:20:00',40,0),(2,'Horario 35h/semana','00:20:00',35,1),(3,'Horario 20h/semana','00:00:00',20,1),(4,'Festivo y Fin de semana','00:00:00',0,1),(5,'Horario 30h/semana','00:20:00',30,1),(6,'Horario 25h/semana','00:20:00',25,1),(7,'Vacaciones trabajadas','00:00:00',0,1),(8,'Vacaciones','00:00:00',0,1),(9,'Horario 26h/semana','00:20:00',26,1),(10,'Horario 28h/semana','00:20:00',28,1),(11,'Horario 8h/semana','00:00:00',8,1),(12,'Horario 16h/semana','00:00:00',16,1),(13,'Horario 32h/semana','00:20:00',32,1),(14,'Horario 24h/semana','00:20:00',24,1),(15,'Horario 10h/semana','00:00:00',10,1),(16,'Horario 27,5h/semana','00:20:00',28,1),(17,'Horario 13,5h/semana','00:20:00',14,1),(18,'Horario 31h/semana',NULL,31,1),(19,'Horario 21,5h/semana',NULL,22,1),(20,'Horario 34h/semana',NULL,34,1),(21,'Horario 17h/semana',NULL,17,1),(22,'Horario 18h/semana',NULL,18,1),(23,'Horario 37,5 h/semana',NULL,38,1),(24,'Horario 29 h/semana',NULL,29,1),(25,'Horario 12h/semana',NULL,12,1),(26,'Horario 10h/semana',NULL,10,1),(27,'Horario 15h/semana',NULL,15,1),(28,'Horario 9h/semana',NULL,9,1),(29,'Horario 23h/semana',NULL,23,1),(30,'Horario 21h/semana',NULL,21,1),(31,'Horario 39h/semana',NULL,39,1),(32,'Horario 22/semana',NULL,22,1);
/*!40000 ALTER TABLE `calendar_labour_type` ENABLE KEYS */;
UNLOCK TABLES;
@ -597,7 +587,7 @@ UNLOCK TABLES;
LOCK TABLES `workcenter` WRITE;
/*!40000 ALTER TABLE `workcenter` DISABLE KEYS */;
INSERT INTO `workcenter` VALUES (1,'Silla',20,1024,1),(2,'Mercaflor',19,NULL,NULL),(3,'Marjales',26,20007,NULL),(4,'VNH',NULL,NULL,3),(5,'Madrid',28,2851,5),(6,'Vilassar',88,88031,2),(7,'Tenerife',NULL,NULL,10),(8,'Silla-Agrario',26,2,NULL);
INSERT INTO `workcenter` VALUES (1,'Silla',20,1026,1),(2,'Mercaflor',19,NULL,NULL),(3,'Marjales',26,20007,NULL),(4,'VNH',NULL,NULL,3),(5,'Madrid',28,2851,5),(6,'Vilassar',88,88031,2),(7,'Tenerife',NULL,NULL,10),(8,'Silla-Agrario',26,2,NULL);
/*!40000 ALTER TABLE `workcenter` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
@ -610,4 +600,4 @@ UNLOCK TABLES;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2019-10-29 8:19:06
-- Dump completed on 2019-11-12 10:01:43

View File

@ -1,11 +1,11 @@
ALTER TABLE `vn`.`itemTaxCountry` AUTO_INCREMENT = 1;
ALTER TABLE `vn2008`.`Consignatarios` AUTO_INCREMENT = 1;
ALTER TABLE `vn`.`address` AUTO_INCREMENT = 1;
ALTER TABLE `vn`.`zoneGeo` AUTO_INCREMENT = 1;
INSERT INTO `vn`.`ticketConfig` (`id`, `scopeDays`)
VALUES
('1', '6');
INSERT INTO `account`.`mailConfig` (`id`, `domain`)
VALUES
('1', 'verdnatura.es');
@ -14,16 +14,20 @@ INSERT INTO `account`.`user`(`id`,`name`, `nickname`, `password`,`role`,`active`
SELECT id, name, CONCAT(name, 'Nick'),MD5('nightmare'), id, 1, CONCAT(name, '@mydomain.com'), 'es'
FROM `account`.`role`;
INSERT INTO `vn2008`.`Trabajadores`(`Id_Trabajador`,`CodigoTrabajador`, `Nombre`, `Apellidos`, `user_id`, `boss`)
INSERT INTO `vn`.`worker`(`id`,`code`, `firstName`, `lastName`, `userFk`, `bossFk`)
SELECT id,UPPER(LPAD(role, 3, '0')), name, name, id, 9
FROM `vn`.`user`;
UPDATE `vn2008`.`Trabajadores` SET boss = NULL WHERE Id_Trabajador = 20;
UPDATE `vn2008`.`Trabajadores` SET boss = 20
WHERE Id_Trabajador = 1 OR Id_Trabajador = 9;
UPDATE `vn`.`worker` SET bossFk = NULL WHERE id = 20;
UPDATE `vn`.`worker` SET bossFk = 20
WHERE id = 1 OR id = 9;
DELETE FROM `vn`.`worker` WHERE name ='customer';
DELETE FROM `vn`.`worker` WHERE firstName ='customer';
INSERT INTO `hedera`.`tpvConfig`(`id`, `currency`, `terminal`, `transactionType`, `maxAmount`, `employeeFk`, `testUrl`)
VALUES
(1, 978, 1, 0, 2000, 9, 0);
INSERT INTO `account`.`user`(`id`,`name`,`password`,`role`,`active`,`email`,`lang`)
VALUES
(101, 'BruceWayne', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'BruceWayne@mydomain.com', 'es'),
@ -39,13 +43,13 @@ INSERT INTO `account`.`user`(`id`,`name`,`password`,`role`,`active`,`email`,`lan
(111, 'Missing', 'ac754a330530832ba1bf7687f577da91', 2, 0, NULL, 'es'),
(112, 'Trash', 'ac754a330530832ba1bf7687f577da91', 2, 0, NULL, 'es');
INSERT INTO `vn2008`.`Trabajadores`(`CodigoTrabajador`, `Id_Trabajador`, `Nombre`, `Apellidos`, `user_id`,`boss`)
INSERT INTO `vn`.`worker`(`id`, `code`, `firstName`, `lastName`, `userFk`,`bossFk`)
VALUES
('LGN', 106, 'David Charles', 'Haller', 106, 19),
('ANT', 107, 'Hank' , 'Pym' , 107, 19),
('DCX', 110, 'Charles' , 'Xavier', 108, 19),
('HLK', 109, 'Bruce' , 'Banner', 109, 19),
('JJJ', 108, 'Jessica' , 'Jones' , 110, 19);
(106, 'LGN', 'David Charles', 'Haller', 106, 19),
(107, 'ANT', 'Hank' , 'Pym' , 107, 19),
(108, 'DCX', 'Charles' , 'Xavier', 108, 19),
(109, 'HLK', 'Bruce' , 'Banner', 109, 19),
(110, 'JJJ', 'Jessica' , 'Jones' , 110, 19);
INSERT INTO `vn`.`country`(`id`, `country`, `isUeeMember`, `code`, `currencyFk`, `ibanLength`)
VALUES

File diff suppressed because it is too large Load Diff

View File

@ -80,7 +80,6 @@ dump_tables ${TABLES[@]}
TABLES=(
hedera
imageCollection
tpvConfig
tpvError
tpvResponse
)

View File

@ -185,26 +185,27 @@ let actions = {
isVisible: function(selector) {
return this.wait(selector)
.evaluate(elementSelector => {
const selectorMatches = document.querySelectorAll(elementSelector);
const element = selectorMatches[0];
let selectorMatches = document.querySelectorAll(elementSelector);
let element = selectorMatches[0];
if (selectorMatches.length > 1)
throw new Error(`multiple matches of ${elementSelector} found`);
let isVisible = false;
if (element) {
const eventHandler = event => {
let eventHandler = event => {
event.preventDefault();
isVisible = true;
};
element.addEventListener('mouseover', eventHandler);
const rect = element.getBoundingClientRect();
const x = rect.left + rect.width / 2;
const y = rect.top + rect.height / 2;
const elementInCenter = document.elementFromPoint(x, y);
const elementInTopLeft = document.elementFromPoint(rect.left, rect.top);
const elementInBottomRight = document.elementFromPoint(rect.right, rect.bottom);
const e = new MouseEvent('mouseover', {
let rect = element.getBoundingClientRect();
let x = rect.left + rect.width / 2;
let y = rect.top + rect.height / 2;
let elementInCenter = document.elementFromPoint(x, y);
let elementInTopLeft = document.elementFromPoint(rect.left, rect.top);
let elementInBottomRight = document.elementFromPoint(rect.right, rect.bottom);
let e = new MouseEvent('mouseover', {
view: window,
bubbles: true,
cancelable: true,
@ -420,9 +421,19 @@ let actions = {
}, selector);
},
waitForSpinnerLoad: function() {
return this.waitForClassNotPresent('vn-spinner > div', 'is-active');
waitForStylePresent: function(selector, property, value) {
return this.wait((selector, property, value) => {
const element = document.querySelector(selector);
return element.style[property] == value;
}, selector, property, value);
},
waitForSpinnerLoad: function() {
return this.wait(() => {
const element = document.querySelector('vn-spinner > div');
return element.style.display == 'none';
});
}
};
for (let name in actions) {

View File

@ -191,7 +191,8 @@ export default {
closeItemSummaryPreview: '.vn-popup.shown',
fieldsToShowButton: 'vn-item-index vn-table > div > div > vn-icon-button[icon="menu"]',
fieldsToShowForm: '.vn-dialog.shown form',
firstItemImage: 'vn-item-index vn-tbody > a:nth-child(1) > vn-td:nth-child(1)',
firstItemImage: 'vn-item-index vn-tbody > a:nth-child(1) > vn-td:nth-child(1) > img',
firstItemImageTd: 'vn-item-index vn-table a:nth-child(1) vn-td:nth-child(1)',
firstItemId: 'vn-item-index vn-tbody > a:nth-child(1) > vn-td:nth-child(2)',
idCheckbox: '.vn-dialog.shown form vn-horizontal:nth-child(2) > vn-check',
stemsCheckbox: '.vn-dialog.shown form vn-horizontal:nth-child(3) > vn-check',
@ -367,7 +368,6 @@ export default {
shipButton: 'vn-ticket-descriptor vn-icon[icon="icon-stowaway"]',
thursdayButton: '.vn-popup.shown vn-tool-bar > vn-button:nth-child(4)',
saturdayButton: '.vn-popup.shown vn-tool-bar > vn-button:nth-child(6)',
closeStowawayDialog: '.vn-dialog.shown button[class="close"]',
acceptDeleteButton: '.vn-dialog.shown button[response="accept"]',
acceptChangeHourButton: '.vn-dialog.shown button[response="accept"]',
descriptorDeliveryDate: 'vn-ticket-descriptor > div > div.body > div.attributes > vn-label-value:nth-child(6) > section > span',
@ -441,7 +441,7 @@ export default {
secondSaleIdInput: 'vn-ticket-sale vn-table vn-tbody > vn-tr:nth-child(2) > vn-td:nth-child(4) > vn-autocomplete input',
secondSaleIdAutocomplete: 'vn-ticket-sale vn-table vn-tbody > vn-tr:nth-child(2) > vn-td:nth-child(4) > vn-autocomplete',
secondSaleQuantity: 'vn-ticket-sale vn-table vn-tr:nth-child(2) vn-input-number input',
secondSaleConceptCell: 'vn-ticket-sale vn-table vn-tbody > vn-tr:nth-child(2) > vn-td-editable:nth-child(6)',
secondSaleConceptCell: 'vn-ticket-sale vn-table vn-tbody > vn-tr:nth-child(2) > vn-td-editable:nth-child(6) > div',
secondSaleConceptInput: 'vn-ticket-sale vn-table vn-tr:nth-child(2) > vn-td-editable.ng-isolate-scope.selected vn-textfield input',
totalImport: 'vn-ticket-sale > vn-vertical > vn-card > vn-vertical > vn-horizontal > vn-one > p:nth-child(3) > strong',
selectAllSalesCheckbox: 'vn-ticket-sale vn-thead vn-check',

View File

@ -138,6 +138,7 @@ describe('Client Edit fiscalData path', () => {
it(`should click on the 1st edit icon to confirm EQtax is checked`, async() => {
const result = await nightmare
.waitToClick(selectors.clientAddresses.firstEditAddress)
.waitForSpinnerLoad()
.checkboxState(selectors.clientAddresses.equalizationTaxCheckbox);
expect(result).toBe('checked');
@ -148,6 +149,7 @@ describe('Client Edit fiscalData path', () => {
const result = await nightmare
.waitToClick(selectors.clientAddresses.addressesButton)
.waitToClick(selectors.clientAddresses.secondEditAddress)
.waitForSpinnerLoad()
.checkboxState(selectors.clientAddresses.equalizationTaxCheckbox);
expect(result).toBe('checked');
@ -293,6 +295,7 @@ describe('Client Edit fiscalData path', () => {
it(`should click on the 1st edit icon to access the address details and uncheck EQtax checkbox`, async() => {
const result = await nightmare
.waitToClick(selectors.clientAddresses.firstEditAddress)
.waitForTextInInput(selectors.clientAddresses.cityInput, 'Silla')
.waitToClick(selectors.clientAddresses.equalizationTaxCheckbox)
.waitToClick(selectors.clientAddresses.saveButton)
.waitForLastSnackbar();

View File

@ -28,7 +28,7 @@ describe('Client add address notes path', () => {
.waitToClick(selectors.clientAddresses.saveButton)
.waitForLastSnackbar();
expect(result).toEqual('Observation type cannot be blank');
expect(result).toEqual('Some fields are invalid');
});
it('should not save an observation type without description', async() => {

View File

@ -13,6 +13,7 @@ describe('Item create niche path', () => {
it(`should click create a new niche and delete a former one`, async() => {
const result = await nightmare
.waitForTextInInput(`${selectors.itemNiches.firstWarehouseAutocomplete} input`, 'Warehouse One')
.waitToClick(selectors.itemNiches.addNicheButton)
.waitToClick(selectors.itemNiches.secondNicheRemoveButton)
.autocompleteSearch(selectors.itemNiches.thirdWarehouseAutocomplete, 'Warehouse Two')

View File

@ -27,7 +27,7 @@ describe('Item regularize path', () => {
expect(userLocalWarehouse).toContain('Warehouse Four');
});
it('should search for the item', async() => {
it('should search for an item', async() => {
const resultCount = await nightmare
.clearInput(selectors.itemsIndex.searchItemInput)
.write(selectors.itemsIndex.searchItemInput, 'Ranged weapon pistol 9mm')

View File

@ -42,7 +42,8 @@ describe('Item index path', () => {
.waitToClick(selectors.itemDescriptor.goBackToModuleIndexButton)
.waitToClick(selectors.itemsIndex.searchIcon)
.wait(selectors.itemsIndex.searchResult)
.isVisible(selectors.itemsIndex.firstItemImage);
.waitImgLoad(selectors.itemsIndex.firstItemImage)
.isVisible(selectors.itemsIndex.firstItemImageTd);
expect(imageVisible).toBeTruthy();
});

View File

@ -57,8 +57,8 @@ describe('Ticket List sale path', () => {
expect(result).toEqual('Data saved!');
});
it('should update the description of the new sale', async() => {
// #1865
xit('should update the description of the new sale', async() => {
const result = await nightmare
.focusElement(selectors.ticketSales.secondSaleConceptCell)
.write(selectors.ticketSales.secondSaleConceptInput, 'Aegis of Valor\u000d')

View File

@ -9,7 +9,8 @@ describe('Ticket descriptor path', () => {
.loginAndModule('salesperson', 'ticket');
});
describe('Delete ticket', () => {
// Excluded waiting for #1874
xdescribe('Delete ticket', () => {
it('should search for an specific ticket', async() => {
const result = await nightmare
.write(selectors.ticketsIndex.searchTicketInput, 18)
@ -101,7 +102,10 @@ describe('Ticket descriptor path', () => {
it('should open the add stowaway dialog', async() => {
const isVisible = await nightmare
.waitForSpinnerLoad()
.wait(() => {
let element = document.querySelector('vn-ticket-descriptor');
return element.$ctrl.canShowStowaway === true;
})
.waitToClick(selectors.ticketDescriptor.moreMenu)
.waitToClick(selectors.ticketDescriptor.moreMenuAddStowaway)
.wait(selectors.ticketDescriptor.addStowawayDialogFirstTicket)
@ -127,7 +131,6 @@ describe('Ticket descriptor path', () => {
it(`should navigate back to the added ticket using the descriptors ship button`, async() => {
const url = await nightmare
.waitToClick(selectors.ticketDescriptor.closeStowawayDialog)
.waitToClick(selectors.ticketDescriptor.shipButton)
.waitForURL('#!/ticket/17/summary')
.parsedUrl();

View File

@ -15,6 +15,7 @@ describe('Ticket services path', () => {
it('should find the add descripton button disabled for this user role', async() => {
const result = await nightmare
.waitForClassPresent(selectors.ticketService.firstAddDescriptionButton, 'disabled')
.waitToClick(selectors.ticketService.addServiceButton)
.wait(selectors.ticketService.firstAddDescriptionButton)
.isDisabled(selectors.ticketService.firstAddDescriptionButton);
@ -129,7 +130,7 @@ describe('Ticket services path', () => {
expect(result).toEqual('Data saved!');
});
it(`should confirm the service wasn't sucessfully removed`, async() => {
it(`should confirm the service was removed`, async() => {
const result = await nightmare
.reloadSection('ticket.card.service')
.waitForNumberOfElements(selectors.ticketService.serviceLine, 0)

View File

@ -17,7 +17,7 @@ describe('claim Summary path', () => {
it(`should display details from the claim and it's client on the top of the header`, async() => {
let result = await nightmare
.waitForSpinnerLoad()
.waitForTextInElement(selectors.claimSummary.header, 'Tony Stark')
.waitToGetProperty(selectors.claimSummary.header, 'innerText');
expect(result).toContain('4 -');

View File

@ -140,7 +140,14 @@ describe('InvoiceOut descriptor path', () => {
it(`should check the invoiceOut booked in the summary data`, async() => {
let today = new Date();
let expectedDate = `${today.getDate()}/${(today.getMonth() + 1)}/${today.getFullYear()}`;
let day = today.getDate();
if (day < 10) day = `0${day}`;
let month = (today.getMonth() + 1);
if (month < 10) month = `0${month}`;
let expectedDate = `${day}/${month}/${today.getFullYear()}`;
const result = await nightmare
.waitToGetProperty(selectors.invoiceOutSummary.bookedLabel, 'innerText');

View File

@ -40,6 +40,11 @@ export default class Popup extends Component {
if (this.shown) return;
this._shown = true;
if (this.closeTimeout) {
this.$timeout.cancel(this.closeTimeout);
this.onClose();
}
let linkFn = this.$compile(this.template);
this.$contentScope = this.$.$new();
this.popup = linkFn(this.$contentScope, null,
@ -51,8 +56,7 @@ export default class Popup extends Component {
classList.add(this.displayMode);
classList.add(...this.constructor.$classNames);
if (!this.transitionTimeout)
this.document.body.appendChild(this.popup);
this.document.body.appendChild(this.popup);
this.keyDownHandler = e => this.onkeyDown(e);
this.document.addEventListener('keydown', this.keyDownHandler);
@ -60,9 +64,9 @@ export default class Popup extends Component {
this.deregisterCallback = this.$transitions.onStart({},
() => this.hide());
this.$timeout.cancel(this.transitionTimeout);
this.transitionTimeout = this.$timeout(() => {
this.transitionTimeout = null;
this.$timeout.cancel(this.showTimeout);
this.showTimeout = this.$timeout(() => {
this.showTimeout = null;
classList.add('shown');
}, 10);
@ -74,35 +78,29 @@ export default class Popup extends Component {
*/
hide() {
if (!this.shown) return;
this._shown = false;
this.document.removeEventListener('keydown', this.keyDownHandler);
this.keyDownHandler = null;
if (this.deregisterCallback) {
this.deregisterCallback();
this.deregisterCallback = null;
}
this.deregisterCallback();
this.deregisterCallback = null;
this.popup.classList.remove('shown');
this.$timeout.cancel(this.transitionTimeout);
this.transitionTimeout = this.$timeout(
this.closeTimeout = this.$timeout(
() => this.onClose(), 200);
this.lastEvent = null;
this._shown = false;
this.emit('closeStart');
}
onClose() {
this.transitionTimeout = null;
this.document.body.removeChild(this.popup);
this.$contentScope.$destroy();
this.closeTimeout = null;
this.popup.remove();
this.$contentScope.$destroy();
this.popup = null;
this.windowEl = null;
this.emit('close');
}

View File

@ -103,7 +103,7 @@ vn-table {
text-align: center;
}
&[expand] {
max-width: 10em;
max-width: 25em;
min-width: 0;
}
vn-icon.bright, i.bright {

View File

@ -181,9 +181,9 @@ function e2eOnly() {
})
.on('jasmineDone', function() {
const nightmare = createNightmare();
nightmare.end(() => {});
}));
})
);
}
e2eOnly.description = `Runs the e2e tests only`;

View File

@ -1,7 +1,6 @@
{
"State cannot be blank": "State cannot be blank",
"Cannot be blank": "Cannot be blank",
"Observation type cannot be blank": "Observation type cannot be blank",
"The credit must be an integer greater than or equal to zero": "The credit must be an integer greater than or equal to zero",
"The grade must be an integer greater than or equal to zero": "The grade must be an integer greater than or equal to zero",
"Invalid email": "Invalid email",
@ -56,5 +55,6 @@
"You can't delete a confirmed order": "You can't delete a confirmed order",
"Value has an invalid format": "Value has an invalid format",
"The postcode doesn't exists. Ensure you put the correct format": "The postcode doesn't exists. Ensure you put the correct format",
"Can't create stowaway for this ticket": "Can't create stowaway for this ticket"
"Can't create stowaway for this ticket": "Can't create stowaway for this ticket",
"Has deleted the ticket id": "Has deleted the ticket id [#{{id}}]({{{url}}})"
}

View File

@ -21,7 +21,6 @@
"Worker cannot be blank": "El trabajador no puede estar en blanco",
"Cannot change the payment method if no salesperson": "No se puede cambiar la forma de pago si no hay comercial asignado",
"can't be blank": "El campo no puede estar vacío",
"Observation type cannot be blank": "El tipo de observación no puede estar en blanco",
"Observation type must be unique": "El tipo de observación no puede repetirse",
"The credit must be an integer greater than or equal to zero": "The credit must be an integer greater than or equal to zero",
"The grade must be similar to the last one": "El grade debe ser similar al último",
@ -110,8 +109,11 @@
"The postcode doesn't exists. Ensure you put the correct format": "El código postal no existe. Asegúrate de ponerlo con el formato correcto",
"The department name can't be repeated": "El nombre del departamento no puede repetirse",
"This phone already exists": "Este teléfono ya existe",
"You cannot move a parent to any of its sons": "You cannot move a parent to any of its sons",
"You cannot move a parent to its own sons": "You cannot move a parent to its own sons",
"You cannot move a parent to its own sons": "No puedes mover un elemento padre a uno de sus hijos",
"You can't create a claim for a removed ticket": "No puedes crear una reclamación para un ticket eliminado",
"AMOUNT_NOT_MATCH_GROUPING": "AMOUNT_NOT_MATCH_GROUPING"
"You cannot delete this ticket because is already invoiced, deleted or prepared": "No puedes eliminar este tiquet porque ya está facturado, eliminado o preparado",
"You cannot delete a ticket that part of it is being prepared": "No puedes eliminar un ticket en el que una parte que está siendo preparada",
"You must delete all the buy requests first": "Debes eliminar todas las peticiones de compra primero",
"Has deleted the ticket id": "Ha eliminado el ticket id [#{{id}}]({{{url}}})",
"You cannot remove this ticket because is already invoiced, deleted or prepared": "You cannot remove this ticket because is already invoiced, deleted or prepared"
}

View File

@ -18,7 +18,12 @@ module.exports = Self => {
});
Self.landsThatDay = async filter => {
let query = `CALL vn.zone_getAvailable(?, ?);`;
let query = `
CALL vn.zone_getAgency(?, ?);
SELECT * FROM tmp.zoneGetAgency;
DROP TEMPORARY TABLE tmp.zoneGetAgency;
`;
let result = await Self.rawSql(query, [filter.addressFk, filter.landed]);
return result[1];

View File

@ -56,10 +56,10 @@
"model": "ZoneExclusion",
"foreignKey": "zoneFk"
},
"warehouses": {
"type": "hasMany",
"model": "ZoneWarehouse",
"foreignKey": "zoneFk"
"warehouses": {
"type": "hasMany",
"model": "ZoneWarehouse",
"foreignKey": "zoneFk"
}
}
}

View File

@ -17,7 +17,7 @@ describe('Client activeWorkersWithRole', () => {
let isBuyer = await app.models.Account.hasRole(result[0].id, 'buyer');
expect(result.length).toEqual(11);
expect(result.length).toEqual(12);
expect(isBuyer).toBeTruthy();
});
});

View File

@ -1,8 +1,4 @@
module.exports = function(Self) {
Self.validatesPresenceOf('observationTypeFk', {
message: 'Observation type cannot be blank'
});
Self.validateAsync('typeUnique', typeIsUnique, {
message: 'Observation type must be unique'
});

View File

@ -15,6 +15,9 @@
"description": {
"type": "string",
"required": true
},
"observationTypeFk": {
"required": true
}
},
"relations": {

View File

@ -43,6 +43,11 @@
"model": "Client",
"foreignKey": "clientFk"
},
"ticket": {
"type": "belongsTo",
"model": "Ticket",
"foreignKey": "ticketFk"
},
"greugeType": {
"type": "belongsTo",
"model": "GreugeType",

View File

@ -140,7 +140,8 @@
data="types"
ng-model="observation.observationTypeFk"
show-field="description"
label="Observation type">
label="Observation type"
rule="AddressObservation">
</vn-autocomplete>
<vn-textfield
vn-two

View File

@ -29,7 +29,6 @@ export default class Controller {
this.$.watcher.realSubmit()
.then(() => this.$.model.save(true))
.then(() => {
this.$.watcher.setPristine();
this.$.watcher.notifySaved();
this.card.reload();
this.goToIndex();

View File

@ -49,10 +49,7 @@ export default class Controller {
returnDialogEt(response) {
if (response === 'accept') {
this.$http.patch(`Clients/${this.client.id}/addressesPropagateRe`, {isEqualizated: this.client.isEqualizated}).then(
res => {
if (res.data)
this.vnApp.showMessage(this.translate.instant('Equivalent tax spreaded'));
}
() => this.vnApp.showMessage(this.translate.instant('Equivalent tax spreaded'))
);
}
}

View File

@ -44,6 +44,9 @@
"ItemTypeTag": {
"dataSource": "vn"
},
"ItemShelvingSale": {
"dataSource": "vn"
},
"Origin": {
"dataSource": "vn"
},

View File

@ -0,0 +1,34 @@
{
"name": "ItemShelvingSale",
"base": "VnModel",
"options": {
"mysql": {
"table": "itemShelvingSale"
}
},
"properties": {
"id": {
"type": "Number",
"id": true,
"description": "Identifier"
},
"quantity": {
"type": "Number"
},
"created": {
"type": "Date"
}
},
"relations": {
"sale": {
"type": "belongsTo",
"model": "Sale",
"foreignKey": "saleFk"
},
"user": {
"type": "belongsTo",
"model": "Account",
"foreignKey": "userFk"
}
}
}

View File

@ -23,7 +23,7 @@
<vn-thead>
<vn-tr>
<vn-th expand>Date</vn-th>
<vn-th number order="DESC">Ticket/Entry</vn-th>
<vn-th number order="DESC">Id</vn-th>
<vn-th>State</vn-th>
<vn-th>Reference</vn-th>
<vn-th>Client</vn-th>

View File

@ -37,8 +37,8 @@ module.exports = Self => {
switch (param) {
case 'search':
return {or: [
{ticketFk: value},
{clientFk: value}
{'t.id': value},
{'c.id': value}
]};
}
});

View File

@ -1,7 +1,7 @@
const UserError = require('vn-loopback/util/user-error');
module.exports = Self => {
Self.remoteMethod('setDeleted', {
Self.remoteMethodCtx('setDeleted', {
description: 'Sets true the isDeleted value of a ticket',
accessType: 'WRITE',
accepts: [{
@ -21,16 +21,82 @@ module.exports = Self => {
}
});
Self.setDeleted = async id => {
try {
let claimOfATicket = await Self.app.models.Claim.findOne({where: {ticketFk: id}});
if (claimOfATicket)
throw new UserError('You must delete the claim id %d first', 'DELETE_CLAIM_FIRST', claimOfATicket.id);
Self.setDeleted = async(ctx, id) => {
const models = Self.app.models;
const isEditable = await Self.isEditable(ctx, id);
const $t = ctx.req.__; // $translate
let currentTicket = await Self.app.models.Ticket.findById(id);
return await currentTicket.updateAttributes({isDeleted: true});
} catch (e) {
throw e;
if (!isEditable)
throw new UserError('You cannot delete this ticket because is already invoiced, deleted or prepared');
// Check if has sales with shelving
const sales = await models.Sale.find({
include: {relation: 'itemShelving'},
where: {ticketFk: id}
});
const hasItemShelvingSales = sales.some(sale => {
return sale.itemShelving();
});
if (hasItemShelvingSales)
throw new UserError(`You cannot delete a ticket that part of it is being prepared`);
// Check for existing claim
const claimOfATicket = await models.Claim.findOne({where: {ticketFk: id}});
if (claimOfATicket)
throw new UserError('You must delete the claim id %d first', 'DELETE_CLAIM_FIRST', claimOfATicket.id);
// Check for existing purchase requests
const hasPurchaseRequests = await models.TicketRequest.count({
ticketFk: id,
isOk: true
});
if (hasPurchaseRequests)
throw new UserError('You must delete all the buy requests first');
// Remove ticket greuges
const ticketGreuges = await models.Greuge.find({where: {ticketFk: id}});
const ownGreuges = ticketGreuges.every(greuge => {
return greuge.ticketFk = id;
});
if (ownGreuges) {
for (const greuge of ticketGreuges) {
const instance = await models.Greuge.findById(greuge.id);
await instance.destroy();
}
}
const ticket = await models.Ticket.findById(id, {
include: {
relation: 'client',
scope: {
fields: ['id', 'salesPersonFk'],
include: {
relation: 'salesPerson',
scope: {
fields: ['id', 'userFk'],
include: {
relation: 'user'
}
}
}
}
}
});
// Send notification to salesPerson
const salesPerson = ticket.client().salesPerson();
if (salesPerson) {
const salesPersonUser = salesPerson.user().name;
const origin = ctx.req.headers.origin;
const message = $t(`Has deleted the ticket id`, {
id: id,
url: `${origin}/#!/ticket/${id}/summary`
});
await models.Chat.sendMessage(ctx, `@${salesPersonUser}`, message);
}
return ticket.updateAttribute('isDeleted', true);
};
};

View File

@ -1,13 +1,25 @@
const app = require('vn-loopback/server/server');
describe('ticket deleted()', () => {
// Excluded waiting for #1874
xdescribe('ticket deleted()', () => {
let ticket;
let ctx;
beforeAll(async done => {
let originalTicket = await app.models.Ticket.findOne({where: {id: 16}});
originalTicket.id = null;
ticket = await app.models.Ticket.create(originalTicket);
ctx = {
req: {
accessToken: {userId: 106},
headers: {
origin: 'http://localhost:5000'
},
__: () => {}
}
};
done();
});
@ -22,7 +34,7 @@ describe('ticket deleted()', () => {
});
it('should set a ticket to deleted', async() => {
await app.models.Ticket.setDeleted(ticket.id);
await app.models.Ticket.setDeleted(ctx, ticket.id);
let deletedTicket = await app.models.Ticket.findOne({where: {id: ticket.id}, fields: ['isDeleted']});
@ -34,7 +46,7 @@ describe('ticket deleted()', () => {
let error;
try {
await app.models.Ticket.setDeleted(ticketId);
await app.models.Ticket.setDeleted(ctx, ticketId);
} catch (e) {
error = e;
}

View File

@ -72,6 +72,11 @@
"type": "hasOne",
"model": "SaleTracking",
"foreignKey": "saleFk"
},
"itemShelving": {
"type": "hasOne",
"model": "ItemShelvingSale",
"foreignKey": "saleFk"
}
}
}

View File

@ -46,8 +46,7 @@ class Controller {
this.getShipped({
landed: this.ticket.landed,
addressFk: value,
agencyModeFk: this.ticket.agencyModeFk,
warehouseFk: this.ticket.warehouseFk
agencyModeFk: this.ticket.agencyModeFk
});
}
}
@ -78,8 +77,7 @@ class Controller {
this.getLanded({
shipped: value,
addressFk: this.ticket.addressFk,
agencyModeFk: this.ticket.agencyModeFk,
warehouseFk: this.ticket.warehouseFk
agencyModeFk: this.ticket.agencyModeFk
});
}
@ -92,8 +90,7 @@ class Controller {
this.getShipped({
landed: value,
addressFk: this.ticket.addressFk,
agencyModeFk: this.ticket.agencyModeFk,
warehouseFk: this.ticket.warehouseFk
agencyModeFk: this.ticket.agencyModeFk
});
}
@ -107,8 +104,7 @@ class Controller {
this.getLanded({
shipped: this.ticket.shipped,
addressFk: this.ticket.addressFk,
agencyModeFk: value,
warehouseFk: this.ticket.warehouseFk
agencyModeFk: value
});
}
}
@ -160,10 +156,7 @@ class Controller {
this.ticket.agencyModeFk = null;
const query = `Zones/${zoneId}`;
this.$http.get(query).then(res => {
if (res.data) {
this.ticket.agencyModeFk = res.data.agencyModeFk;
this.ticket.warehouseFk = res.data.warehouseFk;
}
this.ticket.agencyModeFk = res.data.agencyModeFk;
});
}
@ -205,7 +198,6 @@ class Controller {
if (res.data) {
this.ticket.zoneFk = res.data.zoneFk;
this.ticket.agencyModeFk = res.data.agencyModeFk;
this.ticket.warehouseFk = res.data.warehouseFk;
this.ticket.landed = res.data.landed;
this.ticket.shipped = params.shipped;
} else {
@ -226,7 +218,6 @@ class Controller {
if (res.data) {
this.ticket.zoneFk = res.data.zoneFk;
this.ticket.agencyModeFk = res.data.agencyModeFk;
this.ticket.warehouseFk = res.data.warehouseFk;
this.ticket.landed = params.landed;
this.ticket.shipped = res.data.shipped;
} else {

View File

@ -72,8 +72,7 @@ describe('Ticket', () => {
const spectedResult = {
landed: landed,
addressFk: 100,
agencyModeFk: 7,
warehouseFk: 1
agencyModeFk: 7
};
controller.landed = landed;
@ -99,8 +98,7 @@ describe('Ticket', () => {
const spectedResult = {
landed: landed,
addressFk: 121,
agencyModeFk: 7,
warehouseFk: 2
agencyModeFk: 7
};
controller.landed = landed;
@ -125,8 +123,7 @@ describe('Ticket', () => {
const spectedResult = {
shipped: shipped,
addressFk: 121,
agencyModeFk: 7,
warehouseFk: 1
agencyModeFk: 7
};
controller.shipped = shipped;
@ -150,8 +147,7 @@ describe('Ticket', () => {
const spectedResult = {
landed: landed,
addressFk: 121,
agencyModeFk: 7,
warehouseFk: 1
agencyModeFk: 7
};
controller.landed = landed;
@ -176,8 +172,7 @@ describe('Ticket', () => {
const spectedResult = {
shipped: shipped,
addressFk: 121,
agencyModeFk: agencyModeId,
warehouseFk: 1
agencyModeFk: agencyModeId
};
controller.ticket.shipped = shipped;
controller.agencyModeId = 8;
@ -192,8 +187,7 @@ describe('Ticket', () => {
const spectedResult = {
landed: landed,
addressFk: 121,
agencyModeFk: agencyModeId,
warehouseFk: 1
agencyModeFk: agencyModeId
};
controller.ticket.landed = landed;
controller.agencyModeId = 7;
@ -261,18 +255,13 @@ describe('Ticket', () => {
describe('onChangeZone()', () => {
it('should return an available zone', async() => {
const zoneId = 5;
const landed = new Date();
controller._ticket = {
id: 1,
landed: landed,
addressFk: 121,
warehouseFk: 1
};
$httpBackend.when('GET', `Zones/${zoneId}`).respond(200);
const agencyModeFk = 8;
$httpBackend.when('GET', `Zones/${zoneId}`).respond(200, {agencyModeFk});
$httpBackend.expect('GET', `Zones/${zoneId}`);
controller.onChangeZone(zoneId);
$httpBackend.flush();
expect(controller.ticket.agencyModeFk).toEqual(agencyModeFk);
});
});

View File

@ -1,14 +1,11 @@
import ngModule from '../module';
import Component from 'core/lib/component';
class Controller {
constructor($state, $scope, $http, vnApp, $translate, aclService, $httpParamSerializer) {
this.$scope = $scope;
this.$state = $state;
this.$http = $http;
this.vnApp = vnApp;
this.$translate = $translate;
this.$httpParamSerializer = $httpParamSerializer;
class Controller extends Component {
constructor($element, $, aclService, $httpParamSerializer) {
super($element, $);
this.aclService = aclService;
this.$httpParamSerializer = $httpParamSerializer;
this.moreOptions = [
{name: 'Add turn', callback: this.showAddTurnDialog},
{name: 'Show Delivery Note', callback: this.showDeliveryNote},
@ -47,7 +44,7 @@ class Controller {
return;
}
this.newShipped = this.ticket.shipped;
this.$scope.changeShippedDialog.show();
this.$.changeShippedDialog.show();
}
changeShipped(response) {
@ -105,7 +102,7 @@ class Controller {
return (!hasShowProperty || option.show === true ||
typeof option.show === 'function' && option.show()) && hasAcl;
});
this.$scope.moreButton.data = options;
this.$.moreButton.data = options;
}
get isEditable() {
@ -117,13 +114,13 @@ class Controller {
}
showAddTurnDialog() {
this.$scope.addTurn.show();
this.$.addTurn.show();
}
addTurn(day) {
let params = {ticketFk: this.ticket.id, weekDay: day};
this.$http.patch(`TicketWeeklies`, params).then(() => {
this.$scope.addTurn.hide();
this.$.addTurn.hide();
this.vnApp.showSuccess(this.$translate.instant('Data saved!'));
});
}
@ -134,7 +131,7 @@ class Controller {
return;
}
this.$scope.deleteConfirmation.show();
this.$.deleteConfirmation.show();
}
deleteTicket(response) {
@ -148,11 +145,11 @@ class Controller {
}
showAddStowaway() {
this.$scope.addStowaway.show();
this.$.addStowaway.show();
}
showRemoveStowaway() {
this.$scope.removeStowaway.show();
this.$.removeStowaway.show();
}
get ticket() {
@ -161,11 +158,11 @@ class Controller {
set ticket(value) {
this._ticket = value;
if (value)
this.canStowaway();
if (!value) return;
this.canStowaway();
let links = {
btnOne: {
icon: 'person',
@ -230,14 +227,14 @@ class Controller {
destination: address.mobile || null,
message: this.$translate.instant('SMSPayment')
};
this.$scope.sms.open();
this.$.sms.open();
}
/**
* Shows an invoice confirmation
*/
showMakeInvoiceDialog() {
this.$scope.makeInvoiceConfirmation.show();
this.$.makeInvoiceConfirmation.show();
}
/**
@ -260,7 +257,7 @@ class Controller {
* Shows an invoice confirmation
*/
showRegenerateInvoiceDialog() {
this.$scope.regenerateInvoiceConfirmation.show();
this.$.regenerateInvoiceConfirmation.show();
}
/**
@ -291,11 +288,11 @@ class Controller {
}
confirmDeliveryNote() {
this.$scope.confirmDeliveryNote.show();
this.$.confirmDeliveryNote.show();
}
}
Controller.$inject = ['$state', '$scope', '$http', 'vnApp', '$translate', 'aclService', '$httpParamSerializer'];
Controller.$inject = ['$element', '$scope', 'aclService', '$httpParamSerializer'];
ngModule.component('vnTicketDescriptor', {
template: require('./index.html'),

View File

@ -8,7 +8,8 @@ describe('Ticket Component vnTicketDescriptor', () => {
beforeEach(ngModule('ticket'));
beforeEach(angular.mock.inject(($componentController, _$state_, _$httpBackend_, _$httpParamSerializer_) => {
beforeEach(angular.mock.inject(($componentController, _$httpBackend_, $rootScope, $compile, _$state_, _$httpParamSerializer_) => {
let $element = $compile(`<vn-autocomplete></vn-autocomplete>`)($rootScope);
$state = _$state_;
$state.getCurrentPath = () => {
return [
@ -18,7 +19,7 @@ describe('Ticket Component vnTicketDescriptor', () => {
};
$httpBackend = _$httpBackend_;
$httpParamSerializer = _$httpParamSerializer_;
controller = $componentController('vnTicketDescriptor', {$state});
controller = $componentController('vnTicketDescriptor', {$element});
controller._ticket = {id: 2, invoiceOut: {id: 1}, client: {id: 101, email: 'client@email'}};
controller.cardReload = ()=> {
return true;
@ -26,25 +27,25 @@ describe('Ticket Component vnTicketDescriptor', () => {
}));
describe('showAddTurnDialog()', () => {
it('should call contrtoller.$scope.addTurn.show()', () => {
controller.$scope.addTurn = {show: () => {}};
spyOn(controller.$scope.addTurn, 'show');
it('should call controller.$.addTurn.show()', () => {
controller.$.addTurn = {show: () => {}};
spyOn(controller.$.addTurn, 'show');
controller.showAddTurnDialog();
expect(controller.$scope.addTurn.show).toHaveBeenCalledWith();
expect(controller.$.addTurn.show).toHaveBeenCalledWith();
});
});
describe('addTurn()', () => {
it('should make a query and call $.addTurn.hide() and vnApp.showSuccess()', () => {
controller.$scope.addTurn = {hide: () => {}};
spyOn(controller.$scope.addTurn, 'hide');
controller.$.addTurn = {hide: () => {}};
spyOn(controller.$.addTurn, 'hide');
$httpBackend.expectPATCH(`TicketWeeklies`).respond();
controller.addTurn(1);
$httpBackend.flush();
expect(controller.$scope.addTurn.hide).toHaveBeenCalledWith();
expect(controller.$.addTurn.hide).toHaveBeenCalledWith();
});
});
@ -59,11 +60,11 @@ describe('Ticket Component vnTicketDescriptor', () => {
it('should call deleteConfirmation.show() if the ticket is editable', () => {
controller.ticket.tracking = {state: {alertLevel: 0}};
controller.$scope.deleteConfirmation = {show: () => {}};
spyOn(controller.$scope.deleteConfirmation, 'show');
controller.$.deleteConfirmation = {show: () => {}};
spyOn(controller.$.deleteConfirmation, 'show');
controller.showDeleteTicketDialog();
expect(controller.$scope.deleteConfirmation.show).toHaveBeenCalledWith();
expect(controller.$.deleteConfirmation.show).toHaveBeenCalledWith();
});
});
@ -163,21 +164,21 @@ describe('Ticket Component vnTicketDescriptor', () => {
describe('showAddStowaway()', () => {
it('should show a dialog with a list of tickets available for an stowaway', () => {
controller.$scope.addStowaway = {};
controller.$scope.addStowaway.show = jasmine.createSpy('show');
controller.$.addStowaway = {};
controller.$.addStowaway.show = jasmine.createSpy('show');
controller.showAddStowaway();
expect(controller.$scope.addStowaway.show).toHaveBeenCalledWith();
expect(controller.$.addStowaway.show).toHaveBeenCalledWith();
});
});
describe('showRemoveStowaway()', () => {
it('should show a dialog for an stowaway removal', () => {
controller.$scope.removeStowaway = {};
controller.$scope.removeStowaway.show = jasmine.createSpy('show');
controller.$.removeStowaway = {};
controller.$.removeStowaway.show = jasmine.createSpy('show');
controller.showRemoveStowaway();
expect(controller.$scope.removeStowaway.show).toHaveBeenCalledWith();
expect(controller.$.removeStowaway.show).toHaveBeenCalledWith();
});
});

View File

@ -30,8 +30,7 @@ import './picture';
import './request/index';
import './request/create';
import './log';
import './weekly/index';
import './weekly/create';
import './weekly';
import './dms/index';
import './dms/create';
import './dms/edit';

View File

@ -191,11 +191,6 @@
"state": "ticket.weekly.index",
"component": "vn-ticket-weekly-index",
"description": "Weekly tickets"
}, {
"url": "/create",
"state": "ticket.weekly.create",
"component": "vn-ticket-weekly-create",
"description": "Add weekly ticket"
}, {
"url": "/request",
"state": "ticket.card.request",

View File

@ -14,11 +14,11 @@
<vn-tr>
<vn-th shrink></vn-th>
<vn-th field="itemFk" number>Item</vn-th>
<vn-th>Description</vn-th>
<vn-th expand>Description</vn-th>
<vn-th field="quantity" number>Quantity</vn-th>
<vn-th field="originalQuantity" number>Original</vn-th>
<vn-th field="workerFk">Worker</vn-th>
<vn-th field="state">State</vn-th>
<vn-th field="state" shrink>State</vn-th>
<vn-th field="created">Created</vn-th>
</vn-tr>
</vn-thead>
@ -56,7 +56,7 @@
{{::sale.userNickname | dashIfEmpty}}
</span>
</vn-td>
<vn-td>{{::sale.state}}</vn-td>
<vn-td shrink>{{::sale.state}}</vn-td>
<vn-td>{{::sale.created | date: 'dd/MM/yyyy HH:mm'}}</vn-td>
</vn-tr>
</vn-tbody>

View File

@ -152,7 +152,6 @@
<field>
<vn-textfield
vn-id="concept"
vn-focus
ng-model="sale.concept"
on-change="$ctrl.updateConcept(sale)">
</vn-textfield>

View File

@ -60,6 +60,7 @@
</vn-auto>
</vn-horizontal>
<vn-icon-button
ng-if=$ctrl.defaultTaxClass
vn-tooltip="Add service"
vn-bind="+"
icon="add_circle"

View File

@ -33,11 +33,13 @@ class Controller {
}
add() {
this.$scope.model.insert({
taxClassFk: this.defaultTaxClass.id,
quantity: 1,
ticketFk: this.$stateParams.id
});
if (this.defaultTaxClass) {
this.$scope.model.insert({
taxClassFk: this.defaultTaxClass.id,
quantity: 1,
ticketFk: this.$stateParams.id
});
}
}
onNewServiceTypeOpen() {

View File

@ -1,71 +0,0 @@
<mg-ajax path="ticketWeeklies" options="vnPost"></mg-ajax>
<vn-watcher
vn-id="watcher"
data="$ctrl.ticketWeekly"
form="form"
save="post">
</vn-watcher>
<div class="content-block">
<form name="form" vn-http-submit="$ctrl.onSubmit()" compact>
<vn-card class="vn-pa-lg">
<vn-horizontal>
<vn-autocomplete vn-one vn-id="ticket"
url="tickets"
ng-model="$ctrl.ticketWeekly.ticketFk"
fields="['id', 'nickname', 'clientFk', 'warehouseFk']"
search-function="{nickname: $search}"
show-field="id"
value-field="id"
label="Ticket"
on-change="$ctrl.onChangeTicket(ticket.selection)">
<tpl-item>#{{id}} - {{nickname}}</tpl-item>
</vn-autocomplete>
<vn-autocomplete vn-one label="Weekday"
ng-model="$ctrl.ticketWeekly.weekDay"
data="$ctrl.weekdays"
show-field="name"
value-field="id"
translate-fields="['name']"
order="id">
</vn-autocomplete>
</vn-horizontal>
<vn-horizontal>
<vn-autocomplete vn-id="client" vn-one disabled="true"
url="clients"
fields="['id', 'name', 'salesPersonFk']"
ng-model="$ctrl.ticketWeekly.clientFk"
show-field="name"
value-field="id"
label="Client"
selection="$ctrl.clientSelection">
</vn-autocomplete>
<vn-autocomplete vn-one disabled="true"
ng-model="$ctrl.ticketWeekly.warehouseFk"
url="warehouses"
show-field="name"
value-field="id"
label="Warehouse">
</vn-autocomplete>
<vn-autocomplete vn-one disabled="true"
ng-model="$ctrl.ticketWeekly.salesPersonFk"
url="clients/activeWorkersWithRole"
search-function="{firstName: $search}"
show-field="firstName"
value-field="id"
where="{role: 'employee'}"
label="Salesperson">
<tpl-item>{{firstName}} {{lastName}}</tpl-item>
</vn-autocomplete>
</vn-horizontal>
</vn-card>
<vn-button-bar>
<vn-submit label="Create"></vn-submit>
<vn-button ui-sref="ticket.weekly.index" label="Cancel"></vn-button>
</vn-button-bar>
</form>
<!-- New postcode dialog -->
<vn-client-postcode vn-id="postcode"
on-response="$ctrl.onResponse($response)">
</vn-client-postcode>
</div>

View File

@ -1,49 +0,0 @@
import ngModule from '../../module';
export default class Controller {
constructor($scope, $state, $http, $translate, vnApp) {
this.$ = $scope;
this.$state = $state;
this.$http = $http;
this.$translate = $translate;
this.vnApp = vnApp;
this.ticketWeekly = {};
this.weekdays = [
{id: 0, name: 'Monday'},
{id: 1, name: 'Tuesday'},
{id: 2, name: 'Wednesday'},
{id: 3, name: 'Thursday'},
{id: 4, name: 'Friday'},
{id: 5, name: 'Saturday'},
{id: 6, name: 'Sunday'}
];
}
onChangeTicket(ticket) {
this.ticketWeekly.clientFk = ticket.clientFk;
this.ticketWeekly.warehouseFk = ticket.warehouseFk;
}
get clientSelection() {
return this._clientSelection;
}
set clientSelection(value) {
this._clientSelection = value;
if (value)
this.ticketWeekly.salesPersonFk = value.salesPersonFk;
}
onSubmit() {
return this.$.watcher.submit().then(
json => this.$state.go('ticket.weekly.index')
);
}
}
Controller.$inject = ['$scope', '$state', '$http', '$translate', 'vnApp'];
ngModule.component('vnTicketWeeklyCreate', {
template: require('./index.html'),
controller: Controller
});

View File

@ -1,58 +0,0 @@
import './index';
describe('Ticket', () => {
describe('Component vnTicketWeeklyCreate', () => {
let $componentController;
let $scope;
let $state;
let controller;
beforeEach(ngModule('ticket'));
beforeEach(angular.mock.inject((_$componentController_, $rootScope, _$state_) => {
$componentController = _$componentController_;
$scope = $rootScope.$new();
$state = _$state_;
$scope.watcher = {
submit: () => {
return {
then: callback => {
callback({data: {id: '1234'}});
}
};
}
};
controller = $componentController('vnTicketWeeklyCreate', {$scope, $state});
}));
describe('onChangeTicket() setter', () => {
it(`should define clientFk and warehouseFk properties on ticketWeekly object`, () => {
controller.onChangeTicket({clientFk: 101, warehouseFk: 1});
expect(controller.ticketWeekly.clientFk).toEqual(101);
expect(controller.ticketWeekly.warehouseFk).toEqual(1);
});
});
describe('clientSelection() setter', () => {
it(`should define salesPersonFk property on ticketWeekly object`, () => {
controller.clientSelection = {clientFk: 101, salesPersonFk: 106};
expect(controller.ticketWeekly.salesPersonFk).toEqual(106);
});
});
describe('onSubmit()', () => {
it(`should call submit() on the watcher then expect a callback`, () => {
spyOn(controller.$state, 'go');
controller.ticketWeekly = {
ticketFk: 11,
weekDay: 0
};
controller.onSubmit();
expect(controller.$state.go).toHaveBeenCalledWith('ticket.weekly.index');
});
});
});
});

View File

@ -1,2 +0,0 @@
Weekday: Día de la semana
Add weekly ticket: Añadir ticket programado

View File

@ -96,10 +96,4 @@
on-response="$ctrl.returnDialog($response)"
question="This ticket will be removed from weekly tickets! Continue anyway?"
message="You are going to delete this weekly ticket">
</vn-confirm>
<a ui-sref="ticket.weekly.create"
vn-tooltip="Add weekly ticket"
vn-bind="+"
fixed-bottom-right>
<vn-float-button icon="person_add"></vn-float-button>
</a>
</vn-confirm>

View File

@ -1,4 +1,4 @@
import ngModule from '../../module';
import ngModule from '../module';
export default class Controller {
constructor($scope, vnApp, $translate, $http) {