diff --git a/db/routines/vn/events/clientsDisable.sql b/db/routines/vn/events/clientsDisable.sql index 238e060dd..35e6554a2 100644 --- a/db/routines/vn/events/clientsDisable.sql +++ b/db/routines/vn/events/clientsDisable.sql @@ -7,15 +7,19 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` EVENT `vn`.`clientsDisable` DO BEGIN UPDATE account.user u JOIN client c ON c.id = u.id + LEFT JOIN account.account a ON a.id = u.id SET u.active = FALSE WHERE c.typeFk = 'normal' + AND a.id IS NULL + AND u.active + AND c.created < util.VN_CURDATE() - INTERVAL 12 MONTH AND u.id NOT IN ( SELECT DISTINCT c.id FROM client c LEFT JOIN ticket t ON t.clientFk = c.id WHERE c.salesPersonFk IS NOT NULL - OR t.created > util.VN_CURDATE() - INTERVAL 2 MONTH - OR shipped > util.VN_CURDATE() - INTERVAL 2 MONTH + OR t.created > util.VN_CURDATE() - INTERVAL 12 MONTH + OR shipped > util.VN_CURDATE() - INTERVAL 12 MONTH ); END$$ DELIMITER ; diff --git a/db/routines/vn/procedures/collection_assign.sql b/db/routines/vn/procedures/collection_assign.sql index 196764c42..c2b6e538e 100644 --- a/db/routines/vn/procedures/collection_assign.sql +++ b/db/routines/vn/procedures/collection_assign.sql @@ -30,7 +30,10 @@ BEGIN -- Si hay colecciones sin terminar, sale del proceso CALL collection_get(vUserFk); - SELECT (pc.maxNotReadyCollections - COUNT(*)) <= 0 INTO vHasTooMuchCollections + SELECT (pc.maxNotReadyCollections - COUNT(*)) <= 0, + collection_assign_lockname + INTO vHasTooMuchCollections, + vLockName FROM productionConfig pc LEFT JOIN tCollection ON TRUE; diff --git a/db/routines/vn/procedures/itemShelving_add.sql b/db/routines/vn/procedures/itemShelving_add.sql index 0dc7f3098..d3e0f6a90 100644 --- a/db/routines/vn/procedures/itemShelving_add.sql +++ b/db/routines/vn/procedures/itemShelving_add.sql @@ -20,8 +20,11 @@ BEGIN SELECT barcodeToItem(vBarcode) INTO vItemFk; - SET vPacking = COALESCE(vPacking, GREATEST(vn.itemPacking(vBarcode,vWarehouseFk), 1)); - SET vQuantity = vQuantity * vPacking; + IF vPacking IS NULL + THEN + SET vPacking = itemPacking(vBarcode, vWarehouseFk); + SET vQuantity = vQuantity * vPacking; + END IF; IF (SELECT COUNT(*) FROM itemShelving WHERE shelvingFk COLLATE utf8_unicode_ci = vShelvingFk diff --git a/db/routines/vn/triggers/client_afterUpdate.sql b/db/routines/vn/triggers/client_afterUpdate.sql index 8bca36d63..e316fb08a 100644 --- a/db/routines/vn/triggers/client_afterUpdate.sql +++ b/db/routines/vn/triggers/client_afterUpdate.sql @@ -10,11 +10,5 @@ BEGIN UPDATE `address` SET isDefaultAddress = TRUE WHERE id = NEW.defaultAddressFk; END IF; - - IF NOT NEW.isActive THEN - UPDATE account.`user` - SET active = FALSE - WHERE id = NEW.id; - END IF; END$$ DELIMITER ; diff --git a/db/versions/10995-navyErica/02-agencyWorkCenterCreate.sql b/db/versions/10995-navyErica/02-agencyWorkCenterCreate.sql index 179fbc63c..6aeb52a41 100644 --- a/db/versions/10995-navyErica/02-agencyWorkCenterCreate.sql +++ b/db/versions/10995-navyErica/02-agencyWorkCenterCreate.sql @@ -10,9 +10,10 @@ CREATE TABLE IF NOT EXISTS `vn`.`agencyWorkCenter` ( CONSTRAINT `agencyWorkCenter_agency_FK` FOREIGN KEY (`agencyFk`) REFERENCES `agency` (`id`) ON DELETE CASCADE, CONSTRAINT `agencyWorkCenter_user_FK` FOREIGN KEY (`editorFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, CONSTRAINT `agencyWorkCenter_workCenter_FK` FOREIGN KEY (`workCenterFk`) REFERENCES `workCenter` (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci COMMENT='refs #4988'; +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; INSERT INTO vn.agencyWorkCenter (agencyFk, workCenterFk) - SELECT id, workCenterFk - FROM vn.agency - WHERE workCenterFk IS NOT NULL; + SELECT a.id, wc.id + FROM vn.agency a + JOIN vn.warehouse w ON w.id = a.warehouseFk + JOIN vn.workCenter wc ON wc.warehouseFk = w.id; \ No newline at end of file diff --git a/db/versions/11045-redLaurel/00-firstScript.sql b/db/versions/11045-redLaurel/00-firstScript.sql new file mode 100644 index 000000000..cc83f922f --- /dev/null +++ b/db/versions/11045-redLaurel/00-firstScript.sql @@ -0,0 +1,4 @@ + + +ALTER TABLE vn.productionConfig + ADD IF NOT EXISTS defaultSectorFk INT UNSIGNED DEFAULT 37 NOT NULL COMMENT 'Default sector'; \ No newline at end of file diff --git a/modules/invoiceIn/back/methods/invoice-in/invoiceInPdf.js b/modules/invoiceIn/back/methods/invoice-in/invoiceInPdf.js index 681a19fc6..1e9da86a4 100644 --- a/modules/invoiceIn/back/methods/invoice-in/invoiceInPdf.js +++ b/modules/invoiceIn/back/methods/invoice-in/invoiceInPdf.js @@ -29,7 +29,8 @@ module.exports = Self => { http: { path: '/:id/invoice-in-pdf', verb: 'GET' - } + }, + accessScopes: ['DEFAULT', 'read:multimedia'] }); Self.invoiceInPdf = (ctx, id) => Self.printReport(ctx, id, 'invoiceIn');