#6321 - Negative tickets #1945
|
@ -49,6 +49,7 @@ describe('MRWConfig createShipment()', () => {
|
|||
|
||||
await models.MrwConfig.create(
|
||||
{
|
||||
'id': 1,
|
||||
'url': 'https://url.com',
|
||||
'user': 'user',
|
||||
'password': 'password',
|
||||
|
|
|
@ -7,7 +7,7 @@ describe('NotificationSubscription getList()', () => {
|
|||
const notifications = await models.Notification.find({});
|
||||
const totalAvailable = notifications.length - active.length;
|
||||
|
||||
expect(active.length).toEqual(2);
|
||||
expect(active.length).toEqual(3);
|
||||
expect(available.length).toEqual(totalAvailable);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
"properties": {
|
||||
"id": {
|
||||
"type": "number",
|
||||
"id": true,
|
||||
"required": true
|
||||
},
|
||||
"url": {
|
||||
|
|
|
@ -7,8 +7,8 @@ SET foreign_key_checks = 0;
|
|||
|
||||
-- XXX: vn-database
|
||||
|
||||
INSERT INTO util.config (environment, mockTime, mockUtcTime, mockEnabled)
|
||||
VALUES ('local', '2001-01-01 12:00:00', '2001-01-01 11:00:00', TRUE);
|
||||
INSERT INTO util.config (id, environment, mockTime, mockUtcTime, mockEnabled)
|
||||
VALUES (1, 'local', '2001-01-01 12:00:00', '2001-01-01 11:00:00', TRUE);
|
||||
/* #5483
|
||||
INSERT INTO vn.entryConfig (defaultEntry, mailToNotify, inventorySupplierFk, maxLockTime, defaultSupplierFk)
|
||||
VALUES(1, NULL, 1, 300, 1);
|
||||
|
@ -70,7 +70,7 @@ UPDATE vn.supplier
|
|||
|
||||
UPDATE `vn`.`claimRatio` SET `claimAmount` = '10' WHERE (`clientFk` = '1101');
|
||||
|
||||
INSERT INTO `vn`.`agency` (`name`, `warehouseFk`, `isOwn`, `isAnyVolumeAllowed`)
|
||||
INSERT INTO `vn`.`agency` (`name`, `warehouseFk`, `isOwn`, `isAnyVolumeAllowed`)
|
||||
VALUES
|
||||
('Agencia', '1', '1', '1'),
|
||||
('Otra agencia ', '1', '0', '0');
|
||||
|
|
|
@ -60,13 +60,13 @@ INSERT INTO `vn`.`ticketConfig` (`id`, `scopeDays`)
|
|||
VALUES
|
||||
('1', '6');
|
||||
|
||||
INSERT INTO `vn`.`bionicConfig` (`generalInflationCoeficient`, `minimumDensityVolumetricWeight`, `verdnaturaVolumeBox`, `itemCarryBox`)
|
||||
INSERT INTO `vn`.`bionicConfig` (`id`, `generalInflationCoeficient`, `minimumDensityVolumetricWeight`, `verdnaturaVolumeBox`, `itemCarryBox`)
|
||||
VALUES
|
||||
(1.30, 167.00, 138000, 71);
|
||||
(1, 1.30, 167.00, 138000, 71);
|
||||
|
||||
INSERT INTO `vn`.`chatConfig` (`host`, `api`)
|
||||
INSERT INTO `vn`.`chatConfig` (`id`, `host`, `api`)
|
||||
VALUES
|
||||
('https://chat.verdnatura.es', 'https://chat.verdnatura.es/api/v1');
|
||||
(1, 'https://chat.verdnatura.es', 'https://chat.verdnatura.es/api/v1');
|
||||
|
||||
INSERT IGNORE INTO `vn`.`greugeConfig`(`id`, `freightPickUpPrice`)
|
||||
VALUES
|
||||
|
@ -592,13 +592,13 @@ INSERT INTO `vn`.`supplierAccount`(`id`, `supplierFk`, `iban`, `bankEntityFk`)
|
|||
VALUES
|
||||
(241, 442, 'ES111122333344111122221111', 128);
|
||||
|
||||
INSERT INTO `vn`.`company`(`id`, `code`, `supplierAccountFk`, `workerManagerFk`, `companyCode`, `sage200Company`, `expired`, `companyGroupFk`, `phytosanitary` , `clientFk`)
|
||||
INSERT INTO `vn`.`company`(`id`, `code`, `supplierAccountFk`, `workerManagerFk`, `companyCode`, `expired`, `companyGroupFk`, `phytosanitary` , `clientFk`)
|
||||
VALUES
|
||||
(69 , 'CCs', NULL, 30, NULL, 0, NULL, 1, NULL , NULL),
|
||||
(442 , 'VNL', 241, 30, 2 , 1, NULL, 2, 'VNL Company - Plant passport' , 1101),
|
||||
(567 , 'VNH', NULL, 30, NULL, 4, NULL, 1, 'VNH Company - Plant passport' , NULL),
|
||||
(791 , 'FTH', NULL, 30, NULL, 3, '2015-11-30', 1, NULL , NULL),
|
||||
(1381, 'ORN', NULL, 30, NULL, 7, NULL, 1, 'ORN Company - Plant passport' , NULL);
|
||||
(69 , 'CCs', NULL, 30, 0, NULL, 1, NULL , NULL),
|
||||
(442 , 'VNL', 241, 30, 1, NULL, 2, 'VNL Company - Plant passport' , 1101),
|
||||
(567 , 'VNH', NULL, 30, 4, NULL, 1, 'VNH Company - Plant passport' , NULL),
|
||||
(791 , 'FTH', NULL, 30, 3, '2015-11-30', 1, NULL , NULL),
|
||||
(1381, 'ORN', NULL, 30, 7, NULL, 1, 'ORN Company - Plant passport' , NULL);
|
||||
|
||||
INSERT INTO `vn`.`taxArea` (`code`, `claveOperacionFactura`, `CodigoTransaccion`)
|
||||
VALUES
|
||||
|
@ -608,7 +608,8 @@ INSERT INTO `vn`.`taxArea` (`code`, `claveOperacionFactura`, `CodigoTransaccion`
|
|||
('WORLD', 2, 15);
|
||||
|
||||
INSERT INTO vn.invoiceOutConfig
|
||||
SET parallelism = 8;
|
||||
SET id = 1,
|
||||
parallelism = 8;
|
||||
|
||||
INSERT INTO `vn`.`invoiceOutSerial` (`code`, `description`, `isTaxed`, `taxAreaFk`, `isCEE`, `type`)
|
||||
VALUES
|
||||
|
@ -714,7 +715,7 @@ INSERT INTO `vn`.`zoneClosure` (`zoneFk`, `dated`, `hour`)
|
|||
(12, util.VN_CURDATE(), '23:59'),
|
||||
(13, util.VN_CURDATE(), '23:59');
|
||||
|
||||
INSERT INTO `vn`.`zoneConfig` (`scope`) VALUES ('1');
|
||||
INSERT INTO `vn`.`zoneConfig` (`id`, `scope`) VALUES (1, '1');
|
||||
|
||||
INSERT INTO `vn`.`route`(`id`, `time`, `workerFk`, `created`, `vehicleFk`, `agencyModeFk`, `description`, `m3`, `cost`, `started`, `finished`, `zoneFk`)
|
||||
VALUES
|
||||
|
@ -983,9 +984,9 @@ INSERT INTO `vn`.`packaging`(`id`, `volume`, `width`, `height`, `depth`, `isPack
|
|||
('cc', 1640038.00, 56.00, 220.00, 128.00, 1, util.VN_CURDATE(), 15, 90.00),
|
||||
('pallet 100', 2745600.00, 100.00, 220.00, 120.00, 1, util.VN_CURDATE(), 16, 0.00);
|
||||
|
||||
INSERT INTO `vn`.`packagingConfig`(`upperGap`, `defaultSmallPackageFk`, `defaultBigPackageFk`)
|
||||
INSERT INTO `vn`.`packagingConfig`(`id`, `upperGap`, `defaultSmallPackageFk`, `defaultBigPackageFk`)
|
||||
VALUES
|
||||
('10', 1, 'pallet 100');
|
||||
(1, '10', 1, 'pallet 100');
|
||||
|
||||
INSERT INTO `vn`.`expeditionStateType`(`id`, `description`, `code`)
|
||||
VALUES
|
||||
|
@ -1491,8 +1492,8 @@ INSERT INTO `bs`.`waste`(`buyer`, `year`, `week`, `family`, `itemFk`, `itemTypeF
|
|||
|
||||
INSERT INTO `vn`.`buy`(`id`,`entryFk`,`itemFk`,`buyingValue`,`quantity`,`packagingFk`,`stickers`,`freightValue`,`packageValue`,`comissionValue`,`packing`,`grouping`,`groupingMode`,`location`,`price1`,`price2`,`price3`, `printedStickers`,`isChecked`,`isIgnored`,`weight`, `created`)
|
||||
VALUES
|
||||
(1, 1, 1, 50, 5000, 4, 1, 1.500, 1.500, 0.000, 1, 1, 1, NULL, 0.00, 99.6, 99.4, 0, 1, 0, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -2 MONTH)),
|
||||
(2, 2, 1, 50, 100, 4, 1, 1.500, 1.500, 0.000, 1, 1, 1, NULL, 0.00, 99.6, 99.4, 0, 1, 0, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH)),
|
||||
(1, 1, 1, 50, 5000, 4, 1, 1.500, 1.500, 0.000, 1, 1, 1, NULL, 0.00, 99.6, 99.4, 0, 1, 0, 1, util.VN_CURDATE() - INTERVAL 2 MONTH),
|
||||
(2, 2, 1, 50, 100, 4, 1, 1.500, 1.500, 0.000, 1, 1, 1, NULL, 0.00, 99.6, 99.4, 0, 1, 0, 1, util.VN_CURDATE() - INTERVAL 1 MONTH),
|
||||
(3, 3, 1, 50, 100, 4, 1, 1.500, 1.500, 0.000, 1, 1, 0, NULL, 0.00, 99.6, 99.4, 0, 1, 0, 1, util.VN_CURDATE()),
|
||||
(4, 2, 2, 5, 450, 3, 1, 1.000, 1.000, 0.000, 10, 10, 0, NULL, 0.00, 7.30, 7.00, 0, 1, 0, 2.5, util.VN_CURDATE()),
|
||||
(5, 3, 3, 55, 500, 5, 1, 1.000, 1.000, 0.000, 1, 1, 0, NULL, 0.00, 78.3, 75.6, 0, 1, 0, 2.5, util.VN_CURDATE()),
|
||||
|
@ -1868,8 +1869,7 @@ INSERT INTO `vn`.`claimEnd`(`id`, `saleFk`, `claimFk`, `workerFk`, `claimDestina
|
|||
|
||||
INSERT INTO `vn`.`claimConfig`(`id`, `maxResponsibility`)
|
||||
VALUES
|
||||
(1, 50),
|
||||
(2, 30);
|
||||
(1, 50);
|
||||
|
||||
INSERT INTO `vn`.`claimRatio`(`clientFk`, `yearSale`, `claimAmount`, `claimingRate`, `priceIncreasing`, `packingRate`)
|
||||
VALUES
|
||||
|
@ -2504,9 +2504,9 @@ INSERT INTO `hedera`.`imageCollectionSize`(`id`, `collectionFk`,`width`, `height
|
|||
VALUES
|
||||
(1, 4, 160, 160);
|
||||
|
||||
INSERT INTO `vn`.`rateConfig`(`rate0`, `rate1`, `rate2`, `rate3`)
|
||||
INSERT INTO `vn`.`rateConfig`(`id`, `rate0`, `rate1`, `rate2`, `rate3`)
|
||||
VALUES
|
||||
(36, 31, 25, 21);
|
||||
(1, 36, 31, 25, 21);
|
||||
|
||||
INSERT INTO `vn`.`rate`(`dated`, `warehouseFk`, `rate0`, `rate1`, `rate2`, `rate3`)
|
||||
VALUES
|
||||
|
@ -2697,9 +2697,9 @@ INSERT INTO `bs`.`sale` (`saleFk`, `amount`, `dated`, `typeFk`, `clientFk`)
|
|||
(4, 33.8, util.VN_CURDATE(), 1, 1101),
|
||||
(30, 34.4, util.VN_CURDATE(), 1, 1108);
|
||||
|
||||
INSERT INTO `vn`.`docuwareConfig` (`url`)
|
||||
INSERT INTO `vn`.`docuwareConfig` (`id`, `url`)
|
||||
VALUES
|
||||
('http://docuware.url/');
|
||||
(1, 'http://docuware.url/');
|
||||
|
||||
INSERT INTO `vn`.`calendarHolidaysName` (`id`, `name`)
|
||||
VALUES
|
||||
|
@ -2796,11 +2796,12 @@ INSERT INTO `vn`.`packingSite` (`id`, `code`, `hostFk`, `monitorId`)
|
|||
VALUES
|
||||
(1, 'h1', 1, '');
|
||||
|
||||
INSERT INTO `vn`.`packingSiteConfig` (`shinobiUrl`, `shinobiToken`, `shinobiGroupKey`, `avgBoxingTime`)
|
||||
INSERT INTO `vn`.`packingSiteConfig` (`id`, `shinobiUrl`, `shinobiToken`, `shinobiGroupKey`, `avgBoxingTime`)
|
||||
VALUES
|
||||
('', 'SHINNOBI_TOKEN', 'GROUP_TOKEN', 6000);
|
||||
(1, '', 'SHINNOBI_TOKEN', 'GROUP_TOKEN', 6000);
|
||||
INSERT INTO `util`.`notificationConfig`
|
||||
SET `cleanDays` = 90;
|
||||
SET `id` = 1,
|
||||
`cleanDays` = 90;
|
||||
|
||||
INSERT INTO `util`.`notification` (`id`, `name`, `description`)
|
||||
VALUES
|
||||
|
@ -2809,7 +2810,8 @@ INSERT INTO `util`.`notification` (`id`, `name`, `description`)
|
|||
(3, 'not-main-printer-configured', 'A printer distinct than main has been configured'),
|
||||
(4, 'supplier-pay-method-update', 'A supplier pay method has been updated'),
|
||||
(5, 'modified-entry', 'An entry has been modified'),
|
||||
(6, 'book-entry-deleted', 'accounting entries deleted');
|
||||
(6, 'book-entry-deleted', 'accounting entries deleted'),
|
||||
(7, 'zone-included','An email to notify zoneCollisions');
|
||||
|
||||
INSERT INTO `util`.`notificationAcl` (`notificationFk`, `roleFk`)
|
||||
VALUES
|
||||
|
@ -2819,7 +2821,8 @@ INSERT INTO `util`.`notificationAcl` (`notificationFk`, `roleFk`)
|
|||
(3, 9),
|
||||
(4, 1),
|
||||
(5, 9),
|
||||
(6, 9);
|
||||
(6, 9),
|
||||
(7, 9);
|
||||
|
||||
INSERT INTO `util`.`notificationQueue` (`id`, `notificationFk`, `params`, `authorFk`, `status`, `created`)
|
||||
VALUES
|
||||
|
@ -2836,8 +2839,8 @@ INSERT INTO `util`.`notificationSubscription` (`notificationFk`, `userFk`)
|
|||
(2, 1109),
|
||||
(1, 9),
|
||||
(1, 3),
|
||||
(6, 9);
|
||||
|
||||
(6, 9),
|
||||
(7, 9);
|
||||
|
||||
INSERT INTO `vn`.`routeConfig` (`id`, `defaultWorkCenterFk`)
|
||||
VALUES
|
||||
|
@ -2853,7 +2856,7 @@ INSERT INTO `vn`.`collection` (`id`, `created`, `workerFk`, `stateFk`, `itemPack
|
|||
|
||||
INSERT INTO `vn`.`itemConfig` (`id`, `isItemTagTriggerDisabled`, `monthToDeactivate`, `wasteRecipients`, `validPriorities`, `defaultPriority`, `defaultTag`, `warehouseFk`)
|
||||
VALUES
|
||||
(0, 0, 24, '', '[1,2,3]', 2, 56, 60);
|
||||
(1, 0, 24, '', '[1,2,3]', 2, 56, 60);
|
||||
|
||||
INSERT INTO `vn`.`ticketCollection` (`ticketFk`, `collectionFk`, `created`, `level`, `wagon`, `smartTagFk`, `usedShelves`, `itemCount`, `liters`)
|
||||
VALUES
|
||||
|
@ -2890,7 +2893,7 @@ INSERT INTO `vn`.`ticketLog` (originFk, userFk, `action`, creationDate, changedM
|
|||
(1, 18, 'insert', '1999-05-09 10:00:00', 'Ticket', 45, 'Super Man' , NULL, '{"id":45,"clientFk":8608,"warehouseFk":60,"shipped":"2023-05-16T22:00:00.000Z","nickname":"Super Man","addressFk":48637,"isSigned":true,"isLabeled":true,"isPrinted":true,"packages":0,"hour":0,"created":"2023-05-16T11:42:56.000Z","isBlocked":false,"hasPriority":false,"companyFk":442,"agencyModeFk":639,"landed":"2023-05-17T22:00:00.000Z","isBoxed":true,"isDeleted":true,"zoneFk":713,"zonePrice":13,"zoneBonus":0}', NULL);
|
||||
INSERT INTO `vn`.`osTicketConfig` (`id`, `host`, `user`, `password`, `oldStatus`, `newStatusId`, `day`, `comment`, `hostDb`, `userDb`, `passwordDb`, `portDb`, `responseType`, `fromEmailId`, `replyTo`)
|
||||
VALUES
|
||||
(0, 'http://localhost:56596/scp', 'ostadmin', 'Admin1', '1,6', 3, 60, 'Este CAU se ha cerrado automáticamente. Si el problema persiste responda a este mensaje.', 'localhost', 'osticket', 'osticket', 40003, 'reply', 1, 'all');
|
||||
(1, 'http://localhost:56596/scp', 'ostadmin', 'Admin1', '1,6', 3, 60, 'Este CAU se ha cerrado automáticamente. Si el problema persiste responda a este mensaje.', 'localhost', 'osticket', 'osticket', 40003, 'reply', 1, 'all');
|
||||
|
||||
INSERT INTO `vn`.`mdbApp` (`app`, `baselineBranchFk`, `userFk`, `locked`)
|
||||
VALUES
|
||||
|
@ -3720,8 +3723,8 @@ UPDATE vn.collection
|
|||
UPDATE vn.sale
|
||||
SET isPicked =FALSE;
|
||||
|
||||
INSERT INTO vn.machineWorkerConfig(maxHours)
|
||||
VALUES(12);
|
||||
INSERT INTO vn.machineWorkerConfig(id, maxHours)
|
||||
VALUES(1, 12);
|
||||
|
||||
INSERT INTO vn.workerAppTester(workerFk) VALUES(66);
|
||||
|
||||
|
|
|
@ -17,13 +17,13 @@ BEGIN
|
|||
e.id accountFk,
|
||||
UCASE(e.name),
|
||||
''
|
||||
FROM expense e
|
||||
FROM vn.expense e
|
||||
UNION
|
||||
SELECT company_getCode(vCompanyFk),
|
||||
a.account,
|
||||
UCASE(a.bank),
|
||||
''
|
||||
FROM accounting a
|
||||
FROM vn.accounting a
|
||||
WHERE a.isActive
|
||||
AND a.`account`
|
||||
UNION
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
DELIMITER $$
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `vn`.`travel_hasUniqueAwb`(
|
||||
vSelf INT
|
||||
)
|
||||
RETURNS BOOL
|
||||
READS SQL DATA
|
||||
BEGIN
|
||||
/**
|
||||
* Comprueba que el travel pasado tiene un AWB lógico,
|
||||
* no se pueden tener varios AWB asociados al mismo DUA
|
||||
*
|
||||
* @param vSelf Id del travel
|
||||
*/
|
||||
DECLARE vHasUniqueAwb BOOL DEFAULT TRUE;
|
||||
|
||||
SELECT NOT COUNT(t2.awbFk) INTO vHasUniqueAwb
|
||||
FROM entry e
|
||||
JOIN travel t ON t.id = e.travelFk
|
||||
JOIN duaEntry de ON de.entryFk = e.id
|
||||
JOIN duaEntry de2 ON de2.duaFk = de.duaFk
|
||||
JOIN entry e2 ON e2.id = de2.entryFk
|
||||
JOIN travel t2 ON t2.id = e2.travelFk
|
||||
WHERE t.id = vSelf
|
||||
AND t2.awbFk <> t.awbFk;
|
||||
|
||||
RETURN vHasUniqueAwb;
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -1,8 +1,9 @@
|
|||
DELIMITER $$
|
||||
|
||||
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`zone_getCollisions`()
|
||||
BEGIN
|
||||
/**
|
||||
* Calcula si para un mismo codigo postal y dia
|
||||
* Calcula si para un mismo codigo postal y dia
|
||||
* hay mas de una zona configurada y manda correo
|
||||
*
|
||||
*/
|
||||
|
@ -10,17 +11,18 @@ BEGIN
|
|||
DECLARE vZoneFk INT;
|
||||
DECLARE vIsDone INT DEFAULT FALSE;
|
||||
DECLARE vTableCollisions TEXT;
|
||||
DECLARE json_data JSON;
|
||||
DECLARE cur1 CURSOR FOR SELECT zoneFk from tmp.zoneOption;
|
||||
|
||||
|
||||
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vIsDone = TRUE;
|
||||
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp.zone;
|
||||
CREATE TEMPORARY TABLE tmp.zone
|
||||
SELECT z.id
|
||||
SELECT z.id
|
||||
FROM zone z
|
||||
JOIN agencyMode am ON am.id = z.agencyModeFk
|
||||
JOIN deliveryMethod dm ON dm.id = am.deliveryMethodFk
|
||||
WHERE dm.code IN ('AGENCY','DELIVERY');
|
||||
WHERE dm.code IN ('AGENCY','DELIVERY');
|
||||
|
||||
CALL zone_getOptionsForShipment(util.VN_CURDATE(),FALSE);
|
||||
|
||||
|
@ -35,7 +37,7 @@ BEGIN
|
|||
PRIMARY KEY zoneFkk (zoneFk, geoFk),
|
||||
INDEX(geoFk))
|
||||
ENGINE = MyISAM;
|
||||
|
||||
|
||||
OPEN cur1;
|
||||
cur1Loop: LOOP
|
||||
SET vIsDone = FALSE;
|
||||
|
@ -43,82 +45,63 @@ BEGIN
|
|||
IF vIsDone THEN
|
||||
LEAVE cur1Loop;
|
||||
END IF;
|
||||
|
||||
|
||||
CALL zone_getLeaves(vZoneFk, NULL, NULL, TRUE);
|
||||
|
||||
myLoop: LOOP
|
||||
myLoop: LOOP
|
||||
SET vGeoFk = NULL;
|
||||
SELECT geoFk INTO vGeoFk
|
||||
SELECT geoFk INTO vGeoFk
|
||||
FROM tmp.zoneNodes zn
|
||||
WHERE NOT isChecked
|
||||
LIMIT 1;
|
||||
|
||||
|
||||
IF vGeoFk IS NULL THEN
|
||||
LEAVE myLoop;
|
||||
END IF;
|
||||
|
||||
|
||||
CALL zone_getLeaves(vZoneFk, vGeoFk, NULL, TRUE);
|
||||
UPDATE tmp.zoneNodes
|
||||
SET isChecked = TRUE
|
||||
SET isChecked = TRUE
|
||||
WHERE geoFk = vGeoFk;
|
||||
END LOOP;
|
||||
|
||||
END LOOP;
|
||||
CLOSE cur1;
|
||||
DELETE FROM tmp.zoneNodes
|
||||
DELETE FROM tmp.zoneNodes
|
||||
WHERE sons > 0;
|
||||
|
||||
|
||||
DROP TEMPORARY TABLE IF EXISTS geoCollision;
|
||||
CREATE TEMPORARY TABLE geoCollision
|
||||
SELECT z.agencyModeFk, zn.geoFk, zw.warehouseFk
|
||||
FROM tmp.zoneNodes zn
|
||||
JOIN zone z ON z.id = zn.zoneFk
|
||||
JOIN zoneWarehouse zw ON z.id = zw.zoneFk
|
||||
JOIN zoneWarehouse zw ON z.id = zw.zoneFk
|
||||
GROUP BY z.agencyModeFk, zn.geoFk, zw.warehouseFk
|
||||
HAVING count(*) > 1;
|
||||
|
||||
SELECT '<table cellspacing="10">
|
||||
<tr>
|
||||
<th>C.Postal</th>
|
||||
<th>Número de zona</th>
|
||||
<th>Precio</th>
|
||||
<th>Zona</th>
|
||||
<th>Almacén</th>
|
||||
<th>Salix</th>
|
||||
</tr>' INTO vTableCollisions;
|
||||
|
||||
INSERT INTO mail (receiver,replyTo,subject,body)
|
||||
SELECT 'pepe@verdnatura.es' receiver,
|
||||
'noreply@verdnatura.es' replyTo,
|
||||
CONCAT('Colisiones en zonas ', util.VN_CURDATE()) subject,
|
||||
CONCAT(vTableCollisions,
|
||||
GROUP_CONCAT(sub.td SEPARATOR ''),
|
||||
'</table>') body
|
||||
FROM(SELECT
|
||||
CONCAT('<tr>
|
||||
<td>', zn.name, '</td>
|
||||
<td>', zoneFk,'</td>
|
||||
<td>', z.price,'</td>
|
||||
<td>', z.name,'</td>
|
||||
<td>', w.name, '</td>
|
||||
<td>', CONCAT('<a href="https://salix.verdnatura.es/#!/zone/',
|
||||
zoneFk,
|
||||
'/location?q=%7B%22search%22:%22',
|
||||
zn.name,
|
||||
'%22%7D">'
|
||||
'https://salix.verdnatura.es/#!/zone/',
|
||||
zoneFk,
|
||||
'/location?q=%7B%22search%22:%22',
|
||||
zn.name,
|
||||
'%22%7D</a>'),'</td>
|
||||
</tr>') td
|
||||
FROM tmp.zoneNodes zn
|
||||
JOIN zone z ON z.id = zn.zoneFk
|
||||
JOIN geoCollision gc ON gc.agencyModeFk = z.agencyModeFk AND zn.geoFk = gc.geoFk
|
||||
JOIN warehouse w ON w.id = gc.warehouseFk) sub;
|
||||
|
||||
DROP TEMPORARY TABLE
|
||||
geoCollision,
|
||||
|
||||
-- Recojo los datos de la zona que ha dado conflicto
|
||||
SELECT JSON_ARRAYAGG(
|
||||
JSON_OBJECT(
|
||||
'zoneFk', zoneFk,
|
||||
'zn', JSON_OBJECT('name', zn.name),
|
||||
'z', JSON_OBJECT('name', z.name,'price', z.price),
|
||||
'w', JSON_OBJECT('name', w.name)
|
||||
)
|
||||
) FROM tmp.zoneNodes zn
|
||||
JOIN zone z ON z.id = zn.zoneFk
|
||||
JOIN geoCollision gc ON gc.agencyModeFk = z.agencyModeFk AND zn.geoFk = gc.geoFk
|
||||
JOIN warehouse w ON w.id = gc.warehouseFk
|
||||
INTO json_data;
|
||||
|
||||
-- Creo un registro de la notificacion 'zone-included' para reportar via email
|
||||
SELECT util.notification_send(
|
||||
'zone-included',
|
||||
JSON_OBJECT('zoneCollisions',json_data),
|
||||
account.myUser_getId()
|
||||
);
|
||||
|
||||
DROP TEMPORARY TABLE
|
||||
geoCollision,
|
||||
tmp.zone,
|
||||
tmp.zoneNodes;
|
||||
END$$
|
||||
|
|
|
@ -9,6 +9,7 @@ trig: BEGIN
|
|||
DECLARE vGroupingMode TINYINT;
|
||||
DECLARE vGenericFk INT;
|
||||
DECLARE vGenericInDate BOOL;
|
||||
DECLARE vBuyerFk INT;
|
||||
|
||||
IF @isModeInventory THEN
|
||||
LEAVE trig;
|
||||
|
@ -20,6 +21,13 @@ trig: BEGIN
|
|||
|
||||
SET NEW.editorFk = account.myUser_getId();
|
||||
|
||||
SELECT it.workerFk INTO vBuyerFk
|
||||
FROM item i
|
||||
JOIN itemType it ON it.id = i.typeFk
|
||||
WHERE i.id = NEW.itemFk;
|
||||
|
||||
SET NEW.buyerFk = vBuyerFk;
|
||||
|
||||
CALL buy_checkGrouping(NEW.`grouping`);
|
||||
|
||||
SELECT t.warehouseInFk, t.landed
|
||||
|
|
|
@ -7,6 +7,7 @@ trig:BEGIN
|
|||
DECLARE vGenericInDate BOOL;
|
||||
DECLARE vIsInventory BOOL;
|
||||
DECLARE vDefaultEntry INT;
|
||||
DECLARE vBuyerFk INT;
|
||||
|
||||
IF @isTriggerDisabled THEN
|
||||
LEAVE trig;
|
||||
|
@ -65,6 +66,15 @@ trig:BEGIN
|
|||
SET NEW.isIgnored = TRUE;
|
||||
END IF;
|
||||
|
||||
IF NOT (NEW.itemFk <=> OLD.itemFk) THEN
|
||||
SELECT it.workerFk INTO vBuyerFk
|
||||
FROM item i
|
||||
JOIN itemType it ON it.id = i.typeFk
|
||||
WHERE i.id = NEW.itemFk;
|
||||
|
||||
SET NEW.buyerFk = vBuyerFk;
|
||||
END IF;
|
||||
|
||||
IF NOT (NEW.itemFk <=> OLD.itemFk) OR
|
||||
NOT (OLD.entryFk <=> NEW.entryFk) THEN
|
||||
CREATE OR REPLACE TEMPORARY TABLE tmp.buysToCheck
|
||||
|
|
|
@ -7,6 +7,8 @@ BEGIN
|
|||
CALL supplier_checkIsActive(NEW.supplierFk);
|
||||
SET NEW.currencyFk = entry_getCurrency(NEW.currencyFk, NEW.supplierFk);
|
||||
SET NEW.commission = entry_getCommission(NEW.travelFk, NEW.currencyFk,NEW.supplierFk);
|
||||
|
||||
IF NEW.travelFk IS NOT NULL AND NOT travel_hasUniqueAwb(NEW.travelFk) THEN
|
||||
CALL util.throw('The travel is incorrect, there is a different AWB in the associated entries');
|
||||
END IF;
|
||||
END$$
|
||||
DELIMITER ;
|
||||
|
|
|
@ -8,13 +8,18 @@ BEGIN
|
|||
DECLARE vHasDistinctWarehouses BOOL;
|
||||
|
||||
SET NEW.editorFk = account.myUser_getId();
|
||||
|
||||
IF NOT (NEW.travelFk <=> OLD.travelFk) THEN
|
||||
|
||||
IF !(NEW.travelFk <=> OLD.travelFk) THEN
|
||||
IF NEW.travelFk IS NOT NULL AND NOT travel_hasUniqueAwb(NEW.travelFk) THEN
|
||||
CALL util.throw('The travel is incorrect, there is a different AWB in the associated entries');
|
||||
END IF;
|
||||
|
||||
SELECT COUNT(*) > 0 INTO vIsVirtual
|
||||
FROM entryVirtual WHERE entryFk = NEW.id;
|
||||
|
||||
SELECT !(o.warehouseInFk <=> n.warehouseInFk)
|
||||
OR !(o.warehouseOutFk <=> n.warehouseOutFk)
|
||||
SELECT NOT (o.warehouseInFk <=> n.warehouseInFk)
|
||||
OR NOT (o.warehouseOutFk <=> n.warehouseOutFk)
|
||||
INTO vHasDistinctWarehouses
|
||||
FROM travel o, travel n
|
||||
WHERE o.id = OLD.travelFk
|
||||
|
@ -43,9 +48,8 @@ BEGIN
|
|||
SET NEW.currencyFk = entry_getCurrency(NEW.currencyFk, NEW.supplierFk);
|
||||
END IF;
|
||||
|
||||
IF NOT (NEW.travelFk <=> OLD.travelFk)
|
||||
OR NOT (NEW.currencyFk <=> OLD.currencyFk) THEN
|
||||
SET NEW.commission = entry_getCommission(NEW.travelFk, NEW.currencyFk,NEW.supplierFk);
|
||||
IF NOT (NEW.travelFk <=> OLD.travelFk) OR NOT (NEW.currencyFk <=> OLD.currencyFk) THEN
|
||||
SET NEW.commission = entry_getCommission(NEW.travelFk, NEW.currencyFk, NEW.supplierFk);
|
||||
END IF;
|
||||
END$$
|
||||
DELIMITER ;
|
||||
|
|
|
@ -5,7 +5,7 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`travel_afterUpdate`
|
|||
BEGIN
|
||||
CALL stock.log_add('travel', NEW.id, OLD.id);
|
||||
|
||||
IF !(NEW.shipped <=> OLD.shipped) THEN
|
||||
IF NOT(NEW.shipped <=> OLD.shipped) THEN
|
||||
UPDATE entry
|
||||
SET commission = entry_getCommission(travelFk, currencyFk,supplierFk)
|
||||
WHERE travelFk = NEW.id;
|
||||
|
@ -23,5 +23,9 @@ BEGIN
|
|||
CALL buy_checkItem();
|
||||
END IF;
|
||||
END IF;
|
||||
|
||||
IF (NOT(NEW.awbFk <=> OLD.awbFk)) AND NEW.awbFk IS NOT NULL AND NOT travel_hasUniqueAwb(NEW.id) THEN
|
||||
CALL util.throw('The AWB is incorrect, there is a different AWB in the associated entries');
|
||||
END IF;
|
||||
END$$
|
||||
DELIMITER ;
|
||||
|
|
|
@ -8,5 +8,9 @@ BEGIN
|
|||
CALL travel_checkDates(NEW.shipped, NEW.landed);
|
||||
|
||||
CALL travel_checkWarehouseIsFeedStock(NEW.warehouseInFk);
|
||||
|
||||
IF NEW.awbFk IS NOT NULL AND NOT travel_hasUniqueAwb(NEW.id) THEN
|
||||
CALL util.throw('The AWB is incorrect, there is a different AWB in the associated entries');
|
||||
END IF;
|
||||
END$$
|
||||
DELIMITER ;
|
||||
|
|
|
@ -8,5 +8,6 @@ BEGIN
|
|||
`changedModel` = 'zoneIncluded',
|
||||
`changedModelId` = OLD.zoneFk,
|
||||
`userFk` = account.myUser_getId();
|
||||
|
||||
END$$
|
||||
DELIMITER ;
|
||||
|
|
|
@ -4,5 +4,6 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`zoneIncluded_beforeIn
|
|||
FOR EACH ROW
|
||||
BEGIN
|
||||
SET NEW.editorFk = account.myUser_getId();
|
||||
|
||||
END$$
|
||||
DELIMITER ;
|
||||
|
|
|
@ -4,5 +4,6 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`zoneIncluded_beforeUp
|
|||
FOR EACH ROW
|
||||
BEGIN
|
||||
SET NEW.editorFk = account.myUser_getId();
|
||||
|
||||
END$$
|
||||
DELIMITER ;
|
||||
|
|
|
@ -5,7 +5,6 @@ AS SELECT `c`.`id` AS `id`,
|
|||
`c`.`code` AS `abbreviation`,
|
||||
`c`.`supplierAccountFk` AS `Id_Proveedores_account`,
|
||||
`c`.`workerManagerFk` AS `gerente_id`,
|
||||
`c`.`sage200Company` AS `digito_factura`,
|
||||
`c`.`phytosanitary` AS `phytosanitary`,
|
||||
`c`.`companyCode` AS `CodigoEmpresa`,
|
||||
`c`.`companyGroupFk` AS `empresa_grupo`,
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
ALTER TABLE vn.buy ADD buyerFk int(10) unsigned DEFAULT NULL NULL;
|
|
@ -0,0 +1 @@
|
|||
ALTER TABLE util.notification MODIFY COLUMN id int(11) auto_increment NOT NULL;
|
|
@ -0,0 +1,15 @@
|
|||
INSERT IGNORE INTO util.notification ( `name`,`description`)
|
||||
VALUES
|
||||
( 'zone-included','An email to notify zoneCollisions');
|
||||
|
||||
-- Change value if destionation user should be different
|
||||
SET @DESTINATION_USER = "pepe";
|
||||
|
||||
SET @MaxId = LAST_INSERT_ID();
|
||||
|
||||
INSERT IGNORE INTO util.notificationSubscription (notificationFk,userFk)
|
||||
VALUES(
|
||||
@MaxId, (SELECT id from `account`.`user` where name = @DESTINATION_USER));
|
||||
|
||||
INSERT IGNORE INTO util.notificationAcl (notificationFk,roleFk)
|
||||
SELECT @MaxId, (SELECT role from `account`.`user` where name = @DESTINATION_USER) FROM util.notification WHERE name= "zone-included";
|
|
@ -12,8 +12,8 @@ UPDATE vn.itemShelving
|
|||
|
||||
SET @isTriggerDisabled := FALSE;
|
||||
|
||||
ALTER TABLE vn.buy MODIFY COLUMN packing int(11) NOT NULL CHECK(packing > 0);
|
||||
ALTER TABLE vn.itemShelving MODIFY COLUMN packing int(11) NOT NULL CHECK(packing > 0);
|
||||
ALTER TABLE vn.buy MODIFY COLUMN packing int(11) NOT NULL DEFAULT 1 CHECK(packing > 0);
|
||||
ALTER TABLE vn.itemShelving MODIFY COLUMN packing int(11) NOT NULL DEFAULT 1 CHECK(packing > 0);
|
||||
|
||||
-- Antes tenia '0=sin obligar 1=groping 2=packing' (groping → grouping)
|
||||
ALTER TABLE vn.buy MODIFY COLUMN groupingMode tinyint(4) DEFAULT 0 NOT NULL COMMENT '0=sin obligar 1=grouping 2=packing';
|
||||
|
|
|
@ -0,0 +1,73 @@
|
|||
-- Auto-generated SQL script #202403061303
|
||||
UPDATE vn.company
|
||||
SET companyCode=0
|
||||
WHERE id=69;
|
||||
UPDATE vn.company
|
||||
SET companyCode=1
|
||||
WHERE id=442;
|
||||
UPDATE vn.company
|
||||
SET companyCode=4
|
||||
WHERE id=567;
|
||||
UPDATE vn.company
|
||||
SET companyCode=2
|
||||
WHERE id=791;
|
||||
UPDATE vn.company
|
||||
SET companyCode=3
|
||||
WHERE id=792;
|
||||
UPDATE vn.company
|
||||
SET companyCode=5
|
||||
WHERE id=965;
|
||||
UPDATE vn.company
|
||||
SET companyCode=7
|
||||
WHERE id=1381;
|
||||
UPDATE vn.company
|
||||
SET companyCode=3
|
||||
WHERE id=1463;
|
||||
UPDATE vn.company
|
||||
SET companyCode=8
|
||||
WHERE id=2142;
|
||||
UPDATE vn.company
|
||||
SET companyCode=6
|
||||
WHERE id=2393;
|
||||
UPDATE vn.company
|
||||
SET companyCode=9
|
||||
WHERE id=3869;
|
||||
|
||||
-- Auto-generated SQL script #202403061311
|
||||
UPDATE vn.company
|
||||
SET sage200Company=NULL
|
||||
WHERE id=69;
|
||||
UPDATE vn.company
|
||||
SET sage200Company=NULL
|
||||
WHERE id=442;
|
||||
UPDATE vn.company
|
||||
SET sage200Company=NULL
|
||||
WHERE id=567;
|
||||
UPDATE vn.company
|
||||
SET sage200Company=NULL
|
||||
WHERE id=791;
|
||||
UPDATE vn.company
|
||||
SET sage200Company=NULL
|
||||
WHERE id=792;
|
||||
UPDATE vn.company
|
||||
SET sage200Company=NULL
|
||||
WHERE id=965;
|
||||
UPDATE vn.company
|
||||
SET sage200Company=NULL
|
||||
WHERE id=1381;
|
||||
UPDATE vn.company
|
||||
SET sage200Company=NULL
|
||||
WHERE id=1463;
|
||||
UPDATE vn.company
|
||||
SET sage200Company=NULL
|
||||
WHERE id=2142;
|
||||
UPDATE vn.company
|
||||
SET sage200Company=NULL
|
||||
WHERE id=2393;
|
||||
UPDATE vn.company
|
||||
SET sage200Company=NULL
|
||||
WHERE id=3869;
|
||||
|
||||
|
||||
ALTER TABLE vn.company CHANGE sage200Company sage200Company__ int(2) DEFAULT NULL NULL COMMENT '@deprecated 06/03/2024';
|
||||
ALTER TABLE vn.company MODIFY COLUMN sage200Company__ int(2) DEFAULT NULL NULL COMMENT '@deprecated 06/03/2024';
|
|
@ -0,0 +1,23 @@
|
|||
-- account.accountConfig
|
||||
ALTER TABLE account.accountConfig MODIFY COLUMN id tinyint(3) unsigned NOT NULL;
|
||||
ALTER TABLE account.accountConfig ADD CONSTRAINT accountConfig_check CHECK (id = 1);
|
||||
|
||||
-- account.ldapConfig
|
||||
ALTER TABLE account.ldapConfig MODIFY COLUMN id int(10) unsigned NOT NULL;
|
||||
ALTER TABLE account.ldapConfig ADD CONSTRAINT ldapConfig_check CHECK (id = 1);
|
||||
|
||||
-- account.mailConfig
|
||||
ALTER TABLE account.mailConfig MODIFY COLUMN id int(10) unsigned NOT NULL;
|
||||
ALTER TABLE account.mailConfig ADD CONSTRAINT mailConfig_check CHECK (id = 1);
|
||||
|
||||
-- account.roleConfig
|
||||
ALTER TABLE account.roleConfig MODIFY COLUMN id int(10) unsigned NOT NULL;
|
||||
ALTER TABLE account.roleConfig ADD CONSTRAINT roleConfig_check CHECK (id = 1);
|
||||
|
||||
-- account.sambaConfig
|
||||
ALTER TABLE account.sambaConfig MODIFY COLUMN id tinyint(3) unsigned NOT NULL;
|
||||
ALTER TABLE account.sambaConfig ADD CONSTRAINT sambaConfig_check CHECK (id = 1);
|
||||
|
||||
-- account.userConfig
|
||||
ALTER TABLE account.userConfig MODIFY COLUMN id int(10) unsigned NOT NULL;
|
||||
ALTER TABLE account.userConfig ADD CONSTRAINT userConfig_check CHECK (id = 1);
|
|
@ -0,0 +1,7 @@
|
|||
-- bs.nightTaskConfig
|
||||
ALTER TABLE bs.nightTaskConfig MODIFY COLUMN id int(10) unsigned NOT NULL;
|
||||
ALTER TABLE bs.nightTaskConfig ADD CONSTRAINT nightTaskConfig_check CHECK (id = 1);
|
||||
|
||||
-- bs.workerProductivityConfig
|
||||
ALTER TABLE bs.workerProductivityConfig MODIFY COLUMN id int(10) unsigned NOT NULL;
|
||||
ALTER TABLE bs.workerProductivityConfig ADD CONSTRAINT workerProductivityConfig_check CHECK (id = 1);
|
|
@ -0,0 +1,15 @@
|
|||
-- edi.exchangeConfig
|
||||
ALTER TABLE edi.exchangeConfig MODIFY COLUMN id tinyint(3) unsigned NOT NULL;
|
||||
ALTER TABLE edi.exchangeConfig ADD CONSTRAINT exchangeConfig_check CHECK (id = 1);
|
||||
|
||||
-- edi.ftpConfig
|
||||
ALTER TABLE edi.ftpConfig MODIFY COLUMN id tinyint(3) unsigned NOT NULL;
|
||||
ALTER TABLE edi.ftpConfig ADD CONSTRAINT ftpConfig_check CHECK (id = 1);
|
||||
|
||||
-- edi.imapConfig (Tiene más de 1 registro en producción)
|
||||
-- ALTER TABLE edi.imapConfig MODIFY COLUMN id tinyint(3) unsigned NOT NULL;
|
||||
-- ALTER TABLE edi.imapConfig ADD CONSTRAINT imapConfig_check CHECK (id = 1);
|
||||
|
||||
-- edi.offerRefreshConfig
|
||||
ALTER TABLE edi.offerRefreshConfig MODIFY COLUMN id int(10) unsigned NOT NULL;
|
||||
ALTER TABLE edi.offerRefreshConfig ADD CONSTRAINT offerRefreshConfig_check CHECK (id = 1);
|
|
@ -0,0 +1,27 @@
|
|||
-- hedera.config
|
||||
ALTER TABLE hedera.config MODIFY COLUMN id tinyint(3) unsigned NOT NULL;
|
||||
ALTER TABLE hedera.config ADD CONSTRAINT config_check CHECK (id = 1);
|
||||
|
||||
-- hedera.imageConfig
|
||||
ALTER TABLE hedera.imageConfig MODIFY COLUMN id tinyint(3) unsigned NOT NULL;
|
||||
ALTER TABLE hedera.imageConfig ADD CONSTRAINT imageConfig_check CHECK (id = 1);
|
||||
|
||||
-- hedera.mailConfig
|
||||
ALTER TABLE hedera.mailConfig MODIFY COLUMN id tinyint(3) unsigned NOT NULL;
|
||||
ALTER TABLE hedera.mailConfig ADD CONSTRAINT mailConfig_check CHECK (id = 1);
|
||||
|
||||
-- hedera.orderConfig
|
||||
ALTER TABLE hedera.orderConfig MODIFY COLUMN id int(10) unsigned NOT NULL;
|
||||
ALTER TABLE hedera.orderConfig ADD CONSTRAINT orderConfig_check CHECK (id = 1);
|
||||
|
||||
-- hedera.shelfConfig (Tiene más de 1 registro en producción)
|
||||
-- ALTER TABLE hedera.shelfConfig MODIFY COLUMN id int(10) unsigned NOT NULL;
|
||||
-- ALTER TABLE hedera.shelfConfig ADD CONSTRAINT shelfConfig_check CHECK (id = 1);
|
||||
|
||||
-- hedera.tpvConfig
|
||||
ALTER TABLE hedera.tpvConfig MODIFY COLUMN id tinyint(3) unsigned NOT NULL;
|
||||
ALTER TABLE hedera.tpvConfig ADD CONSTRAINT tpvConfig_check CHECK (id = 1);
|
||||
|
||||
-- hedera.tpvImapConfig
|
||||
ALTER TABLE hedera.tpvImapConfig MODIFY COLUMN id tinyint(3) unsigned NOT NULL;
|
||||
ALTER TABLE hedera.tpvImapConfig ADD CONSTRAINT tpvImapConfig_check CHECK (id = 1);
|
|
@ -0,0 +1,15 @@
|
|||
-- pbx.config
|
||||
ALTER TABLE pbx.config MODIFY COLUMN id int(10) unsigned NOT NULL;
|
||||
ALTER TABLE pbx.config ADD CONSTRAINT config_check CHECK (id = 1);
|
||||
|
||||
-- pbx.followmeConfig
|
||||
ALTER TABLE pbx.followmeConfig MODIFY COLUMN id int(10) unsigned NOT NULL;
|
||||
ALTER TABLE pbx.followmeConfig ADD CONSTRAINT followmeConfig_check CHECK (id = 1);
|
||||
|
||||
-- pbx.queueConfig (Tiene más de 1 registro en producción)
|
||||
-- ALTER TABLE pbx.queueConfig MODIFY COLUMN id int(10) unsigned NOT NULL;
|
||||
-- ALTER TABLE pbx.queueConfig ADD CONSTRAINT queueConfig_check CHECK (id = 1);
|
||||
|
||||
-- pbx.sipConfig
|
||||
ALTER TABLE pbx.sipConfig MODIFY COLUMN id mediumint(8) unsigned NOT NULL;
|
||||
ALTER TABLE pbx.sipConfig ADD CONSTRAINT sipConfig_check CHECK (id = 1);
|
|
@ -0,0 +1,3 @@
|
|||
-- sage.config
|
||||
ALTER TABLE sage.config MODIFY COLUMN id int(10) unsigned NOT NULL;
|
||||
ALTER TABLE sage.config ADD CONSTRAINT config_check CHECK (id = 1);
|
|
@ -0,0 +1,7 @@
|
|||
-- salix.accessTokenConfig
|
||||
ALTER TABLE salix.accessTokenConfig MODIFY COLUMN id int(10) unsigned NOT NULL;
|
||||
ALTER TABLE salix.accessTokenConfig ADD CONSTRAINT accessTokenConfig_check CHECK (id = 1);
|
||||
|
||||
-- salix.printConfig
|
||||
ALTER TABLE salix.printConfig MODIFY COLUMN id int(10) unsigned NOT NULL;
|
||||
ALTER TABLE salix.printConfig ADD CONSTRAINT printConfig_check CHECK (id = 1);
|
|
@ -0,0 +1,3 @@
|
|||
-- srt.config
|
||||
ALTER TABLE srt.config MODIFY COLUMN id int(10) unsigned NOT NULL;
|
||||
ALTER TABLE srt.config ADD CONSTRAINT config_check CHECK (id = 1);
|
|
@ -0,0 +1,11 @@
|
|||
-- util.config
|
||||
ALTER TABLE util.config MODIFY COLUMN id int(10) unsigned NOT NULL;
|
||||
ALTER TABLE util.config ADD CONSTRAINT config_check CHECK (id = 1);
|
||||
|
||||
-- util.notificationConfig
|
||||
ALTER TABLE util.notificationConfig MODIFY COLUMN id int(10) unsigned NOT NULL;
|
||||
ALTER TABLE util.notificationConfig ADD CONSTRAINT notificationConfig_check CHECK (id = 1);
|
||||
|
||||
-- util.versionConfig
|
||||
ALTER TABLE util.versionConfig MODIFY COLUMN id int(10) unsigned NOT NULL;
|
||||
ALTER TABLE util.versionConfig ADD CONSTRAINT versionConfig_check CHECK (id = 1);
|
|
@ -0,0 +1,87 @@
|
|||
-- vn.accountingConfig
|
||||
ALTER TABLE vn.accountingConfig MODIFY COLUMN id int(10) unsigned NOT NULL;
|
||||
ALTER TABLE vn.accountingConfig ADD CONSTRAINT accountingConfig_check CHECK (id = 1);
|
||||
|
||||
-- vn.auctionConfig
|
||||
ALTER TABLE vn.auctionConfig MODIFY COLUMN id int(10) unsigned NOT NULL;
|
||||
ALTER TABLE vn.auctionConfig ADD CONSTRAINT auctionConfig_check CHECK (id = 1);
|
||||
|
||||
-- vn.autoRadioConfig
|
||||
ALTER TABLE vn.autoRadioConfig MODIFY COLUMN id int(10) unsigned NOT NULL;
|
||||
ALTER TABLE vn.autoRadioConfig ADD CONSTRAINT autoRadioConfig_check CHECK (id = 1);
|
||||
|
||||
-- vn.bankEntityConfig
|
||||
ALTER TABLE vn.bankEntityConfig MODIFY COLUMN id int(10) unsigned NOT NULL;
|
||||
ALTER TABLE vn.bankEntityConfig ADD CONSTRAINT bankEntityConfig_check CHECK (id = 1);
|
||||
|
||||
-- vn.bionicConfig
|
||||
ALTER TABLE vn.bionicConfig MODIFY COLUMN id int(10) unsigned NOT NULL;
|
||||
ALTER TABLE vn.bionicConfig ADD CONSTRAINT bionicConfig_check CHECK (id = 1);
|
||||
|
||||
-- vn.buyConfig
|
||||
ALTER TABLE vn.buyConfig MODIFY COLUMN id int(10) unsigned NOT NULL;
|
||||
ALTER TABLE vn.buyConfig ADD CONSTRAINT buyConfig_check CHECK (id = 1);
|
||||
|
||||
-- vn.chatConfig
|
||||
ALTER TABLE vn.chatConfig MODIFY COLUMN id int(10) unsigned NOT NULL;
|
||||
ALTER TABLE vn.chatConfig ADD CONSTRAINT chatConfig_check CHECK (id = 1);
|
||||
|
||||
-- vn.claimConfig
|
||||
ALTER TABLE vn.claimConfig MODIFY COLUMN id int(10) unsigned NOT NULL;
|
||||
ALTER TABLE vn.claimConfig ADD CONSTRAINT claimConfig_check CHECK (id = 1);
|
||||
|
||||
-- vn.clientConfig
|
||||
ALTER TABLE vn.clientConfig MODIFY COLUMN id int(10) unsigned NOT NULL;
|
||||
ALTER TABLE vn.clientConfig ADD CONSTRAINT clientConfig_check CHECK (id = 1);
|
||||
|
||||
-- vn.comparativeAddConfig
|
||||
ALTER TABLE vn.comparativeAddConfig MODIFY COLUMN id int(10) unsigned NOT NULL;
|
||||
ALTER TABLE vn.comparativeAddConfig ADD CONSTRAINT comparativeAddConfig_check CHECK (id = 1);
|
||||
|
||||
-- vn.comparativeConfig
|
||||
ALTER TABLE vn.comparativeConfig MODIFY COLUMN id int(10) unsigned NOT NULL;
|
||||
ALTER TABLE vn.comparativeConfig ADD CONSTRAINT comparativeConfig_check CHECK (id = 1);
|
||||
|
||||
-- vn.config
|
||||
ALTER TABLE vn.config MODIFY COLUMN id int(10) unsigned NOT NULL;
|
||||
ALTER TABLE vn.config ADD CONSTRAINT config_check CHECK (id = 1);
|
||||
|
||||
-- vn.conveyorConfig (Tiene más de 1 registro en producción)
|
||||
-- ALTER TABLE vn.conveyorConfig MODIFY COLUMN id int(10) unsigned NOT NULL;
|
||||
-- ALTER TABLE vn.conveyorConfig ADD CONSTRAINT conveyorConfig_check CHECK (id = 1);
|
||||
|
||||
-- vn.deviceProductionConfig
|
||||
ALTER TABLE vn.deviceProductionConfig MODIFY COLUMN id int(10) unsigned NOT NULL;
|
||||
ALTER TABLE vn.deviceProductionConfig ADD CONSTRAINT deviceProductionConfig_check CHECK (id = 1);
|
||||
|
||||
-- vn.docuwareConfig
|
||||
ALTER TABLE vn.docuwareConfig MODIFY COLUMN id int(10) unsigned NOT NULL;
|
||||
ALTER TABLE vn.docuwareConfig ADD CONSTRAINT docuwareConfig_check CHECK (id = 1);
|
||||
|
||||
-- vn.floramondoConfig
|
||||
ALTER TABLE vn.floramondoConfig MODIFY COLUMN id int(10) unsigned NOT NULL;
|
||||
ALTER TABLE vn.floramondoConfig ADD CONSTRAINT floramondoConfig_check CHECK (id = 1);
|
||||
|
||||
-- vn.franceExpressConfig
|
||||
ALTER TABLE vn.franceExpressConfig MODIFY COLUMN id int(10) unsigned NOT NULL;
|
||||
ALTER TABLE vn.franceExpressConfig ADD CONSTRAINT franceExpressConfig_check CHECK (id = 1);
|
||||
|
||||
-- vn.glsConfig
|
||||
ALTER TABLE vn.glsConfig MODIFY COLUMN id int(10) unsigned NOT NULL;
|
||||
ALTER TABLE vn.glsConfig ADD CONSTRAINT glsConfig_check CHECK (id = 1);
|
||||
|
||||
-- vn.greugeConfig
|
||||
ALTER TABLE vn.greugeConfig MODIFY COLUMN id int(10) unsigned NOT NULL;
|
||||
ALTER TABLE vn.greugeConfig ADD CONSTRAINT greugeConfig_check CHECK (id = 1);
|
||||
|
||||
-- vn.inventoryConfig
|
||||
ALTER TABLE vn.inventoryConfig MODIFY COLUMN id int(10) unsigned NOT NULL;
|
||||
ALTER TABLE vn.inventoryConfig ADD CONSTRAINT inventoryConfig_check CHECK (id = 1);
|
||||
|
||||
-- vn.invoiceInConfig
|
||||
ALTER TABLE vn.invoiceInConfig MODIFY COLUMN id int(10) unsigned NOT NULL;
|
||||
ALTER TABLE vn.invoiceInConfig ADD CONSTRAINT invoiceInConfig_check CHECK (id = 1);
|
||||
|
||||
-- vn.invoiceOutConfig
|
||||
ALTER TABLE vn.invoiceOutConfig MODIFY COLUMN id int(10) unsigned NOT NULL;
|
||||
ALTER TABLE vn.invoiceOutConfig ADD CONSTRAINT invoiceOutConfig_check CHECK (id = 1);
|
|
@ -0,0 +1,91 @@
|
|||
-- vn.invoiceOutTaxConfig (Tiene más de 1 registro en producción)
|
||||
-- ALTER TABLE vn.invoiceOutTaxConfig MODIFY COLUMN id int(10) unsigned NOT NULL;
|
||||
-- ALTER TABLE vn.invoiceOutTaxConfig ADD CONSTRAINT invoiceOutTaxConfig_check CHECK (id = 1);
|
||||
|
||||
-- vn.itemConfig
|
||||
ALTER TABLE vn.itemConfig MODIFY COLUMN id int(10) unsigned NOT NULL;
|
||||
ALTER TABLE vn.itemConfig ADD CONSTRAINT itemConfig_check CHECK (id = 1);
|
||||
|
||||
-- vn.machineWorkerConfig
|
||||
ALTER TABLE vn.machineWorkerConfig MODIFY COLUMN id int(10) unsigned NOT NULL;
|
||||
ALTER TABLE vn.machineWorkerConfig ADD CONSTRAINT machineWorkerConfig_check CHECK (id = 1);
|
||||
|
||||
-- vn.mdbConfig
|
||||
ALTER TABLE vn.mdbConfig MODIFY COLUMN id int(10) unsigned NOT NULL;
|
||||
ALTER TABLE vn.mdbConfig ADD CONSTRAINT mdbConfig_check CHECK (id = 1);
|
||||
|
||||
-- vn.mrwConfig
|
||||
ALTER TABLE vn.mrwConfig MODIFY COLUMN id int(10) unsigned NOT NULL;
|
||||
ALTER TABLE vn.mrwConfig ADD CONSTRAINT mrwConfig_check CHECK (id = 1);
|
||||
|
||||
-- vn.osTicketConfig
|
||||
ALTER TABLE vn.osTicketConfig MODIFY COLUMN id int(10) unsigned NOT NULL;
|
||||
ALTER TABLE vn.osTicketConfig ADD CONSTRAINT osTicketConfig_check CHECK (id = 1);
|
||||
|
||||
-- vn.packagingConfig
|
||||
ALTER TABLE vn.packagingConfig MODIFY COLUMN id int(10) unsigned NOT NULL;
|
||||
ALTER TABLE vn.packagingConfig ADD CONSTRAINT packagingConfig_check CHECK (id = 1);
|
||||
|
||||
-- vn.packingSiteConfig
|
||||
ALTER TABLE vn.packingSiteConfig MODIFY COLUMN id int(10) unsigned NOT NULL;
|
||||
ALTER TABLE vn.packingSiteConfig ADD CONSTRAINT packingSiteConfig_check CHECK (id = 1);
|
||||
|
||||
-- vn.productionConfig
|
||||
ALTER TABLE vn.productionConfig MODIFY COLUMN id int(10) unsigned NOT NULL;
|
||||
ALTER TABLE vn.productionConfig ADD CONSTRAINT productionConfig_check CHECK (id = 1);
|
||||
|
||||
-- vn.rateConfig
|
||||
ALTER TABLE vn.rateConfig MODIFY COLUMN id int(10) unsigned NOT NULL;
|
||||
ALTER TABLE vn.rateConfig ADD CONSTRAINT rateConfig_check CHECK (id = 1);
|
||||
|
||||
-- vn.routeConfig
|
||||
ALTER TABLE vn.routeConfig MODIFY COLUMN id int(10) unsigned NOT NULL;
|
||||
ALTER TABLE vn.routeConfig ADD CONSTRAINT routeConfig_check CHECK (id = 1);
|
||||
|
||||
-- vn.salespersonConfig
|
||||
ALTER TABLE vn.salespersonConfig MODIFY COLUMN id int(10) unsigned NOT NULL;
|
||||
ALTER TABLE vn.salespersonConfig ADD CONSTRAINT salespersonConfig_check CHECK (id = 1);
|
||||
|
||||
-- vn.sendingConfig
|
||||
ALTER TABLE vn.sendingConfig MODIFY COLUMN id int(10) unsigned NOT NULL;
|
||||
ALTER TABLE vn.sendingConfig ADD CONSTRAINT sendingConfig_check CHECK (id = 1);
|
||||
|
||||
-- vn.smsConfig
|
||||
ALTER TABLE vn.smsConfig MODIFY COLUMN id int(10) unsigned NOT NULL;
|
||||
ALTER TABLE vn.smsConfig ADD CONSTRAINT smsConfig_check CHECK (id = 1);
|
||||
|
||||
-- vn.ticketConfig
|
||||
ALTER TABLE vn.ticketConfig MODIFY COLUMN id int(10) unsigned NOT NULL;
|
||||
ALTER TABLE vn.ticketConfig ADD CONSTRAINT ticketConfig_check CHECK (id = 1);
|
||||
|
||||
-- vn.tillConfig
|
||||
ALTER TABLE vn.tillConfig MODIFY COLUMN id int(10) unsigned NOT NULL;
|
||||
ALTER TABLE vn.tillConfig ADD CONSTRAINT tillConfig_check CHECK (id = 1);
|
||||
|
||||
-- vn.travelConfig
|
||||
ALTER TABLE vn.travelConfig MODIFY COLUMN id int(10) unsigned NOT NULL;
|
||||
ALTER TABLE vn.travelConfig ADD CONSTRAINT travelConfig_check CHECK (id = 1);
|
||||
|
||||
-- vn.viaexpressConfig
|
||||
ALTER TABLE vn.viaexpressConfig MODIFY COLUMN id int(10) unsigned NOT NULL;
|
||||
ALTER TABLE vn.viaexpressConfig ADD CONSTRAINT viaexpressConfig_check CHECK (id = 1);
|
||||
|
||||
-- vn.wagonConfig
|
||||
ALTER TABLE vn.wagonConfig MODIFY COLUMN id int(10) unsigned NOT NULL;
|
||||
ALTER TABLE vn.wagonConfig ADD CONSTRAINT wagonConfig_check CHECK (id = 1);
|
||||
|
||||
-- vn.workerConfig
|
||||
ALTER TABLE vn.workerConfig MODIFY COLUMN id int(10) unsigned NOT NULL;
|
||||
ALTER TABLE vn.workerConfig ADD CONSTRAINT workerConfig_check CHECK (id = 1);
|
||||
|
||||
-- vn.workerTimeControlConfig
|
||||
ALTER TABLE vn.workerTimeControlConfig MODIFY COLUMN id int(10) unsigned NOT NULL;
|
||||
ALTER TABLE vn.workerTimeControlConfig ADD CONSTRAINT workerTimeControlConfig_check CHECK (id = 1);
|
||||
|
||||
-- vn.zipConfig
|
||||
ALTER TABLE vn.zipConfig MODIFY COLUMN id int(10) unsigned NOT NULL;
|
||||
ALTER TABLE vn.zipConfig ADD CONSTRAINT zipConfig_check CHECK (id = 1);
|
||||
|
||||
-- vn.zoneConfig
|
||||
ALTER TABLE vn.zoneConfig MODIFY COLUMN id int(10) unsigned NOT NULL;
|
||||
ALTER TABLE vn.zoneConfig ADD CONSTRAINT zoneConfig_check CHECK (id = 1);
|
|
@ -220,5 +220,7 @@
|
|||
"Shelving not valid": "Shelving not valid",
|
||||
"printerNotExists": "The printer does not exist",
|
||||
"There are not picking tickets": "There are not picking tickets",
|
||||
"ticketCommercial": "The ticket {{ ticket }} for the salesperson {{ salesMan }} is in preparation. (automatically generated message)"
|
||||
"ticketCommercial": "The ticket {{ ticket }} for the salesperson {{ salesMan }} is in preparation. (automatically generated message)",
|
||||
"This password can only be changed by the user themselves": "This password can only be changed by the user themselves",
|
||||
"They're not your subordinate": "They're not your subordinate"
|
||||
}
|
||||
|
|
|
@ -346,5 +346,7 @@
|
|||
"CountryFK cannot be empty": "El país no puede estar vacío",
|
||||
"Cmr file does not exist": "El archivo del cmr no existe",
|
||||
"You are not allowed to modify the alias": "No estás autorizado a modificar el alias",
|
||||
"The address of the customer must have information about Incoterms and Customs Agent": "El consignatario del cliente debe tener informado Incoterms y Agente de aduanas"
|
||||
}
|
||||
"The address of the customer must have information about Incoterms and Customs Agent": "El consignatario del cliente debe tener informado Incoterms y Agente de aduanas",
|
||||
"This password can only be changed by the user themselves": "Esta contraseña solo puede ser modificada por el propio usuario",
|
||||
"They're not your subordinate": "No es tu subordinado/a."
|
||||
}
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
|
||||
const ForbiddenError = require('vn-loopback/util/forbiddenError');
|
||||
const {models} = require('vn-loopback/server/server');
|
||||
|
||||
module.exports = Self => {
|
||||
require('../methods/account/sync')(Self);
|
||||
require('../methods/account/sync-by-id')(Self);
|
||||
|
@ -7,4 +10,11 @@ module.exports = Self => {
|
|||
require('../methods/account/logout')(Self);
|
||||
require('../methods/account/change-password')(Self);
|
||||
require('../methods/account/set-password')(Self);
|
||||
|
||||
Self.setUnverifiedPassword = async(id, pass, options) => {
|
||||
const {emailVerified} = await models.VnUser.findById(id, {fields: ['emailVerified']}, options);
|
||||
if (emailVerified) throw new ForbiddenError('This password can only be changed by the user themselves');
|
||||
|
||||
await models.VnUser.setPassword(id, pass, options);
|
||||
};
|
||||
};
|
||||
|
|
|
@ -1,31 +1,29 @@
|
|||
const UserError = require('vn-loopback/util/user-error');
|
||||
const ForbiddenError = require('vn-loopback/util/forbiddenError');
|
||||
module.exports = Self => {
|
||||
Self.remoteMethodCtx('setPassword', {
|
||||
description: 'Set a new password',
|
||||
accepts: [
|
||||
{
|
||||
arg: 'workerFk',
|
||||
type: 'number',
|
||||
required: true,
|
||||
description: 'The worker id',
|
||||
},
|
||||
{
|
||||
arg: 'newPass',
|
||||
type: 'String',
|
||||
required: true,
|
||||
description: 'The new worker password'
|
||||
}
|
||||
],
|
||||
accepts: [{
|
||||
arg: 'id',
|
||||
type: 'number',
|
||||
required: true,
|
||||
description: 'The worker id',
|
||||
http: {source: 'path'}
|
||||
}, {
|
||||
arg: 'newPass',
|
||||
type: 'String',
|
||||
required: true,
|
||||
description: 'The new worker password'
|
||||
}],
|
||||
http: {
|
||||
path: `/:id/setPassword`,
|
||||
verb: 'PATCH'
|
||||
}
|
||||
});
|
||||
Self.setPassword = async(ctx, options) => {
|
||||
Self.setPassword = async(ctx, id, newPass, options) => {
|
||||
const models = Self.app.models;
|
||||
const myOptions = {};
|
||||
const {args} = ctx;
|
||||
let tx;
|
||||
|
||||
if (typeof options == 'object')
|
||||
Object.assign(myOptions, options);
|
||||
if (!myOptions.transaction) {
|
||||
|
@ -33,11 +31,10 @@ module.exports = Self => {
|
|||
myOptions.transaction = tx;
|
||||
}
|
||||
try {
|
||||
const isSubordinate = await models.Worker.isSubordinate(ctx, args.workerFk, myOptions);
|
||||
if (!isSubordinate) throw new UserError('You don\'t have enough privileges.');
|
||||
const isSubordinate = await Self.isSubordinate(ctx, id, myOptions);
|
||||
if (!isSubordinate) throw new ForbiddenError('They\'re not your subordinate');
|
||||
|
||||
await models.VnUser.setPassword(args.workerFk, args.newPass, myOptions);
|
||||
await models.VnUser.updateAll({id: args.workerFk}, {emailVerified: true}, myOptions);
|
||||
await models.Account.setUnverifiedPassword(id, newPass, myOptions);
|
||||
|
||||
if (tx) await tx.commit();
|
||||
} catch (e) {
|
||||
|
|
|
@ -1,31 +1,30 @@
|
|||
const UserError = require('vn-loopback/util/user-error');
|
||||
|
||||
const models = require('vn-loopback/server/server').models;
|
||||
const {models} = require('vn-loopback/server/server');
|
||||
|
||||
describe('worker setPassword()', () => {
|
||||
let ctx;
|
||||
const newPass = 'H3rn4d3z#';
|
||||
const employeeId = 1;
|
||||
const managerId = 20;
|
||||
const administrativeId = 5;
|
||||
|
||||
beforeAll(() => {
|
||||
ctx = {
|
||||
req: {
|
||||
accessToken: {},
|
||||
accessToken: {userId: managerId},
|
||||
headers: {origin: 'http://localhost'}
|
||||
},
|
||||
args: {workerFk: 9}
|
||||
};
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
ctx.req.accessToken.userId = 20;
|
||||
ctx.args.newPass = 'H3rn4d3z#';
|
||||
});
|
||||
|
||||
it('should change the password', async() => {
|
||||
it('should change the password if it is a subordinate and the email is not verified', async() => {
|
||||
const tx = await models.Worker.beginTransaction({});
|
||||
|
||||
try {
|
||||
const options = {transaction: tx};
|
||||
await models.Worker.setPassword(ctx, options);
|
||||
await models.Worker.setPassword(ctx, employeeId, newPass, options);
|
||||
const isNewPass = await passHasBeenChanged(employeeId, newPass, options);
|
||||
|
||||
expect(isNewPass).toBeTrue();
|
||||
await tx.rollback();
|
||||
} catch (e) {
|
||||
await tx.rollback();
|
||||
|
@ -33,29 +32,48 @@ describe('worker setPassword()', () => {
|
|||
}
|
||||
});
|
||||
|
||||
it('should throw an error: Password does not meet requirements', async() => {
|
||||
const tx = await models.Collection.beginTransaction({});
|
||||
ctx.args.newPass = 'Hi';
|
||||
it('should not change the password if it is a subordinate and the email is verified', async() => {
|
||||
const tx = await models.Worker.beginTransaction({});
|
||||
|
||||
try {
|
||||
const options = {transaction: tx};
|
||||
await models.Worker.setPassword(ctx, options);
|
||||
await models.VnUser.updateAll({id: employeeId}, {emailVerified: true}, options);
|
||||
await models.Worker.setPassword(ctx, employeeId, newPass, options);
|
||||
|
||||
await tx.rollback();
|
||||
} catch (e) {
|
||||
expect(e.message).toEqual(`This password can only be changed by the user themselves`);
|
||||
await tx.rollback();
|
||||
}
|
||||
});
|
||||
|
||||
it('should not change the password if it is not a subordinate', async() => {
|
||||
const tx = await models.Worker.beginTransaction({});
|
||||
try {
|
||||
const options = {transaction: tx};
|
||||
await models.Worker.setPassword(ctx, administrativeId, newPass, options);
|
||||
await tx.rollback();
|
||||
} catch (e) {
|
||||
expect(e.message).toEqual(`They're not your subordinate`);
|
||||
await tx.rollback();
|
||||
}
|
||||
});
|
||||
|
||||
it('should throw an error: Password does not meet requirements', async() => {
|
||||
const tx = await models.Worker.beginTransaction({});
|
||||
const newPass = 'Hi';
|
||||
try {
|
||||
const options = {transaction: tx};
|
||||
await models.Worker.setPassword(ctx, employeeId, newPass, options);
|
||||
await tx.rollback();
|
||||
} catch (e) {
|
||||
expect(e.sqlMessage).toEqual('Password does not meet requirements');
|
||||
await tx.rollback();
|
||||
}
|
||||
});
|
||||
|
||||
it('should throw an error: You don\'t have enough privileges.', async() => {
|
||||
ctx.req.accessToken.userId = 5;
|
||||
const tx = await models.Collection.beginTransaction({});
|
||||
try {
|
||||
const options = {transaction: tx};
|
||||
await models.Worker.setPassword(ctx, options);
|
||||
await tx.rollback();
|
||||
} catch (e) {
|
||||
expect(e).toEqual(new UserError(`You don't have enough privileges.`));
|
||||
await tx.rollback();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
const passHasBeenChanged = async(userId, pass, options) => {
|
||||
const user = await models.VnUser.findById(userId, null, options);
|
||||
return user.hasPassword(pass);
|
||||
};
|
||||
|
|
|
@ -11,8 +11,8 @@
|
|||
? 'Click to allow the user to be disabled'
|
||||
: 'Click to exclude the user from getting disabled'}}
|
||||
</vn-item>
|
||||
<vn-item ng-if="!$ctrl.worker.user.emailVerified" ng-click="setPassword.show()" translate>
|
||||
Change password
|
||||
<vn-item ng-if="!$ctrl.worker.user.emailVerified && $ctrl.vnConfig.storage.currentUserWorkerId !=$ctrl.worker.id" ng-click="setPassword.show()" translate>
|
||||
Change password
|
||||
</vn-item>
|
||||
</slot-menu>
|
||||
<slot-body>
|
||||
|
|
|
@ -69,6 +69,7 @@ class Controller extends Descriptor {
|
|||
}
|
||||
]
|
||||
};
|
||||
|
||||
return this.getData(`Workers/${this.id}`, {filter})
|
||||
.then(res => this.entity = res.data);
|
||||
}
|
||||
|
@ -86,15 +87,14 @@ class Controller extends Descriptor {
|
|||
if (this.newPassword != this.repeatPassword)
|
||||
throw new UserError(`Passwords don't match`);
|
||||
this.$http.patch(
|
||||
`Workers/${this.entity.id}/setPassword`,
|
||||
{workerFk: this.entity.id, newPass: this.newPassword}
|
||||
`Workers/${this.entity.id}/setPassword`, {newPass: this.newPassword}
|
||||
) .then(() => {
|
||||
this.vnApp.showSuccess(this.$translate.instant('Password changed!'));
|
||||
});
|
||||
}).then(() => this.loadData());
|
||||
}
|
||||
}
|
||||
|
||||
Controller.$inject = ['$element', '$scope', '$rootScope'];
|
||||
Controller.$inject = ['$element', '$scope', '$rootScope', 'vnConfig'];
|
||||
|
||||
ngModule.vnComponent('vnWorkerDescriptor', {
|
||||
template: require('./index.html'),
|
||||
|
|
|
@ -16,6 +16,7 @@ describe('vnWorkerDescriptor', () => {
|
|||
const id = 1;
|
||||
const response = 'foo';
|
||||
|
||||
$httpBackend.whenGET('UserConfigs/getUserConfig').respond({});
|
||||
$httpBackend.expectRoute('GET', `Workers/${id}`).respond(response);
|
||||
controller.id = id;
|
||||
$httpBackend.flush();
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
const models = require('vn-loopback/server/server').models;
|
||||
const LoopBackContext = require('loopback-context');
|
||||
|
||||
describe('zone toggleIsIncluded()', () => {
|
||||
beforeAll(async() => {
|
||||
const activeCtx = {
|
||||
|
@ -58,7 +57,7 @@ describe('zone toggleIsIncluded()', () => {
|
|||
|
||||
await models.Zone.toggleIsIncluded(1, 20, false, options);
|
||||
|
||||
let result = await models.Zone.toggleIsIncluded(1, 20, undefined, options);
|
||||
const result = await models.Zone.toggleIsIncluded(1, 20, undefined, options);
|
||||
|
||||
expect(result).toEqual({count: 1});
|
||||
|
||||
|
|
|
@ -3,10 +3,10 @@
|
|||
"dataSource": "vn"
|
||||
},
|
||||
"AgencyMode": {
|
||||
"dataSource": "vn"
|
||||
"dataSource": "vn"
|
||||
},
|
||||
"DeliveryMethod": {
|
||||
"dataSource": "vn"
|
||||
"dataSource": "vn"
|
||||
},
|
||||
"Zone": {
|
||||
"dataSource": "vn"
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
const Stylesheet = require(`vn-print/core/stylesheet`);
|
||||
|
||||
const path = require('path');
|
||||
const vnPrintPath = path.resolve('print');
|
||||
|
||||
module.exports = new Stylesheet([
|
||||
`${vnPrintPath}/common/css/spacing.css`,
|
||||
`${vnPrintPath}/common/css/misc.css`,
|
||||
`${vnPrintPath}/common/css/layout.css`,
|
||||
`${vnPrintPath}/common/css/email.css`])
|
||||
.mergeStyles();
|
|
@ -0,0 +1,7 @@
|
|||
subject: Colisiones en zonas
|
||||
title: "La zona {0} y localización {1} ha sido registrada en más de un sitio"
|
||||
postalCode: C. Postal
|
||||
zoneFk: Número de zona
|
||||
price: Precio
|
||||
zone: Zona
|
||||
warehouse: Almacén
|
|
@ -0,0 +1,42 @@
|
|||
<!DOCTYPE html>
|
||||
<html v-bind:lang="$i18n.locale">
|
||||
<head>
|
||||
<meta name="viewport" content="width=device-width" />
|
||||
<meta name="format-detection" content="telephone=no" />
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<table class="grid column-oriented">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{{ $t('postalCode') }}</th>
|
||||
<th>{{ $t('zoneFk') }}</th>
|
||||
<th>{{ $t('price') }}</th>
|
||||
<th>{{ $t('zone') }}</th>
|
||||
<th>{{ $t('warehouse') }}</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="zone in zoneCollisions">
|
||||
<td>{{ zone.zn.name }}</td>
|
||||
<td>{{ zone.zoneFk }}</td>
|
||||
<td>{{ zone.z.price }}</td>
|
||||
<td>{{ zone.z.name }}</td>
|
||||
<td>{{ zone.w.name }}</td>
|
||||
<td>
|
||||
<a v-bind:href="'https://salix.verdnatura.es/#!/zone/'+
|
||||
zone.zoneFk+
|
||||
'/location?q=%7B%22search%22:%22'+
|
||||
zone.zn.name+
|
||||
'%22%7D'">
|
||||
https://salix.verdnatura.es/#!/zone/
|
||||
{{zone.zoneFk}}
|
||||
/location?q=%7B%22search%22:%22
|
||||
{{zone.zn.name}}
|
||||
%22%7D</a></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,12 @@
|
|||
const Component = require(`vn-print/core/component`);
|
||||
const emailHeader = new Component('email-header');
|
||||
|
||||
module.exports = {
|
||||
name: 'zone-included',
|
||||
components: {
|
||||
'email-header': emailHeader.build(),
|
||||
},
|
||||
props: {
|
||||
zoneCollisions: {type: Array, required: true}
|
||||
}
|
||||
};
|
Loading…
Reference in New Issue