Merge branch '7277-RefundInvoices' of https://gitea.verdnatura.es/verdnatura/salix into 7277-RefundInvoices
gitea/salix/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Javi Gallego 2024-09-04 10:24:56 +02:00
commit c1e76e4c43
13 changed files with 96 additions and 20 deletions

View File

@ -582,6 +582,7 @@ INSERT INTO `vn`.`supplier`(`id`, `name`, `nickname`,`account`,`countryFk`,`nif`
VALUES
(1, 'PLANTS SL', 'Plants nick', 4100000001, 1, '06089160W', 0, util.VN_CURDATE(), 1, 'supplier address 1', 'GOTHAM', 1, 46000, 1, 1, 15, 4, 1, 1, 18, 'flowerPlants', 1, '400664487V'),
(2, 'FARMER KING', 'The farmer', 4000020002, 1, '87945234L', 0, util.VN_CURDATE(), 1, 'supplier address 2', 'GOTHAM', 2, 46000, 1, 2, 10, 93, 2, 8, 18, 'animals', 1, '400664487V'),
(4, 'INVENTARIO', 'INVENTARIO', 4000000004, NULL, NULL, 0, util.VN_CURDATE(), 1, NULL, NULL, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, NULL, NULL),
(69, 'PACKAGING', 'Packaging nick', 4100000069, 1, '94935005K', 0, util.VN_CURDATE(), 1, 'supplier address 5', 'ASGARD', 3, 46600, 1, 1, 15, 4, 1, 1, 18, 'flowerPlants', 1, '400664487V'),
(442, 'VERDNATURA LEVANTE SL', 'Verdnatura', 5115000442, 1, '06815934E', 0, util.VN_CURDATE(), 1, 'supplier address 3', 'GOTHAM', 1, 46000, 1, 2, 15, 6, 9, 3, 18, 'complements', 1, '400664487V'),
(567, 'HOLLAND', 'Holland nick', 4000020567, 1, '14364089Z', 0, util.VN_CURDATE(), 1, 'supplier address 6', 'ASGARD', 3, 46600, 1, 2, 10, 93, 2, 8, 18, 'animals', 1, '400664487V'),
@ -1516,6 +1517,9 @@ INSERT INTO `vn`.`entry`(`id`, `supplierFk`, `created`, `travelFk`, `isConfirmed
(9, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL +2 DAY), 10, 0, 442, 'IN2009', 'Movement 9', 1, 1, ''),
(10, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL +2 DAY), 10, 0, 442, 'IN2009', 'Movement 9', 1, 1, '');
INSERT INTO `vn`.`entryConfig` (`defaultEntry`, `inventorySupplierFk`, `defaultSupplierFk`)
VALUES (2, 4, 1);
INSERT INTO `bs`.`waste`(`buyerFk`, `year`, `week`, `itemFk`, `itemTypeFk`, `saleTotal`, `saleWasteQuantity`, `saleInternalWaste`, `saleExternalWaste`)
VALUES
('35', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 1, 1, '1062', '51', '56.20', '56.20'),

View File

@ -5,28 +5,26 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`itemShelving_transf
)
BEGIN
/**
* Transfiere producto de una ubicación a otra, fusionando si coincide el
* packing y la fecha.
* Transfiere producto de una ubicación a otra
* fusionando si coincide el packing y la fecha.
*
* @param vItemShelvingFk Identificador de itemShelving
* @param vShelvingFk Identificador de shelving
*/
DECLARE vNewItemShelvingFk INT DEFAULT 0;
DECLARE vNewItemShelvingFk INT;
SELECT MAX(ish.id)
INTO vNewItemShelvingFk
SELECT MAX(ish.id) INTO vNewItemShelvingFk
FROM itemShelving ish
JOIN (
SELECT
itemFk,
packing,
created,
buyFk
SELECT itemFk,
packing,
created,
buyFk
FROM itemShelving
WHERE id = vItemShelvingFk
) ish2 ON ish2.itemFk = ish.itemFk
AND ish2.packing = ish.packing
AND date(ish2.created) = date(ish.created)
AND DATE(ish2.created) = DATE(ish.created)
AND ish2.buyFk = ish.buyFk
WHERE ish.shelvingFk = vShelvingFk COLLATE utf8_unicode_ci;
@ -39,10 +37,16 @@ BEGIN
DELETE FROM itemShelving
WHERE id = vItemShelvingFk;
ELSE
UPDATE itemShelving
SET shelvingFk = vShelvingFk
WHERE id = vItemShelvingFk;
IF (SELECT EXISTS(SELECT id FROM shelving
WHERE code = vShelvingFk COLLATE utf8_unicode_ci)) THEN
UPDATE itemShelving
SET shelvingFk = vShelvingFk
WHERE id = vItemShelvingFk;
ELSE
CALL util.throw('The shelving not exists');
END IF;
END IF;
SELECT true;
SELECT TRUE;
END$$
DELIMITER ;
DELIMITER ;

View File

@ -69,6 +69,10 @@ trig:BEGIN
IF NOT NEW.printedStickers <=> OLD.printedStickers THEN
CALL util.throw("Stickers cannot be modified if they are inventory");
END IF;
IF OLD.entryFk <> NEW.entryFk THEN
CALL util.throw("Cannot transfer lines to inventory entry");
END IF;
END IF;
IF NEW.quantity < 0 THEN

View File

@ -5,7 +5,7 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`itemShelving_afterDel
BEGIN
INSERT INTO shelvingLog
SET `action` = 'delete',
`changedModel` = 'itemShelving',
`changedModel` = 'ItemShelving',
`changedModelId` = OLD.id,
`userFk` = account.myUser_getId();
END$$

View File

@ -0,0 +1,8 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`saleGroupDetail_beforeInsert`
BEFORE INSERT ON `saleGroupDetail`
FOR EACH ROW
BEGIN
SET NEW.editorFk = account.myUser_getId();
END$$
DELIMITER ;

View File

@ -0,0 +1,12 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`saleGroupDetail_afterDelete`
AFTER DELETE ON `saleGroupDetail`
FOR EACH ROW
BEGIN
INSERT INTO saleGroupLog
SET `action` = 'delete',
`changedModel` = 'SaleGroupDetail',
`changedModelId` = OLD.id,
`userFk` = account.myUser_getId();
END$$
DELIMITER ;

View File

@ -0,0 +1,8 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`saleGroupDetail_beforeUpdate`
BEFORE UPDATE ON `saleGroupDetail`
FOR EACH ROW
BEGIN
SET NEW.editorFk = account.myUser_getId();
END$$
DELIMITER ;

View File

@ -3,7 +3,7 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`saleGroup_afterDelete
AFTER DELETE ON `saleGroup`
FOR EACH ROW
BEGIN
INSERT INTO ticketLog
INSERT INTO saleGroupLog
SET `action` = 'delete',
`changedModel` = 'SaleGroup',
`changedModelId` = OLD.id,

View File

@ -0,0 +1,23 @@
CREATE OR REPLACE TABLE `vn`.`saleGroupLog` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`originFk` int(11) DEFAULT NULL,
`userFk` int(10) unsigned DEFAULT NULL,
`action` set('insert','update','delete','select') NOT NULL,
`creationDate` timestamp NULL DEFAULT current_timestamp(),
`description` text CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL,
`changedModel` enum('SaleGroup', 'SaleGroupDetail') NOT NULL DEFAULT 'SaleGroup',
`oldInstance` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`oldInstance`)),
`newInstance` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`newInstance`)),
`changedModelId` int(11) NOT NULL,
`changedModelValue` varchar(45) DEFAULT NULL,
`summaryId` varchar(30) DEFAULT NULL,
`reason` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `saleGroupUserFk` (`userFk`),
KEY `saleGroupLog_changedModel` (`changedModel`,`changedModelId`,`creationDate`),
KEY `saleGroupLog_originFk` (`originFk`,`creationDate`),
CONSTRAINT `saleGroupLogUserFk` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
ALTER TABLE vn.parkingLog
MODIFY COLUMN changedModel enum('Parking') CHARACTER SET utf8mb3 COLLATE utf8mb3_unicode_ci DEFAULT 'Parking' NOT NULL;

View File

@ -0,0 +1,6 @@
ALTER TABLE vn.operator
MODIFY COLUMN sizeLimit int(10) unsigned DEFAULT NULL NULL COMMENT 'Límite de altura en una colección para la asignación de pedidos';
UPDATE vn.operator
SET sizeLimit = 90
WHERE itemPackingTypeFk = 'V';

View File

@ -342,6 +342,9 @@ exports.initialize = function initialize(dataSource, callback) {
}
};
// Code extracted from original Loopback MySQL connector
// since it cannot be reused, please try not to alter it.
// https://github.com/loopbackio/loopback-connector-mysql/blob/v6.2.0/lib/mysql.js
MySQL.prototype.connect = function(callback) {
const self = this;
const options = generateOptions(this.settings);

View File

@ -11,12 +11,16 @@
"port": "3306",
"username": "root",
"password": "root",
"connectionLimit": 100,
"queueLimit": 100,
"multipleStatements": true,
"legacyUtcDateProcessing": false,
"timezone": "local",
"connectTimeout": 40000,
"acquireTimeout": 90000,
"waitForConnections": true
"waitForConnections": true,
"maxIdleTime": 60000,
"idleTimeout": 60000
},
"osticket": {
"connector": "memory",

View File

@ -6,7 +6,7 @@
<vn-menu vn-id="menu">
<vn-list>
<vn-item
vn-acl="administrative"
vn-acl="claimManager"
vn-acl-action="remove"
ng-click="transferClient.show()"
translate>