update ACL and structure db

This commit is contained in:
Bernat 2018-11-21 09:19:20 +01:00
parent ead97cb142
commit 3f98deff49
2 changed files with 53 additions and 0 deletions

View File

@ -3,3 +3,6 @@ INSERT INTO `salix`.`ACL` (`id`, `model`, `property`, `accessType`, `permission`
INSERT INTO `salix`.`ACL` (`id`, `model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES (120, 'Travel', '*', 'WRITE', 'ALLOW', 'role', 'buyer');
INSERT INTO `salix`.`ACL` (`id`, `model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES (121, 'Item', 'regularize', '*', 'ALLOW', 'role', 'employee');
INSERT INTO `salix`.`ACL` (`id`, `model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES (122, 'TicketRequest', '*', '*', 'ALLOW', 'role', 'employee');
INSERT INTO `salix`.`fieldAcl` (`model`, `property`, `actionType`, `role`) VALUES('TicketRequest', '*', '*', 'salesPerson');
UPDATE `salix`.`ACL` SET model='TicketRequest', property='*', accessType='*', permission='ALLOW', principalType='ROLE', principalId='salesPerson' WHERE id=122;
INSERT INTO `salix`.`fieldAcl` (`model`, `property`, `actionType`,`role`) VALUES ('ClaimBeginning','*','*','salesAssistant');

View File

@ -0,0 +1,50 @@
USE `cache`;
DROP procedure IF EXISTS `last_buy_refresh`;
DELIMITER $$
USE `cache`$$
CREATE DEFINER=`root`@`%` PROCEDURE `last_buy_refresh`(vRefresh BOOL)
proc: BEGIN
/**
* Crea o actualiza la cache con la última compra y fecha de cada
* artículo hasta ayer. Para obtener la última compra hasta una fecha
* determinada utilizar el procedimiento vn2008.item_last_buy_().
*
* @param vRefresh %TRUE para forzar el recálculo de la cache
**/
DECLARE vCalc INT;
DECLARE started DATE;
DECLARE ended DATE;
DECLARE vLastRefresh DATE;
DECLARE EXIT HANDLER FOR SQLEXCEPTION
BEGIN
CALL cache_calc_unlock (vCalc);
RESIGNAL;
END;
CALL cache_calc_start (vCalc, vRefresh, 'last_buy', NULL);
IF !vRefresh
THEN
LEAVE proc;
END IF;
-- TODO: ¿Se puede usar la fecha del ultimo inventario?
SET started = vn2008.date_inv();-- TIMESTAMPADD(DAY, -90, CURDATE());
SET ended = CURDATE(); -- TIMESTAMPADD(DAY, -1, CURDATE());
CALL vn.buyUltimateFromInterval(NULL, started, ended);
DELETE FROM last_buy;
INSERT INTO last_buy (item_id, warehouse_id, buy_id, landing)
SELECT itemFk, warehouseFk, buyFk, landed
FROM tmp.buyUltimateFromInterval;
DROP TEMPORARY TABLE tmp.buyUltimateFromInterval;
CALL cache_calc_end (vCalc);
END$$
DELIMITER ;