diff --git a/db/.pullinfo.json b/db/.pullinfo.json index 0defed845..27d2c7535 100644 --- a/db/.pullinfo.json +++ b/db/.pullinfo.json @@ -9,7 +9,7 @@ }, "vn": { "view": { - "expeditionPallet_Print": "06613719475fcdba8309607c38cc78efc2e348cca7bc96b48dc3ae3c12426f54" + "expeditionPallet_Print": "ced2b84a114fcb99fce05f0c34f4fc03f3fa387bef92621be1bc306608a84345" } } } diff --git a/db/routines/bi/procedures/claim_ratio_routine.sql b/db/routines/bi/procedures/claim_ratio_routine.sql index 40b879483..3cf4bf8dc 100644 --- a/db/routines/bi/procedures/claim_ratio_routine.sql +++ b/db/routines/bi/procedures/claim_ratio_routine.sql @@ -65,11 +65,12 @@ BEGIN JOIN vn.ticketLastState ts ON ts.ticketFk = t.id JOIN vn.ticketTracking tt ON tt.id = ts.ticketTrackingFk JOIN vn.state st ON st.id = tt.stateFk + JOIN vn.alertLevel al ON al.code = 'DELIVERED' WHERE sc.componentFk = 17 AND sc.isGreuge = 0 AND t.shipped >= '2016-10-01' AND t.shipped < util.VN_CURDATE() - AND st.alertLevel >= 3; + AND st.alertLevel >= al.id; DELETE g.* FROM vn.greuge g diff --git a/db/routines/hedera/procedures/item_getVisible.sql b/db/routines/hedera/procedures/item_getVisible.sql index 8e25eaab3..2f4ef32ab 100644 --- a/db/routines/hedera/procedures/item_getVisible.sql +++ b/db/routines/hedera/procedures/item_getVisible.sql @@ -5,7 +5,7 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `hedera`.`item_getVisible vType INT, vPrefix VARCHAR(255)) BEGIN - + /** * Gets visible items of the specified type at specified date. * @@ -14,7 +14,7 @@ BEGIN * @param vType The type id * @param vPrefix The article prefix to filter or %NULL for all * @return tmp.itemVisible Visible items - */ + */ DECLARE vPrefixLen SMALLINT; DECLARE vFilter VARCHAR(255) DEFAULT NULL; DECLARE vDateInv DATE DEFAULT vn.getInventoryDate(); @@ -23,13 +23,13 @@ BEGIN GET DIAGNOSTICS CONDITION 1 @message = MESSAGE_TEXT; CALL vn.mail_insert( - 'cau@verdnatura.es', - NULL, + 'cau@verdnatura.es', + NULL, CONCAT('hedera.item_getVisible error: ', @message), CONCAT( - 'warehouse: ', IFNULL(vWarehouse, ''), - ', Fecha:', IFNULL(vDate, ''), - ', tipo: ', IFNULL(vType,''), + 'warehouse: ', IFNULL(vWarehouse, ''), + ', Fecha:', IFNULL(vDate, ''), + ', tipo: ', IFNULL(vType,''), ', prefijo: ', IFNULL(vPrefix,''))); RESIGNAL; END; @@ -74,9 +74,10 @@ BEGIN FROM vn.sale m JOIN vn.ticket t ON t.id = m.ticketFk JOIN vn.ticketState s ON s.ticketFk = t.id + JOIN vn.alertLevel al ON al.code = 'DELIVERED' WHERE t.shipped BETWEEN vDateInv AND util.VN_CURDATE() AND t.warehouseFk = vWarehouse - AND s.alertLevel = 3 + AND s.alertLevel = al.id ) t GROUP BY itemFk HAVING quantity > 0; @@ -108,7 +109,7 @@ BEGIN IF(p.depth > 0, p.depth, 0) depth, p.width, p.height, CEIL(s.quantity / t.packing) etiquetas FROM vn.item i - JOIN `filter` f ON f.itemFk = i.id + JOIN `filter` f ON f.itemFk = i.id JOIN currentStock s ON s.itemFk = i.id LEFT JOIN tmp t ON t.itemFk = i.id LEFT JOIN vn.packaging p ON p.id = t.packagingFk diff --git a/db/routines/hedera/procedures/order_confirmWithUser.sql b/db/routines/hedera/procedures/order_confirmWithUser.sql index 0aeaaf65b..9c932aaa1 100644 --- a/db/routines/hedera/procedures/order_confirmWithUser.sql +++ b/db/routines/hedera/procedures/order_confirmWithUser.sql @@ -62,7 +62,7 @@ BEGIN END; -- Carga los datos del pedido - SELECT o.date_send, o.address_id, o.note, a.clientFk, + SELECT o.date_send, o.address_id, o.note, a.clientFk, o.company_id, o.agency_id, c.isTaxDataChecked INTO vDelivery, vAddress, vNotes, vClientId, vCompanyId, vAgencyModeId, vIsTaxDataChecked @@ -121,6 +121,7 @@ BEGIN ) SELECT t.id INTO vTicket FROM vn.ticket t + JOIN vn.alertLevel al ON al.code = 'FREE' LEFT JOIN tPrevia tp ON tp.ticketFk = t.id LEFT JOIN vn.ticketState tls on tls.ticketFk = t.id JOIN hedera.`order` o @@ -131,7 +132,7 @@ BEGIN WHERE o.id = vSelf AND t.refFk IS NULL AND tp.ticketFk IS NULL - AND IFNULL(tls.alertLevel,0) = 0 + AND (tls.alertLevel IS NULL OR tls.alertLevel = al.id) LIMIT 1; -- Crea el ticket en el caso de no existir uno adecuado diff --git a/db/routines/stock/procedures/log_refreshSale.sql b/db/routines/stock/procedures/log_refreshSale.sql index 983616dca..3054f8ecb 100644 --- a/db/routines/stock/procedures/log_refreshSale.sql +++ b/db/routines/stock/procedures/log_refreshSale.sql @@ -16,12 +16,13 @@ BEGIN m.created, TIMESTAMPADD(DAY, tp.life, t.shipped) expired, m.quantity < 0 isIn, - m.isPicked OR s.alertLevel > 1 isPicked + m.isPicked OR s.alertLevel > al.id isPicked FROM vn.sale m JOIN vn.ticket t ON t.id = m.ticketFk JOIN vn.ticketState s ON s.ticketFk = t.id JOIN vn.item i ON i.id = m.itemFk JOIN vn.itemType tp ON tp.id = i.typeFk + JOIN vn.alertLevel al ON al.code = 'ON_PREPARATION' WHERE ( vTableId IS NULL OR (vTableName = 'ticket' AND t.id = vTableId) diff --git a/db/routines/vn/procedures/invoiceOut_new.sql b/db/routines/vn/procedures/invoiceOut_new.sql index 1b486df86..42c3f99da 100644 --- a/db/routines/vn/procedures/invoiceOut_new.sql +++ b/db/routines/vn/procedures/invoiceOut_new.sql @@ -80,8 +80,8 @@ BEGIN OR t.isDeleted OR c.hasToInvoice = FALSE OR itc.id IS NULL - OR a.id IS NULL - OR (vTaxArea = 'WORLD' + OR a.id IS NULL + OR (vTaxArea = 'WORLD' AND (a.customsAgentFk IS NULL OR a.incotermsFk IS NULL)); SELECT SUM(s.quantity * s.price * (100 - s.discount)/100) <> 0 @@ -153,7 +153,9 @@ BEGIN FROM tmp.ticketToInvoice ti LEFT JOIN ticketState ts ON ti.id = ts.ticketFk JOIN state s - WHERE IFNULL(ts.alertLevel, 0) < 3 and s.`code` = getAlert3State(ti.id); + JOIN alertLevel al ON al.code = 'DELIVERED' + WHERE (ts.alertLevel IS NULL OR ts.alertLevel < al.id) + AND s.`code` = getAlert3State(ti.id); INSERT INTO ticketTracking(stateFk, ticketFk, userFk) SELECT * FROM tmp.updateInter; diff --git a/db/routines/vn/procedures/prepareTicketList.sql b/db/routines/vn/procedures/prepareTicketList.sql index f0f47f9a2..29c95cc9f 100644 --- a/db/routines/vn/procedures/prepareTicketList.sql +++ b/db/routines/vn/procedures/prepareTicketList.sql @@ -6,14 +6,16 @@ BEGIN (PRIMARY KEY (ticketFk)) ENGINE = MEMORY SELECT t.id ticketFk, t.clientFk - FROM vn.ticket t - LEFT JOIN vn.ticketState ts ON ts.ticketFk = t.id - JOIN vn.client c ON c.id = t.clientFk + FROM ticket t + JOIN alertLevel al ON al.code = 'DELIVERED' + LEFT JOIN ticketState ts ON ts.ticketFk = t.id + JOIN client c ON c.id = t.clientFk + WHERE c.typeFk IN ('normal','handMaking','internalUse') AND ( t.shipped BETWEEN util.VN_CURDATE() AND vEndingDate OR ( - ts.alertLevel < 3 + ts.alertLevel < al.id AND t.shipped >= vStartingDate AND t.shipped < util.VN_CURDATE() ) diff --git a/db/routines/vn/procedures/productionControl.sql b/db/routines/vn/procedures/productionControl.sql index b42645d1e..6505473fa 100644 --- a/db/routines/vn/procedures/productionControl.sql +++ b/db/routines/vn/procedures/productionControl.sql @@ -1,6 +1,6 @@ DELIMITER $$ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`productionControl`( - vWarehouseFk INT, + vWarehouseFk INT, vScopeDays INT ) proc: BEGIN @@ -67,7 +67,7 @@ proc: BEGIN wk.code salesPersonCode, p.id provinceFk, tls.productionOrder, - IFNULL(tls.alertLevel, 0) alertLevel, + IFNULL(tls.alertLevel, al.id) alertLevel, t.isBoxed palletized, IF(rm.isPickingAllowed, rm.bufferFk, NULL) ubicacion, tlu.lastUpdated, @@ -81,6 +81,7 @@ proc: BEGIN rm.bufferFk FROM tmp.productionTicket tt JOIN ticket t ON tt.ticketFk = t.id + JOIN alertLevel al ON al.code = 'FREE' LEFT JOIN ticketStateToday tst ON tst.ticketFk = t.id LEFT JOIN `state` st ON st.id = tst.state LEFT JOIN client c ON c.id = t.clientFk @@ -101,7 +102,7 @@ proc: BEGIN LEFT JOIN parking pk ON pk.id = tp.parkingFk WHERE t.warehouseFk = vWarehouseFk AND dm.code IN ('AGENCY', 'DELIVERY', 'PICKUP'); - + UPDATE tmp.productionBuffer pb JOIN ( SELECT pb.ticketFk, GROUP_CONCAT(p.code) previaParking @@ -109,12 +110,12 @@ proc: BEGIN JOIN sale s ON s.ticketFk = pb.ticketFk JOIN saleGroupDetail sgd ON sgd.saleFk = s.id JOIN saleGroup sg ON sg.id = sgd.saleGroupFk - JOIN parking p ON p.id = sg.parkingFk + JOIN parking p ON p.id = sg.parkingFk GROUP BY pb.ticketFk ) t ON t.ticketFk = pb.ticketFk SET pb.previaParking = t.previaParking; - -- Problemas por ticket + -- Problemas por ticket ALTER TABLE tmp.productionBuffer CHANGE COLUMN `problem` `problem` VARCHAR(255), ADD COLUMN `collectionH` INT, diff --git a/db/routines/vn/procedures/ticketGetVisibleAvailable.sql b/db/routines/vn/procedures/ticketGetVisibleAvailable.sql index 07dfa69e5..3717d57e3 100644 --- a/db/routines/vn/procedures/ticketGetVisibleAvailable.sql +++ b/db/routines/vn/procedures/ticketGetVisibleAvailable.sql @@ -7,13 +7,16 @@ BEGIN DECLARE vShipped DATE; DECLARE vWarehouse TINYINT; DECLARE vAlertLevel INT; + DECLARE vAlertLevelFree INT; - SELECT t.warehouseFk, t.shipped, ts.alertLevel INTO vWarehouse, vShipped, vAlertLevel + SELECT t.warehouseFk, t.shipped, ts.alertLevel, al.id + INTO vWarehouse, vShipped, vAlertLevel, vAlertLevelFree FROM ticket t + JOIN alertLevel al ON al.code = 'FREE' LEFT JOIN ticketState ts ON ts.ticketFk = vTicket WHERE t.id = vTicket; - IF vAlertLevel IS NULL OR vAlertLevel = 0 THEN + IF vAlertLevel IS NULL OR vAlertLevel = vAlertLevelFree THEN IF vShipped >= util.VN_CURDATE() THEN CALL cache.available_refresh(vAvailableCalc, FALSE, vWarehouse, vShipped); END IF; diff --git a/db/routines/vn/procedures/ticketMissed_List.sql b/db/routines/vn/procedures/ticketMissed_List.sql deleted file mode 100644 index 6b0f66e6a..000000000 --- a/db/routines/vn/procedures/ticketMissed_List.sql +++ /dev/null @@ -1,49 +0,0 @@ -DELIMITER $$ -CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticketMissed_List`(vTicketFk INT) -BEGIN - - DECLARE vParkingFk INT; - DECLARE vParked DATETIME; - DECLARE vLevel INT; - DECLARE vCollectionFk INT; - - SELECT IFNULL(`level`,0), IFNULL(collectionFk,0) - INTO vLevel, vCollectionFk - FROM vn.ticketCollection - WHERE ticketFk = vTicketFk - LIMIT 1; - - SELECT created, parkingFk - INTO vParked, vParkingFk - FROM vn.ticketParking - WHERE ticketFk = vTicketFk; - - SELECT tp.ticketFk, CONCAT(tc.collectionFk, ' - ', tc.level) coleccion, tp.created, p.code, am.name as Agencia - FROM vn.ticketParking tp - JOIN vn.parking p ON p.id = tp.parkingFk - JOIN vn.sector sc ON sc.id = p.sectorFk - LEFT JOIN vn.ticketCollection tc ON tc.ticketFk = tp.ticketFk - JOIN vn.ticketStateToday tst ON tst.ticketFk = tp.ticketFk - JOIN vn.ticket t ON t.id = tp.ticketFk - JOIN vn.zone z ON z.id = t.zoneFk - JOIN vn.agencyMode am ON am.id = z.agencyModeFk - JOIN vn.state s ON s.id = tst.state - WHERE (s.alertLevel < 2 - AND tp.parkingFk = vParkingFk - AND sc.isPackagingArea - AND ( - ( - ( IFNULL(tc.collectionFk,-1) != IFNULL(@vCollectionFk,0) AND tp.created < vParked ) - OR - ( tc.collectionFk = vCollectionFk AND LEFT(tc.level,1) < LEFT(vLevel,1) ) - ) - )) -- Etiquetas que no se han escaneado y ya estamos con una posterior - OR - (s.alertLevel > 1 - AND tp.parkingFk = vParkingFk - AND sc.isPackagingArea - AND tp.created < vParked - AND t.packages <=> 0); - -END$$ -DELIMITER ; diff --git a/db/routines/vn/procedures/ticketParking_findSkipped.sql b/db/routines/vn/procedures/ticketParking_findSkipped.sql index b00006ffe..7713d5b50 100644 --- a/db/routines/vn/procedures/ticketParking_findSkipped.sql +++ b/db/routines/vn/procedures/ticketParking_findSkipped.sql @@ -1,64 +1,66 @@ DELIMITER $$ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticketParking_findSkipped`(vTicketFk INT, vItemPackingTypeFk VARCHAR(1)) BEGIN - + /** * Averigua los tickets que se han saltado por un error en el proceso encajado * @param vTicketFk Ticket * @param vItemPackingTypeFk Modo de encajado * @return un select con los tickets afectados - */ + */ DECLARE vParkingFk INT; DECLARE vParked DATETIME; DECLARE vLevel INT; DECLARE vWagon INT; DECLARE vCollectionFk INT; - - SELECT IFNULL(`level`,0), IFNULL(`wagon`,0),IFNULL(collectionFk,0) + + SELECT IFNULL(`level`,0), IFNULL(`wagon`,0),IFNULL(collectionFk,0) INTO vLevel, vWagon, vCollectionFk FROM vn.ticketCollection tc JOIN vn.collection c ON c.id = tc.collectionFk AND c.itemPackingTypeFk = vItemPackingTypeFk WHERE ticketFk = vTicketFk ORDER BY c.id DESC LIMIT 1; - - SELECT created, parkingFk + + SELECT created, parkingFk INTO vParked, vParkingFk FROM vn.ticketParking tp - JOIN vn.parking p ON p.id = tp.parkingFk - JOIN vn.sector s ON s.id = p.sectorFk + JOIN vn.parking p ON p.id = tp.parkingFk + JOIN vn.sector s ON s.id = p.sectorFk WHERE ticketFk = vTicketFk AND s.itemPackingTypeFk = vItemPackingTypeFk AND s.isPackagingArea ; - + SELECT tp.ticketFk, CONCAT(tc.collectionFk, ' ', tc.wagon, ' - ', tc.level) coleccion, tp.created, p.code, am.name as Agencia FROM vn.ticketParking tp - JOIN vn.parking p ON p.id = tp.parkingFk - JOIN vn.sector sc ON sc.id = p.sectorFk - LEFT JOIN vn.ticketCollection tc ON tc.ticketFk = tp.ticketFk - JOIN vn.ticketStateToday tst ON tst.ticketFk = tp.ticketFk - JOIN vn.ticket t ON t.id = tp.ticketFk - JOIN vn.zone z ON z.id = t.zoneFk - JOIN vn.agencyMode am ON am.id = z.agencyModeFk - JOIN vn.state s ON s.id = tst.state - WHERE (s.alertLevel < 2 + JOIN vn.parking p ON p.id = tp.parkingFk + JOIN vn.sector sc ON sc.id = p.sectorFk + LEFT JOIN vn.ticketCollection tc ON tc.ticketFk = tp.ticketFk + JOIN vn.ticketStateToday tst ON tst.ticketFk = tp.ticketFk + JOIN vn.ticket t ON t.id = tp.ticketFk + JOIN vn.zone z ON z.id = t.zoneFk + JOIN vn.agencyMode am ON am.id = z.agencyModeFk + JOIN vn.state s ON s.id = tst.state + JOIN vn.alertLevel alPacked ON alPacked.code = 'PACKED' + JOIN vn.alertLevel alOnPreparation ON alOnPreparation.code = 'ON_PREPARATION' + WHERE (s.alertLevel < alPacked.id AND tp.parkingFk = vParkingFk AND sc.isPackagingArea AND ( ( IFNULL(tc.collectionFk,-1) != IFNULL(@vCollectionFk,0) AND tp.created < vParked ) OR - ( tc.collectionFk = vCollectionFk + ( tc.collectionFk = vCollectionFk AND (LEFT(tc.wagon,1) < LEFT(vWagon,1) - OR (LEFT(tc.wagon,1) = LEFT(vWagon,1) AND LEFT(tc.level,1) < LEFT(vLevel,1))) + OR (LEFT(tc.wagon,1) = LEFT(vWagon,1) AND LEFT(tc.level,1) < LEFT(vLevel,1))) ) ) ) -- Etiquetas que no se han escaneado y ya estamos con una posterior OR - (s.alertLevel > 1 + (s.alertLevel > alOnPreparation.id AND tp.parkingFk = vParkingFk AND sc.isPackagingArea - AND tp.created < vParked + AND tp.created < vParked AND t.packages <=> 0); END$$ DELIMITER ; diff --git a/db/routines/vn/procedures/ticketStateToday_setState.sql b/db/routines/vn/procedures/ticketStateToday_setState.sql index 73a92bbb5..bd79043b4 100644 --- a/db/routines/vn/procedures/ticketStateToday_setState.sql +++ b/db/routines/vn/procedures/ticketStateToday_setState.sql @@ -1,26 +1,29 @@ DELIMITER $$ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticketStateToday_setState`(vTicketFk INT, vStateCode VARCHAR(45)) BEGIN - + /* Modifica el estado de un ticket de hoy - * + * * @param vTicketFk el id del ticket * @param vStateCode estado a modificar del ticket - * + * */ - + DECLARE vAlertLevel INT; - - SELECT s.alertLevel INTO vAlertLevel - FROM state s - JOIN ticketStateToday tst ON tst.state = s.id + DECLARE vAlertLevelPacked INT; + + SELECT s.alertLevel, al.id + INTO vAlertLevel, vAlertLevelPacked + FROM state s + JOIN ticketStateToday tst ON tst.state = s.id + JOIN alertLevel al ON al.code = 'PACKED' WHERE tst.ticketFk = vTicketFk LIMIT 1; - - IF vAlertLevel < 2 THEN - + + IF vAlertLevel < vAlertLevelPacked THEN + CALL vn.ticket_setState(vTicketFk, vStateCode); - + END IF; END$$ diff --git a/db/routines/vn/procedures/ticketStateUpdate.sql b/db/routines/vn/procedures/ticketStateUpdate.sql deleted file mode 100644 index 4e19b7eb4..000000000 --- a/db/routines/vn/procedures/ticketStateUpdate.sql +++ /dev/null @@ -1,26 +0,0 @@ -DELIMITER $$ -CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticketStateUpdate`(vTicketFk INT, vStateCode VARCHAR(45)) -BEGIN - - /* - * @deprecated:utilizar ticket_setState - */ - - DECLARE vAlertLevel INT; - - SELECT s.alertLevel INTO vAlertLevel - FROM vn.state s - JOIN vn.ticketState ts ON ts.stateFk = s.id - WHERE ts.ticketFk = vTicketFk; - - IF !(vStateCode = 'ON_CHECKING' AND vAlertLevel > 1) THEN - - INSERT INTO ticketTracking(stateFk, ticketFk, userFk) - SELECT id, vTicketFk, account.myUser_getId() - FROM vn.state - WHERE `code` = vStateCode collate utf8_unicode_ci; - - END IF; - -END$$ -DELIMITER ; diff --git a/db/routines/vn/procedures/ticket_DelayTruck.sql b/db/routines/vn/procedures/ticket_DelayTruck.sql index 7a3170d68..20601ee49 100644 --- a/db/routines/vn/procedures/ticket_DelayTruck.sql +++ b/db/routines/vn/procedures/ticket_DelayTruck.sql @@ -13,10 +13,11 @@ BEGIN CREATE TEMPORARY TABLE tmp.ticket SELECT ticketFk FROM tmp.productionBuffer + JOIN alertLevel al ON al.code = 'FREE' WHERE shipped = util.VN_CURDATE() AND problem LIKE '%I:%' AND (HH <= vHour OR HH = vHour AND mm < vMinute) - AND alertLevel = 0; + AND alertLevel = al.id; OPEN cur1; diff --git a/db/routines/vn/triggers/expedition_beforeInsert.sql b/db/routines/vn/triggers/expedition_beforeInsert.sql index 685de72cb..e73ed9e49 100644 --- a/db/routines/vn/triggers/expedition_beforeInsert.sql +++ b/db/routines/vn/triggers/expedition_beforeInsert.sql @@ -3,25 +3,25 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`expedition_beforeInse BEFORE INSERT ON `expedition` FOR EACH ROW BEGIN - DECLARE intcounter INT; - DECLARE vShipFk INT; + DECLARE vMaxCounter INT; SET NEW.editorFk = account.myUser_getId(); - IF NEW.freightItemFk IS NOT NULL THEN + IF NEW.freightItemFk IS NOT NULL THEN UPDATE ticket SET packages = IFNULL(packages, 0) + 1 WHERE id = NEW.ticketFk; - SELECT IFNULL(MAX(counter),0) +1 INTO intcounter - FROM expedition e - INNER JOIN ticket t1 ON e.ticketFk = t1.id + SELECT IFNULL(MAX(counter),0) + 1 INTO vMaxCounter + FROM expedition e + JOIN alertLevel al ON al.code = 'DELIVERED' + JOIN ticket t1 ON e.ticketFk = t1.id LEFT JOIN ticketState ts ON ts.ticketFk = t1.id - INNER JOIN ticket t2 ON t2.addressFk = t1.addressFk AND DATE(t2.shipped) = DATE(t1.shipped) + JOIN ticket t2 ON t2.addressFk = t1.addressFk AND DATE(t2.shipped) = DATE(t1.shipped) AND t1.warehouseFk = t2.warehouseFk - WHERE t2.id = NEW.ticketFk AND ts.alertLevel < 3 AND t1.companyFk = t2.companyFk + WHERE t2.id = NEW.ticketFk AND ts.alertLevel < al.id AND t1.companyFk = t2.companyFk AND t1.agencyModeFk = t2.agencyModeFk; - SET NEW.`counter` = intcounter; + SET NEW.`counter` = vMaxCounter; END IF; END$$ DELIMITER ; diff --git a/modules/account/back/models/role-inherit.json b/modules/account/back/models/role-inherit.json index a89f47b77..30d526471 100644 --- a/modules/account/back/models/role-inherit.json +++ b/modules/account/back/models/role-inherit.json @@ -1,6 +1,9 @@ { "name": "RoleInherit", "base": "VnModel", + "mixins": { + "Loggable": true + }, "options": { "mysql": { "table": "account.roleInherit"