Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 4859-export_db
gitea/salix/pipeline/head This commit is unstable
Details
gitea/salix/pipeline/head This commit is unstable
Details
This commit is contained in:
commit
995fb6a5c3
|
@ -0,0 +1,49 @@
|
||||||
|
INSERT INTO `salix`.`ACL` (model, property, accessType, permission, principalType, principalId)
|
||||||
|
VALUES
|
||||||
|
('ClientConsumptionQueue', '*', 'WRITE', 'ALLOW', 'ROLE', 'employee'),
|
||||||
|
('Ticket', 'deliveryNotePdf', 'READ', 'ALLOW', 'ROLE', 'employee'),
|
||||||
|
('Ticket', 'deliveryNoteEmail', 'WRITE', 'ALLOW', 'ROLE', 'employee'),
|
||||||
|
('Ticket', 'deliveryNoteCsvPdf', 'READ', 'ALLOW', 'ROLE', 'employee'),
|
||||||
|
('Ticket', 'deliveryNoteCsvEmail', 'WRITE', 'ALLOW', 'ROLE', 'employee'),
|
||||||
|
('Client', 'campaignMetricsPdf', 'READ', 'ALLOW', 'ROLE', 'employee'),
|
||||||
|
('Client', 'campaignMetricsEmail', 'WRITE', 'ALLOW', 'ROLE', 'employee'),
|
||||||
|
('Client', 'clientWelcomeHtml', 'READ', 'ALLOW', 'ROLE', 'employee'),
|
||||||
|
('Client', 'clientWelcomeEmail', 'WRITE', 'ALLOW', 'ROLE', 'employee'),
|
||||||
|
('Client', 'creditRequestPdf', 'READ', 'ALLOW', 'ROLE', 'employee'),
|
||||||
|
('Client', 'creditRequestHtml', 'READ', 'ALLOW', 'ROLE', 'employee'),
|
||||||
|
('Client', 'creditRequestEmail', 'WRITE', 'ALLOW', 'ROLE', 'employee'),
|
||||||
|
('Client', 'printerSetupHtml', 'READ', 'ALLOW', 'ROLE', 'employee'),
|
||||||
|
('Client', 'printerSetupEmail', 'WRITE', 'ALLOW', 'ROLE', 'employee'),
|
||||||
|
('Client', 'sepaCoreEmail', 'WRITE', 'ALLOW', 'ROLE', 'employee'),
|
||||||
|
('Client', 'letterDebtorPdf', 'READ', 'ALLOW', 'ROLE', 'employee'),
|
||||||
|
('Client', 'letterDebtorStHtml', 'READ', 'ALLOW', 'ROLE', 'employee'),
|
||||||
|
('Client', 'letterDebtorStEmail', 'WRITE', 'ALLOW', 'ROLE', 'employee'),
|
||||||
|
('Client', 'letterDebtorNdHtml', 'READ', 'ALLOW', 'ROLE', 'employee'),
|
||||||
|
('Client', 'letterDebtorNdEmail', 'WRITE', 'ALLOW', 'ROLE', 'employee'),
|
||||||
|
('Client', 'clientDebtStatementPdf', 'READ', 'ALLOW', 'ROLE', 'employee'),
|
||||||
|
('Client', 'clientDebtStatementHtml', 'READ', 'ALLOW', 'ROLE', 'employee'),
|
||||||
|
('Client', 'clientDebtStatementEmail', 'WRITE', 'ALLOW', 'ROLE', 'employee'),
|
||||||
|
('Client', 'incotermsAuthorizationPdf', 'READ', 'ALLOW', 'ROLE', 'employee'),
|
||||||
|
('Client', 'incotermsAuthorizationHtml', 'READ', 'ALLOW', 'ROLE', 'employee'),
|
||||||
|
('Client', 'incotermsAuthorizationEmail', 'WRITE', 'ALLOW', 'ROLE', 'employee'),
|
||||||
|
('Client', 'consumptionSendQueued', 'WRITE', 'ALLOW', 'ROLE', 'system'),
|
||||||
|
('InvoiceOut', 'invoiceEmail', 'WRITE', 'ALLOW', 'ROLE', 'employee'),
|
||||||
|
('InvoiceOut', 'exportationPdf', 'READ', 'ALLOW', 'ROLE', 'employee'),
|
||||||
|
('InvoiceOut', 'sendQueued', 'WRITE', 'ALLOW', 'ROLE', 'system'),
|
||||||
|
('Ticket', 'invoiceCsvPdf', 'READ', 'ALLOW', 'ROLE', 'employee'),
|
||||||
|
('Ticket', 'invoiceCsvEmail', 'WRITE', 'ALLOW', 'ROLE', 'employee'),
|
||||||
|
('Supplier', 'campaignMetricsPdf', 'READ', 'ALLOW', 'ROLE', 'employee'),
|
||||||
|
('Supplier', 'campaignMetricsEmail', 'WRITE', 'ALLOW', 'ROLE', 'employee'),
|
||||||
|
('Travel', 'extraCommunityPdf', 'READ', 'ALLOW', 'ROLE', 'employee'),
|
||||||
|
('Travel', 'extraCommunityEmail', 'WRITE', 'ALLOW', 'ROLE', 'employee'),
|
||||||
|
('Entry', 'entryOrderPdf', 'READ', 'ALLOW', 'ROLE', 'employee'),
|
||||||
|
('OsTicket', 'osTicketReportEmail', 'WRITE', 'ALLOW', 'ROLE', 'system'),
|
||||||
|
('Item', 'buyerWasteEmail', 'WRITE', 'ALLOW', 'ROLE', 'system'),
|
||||||
|
('Claim', 'claimPickupPdf', 'READ', 'ALLOW', 'ROLE', 'employee'),
|
||||||
|
('Claim', 'claimPickupEmail', 'WRITE', 'ALLOW', 'ROLE', 'claimManager'),
|
||||||
|
('Item', 'labelPdf', 'READ', 'ALLOW', 'ROLE', 'employee');
|
||||||
|
|
||||||
|
INSERT INTO `salix`.`ACL` (model,property,accessType,permission,principalType,principalId)
|
||||||
|
VALUES ('Sector','*','READ','ALLOW','ROLE','employee');
|
||||||
|
INSERT INTO `salix`.`ACL` (model,property,accessType,permission,principalType,principalId)
|
||||||
|
VALUES ('Sector','*','WRITE','ALLOW','ROLE','employee');
|
|
@ -0,0 +1,3 @@
|
||||||
|
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`)
|
||||||
|
VALUES
|
||||||
|
('Receipt', 'receiptPdf', '*', 'ALLOW', 'ROLE', 'salesAssistant');
|
|
@ -0,0 +1,9 @@
|
||||||
|
create table `vn`.`clientConsumptionQueue`
|
||||||
|
(
|
||||||
|
id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
params json not null,
|
||||||
|
queued datetime default current_timestamp() not null,
|
||||||
|
printed datetime null,
|
||||||
|
status varchar(50) default '' null
|
||||||
|
)
|
||||||
|
comment 'Queue for client consumption PDF mailing';
|
|
@ -0,0 +1 @@
|
||||||
|
rename table `vn`.`invoiceOut_queue` to `vn`.`invoiceOutQueue`;
|
|
@ -0,0 +1,5 @@
|
||||||
|
ALTER TABLE `vn`.`itemConfig`
|
||||||
|
ADD id int null PRIMARY KEY first;
|
||||||
|
|
||||||
|
ALTER TABLE `vn`.`itemConfig`
|
||||||
|
ADD wasteRecipients VARCHAR(50) NOT NULL comment 'Weekly waste report schedule recipients';
|
|
@ -0,0 +1,10 @@
|
||||||
|
create table `salix`.`printConfig`
|
||||||
|
(
|
||||||
|
id int auto_increment,
|
||||||
|
itRecipient varchar(50) null comment 'IT recipients for report mailing',
|
||||||
|
incidencesEmail varchar(50) null comment 'CAU destinatary email',
|
||||||
|
constraint printConfig_pk
|
||||||
|
primary key (id)
|
||||||
|
)
|
||||||
|
comment 'Print service config';
|
||||||
|
|
|
@ -0,0 +1,100 @@
|
||||||
|
DROP TRIGGER IF EXISTS vn.sale_afterUpdate;
|
||||||
|
USE vn;
|
||||||
|
|
||||||
|
DELIMITER $$
|
||||||
|
$$
|
||||||
|
CREATE DEFINER=`root`@`localhost` TRIGGER `vn`.`sale_afterUpdate`
|
||||||
|
AFTER UPDATE ON `sale`
|
||||||
|
FOR EACH ROW
|
||||||
|
BEGIN
|
||||||
|
DECLARE vIsToSendMail BOOL;
|
||||||
|
DECLARE vPickedLines INT;
|
||||||
|
DECLARE vCollectionFk INT;
|
||||||
|
DECLARE vUserRole VARCHAR(255);
|
||||||
|
|
||||||
|
IF !(NEW.id <=> OLD.id)
|
||||||
|
OR !(NEW.ticketFk <=> OLD.ticketFk)
|
||||||
|
OR !(NEW.itemFk <=> OLD.itemFk)
|
||||||
|
OR !(NEW.quantity <=> OLD.quantity)
|
||||||
|
OR !(NEW.created <=> OLD.created)
|
||||||
|
OR !(NEW.isPicked <=> OLD.isPicked) THEN
|
||||||
|
CALL stock.log_add('sale', NEW.id, OLD.id);
|
||||||
|
END IF;
|
||||||
|
|
||||||
|
IF !(NEW.price <=> OLD.price)
|
||||||
|
OR !(NEW.ticketFk <=> OLD.ticketFk)
|
||||||
|
OR !(NEW.itemFk <=> OLD.itemFk)
|
||||||
|
OR !(NEW.quantity <=> OLD.quantity)
|
||||||
|
OR !(NEW.discount <=> OLD.discount) THEN
|
||||||
|
CALL ticket_requestRecalc(NEW.ticketFk);
|
||||||
|
CALL ticket_requestRecalc(OLD.ticketFk);
|
||||||
|
END IF;
|
||||||
|
|
||||||
|
IF !(OLD.ticketFk <=> NEW.ticketFk) THEN
|
||||||
|
UPDATE ticketRequest SET ticketFk = NEW.ticketFk
|
||||||
|
WHERE saleFk = NEW.id;
|
||||||
|
END IF;
|
||||||
|
|
||||||
|
SELECT account.myUser_getName() INTO vUserRole;
|
||||||
|
SELECT account.user_getMysqlRole(vUserRole) INTO vUserRole;
|
||||||
|
|
||||||
|
IF !(OLD.quantity <=> NEW.quantity) THEN
|
||||||
|
SELECT COUNT(*) INTO vIsToSendMail
|
||||||
|
FROM vncontrol.inter i
|
||||||
|
JOIN vn.state s ON s.id = i.state_id
|
||||||
|
WHERE s.code='PACKED'
|
||||||
|
AND i.Id_Ticket = OLD.ticketFk
|
||||||
|
AND vUserRole IN ('salesPerson', 'salesTeamBoss')
|
||||||
|
LIMIT 1;
|
||||||
|
|
||||||
|
IF vIsToSendMail THEN
|
||||||
|
CALL vn.mail_insert('jefesventas@verdnatura.es',
|
||||||
|
'noreply@verdnatura.es',
|
||||||
|
CONCAT('Ticket ', OLD.ticketFk ,' modificada cantidad tras encajado'),
|
||||||
|
CONCAT('Ticket <a href="https://salix.verdnatura.es/#!/ticket/', OLD.ticketFk ,'/log">', OLD.ticketFk ,'</a>. <br>',
|
||||||
|
'Modificada la catidad de ', OLD.quantity, ' a ' , NEW.quantity,
|
||||||
|
' del artículo ', OLD.itemFk, ' tras estado encajado del ticket. <br>',
|
||||||
|
'Este email se ha generado automáticamente' )
|
||||||
|
);
|
||||||
|
END IF;
|
||||||
|
IF (OLD.quantity > NEW.quantity) THEN
|
||||||
|
INSERT INTO saleComponent(saleFk, componentFk, value)
|
||||||
|
SELECT NEW.id, cm.id, sc.value
|
||||||
|
FROM saleComponent sc
|
||||||
|
JOIN component cd ON cd.id = sc.componentFk
|
||||||
|
JOIN component cm ON cm.code = 'mana'
|
||||||
|
WHERE saleFk = NEW.id AND cd.code = 'lastUnitsDiscount'
|
||||||
|
ON DUPLICATE KEY UPDATE value = sc.value + VALUES(value);
|
||||||
|
|
||||||
|
DELETE sc.*
|
||||||
|
FROM vn.saleComponent sc
|
||||||
|
JOIN component c ON c.id = sc.componentFk
|
||||||
|
WHERE saleFk = NEW.id AND c.code = 'lastUnitsDiscount';
|
||||||
|
END IF;
|
||||||
|
INSERT IGNORE INTO `vn`.`routeRecalc` (`routeFk`)
|
||||||
|
SELECT r.id
|
||||||
|
FROM vn.sale s
|
||||||
|
JOIN vn.ticket t ON t.id = s.ticketFk
|
||||||
|
JOIN vn.route r ON r.id = t.routeFk
|
||||||
|
WHERE r.isOk = FALSE
|
||||||
|
AND s.id = NEW.id
|
||||||
|
AND r.created >= CURDATE()
|
||||||
|
GROUP BY r.id;
|
||||||
|
END IF;
|
||||||
|
|
||||||
|
IF !(ABS(NEW.isPicked) <=> ABS(OLD.isPicked)) AND NEW.quantity > 0 THEN
|
||||||
|
|
||||||
|
UPDATE vn.collection c
|
||||||
|
JOIN vn.ticketCollection tc ON tc.collectionFk = c.id AND tc.ticketFk = NEW.ticketFk
|
||||||
|
SET c.salePickedCount = c.salePickedCount + IF(NEW.isPicked != 0, 1, -1);
|
||||||
|
|
||||||
|
END IF;
|
||||||
|
|
||||||
|
IF !(NEW.quantity <=> OLD.quantity) AND (NEW.quantity = 0 OR OLD.quantity = 0) THEN
|
||||||
|
|
||||||
|
UPDATE vn.collection c
|
||||||
|
JOIN vn.ticketCollection tc ON tc.collectionFk = c.id AND tc.ticketFk = NEW.ticketFk
|
||||||
|
SET c.saleTotalCount = c.saleTotalCount + IF(OLD.quantity = 0, 1, -1);
|
||||||
|
END IF;
|
||||||
|
END$$
|
||||||
|
DELIMITER ;
|
|
@ -0,0 +1,6 @@
|
||||||
|
alter table `vn`.`sample`
|
||||||
|
add model VARCHAR(25) null comment 'Model name in plural';
|
||||||
|
|
||||||
|
UPDATE vn.sample t
|
||||||
|
SET t.model = 'Clients'
|
||||||
|
WHERE t.id IN(12, 13, 14, 15, 16, 18, 19, 20);
|
|
@ -0,0 +1 @@
|
||||||
|
ALTER TABLE `account`.`user` ADD hasGrant TINYINT(1) NOT NULL;
|
|
@ -0,0 +1,2 @@
|
||||||
|
INSERT INTO `salix`.`ACL` (model,property,accessType,permission,principalId)
|
||||||
|
VALUES ('WorkerDisableExcluded','*','*','ALLOW','hr');
|
|
@ -0,0 +1,3 @@
|
||||||
|
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`)
|
||||||
|
VALUES
|
||||||
|
('Business', '*', '*', 'ALLOW', 'ROLE', 'hr');
|
|
@ -0,0 +1,3 @@
|
||||||
|
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`)
|
||||||
|
VALUES
|
||||||
|
('Sale', 'usesMana', '*', 'ALLOW', 'ROLE', 'employee');
|
|
@ -0,0 +1,2 @@
|
||||||
|
INSERT INTO `vn`.`payDem` (id,payDem)
|
||||||
|
VALUES (7,'0');
|
|
@ -0,0 +1,4 @@
|
||||||
|
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`)
|
||||||
|
VALUES
|
||||||
|
('InvoiceIn', 'invoiceInPdf', 'READ', 'ALLOW', 'ROLE', 'administrative'),
|
||||||
|
('InvoiceIn', 'invoiceInEmail', 'WRITE', 'ALLOW', 'ROLE', 'administrative');
|
|
@ -0,0 +1,2 @@
|
||||||
|
INSERT INTO `salix`.`ACL` (model,property,accessType,principalId)
|
||||||
|
VALUES ('Supplier','newSupplier','WRITE','administrative');
|
|
@ -0,0 +1,28 @@
|
||||||
|
DROP FUNCTION IF EXISTS `util`.`notification_send`;
|
||||||
|
DELIMITER $$
|
||||||
|
CREATE DEFINER=`root`@`localhost` FUNCTION `util`.`notification_send`(vNotificationName VARCHAR(255), vParams TEXT, vAuthorFk INT)
|
||||||
|
RETURNS INT
|
||||||
|
MODIFIES SQL DATA
|
||||||
|
BEGIN
|
||||||
|
/**
|
||||||
|
* Sends a notification.
|
||||||
|
*
|
||||||
|
* @param vNotificationName The notification name
|
||||||
|
* @param vParams The notification parameters formatted as JSON
|
||||||
|
* @param vAuthorFk The notification author or %NULL if there is no author
|
||||||
|
* @return The notification id
|
||||||
|
*/
|
||||||
|
DECLARE vNotificationFk INT;
|
||||||
|
|
||||||
|
SELECT id INTO vNotificationFk
|
||||||
|
FROM `notification`
|
||||||
|
WHERE `name` = vNotificationName;
|
||||||
|
|
||||||
|
INSERT INTO notificationQueue
|
||||||
|
SET notificationFk = vNotificationFk,
|
||||||
|
params = vParams,
|
||||||
|
authorFk = vAuthorFk;
|
||||||
|
|
||||||
|
RETURN LAST_INSERT_ID();
|
||||||
|
END$$
|
||||||
|
DELIMITER ;
|
|
@ -0,0 +1,63 @@
|
||||||
|
USE util;
|
||||||
|
|
||||||
|
CREATE TABLE notification(
|
||||||
|
id INT PRIMARY KEY,
|
||||||
|
`name` VARCHAR(255) UNIQUE,
|
||||||
|
`description` VARCHAR(255)
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE TABLE notificationAcl(
|
||||||
|
notificationFk INT,
|
||||||
|
roleFk INT(10) unsigned,
|
||||||
|
PRIMARY KEY(notificationFk, roleFk)
|
||||||
|
);
|
||||||
|
|
||||||
|
ALTER TABLE `util`.`notificationAcl` ADD CONSTRAINT `notificationAcl_ibfk_1` FOREIGN KEY (`notificationFk`) REFERENCES `util`.`notification` (`id`)
|
||||||
|
ON DELETE CASCADE
|
||||||
|
ON UPDATE CASCADE;
|
||||||
|
|
||||||
|
ALTER TABLE `util`.`notificationAcl` ADD CONSTRAINT `notificationAcl_ibfk_2` FOREIGN KEY (`roleFk`) REFERENCES `account`.`role`(`id`)
|
||||||
|
ON DELETE RESTRICT
|
||||||
|
ON UPDATE CASCADE;
|
||||||
|
|
||||||
|
CREATE TABLE notificationSubscription(
|
||||||
|
notificationFk INT,
|
||||||
|
userFk INT(10) unsigned,
|
||||||
|
PRIMARY KEY(notificationFk, userFk)
|
||||||
|
);
|
||||||
|
|
||||||
|
ALTER TABLE `util`.`notificationSubscription` ADD CONSTRAINT `notificationSubscription_ibfk_1` FOREIGN KEY (`notificationFk`) REFERENCES `util`.`notification` (`id`)
|
||||||
|
ON DELETE CASCADE
|
||||||
|
ON UPDATE CASCADE;
|
||||||
|
|
||||||
|
ALTER TABLE `util`.`notificationSubscription` ADD CONSTRAINT `notificationSubscription_ibfk_2` FOREIGN KEY (`userFk`) REFERENCES `account`.`user`(`id`)
|
||||||
|
ON DELETE CASCADE
|
||||||
|
ON UPDATE CASCADE;
|
||||||
|
|
||||||
|
CREATE TABLE notificationQueue(
|
||||||
|
id INT PRIMARY KEY AUTO_INCREMENT,
|
||||||
|
notificationFk VARCHAR(255),
|
||||||
|
params JSON,
|
||||||
|
authorFk INT(10) unsigned NULL,
|
||||||
|
`status` ENUM('pending', 'sent', 'error') NOT NULL DEFAULT 'pending',
|
||||||
|
created DATETIME DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
INDEX(notificationFk),
|
||||||
|
INDEX(authorFk),
|
||||||
|
INDEX(status)
|
||||||
|
);
|
||||||
|
|
||||||
|
ALTER TABLE `util`.`notificationQueue` ADD CONSTRAINT `nnotificationQueue_ibfk_1` FOREIGN KEY (`notificationFk`) REFERENCES `util`.`notification` (`name`)
|
||||||
|
ON DELETE CASCADE
|
||||||
|
ON UPDATE CASCADE;
|
||||||
|
|
||||||
|
ALTER TABLE `util`.`notificationQueue` ADD CONSTRAINT `notificationQueue_ibfk_2` FOREIGN KEY (`authorFk`) REFERENCES `account`.`user`(`id`)
|
||||||
|
ON DELETE CASCADE
|
||||||
|
ON UPDATE CASCADE;
|
||||||
|
|
||||||
|
CREATE TABLE notificationConfig(
|
||||||
|
id INT PRIMARY KEY AUTO_INCREMENT,
|
||||||
|
cleanDays MEDIUMINT
|
||||||
|
);
|
||||||
|
|
||||||
|
INSERT INTO notificationConfig
|
||||||
|
SET cleanDays = 90;
|
|
@ -0,0 +1 @@
|
||||||
|
ALTER TABLE `vn`.`supplier` MODIFY COLUMN payMethodFk tinyint(3) unsigned NULL;
|
|
@ -0,0 +1 @@
|
||||||
|
ALTER TABLE `vn`.`supplier` MODIFY COLUMN supplierActivityFk varchar(45) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL NULL;
|
|
@ -0,0 +1,35 @@
|
||||||
|
drop procedure `vn`.`ticket_closeByTicket`;
|
||||||
|
|
||||||
|
DELIMITER $$
|
||||||
|
$$
|
||||||
|
create
|
||||||
|
definer = `root`@`localhost` procedure `vn`.`ticket_closeByTicket`(IN vTicketFk int)
|
||||||
|
BEGIN
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Inserta el ticket en la tabla temporal
|
||||||
|
* para ser cerrado.
|
||||||
|
*
|
||||||
|
* @param vTicketFk Id del ticket
|
||||||
|
*/
|
||||||
|
|
||||||
|
DROP TEMPORARY TABLE IF EXISTS tmp.ticket_close;
|
||||||
|
CREATE TEMPORARY TABLE tmp.ticket_close ENGINE = MEMORY (
|
||||||
|
SELECT
|
||||||
|
t.id AS ticketFk
|
||||||
|
FROM ticket t
|
||||||
|
JOIN agencyMode am ON am.id = t.agencyModeFk
|
||||||
|
LEFT JOIN ticketState ts ON ts.ticketFk = t.id
|
||||||
|
JOIN alertLevel al ON al.id = ts.alertLevel
|
||||||
|
WHERE al.code = 'PACKED' OR (am.code = 'refund' AND al.code != 'delivered')
|
||||||
|
AND t.id = vTicketFk
|
||||||
|
AND t.refFk IS NULL
|
||||||
|
GROUP BY t.id);
|
||||||
|
|
||||||
|
CALL ticket_close();
|
||||||
|
|
||||||
|
DROP TEMPORARY TABLE tmp.ticket_close;
|
||||||
|
END$$
|
||||||
|
DELIMITER ;
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
CREATE TABLE `vn`.`zipConfig` (
|
||||||
|
`id` double(10,2) NOT NULL,
|
||||||
|
`maxSize` int(11) DEFAULT NULL COMMENT 'in MegaBytes',
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
|
||||||
|
|
||||||
|
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`)
|
||||||
|
VALUES
|
||||||
|
('ZipConfig', '*', '*', 'ALLOW', 'ROLE', 'employee');
|
|
@ -0,0 +1 @@
|
||||||
|
Delete this file
|
|
@ -22,8 +22,12 @@ USE `util`;
|
||||||
|
|
||||||
LOCK TABLES `config` WRITE;
|
LOCK TABLES `config` WRITE;
|
||||||
/*!40000 ALTER TABLE `config` DISABLE KEYS */;
|
/*!40000 ALTER TABLE `config` DISABLE KEYS */;
|
||||||
|
<<<<<<< HEAD
|
||||||
INSERT INTO `config` VALUES
|
INSERT INTO `config` VALUES
|
||||||
(1,'10502',0,'production',NULL);
|
(1,'10502',0,'production',NULL);
|
||||||
|
=======
|
||||||
|
INSERT INTO `config` VALUES (1,'224602',0,'production',NULL);
|
||||||
|
>>>>>>> ac447d4981695aeceab34cdc30c48cfe26f559b0
|
||||||
/*!40000 ALTER TABLE `config` ENABLE KEYS */;
|
/*!40000 ALTER TABLE `config` ENABLE KEYS */;
|
||||||
UNLOCK TABLES;
|
UNLOCK TABLES;
|
||||||
|
|
||||||
|
|
|
@ -81,9 +81,9 @@ N_CHANGES=0
|
||||||
|
|
||||||
for DIR_PATH in "$DIR/changes/"*; do
|
for DIR_PATH in "$DIR/changes/"*; do
|
||||||
DIR_NAME=$(basename $DIR_PATH)
|
DIR_NAME=$(basename $DIR_PATH)
|
||||||
DIR_VERSION=${DIR_NAME:0:5}
|
DIR_VERSION=${DIR_NAME:0:6}
|
||||||
|
|
||||||
if [[ ! "$DIR_NAME" =~ ^[0-9]{5}(-[a-zA-Z0-9]+)?$ ]]; then
|
if [[ ! "$DIR_NAME" =~ ^[0-9]{6}$ ]]; then
|
||||||
echo "[WARN] Ignoring wrong directory name: $DIR_NAME"
|
echo "[WARN] Ignoring wrong directory name: $DIR_NAME"
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -57,14 +57,16 @@ module.exports = Self => {
|
||||||
r.clientFk,
|
r.clientFk,
|
||||||
FALSE hasPdf,
|
FALSE hasPdf,
|
||||||
FALSE isInvoice,
|
FALSE isInvoice,
|
||||||
CASE WHEN at2.code LIKE 'compensation' THEN True ELSE False END 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.userFk
|
||||||
JOIN vn.company c ON c.id = r.companyFk
|
JOIN vn.company c ON c.id = r.companyFk
|
||||||
JOIN vn.accounting a ON a.id = r.bankFk
|
LEFT JOIN vn.accounting a ON a.id = r.bankFk
|
||||||
JOIN vn.accountingType at2 ON at2.id = a.accountingTypeFk
|
LEFT JOIN vn.accountingType at2 ON at2.id = a.accountingTypeFk AND at2.code = 'compensation'
|
||||||
WHERE r.clientFk = ? AND r.companyFk = ?
|
WHERE
|
||||||
|
r.clientFk = ?
|
||||||
|
AND r.companyFk = ?
|
||||||
UNION ALL
|
UNION ALL
|
||||||
SELECT
|
SELECT
|
||||||
i.id,
|
i.id,
|
||||||
|
@ -81,13 +83,10 @@ module.exports = Self => {
|
||||||
i.clientFk,
|
i.clientFk,
|
||||||
i.hasPdf,
|
i.hasPdf,
|
||||||
TRUE isInvoice,
|
TRUE isInvoice,
|
||||||
CASE WHEN at2.code LIKE 'compensation' THEN True ELSE False END as isCompensation
|
NULL
|
||||||
FROM vn.invoiceOut i
|
FROM vn.invoiceOut i
|
||||||
JOIN vn.company c ON c.id = i.companyFk
|
JOIN vn.company c ON c.id = i.companyFk
|
||||||
JOIN vn.accounting a ON a.id = i.bankFk
|
|
||||||
JOIN vn.accountingType at2 ON at2.id = a.accountingTypeFk
|
|
||||||
WHERE i.clientFk = ? AND i.companyFk = ?
|
WHERE i.clientFk = ? AND i.companyFk = ?
|
||||||
ORDER BY payed DESC, created DESC
|
|
||||||
) t ORDER BY payed DESC, created DESC`,
|
) t ORDER BY payed DESC, created DESC`,
|
||||||
[
|
[
|
||||||
clientId,
|
clientId,
|
||||||
|
|
|
@ -11,6 +11,7 @@ describe('InvoiceOut createPdf()', () => {
|
||||||
const ctx = {req: activeCtx};
|
const ctx = {req: activeCtx};
|
||||||
|
|
||||||
it('should create a new PDF file and set true the hasPdf property', async() => {
|
it('should create a new PDF file and set true the hasPdf property', async() => {
|
||||||
|
pending('https://redmine.verdnatura.es/issues/4875');
|
||||||
const invoiceId = 1;
|
const invoiceId = 1;
|
||||||
spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({
|
spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({
|
||||||
active: activeCtx
|
active: activeCtx
|
||||||
|
|
|
@ -30,6 +30,7 @@ describe('InvoiceOut downloadZip()', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return an error if the size of the files is too large', async() => {
|
it('should return an error if the size of the files is too large', async() => {
|
||||||
|
pending('https://redmine.verdnatura.es/issues/4875');
|
||||||
const tx = await models.InvoiceOut.beginTransaction({});
|
const tx = await models.InvoiceOut.beginTransaction({});
|
||||||
|
|
||||||
let error;
|
let error;
|
||||||
|
|
|
@ -51,6 +51,7 @@ describe('InvoiceOut filter()', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return the invoice out matching hasPdf', async() => {
|
it('should return the invoice out matching hasPdf', async() => {
|
||||||
|
pending('https://redmine.verdnatura.es/issues/4875');
|
||||||
const tx = await models.InvoiceOut.beginTransaction({});
|
const tx = await models.InvoiceOut.beginTransaction({});
|
||||||
const options = {transaction: tx};
|
const options = {transaction: tx};
|
||||||
|
|
||||||
|
|
|
@ -137,9 +137,11 @@ module.exports = Self => {
|
||||||
const params = [args.id, args.shipped, args.warehouseFk];
|
const params = [args.id, args.shipped, args.warehouseFk];
|
||||||
const [salesMovable] = await Self.rawSql(query, params, myOptions);
|
const [salesMovable] = await Self.rawSql(query, params, myOptions);
|
||||||
|
|
||||||
|
const sales = await models.Sale.find({ticketFk: args.id}, myOptions);
|
||||||
const salesNewTicket = salesMovable.filter(sale => (sale.movable ? sale.movable : 0) >= sale.quantity);
|
const salesNewTicket = salesMovable.filter(sale => (sale.movable ? sale.movable : 0) >= sale.quantity);
|
||||||
|
|
||||||
if (salesNewTicket.length) {
|
const salesNewTicketLength = salesNewTicket.length;
|
||||||
|
if (salesNewTicketLength && sales.length != salesNewTicketLength) {
|
||||||
const newTicket = await models.Ticket.transferSales(ctx, args.id, null, salesNewTicket, myOptions);
|
const newTicket = await models.Ticket.transferSales(ctx, args.id, null, salesNewTicket, myOptions);
|
||||||
args.id = newTicket.id;
|
args.id = newTicket.id;
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,6 +67,7 @@ class Controller extends Component {
|
||||||
ticketHaveNegatives() {
|
ticketHaveNegatives() {
|
||||||
let haveNegatives = false;
|
let haveNegatives = false;
|
||||||
let haveNotNegatives = false;
|
let haveNotNegatives = false;
|
||||||
|
this.ticket.withoutNegatives = false;
|
||||||
const haveDifferences = this.ticket.sale.haveDifferences;
|
const haveDifferences = this.ticket.sale.haveDifferences;
|
||||||
|
|
||||||
this.ticket.sale.items.forEach(item => {
|
this.ticket.sale.items.forEach(item => {
|
||||||
|
@ -76,8 +77,9 @@ class Controller extends Component {
|
||||||
haveNotNegatives = true;
|
haveNotNegatives = true;
|
||||||
});
|
});
|
||||||
|
|
||||||
this.ticket.withoutNegatives = true;
|
|
||||||
this.haveNegatives = (haveNegatives && haveNotNegatives && haveDifferences);
|
this.haveNegatives = (haveNegatives && haveNotNegatives && haveDifferences);
|
||||||
|
if (this.haveNegatives)
|
||||||
|
this.ticket.withoutNegatives = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
onSubmit() {
|
onSubmit() {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
html {
|
html {
|
||||||
font-family: "Roboto";
|
font-family: Arial, Helvetica, sans-serif;
|
||||||
margin-top: -6px;
|
margin-top: -6px;
|
||||||
}
|
}
|
||||||
* {
|
* {
|
||||||
|
@ -9,12 +9,15 @@ html {
|
||||||
}
|
}
|
||||||
#vertical {
|
#vertical {
|
||||||
writing-mode: vertical-rl;
|
writing-mode: vertical-rl;
|
||||||
height: 240px;
|
height: 230px;
|
||||||
|
font-size: 29px;
|
||||||
margin-left: -13px;
|
margin-left: -13px;
|
||||||
}
|
}
|
||||||
.outline {
|
.outline {
|
||||||
border: 1px solid black;
|
border: 1px solid black;
|
||||||
padding: 5px;
|
padding: 5px;
|
||||||
|
height: 37px;
|
||||||
|
width: 100px;
|
||||||
}
|
}
|
||||||
#nickname {
|
#nickname {
|
||||||
font-size: 22px;
|
font-size: 22px;
|
||||||
|
@ -22,17 +25,20 @@ html {
|
||||||
}
|
}
|
||||||
#agencyDescripton {
|
#agencyDescripton {
|
||||||
font-size: 32px;
|
font-size: 32px;
|
||||||
|
width: 375px;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
#bold {
|
#bold {
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
#barcode{
|
#barcode{
|
||||||
width: 390px;
|
width: 370px;
|
||||||
}
|
}
|
||||||
#shipped {
|
#shipped {
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
|
width: 50px;
|
||||||
|
max-width: 100px;
|
||||||
}
|
}
|
||||||
#ticketFk, #vertical {
|
#ticketFk {
|
||||||
font-size: 34px;
|
font-size: 32px;
|
||||||
}
|
}
|
|
@ -4,31 +4,29 @@
|
||||||
<table v-for="labelData in labelsData" style="break-before: page">
|
<table v-for="labelData in labelsData" style="break-before: page">
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<td rowspan="6"><span id="vertical" class="ellipsize">
|
<td rowspan="6"><span id="vertical" class="ellipsize">{{getVertical(labelData)}}</span></td>
|
||||||
{{labelData.collectionFk ? `${labelData.collectionFk} ~ ${labelData.wagon}-${labelData.level}` : '-'.repeat(23)}}
|
|
||||||
</span></td>
|
|
||||||
<td id="ticketFk">
|
<td id="ticketFk">
|
||||||
{{labelData.clientFk ? `${labelData.ticketFk} « ${labelData.clientFk}` : labelData.ticketFk}}
|
{{labelData.clientFk ? `${labelData.ticketFk} « ${labelData.clientFk}` : labelData.ticketFk}}
|
||||||
</td>
|
</td>
|
||||||
<td colspan="2" id="shipped">{{labelData.shipped ? labelData.shipped : '---'}}</td>
|
<td colspan="2" id="shipped">{{labelData.shipped || '---'}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td rowspan="3"><div v-html="getBarcode(labelData.ticketFk)" id="barcode"></div></td>
|
<td rowspan="3"><div v-html="getBarcode(labelData.ticketFk)" id="barcode"></div></td>
|
||||||
<td class="outline">{{labelData.workerCode ? labelData.workerCode : '---'}}</td>
|
<td class="outline">{{labelData.workerCode || '---'}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="outline">{{labelData.labelCount ? labelData.labelCount : 0}}</td>
|
<td class="outline">{{labelData.labelCount || 0}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="outline">{{labelData.code == 'plant' ? labelData.size + 'cm' : labelData.volume + 'm³'}}</td>
|
<td class="outline">{{labelData.code == 'V' ? (labelData.size || 0) + 'cm' : (labelData.volume || 0) + 'm³'}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td><div id="agencyDescripton" class="ellipsize">{{labelData.agencyDescription}}</div></td>
|
<td><div id="agencyDescripton" class="ellipsize">{{labelData.agencyDescription ? labelData.agencyDescription.toUpperCase() : '---'}}</div></td>
|
||||||
<td id="bold">{{labelData.lineCount ? labelData.lineCount : 0}}</td>
|
<td id="bold">{{labelData.lineCount || 0}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td id="nickname" class="ellipsize">{{labelData.nickName ? labelData.nickName : '---'}}</td>
|
<td id="nickname" class="ellipsize">{{labelData.nickName ? labelData.nickName.toUpperCase() : '---'}}</td>
|
||||||
<td id="bold">{{labelData.shipped ? labelData.shippedHour : labelData.zoneHour}}</td>
|
<td id="bold">{{labelData.shippedHour || labelData.zoneHour}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
|
@ -25,7 +25,6 @@ module.exports = {
|
||||||
ticketIds = [this.id];
|
ticketIds = [this.id];
|
||||||
|
|
||||||
this.labelsData = await this.rawSqlFromDef('labelsData', [ticketIds]);
|
this.labelsData = await this.rawSqlFromDef('labelsData', [ticketIds]);
|
||||||
|
|
||||||
if (!this.labelsData.length)
|
if (!this.labelsData.length)
|
||||||
throw new UserError('Empty data source');
|
throw new UserError('Empty data source');
|
||||||
},
|
},
|
||||||
|
@ -44,6 +43,19 @@ module.exports = {
|
||||||
});
|
});
|
||||||
return xmlSerializer.serializeToString(svgNode);
|
return xmlSerializer.serializeToString(svgNode);
|
||||||
},
|
},
|
||||||
|
getVertical(labelData) {
|
||||||
|
let value;
|
||||||
|
if (labelData.collectionFk) {
|
||||||
|
value = `${labelData.collectionFk} ~ `;
|
||||||
|
if (labelData.code == 'V')
|
||||||
|
value = value + `${labelData.wagon}-${labelData.level}`;
|
||||||
|
else
|
||||||
|
value = value + `${labelData.color.substring(0, 4)}`;
|
||||||
|
} else
|
||||||
|
value = '-'.repeat(19);
|
||||||
|
|
||||||
|
return value;
|
||||||
|
},
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
'report-body': reportBody.build()
|
'report-body': reportBody.build()
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"width": "10.4cm",
|
"width": "10.4cm",
|
||||||
"height": "4.8cm",
|
"height": "4.9cm",
|
||||||
"margin": {
|
"margin": {
|
||||||
"top": "0.3cm",
|
"top": "0.3cm",
|
||||||
"right": "0.6cm",
|
"right": "0.6cm",
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
SELECT tc.collectionFk,
|
SELECT c.itemPackingTypeFk code,
|
||||||
|
tc.collectionFk,
|
||||||
SUBSTRING('ABCDEFGH', tc.wagon, 1) wagon,
|
SUBSTRING('ABCDEFGH', tc.wagon, 1) wagon,
|
||||||
tc.`level`,
|
tc.`level`,
|
||||||
t.id ticketFk,
|
t.id ticketFk,
|
||||||
COALESCE(et.description, zo.name, am.name) agencyDescription,
|
COALESCE(et.description, zo.name, am.name) agencyDescription,
|
||||||
am.name,
|
cc.code color,
|
||||||
t.clientFk,
|
t.clientFk,
|
||||||
CAST(SUM(sv.volume) AS DECIMAL(5, 2)) volume,
|
CAST(SUM(sv.volume) AS DECIMAL(5, 2)) volume,
|
||||||
MAX(i.`size`) `size`,
|
MAX(i.`size`) `size`,
|
||||||
ic.code,
|
|
||||||
w.code workerCode,
|
w.code workerCode,
|
||||||
TIME_FORMAT(t.shipped, '%H:%i') shippedHour,
|
TIME_FORMAT(t.shipped, '%H:%i') shippedHour,
|
||||||
TIME_FORMAT(zo.`hour`, '%H:%i') zoneHour,
|
TIME_FORMAT(zo.`hour`, '%H:%i') zoneHour,
|
||||||
|
@ -16,8 +16,8 @@ SELECT tc.collectionFk,
|
||||||
tt.labelCount,
|
tt.labelCount,
|
||||||
COUNT(*) lineCount
|
COUNT(*) lineCount
|
||||||
FROM vn.ticket t
|
FROM vn.ticket t
|
||||||
LEFT JOIN vn.ticketCollection tc ON tc.ticketFk = t.id
|
JOIN vn.ticketCollection tc ON tc.ticketFk = t.id
|
||||||
LEFT JOIN vn.collection c ON c.id = tc.collectionFk
|
JOIN vn.collection c ON c.id = tc.collectionFk
|
||||||
LEFT JOIN vn.collectionColors cc ON cc.shelve = tc.`level`
|
LEFT JOIN vn.collectionColors cc ON cc.shelve = tc.`level`
|
||||||
AND cc.wagon = tc.wagon
|
AND cc.wagon = tc.wagon
|
||||||
AND cc.trainFk = c.trainFk
|
AND cc.trainFk = c.trainFk
|
||||||
|
@ -26,7 +26,7 @@ SELECT tc.collectionFk,
|
||||||
JOIN vn.item i ON i.id = s.itemFk
|
JOIN vn.item i ON i.id = s.itemFk
|
||||||
JOIN vn.itemType it ON it.id = i.typeFk
|
JOIN vn.itemType it ON it.id = i.typeFk
|
||||||
JOIN vn.itemCategory ic ON ic.id = it.categoryFk
|
JOIN vn.itemCategory ic ON ic.id = it.categoryFk
|
||||||
LEFT JOIN vn.worker w ON w.id = c.workerFk
|
JOIN vn.worker w ON w.id = c.workerFk
|
||||||
JOIN vn.agencyMode am ON am.id = t.agencyModeFk
|
JOIN vn.agencyMode am ON am.id = t.agencyModeFk
|
||||||
LEFT JOIN vn.ticketTrolley tt ON tt.ticket = t.id
|
LEFT JOIN vn.ticketTrolley tt ON tt.ticket = t.id
|
||||||
LEFT JOIN vn.`zone` zo ON t.zoneFk = zo.id
|
LEFT JOIN vn.`zone` zo ON t.zoneFk = zo.id
|
||||||
|
|
Loading…
Reference in New Issue