Merge branch 'dev' into 3199-ticket_recalc_itemTaxCountry
gitea/salix/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Guillermo Bonet 2024-05-14 05:55:02 +00:00
commit 5fe88faabd
7 changed files with 26 additions and 16 deletions

View File

@ -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 ;

View File

@ -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;

View File

@ -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

View File

@ -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 ;

View File

@ -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;

View File

@ -0,0 +1,4 @@
ALTER TABLE vn.productionConfig
ADD IF NOT EXISTS defaultSectorFk INT UNSIGNED DEFAULT 37 NOT NULL COMMENT 'Default sector';

View File

@ -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');