Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into test
gitea/salix/pipeline/pr-test This commit looks good
Details
gitea/salix/pipeline/pr-test This commit looks good
Details
This commit is contained in:
commit
3f6ec13fa5
|
@ -71,6 +71,7 @@ pipeline {
|
||||||
stage('Back') {
|
stage('Back') {
|
||||||
steps {
|
steps {
|
||||||
sh 'pnpm install --prefer-offline'
|
sh 'pnpm install --prefer-offline'
|
||||||
|
sh 'pnpx puppeteer browsers install chrome'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stage('Print') {
|
stage('Print') {
|
||||||
|
|
|
@ -352,12 +352,12 @@ INSERT INTO `vn`.`postCode`(`code`, `townFk`, `geoFk`)
|
||||||
('46600', 4, 7),
|
('46600', 4, 7),
|
||||||
('EC170150', 5, 8);
|
('EC170150', 5, 8);
|
||||||
|
|
||||||
INSERT INTO `vn`.`clientType`(`id`, `code`, `type`)
|
INSERT INTO `vn`.`clientType`(`code`, `type`)
|
||||||
VALUES
|
VALUES
|
||||||
(1, 'normal', 'Normal'),
|
('normal', 'Normal'),
|
||||||
(2, 'internalUse', 'Autoconsumo'),
|
('internalUse', 'Autoconsumo'),
|
||||||
(3, 'handMaking', 'Confección'),
|
('handMaking', 'Confección'),
|
||||||
(4, 'loses', 'Mermas');
|
('loses', 'Mermas');
|
||||||
|
|
||||||
INSERT INTO `vn`.`cplusTerIdNif`(`id`, `description`)
|
INSERT INTO `vn`.`cplusTerIdNif`(`id`, `description`)
|
||||||
VALUES
|
VALUES
|
||||||
|
@ -371,23 +371,23 @@ INSERT INTO `vn`.`contactChannel`(`id`, `name`)
|
||||||
(4, 'GCN Channel'),
|
(4, 'GCN Channel'),
|
||||||
(5, 'The Newspaper');
|
(5, 'The Newspaper');
|
||||||
|
|
||||||
INSERT INTO `vn`.`client`(`id`,`name`,`fi`,`socialName`,`contact`,`street`,`city`,`postcode`,`phone`,`mobile`,`isRelevant`,`email`,`iban`,`dueDay`,`accountingAccount`,`isEqualizated`,`provinceFk`,`hasToInvoice`,`credit`,`countryFk`,`isActive`,`gestdocFk`,`quality`,`payMethodFk`,`created`,`isToBeMailed`,`contactChannelFk`,`hasSepaVnl`,`hasCoreVnl`,`hasCoreVnh`,`riskCalculated`,`clientTypeFk`, `hasToInvoiceByAddress`,`isTaxDataChecked`,`isFreezed`,`creditInsurance`,`isCreatedAsServed`,`hasInvoiceSimplified`,`salesPersonFk`,`isVies`,`eypbc`, `businessTypeFk`,`typeFk`)
|
INSERT INTO `vn`.`client`(`id`,`name`,`fi`,`socialName`,`contact`,`street`,`city`,`postcode`,`phone`,`mobile`,`isRelevant`,`email`,`iban`,`dueDay`,`accountingAccount`,`isEqualizated`,`provinceFk`,`hasToInvoice`,`credit`,`countryFk`,`isActive`,`gestdocFk`,`quality`,`payMethodFk`,`created`,`isToBeMailed`,`contactChannelFk`,`hasSepaVnl`,`hasCoreVnl`,`hasCoreVnh`,`riskCalculated`, `hasToInvoiceByAddress`,`isTaxDataChecked`,`isFreezed`,`creditInsurance`,`isCreatedAsServed`,`hasInvoiceSimplified`,`salesPersonFk`,`isVies`,`eypbc`, `businessTypeFk`,`typeFk`)
|
||||||
VALUES
|
VALUES
|
||||||
(1101, 'Bruce Wayne', '84612325V', 'BATMAN', 'Alfred', '1007 MOUNTAIN DRIVE, GOTHAM', 'Gotham', 46460, 1111111111, 222222222, 1, 'BruceWayne@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1, 'florist','normal'),
|
(1101, 'Bruce Wayne', '84612325V', 'BATMAN', 'Alfred', '1007 MOUNTAIN DRIVE, GOTHAM', 'Gotham', 46460, 1111111111, 222222222, 1, 'BruceWayne@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, NULL, 0, 0, 18, 0, 1, 'florist','normal'),
|
||||||
(1102, 'Petter Parker', '87945234L', 'SPIDER MAN', 'Aunt May', '20 INGRAM STREET, QUEENS, USA', 'Gotham', 46460, 1111111111, 222222222, 1, 'PetterParker@mydomain.com', NULL, 0, 1234567890, 0, 2, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1, 'florist','normal'),
|
(1102, 'Petter Parker', '87945234L', 'SPIDER MAN', 'Aunt May', '20 INGRAM STREET, QUEENS, USA', 'Gotham', 46460, 1111111111, 222222222, 1, 'PetterParker@mydomain.com', NULL, 0, 1234567890, 0, 2, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, NULL, 0, 0, 18, 0, 1, 'florist','normal'),
|
||||||
(1103, 'Clark Kent', '06815934E', 'SUPER MAN', 'lois lane', '344 CLINTON STREET, APARTAMENT 3-D', 'Gotham', 46460, 1111111111, 222222222, 1, 'ClarkKent@mydomain.com', NULL, 0, 1234567890, 0, 3, 1, 0, 19, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1, 'florist','normal'),
|
(1103, 'Clark Kent', '06815934E', 'SUPER MAN', 'lois lane', '344 CLINTON STREET, APARTAMENT 3-D', 'Gotham', 46460, 1111111111, 222222222, 1, 'ClarkKent@mydomain.com', NULL, 0, 1234567890, 0, 3, 1, 0, 19, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, NULL, 0, 0, 18, 0, 1, 'florist','normal'),
|
||||||
(1104, 'Tony Stark', '06089160W', 'IRON MAN', 'Pepper Potts', '10880 MALIBU POINT, 90265', 'Gotham', 46460, 1111111111, 222222222, 1, 'TonyStark@mydomain.com', NULL, 0, 1234567890, 0, 2, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1, 'florist','normal'),
|
(1104, 'Tony Stark', '06089160W', 'IRON MAN', 'Pepper Potts', '10880 MALIBU POINT, 90265', 'Gotham', 46460, 1111111111, 222222222, 1, 'TonyStark@mydomain.com', NULL, 0, 1234567890, 0, 2, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, NULL, 0, 0, 18, 0, 1, 'florist','normal'),
|
||||||
(1105, 'Max Eisenhardt', '251628698', 'MAGNETO', 'Rogue', 'UNKNOWN WHEREABOUTS', 'Gotham', 46460, 1111111111, 222222222, 1, 'MaxEisenhardt@mydomain.com', NULL, 0, 1234567890, 0, 3, 1, 300, 8, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 1, NULL, 0, 0, 18, 0, 1, 'florist','normal'),
|
(1105, 'Max Eisenhardt', '251628698', 'MAGNETO', 'Rogue', 'UNKNOWN WHEREABOUTS', 'Gotham', 46460, 1111111111, 222222222, 1, 'MaxEisenhardt@mydomain.com', NULL, 0, 1234567890, 0, 3, 1, 300, 8, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, NULL, 0, 0, 18, 0, 1, 'florist','normal'),
|
||||||
(1106, 'DavidCharlesHaller', '53136686Q', 'LEGION', 'Charles Xavier', 'CITY OF NEW YORK, NEW YORK, USA', 'Gotham', 46460, 1111111111, 222222222, 1, 'DavidCharlesHaller@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 0, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 0, NULL, 0, 0, 19, 0, 1, 'florist','normal'),
|
(1106, 'DavidCharlesHaller', '53136686Q', 'LEGION', 'Charles Xavier', 'CITY OF NEW YORK, NEW YORK, USA', 'Gotham', 46460, 1111111111, 222222222, 1, 'DavidCharlesHaller@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 0, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, NULL, 0, 0, 19, 0, 1, 'florist','normal'),
|
||||||
(1107, 'Hank Pym', '09854837G', 'ANT MAN', 'Hawk', 'ANTHILL, SAN FRANCISCO, CALIFORNIA', 'Gotham', 46460, 1111111111, 222222222, 1, 'HankPym@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, 0, NULL, 0, 0, 19, 0, 1, 'florist','normal'),
|
(1107, 'Hank Pym', '09854837G', 'ANT MAN', 'Hawk', 'ANTHILL, SAN FRANCISCO, CALIFORNIA', 'Gotham', 46460, 1111111111, 222222222, 1, 'HankPym@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 0, 0, NULL, 0, 0, 19, 0, 1, 'florist','normal'),
|
||||||
(1108, 'Charles Xavier', '22641921P', 'PROFESSOR X', 'Beast', '3800 VICTORY PKWY, CINCINNATI, OH 45207, USA', 'Gotham', 46460, 1111111111, 222222222, 1, 'CharlesXavier@mydomain.com', NULL, 0, 1234567890, 0, 5, 1, 300, 13, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 1, NULL, 0, 0, 19, 0, 1, 'florist','normal'),
|
(1108, 'Charles Xavier', '22641921P', 'PROFESSOR X', 'Beast', '3800 VICTORY PKWY, CINCINNATI, OH 45207, USA', 'Gotham', 46460, 1111111111, 222222222, 1, 'CharlesXavier@mydomain.com', NULL, 0, 1234567890, 0, 5, 1, 300, 13, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, NULL, 0, 0, 19, 0, 1, 'florist','normal'),
|
||||||
(1109, 'Bruce Banner', '16104829E', 'HULK', 'Black widow', 'SOMEWHERE IN NEW YORK', 'Gotham', 46460, 1111111111, 222222222, 1, 'BruceBanner@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, 0, NULL, 0, 0, 9, 0, 1, 'florist','normal'),
|
(1109, 'Bruce Banner', '16104829E', 'HULK', 'Black widow', 'SOMEWHERE IN NEW YORK', 'Gotham', 46460, 1111111111, 222222222, 1, 'BruceBanner@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 0, 0, NULL, 0, 0, 9, 0, 1, 'florist','normal'),
|
||||||
(1110, 'Jessica Jones', '58282869H', 'JESSICA JONES', 'Luke Cage', 'NYCC 2015 POSTER', 'Gotham', 46460, 1111111111, 222222222, 1, 'JessicaJones@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, 0, NULL, 0, 0, NULL, 0, 1, 'florist','normal'),
|
(1110, 'Jessica Jones', '58282869H', 'JESSICA JONES', 'Luke Cage', 'NYCC 2015 POSTER', 'Gotham', 46460, 1111111111, 222222222, 1, 'JessicaJones@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 0, 0, NULL, 0, 0, NULL, 0, 1, 'florist','normal'),
|
||||||
(1111, 'Missing', NULL, 'MISSING MAN', 'Anton', 'THE SPACE, UNIVERSE FAR AWAY', 'Gotham', 46460, 1111111111, 222222222, 1, NULL, NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 4, 0, 1, 0, NULL, 1, 0, NULL, 0, 1, 'others','loses'),
|
(1111, 'Missing', NULL, 'MISSING MAN', 'Anton', 'THE SPACE, UNIVERSE FAR AWAY', 'Gotham', 46460, 1111111111, 222222222, 1, NULL, NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 0, 1, 0, NULL, 1, 0, NULL, 0, 1, 'others','loses'),
|
||||||
(1112, 'Trash', NULL, 'GARBAGE MAN', 'Unknown name', 'NEW YORK CITY, UNDERGROUND', 'Gotham', 46460, 1111111111, 222222222, 1, NULL, NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 4, 0, 1, 0, NULL, 1, 0, NULL, 0, 1, 'others','loses');
|
(1112, 'Trash', NULL, 'GARBAGE MAN', 'Unknown name', 'NEW YORK CITY, UNDERGROUND', 'Gotham', 46460, 1111111111, 222222222, 1, NULL, NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 0, 1, 0, NULL, 1, 0, NULL, 0, 1, 'others','loses');
|
||||||
|
|
||||||
INSERT INTO `vn`.`client`(`id`, `name`, `fi`, `socialName`, `contact`, `street`, `city`, `postcode`, `isRelevant`, `email`, `iban`,`dueDay`,`accountingAccount`, `isEqualizated`, `provinceFk`, `hasToInvoice`, `credit`, `countryFk`, `isActive`, `gestdocFk`, `quality`, `payMethodFk`,`created`, `isTaxDataChecked`)
|
INSERT INTO `vn`.`client`(`id`, `name`, `fi`, `socialName`, `contact`, `street`, `city`, `postcode`, `isRelevant`, `email`, `iban`,`dueDay`,`accountingAccount`, `isEqualizated`, `provinceFk`, `hasToInvoice`, `credit`, `countryFk`, `isActive`, `gestdocFk`, `quality`, `payMethodFk`,`created`, `isTaxDataChecked`)
|
||||||
SELECT id, name, CONCAT(RPAD(CONCAT(id,9),8,id),'A'), CONCAT(name, 'Social'), CONCAT(name, 'Contact'), CONCAT(name, 'Street'), 'GOTHAM', 46460, 1, CONCAT(name,'@mydomain.com'), NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1,NULL, 10, 5, util.VN_CURDATE(), 1
|
SELECT id, name, CONCAT(RPAD(CONCAT(id,9),8,id),'A'), UPPER(CONCAT(name, 'Social')), CONCAT(name, 'Contact'), CONCAT(name, 'Street'), 'GOTHAM', 46460, 1, CONCAT(name,'@mydomain.com'), NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1,NULL, 10, 5, util.VN_CURDATE(), 1
|
||||||
FROM `account`.`role` `r`
|
FROM `account`.`role` `r`
|
||||||
WHERE `r`.`hasLogin` = 1;
|
WHERE `r`.`hasLogin` = 1;
|
||||||
|
|
||||||
|
@ -564,13 +564,13 @@ INSERT INTO `vn`.`supplierActivity`(`code`, `name`)
|
||||||
|
|
||||||
INSERT INTO `vn`.`supplier`(`id`, `name`, `nickname`,`account`,`countryFk`,`nif`, `commission`, `created`, `isActive`, `street`, `city`, `provinceFk`, `postCode`, `payMethodFk`, `payDemFk`, `payDay`, `taxTypeSageFk`, `withholdingSageFk`, `transactionTypeSageFk`, `workerFk`, `supplierActivityFk`, `isPayMethodChecked`, `healthRegister`)
|
INSERT INTO `vn`.`supplier`(`id`, `name`, `nickname`,`account`,`countryFk`,`nif`, `commission`, `created`, `isActive`, `street`, `city`, `provinceFk`, `postCode`, `payMethodFk`, `payDemFk`, `payDay`, `taxTypeSageFk`, `withholdingSageFk`, `transactionTypeSageFk`, `workerFk`, `supplierActivityFk`, `isPayMethodChecked`, `healthRegister`)
|
||||||
VALUES
|
VALUES
|
||||||
(1, 'PLANTS SL', 'Plants nick', 4100000001, 1, '06089160W', 0, util.VN_CURDATE(), 1, 'supplier address 1', 'PONTEVEDRA', 1, 15214, 1, 1, 15, 4, 1, 1, 18, 'flowerPlants', 1, '400664487V'),
|
(1, 'PLANTS SL', 'Plants nick', 4100000001, 1, '06089160W', 0, util.VN_CURDATE(), 1, 'supplier address 1', 'GOTHAM', 1, 46000, 1, 1, 15, 4, 1, 1, 18, 'flowerPlants', 1, '400664487V'),
|
||||||
(2, 'FARMER KING', 'The farmer', 4000020002, 1, '87945234L', 0, util.VN_CURDATE(), 1, 'supplier address 2', 'GOTHAM', 2, 43022, 1, 2, 10, 93, 2, 8, 18, 'animals', 1, '400664487V'),
|
(2, 'FARMER KING', 'The farmer', 4000020002, 1, '87945234L', 0, util.VN_CURDATE(), 1, 'supplier address 2', 'GOTHAM', 2, 46000, 1, 2, 10, 93, 2, 8, 18, 'animals', 1, '400664487V'),
|
||||||
(69, 'PACKAGING', 'Packaging nick', 4100000069, 1, '94935005K', 0, util.VN_CURDATE(), 1, 'supplier address 5', 'ASGARD', 3, 46600, 1, 1, 15, 4, 1, 1, 18, 'flowerPlants', 1, '400664487V'),
|
(69, 'PACKAGING', 'Packaging nick', 4100000069, 1, '94935005K', 0, util.VN_CURDATE(), 1, 'supplier address 5', 'ASGARD', 3, 46600, 1, 1, 15, 4, 1, 1, 18, 'flowerPlants', 1, '400664487V'),
|
||||||
(442, 'VERDNATURA LEVANTE SL', 'Verdnatura', 5115000442, 1, '06815934E', 0, util.VN_CURDATE(), 1, 'supplier address 3', 'GOTHAM', 1, 43022, 1, 2, 15, 6, 9, 3, 18, 'complements', 1, '400664487V'),
|
(442, 'VERDNATURA LEVANTE SL', 'Verdnatura', 5115000442, 1, '06815934E', 0, util.VN_CURDATE(), 1, 'supplier address 3', 'GOTHAM', 1, 46000, 1, 2, 15, 6, 9, 3, 18, 'complements', 1, '400664487V'),
|
||||||
(567, 'HOLLAND', 'Holland nick', 4000020567, 1, '14364089Z', 0, util.VN_CURDATE(), 1, 'supplier address 6', 'ASGARD', 3, 46600, 1, 2, 10, 93, 2, 8, 18, 'animals', 1, '400664487V'),
|
(567, 'HOLLAND', 'Holland nick', 4000020567, 1, '14364089Z', 0, util.VN_CURDATE(), 1, 'supplier address 6', 'ASGARD', 3, 46600, 1, 2, 10, 93, 2, 8, 18, 'animals', 1, '400664487V'),
|
||||||
(791, 'BROS SL', 'Bros nick', 5115000791, 1, '37718083S', 0, util.VN_CURDATE(), 1, 'supplier address 7', 'ASGARD', 3, 46600, 1, 2, 15, 6, 9, 3, 18, 'complements', 1, '400664487V'),
|
(791, 'BROS SL', 'Bros nick', 5115000791, 1, '37718083S', 0, util.VN_CURDATE(), 1, 'supplier address 7', 'ASGARD', 3, 46600, 1, 2, 15, 6, 9, 3, 18, 'complements', 1, '400664487V'),
|
||||||
(1381, 'ORNAMENTALES', 'Ornamentales', 7185001381, 1, '07972486L', 0, util.VN_CURDATE(), 1, 'supplier address 4', 'GOTHAM', 1, 43022, 1, 2, 15, 6, 9, 3, 18, 'complements', 1, '400664487V');
|
(1381, 'ORNAMENTALES', 'Ornamentales', 7185001381, 1, '07972486L', 0, util.VN_CURDATE(), 1, 'supplier address 4', 'GOTHAM', 1, 46000, 1, 2, 15, 6, 9, 3, 18, 'complements', 1, '400664487V');
|
||||||
|
|
||||||
INSERT INTO `vn`.`supplierAddress`(`id`, `supplierFk`, `nickname`, `street`, `provinceFk`, `postalCode`, `city`, `phone`, `mobile`)
|
INSERT INTO `vn`.`supplierAddress`(`id`, `supplierFk`, `nickname`, `street`, `provinceFk`, `postalCode`, `city`, `phone`, `mobile`)
|
||||||
VALUES
|
VALUES
|
||||||
|
@ -2409,7 +2409,8 @@ INSERT INTO `vn`.`dmsType`(`id`, `name`, `readRoleFk`, `writeRoleFk`, `code`)
|
||||||
(17, 'cmr', 1, 1, 'cmr'),
|
(17, 'cmr', 1, 1, 'cmr'),
|
||||||
(18, 'dua', NULL, NULL, 'dua'),
|
(18, 'dua', NULL, NULL, 'dua'),
|
||||||
(19, 'inmovilizado', NULL, NULL, 'fixedAssets'),
|
(19, 'inmovilizado', NULL, NULL, 'fixedAssets'),
|
||||||
(20, 'Reclamación', 1, 1, 'claim');
|
(20, 'Reclamación', 1, 1, 'claim'),
|
||||||
|
(21, 'Entrada', 1, 1, 'entry');
|
||||||
|
|
||||||
INSERT INTO `vn`.`dms`(`id`, `dmsTypeFk`, `file`, `contentType`, `workerFk`, `warehouseFk`, `companyFk`, `hardCopyNumber`, `hasFile`, `reference`, `description`, `created`)
|
INSERT INTO `vn`.`dms`(`id`, `dmsTypeFk`, `file`, `contentType`, `workerFk`, `warehouseFk`, `companyFk`, `hardCopyNumber`, `hasFile`, `reference`, `description`, `created`)
|
||||||
VALUES
|
VALUES
|
||||||
|
@ -2420,7 +2421,8 @@ INSERT INTO `vn`.`dms`(`id`, `dmsTypeFk`, `file`, `contentType`, `workerFk`, `wa
|
||||||
(5, 5, '5.txt', 'text/plain', 5, 1, 442, NULL, TRUE, 'travel: 1', 'dmsForThermograph', util.VN_CURDATE()),
|
(5, 5, '5.txt', 'text/plain', 5, 1, 442, NULL, TRUE, 'travel: 1', 'dmsForThermograph', util.VN_CURDATE()),
|
||||||
(6, 5, '6.txt', 'text/plain', 5, 1, 442, NULL, TRUE, 'NotExists', 'DoesNotExists', util.VN_CURDATE()),
|
(6, 5, '6.txt', 'text/plain', 5, 1, 442, NULL, TRUE, 'NotExists', 'DoesNotExists', util.VN_CURDATE()),
|
||||||
(7, 20, '7.jpg', 'image/jpeg', 9, 1, 442, NULL, FALSE, '1', 'TICKET ID DEL CLIENTE BRUCE WAYNE ID 1101', util.VN_CURDATE()),
|
(7, 20, '7.jpg', 'image/jpeg', 9, 1, 442, NULL, FALSE, '1', 'TICKET ID DEL CLIENTE BRUCE WAYNE ID 1101', util.VN_CURDATE()),
|
||||||
(8, 20, '8.mp4', 'video/mp4', 9, 1, 442, NULL, FALSE, '1', 'TICKET ID DEL CLIENTE BRUCE WAYNE ID 1101', util.VN_CURDATE());
|
(8, 20, '8.mp4', 'video/mp4', 9, 1, 442, NULL, FALSE, '1', 'TICKET ID DEL CLIENTE BRUCE WAYNE ID 1101', util.VN_CURDATE()),
|
||||||
|
(9, 21, '7.jpg', 'image/jpeg', 9, 1, 442, NULL, FALSE, '1', 'ENTRADA ID 1', util.VN_CURDATE());
|
||||||
|
|
||||||
INSERT INTO `vn`.`claimDms`(`claimFk`, `dmsFk`)
|
INSERT INTO `vn`.`claimDms`(`claimFk`, `dmsFk`)
|
||||||
VALUES
|
VALUES
|
||||||
|
@ -3064,7 +3066,14 @@ INSERT INTO `vn`.`clientSms` (`id`, `clientFk`, `smsFk`, `ticketFk`)
|
||||||
(13, 1101, 1, NULL),
|
(13, 1101, 1, NULL),
|
||||||
(14, 1101, 4, 27);
|
(14, 1101, 4, 27);
|
||||||
|
|
||||||
|
INSERT INTO `vn`.`entryDms`(`entryFk`, `dmsFk`, `editorFk`)
|
||||||
|
VALUES
|
||||||
|
(1, 9, 9);
|
||||||
|
|
||||||
INSERT INTO `vn`.`cmr` (id,truckPlate,observations,senderInstruccions,paymentInstruccions,specialAgreements,companyFk,addressToFk,addressFromFk,supplierFk,packagesList,merchandiseDetail,state)
|
INSERT INTO `vn`.`cmr` (id,truckPlate,observations,senderInstruccions,paymentInstruccions,specialAgreements,companyFk,addressToFk,addressFromFk,supplierFk,packagesList,merchandiseDetail,state)
|
||||||
VALUES (1,'123456A','Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet',442,1,2,1,'Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet'),
|
VALUES (1,'123456A','Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet',442,1,2,1,'Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet'),
|
||||||
(2,'123456N','Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet',69,3,4,2,'Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet'),
|
(2,'123456N','Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet',69,3,4,2,'Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet'),
|
||||||
(3,'123456B','Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet',567,5,6,69,'Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet');
|
(3,'123456B','Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet',567,5,6,69,'Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet','Lorem ipsum dolor sit amet');
|
||||||
|
|
||||||
|
UPDATE vn.department
|
||||||
|
SET workerFk = null;
|
||||||
|
|
|
@ -19,7 +19,7 @@ BEGIN
|
||||||
itemFk,
|
itemFk,
|
||||||
itemTypeFk,
|
itemTypeFk,
|
||||||
floor(sum(value)) as total,
|
floor(sum(value)) as total,
|
||||||
floor(sum(IF(clientTypeFk = 'loses', value, 0))) as mermas
|
floor(sum(IF(typeFk = 'loses', value, 0))) as mermas
|
||||||
FROM vn.saleValue
|
FROM vn.saleValue
|
||||||
where year = vYear and week = vWeek
|
where year = vYear and week = vWeek
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
DELIMITER $$
|
||||||
|
CREATE OR REPLACE DEFINER=`root`@`localhost` FUNCTION `util`.`checkPrintableChars`(
|
||||||
|
vString VARCHAR(255)
|
||||||
|
) RETURNS tinyint(1)
|
||||||
|
DETERMINISTIC
|
||||||
|
BEGIN
|
||||||
|
/**
|
||||||
|
* Validates whether the input string contains only printable characters
|
||||||
|
* and Spanish special characters (such as ¡, ÿ, etc.).
|
||||||
|
*
|
||||||
|
* @vString string to check
|
||||||
|
*/
|
||||||
|
RETURN vString REGEXP '^[ -~¡-ÿ]*$';
|
||||||
|
END$$
|
||||||
|
DELIMITER ;
|
|
@ -47,12 +47,11 @@ BEGIN
|
||||||
JOIN itemCategory ic ON ic.id = tp.categoryFk
|
JOIN itemCategory ic ON ic.id = tp.categoryFk
|
||||||
JOIN ticket t ON t.id = s.ticketFk
|
JOIN ticket t ON t.id = s.ticketFk
|
||||||
JOIN client c ON c.id = t.clientFk
|
JOIN client c ON c.id = t.clientFk
|
||||||
JOIN clientType ct ON ct.id = c.clientTypeFk
|
|
||||||
JOIN warehouse w ON w.id = t.warehouseFk
|
JOIN warehouse w ON w.id = t.warehouseFk
|
||||||
JOIN address ad ON ad.id = t.addressFk
|
JOIN address ad ON ad.id = t.addressFk
|
||||||
LEFT JOIN province p ON p.id = ad.provinceFk
|
LEFT JOIN province p ON p.id = ad.provinceFk
|
||||||
WHERE tm.period BETWEEN vMaxPeriod AND vPeriod
|
WHERE tm.period BETWEEN vMaxPeriod AND vPeriod
|
||||||
AND ct.code <> 'loses'
|
AND c.typeFk <> 'loses'
|
||||||
AND NOT w.code = 'inv'
|
AND NOT w.code = 'inv'
|
||||||
GROUP BY p.countryFk, s.itemFk, tm.period, t.warehouseFk;
|
GROUP BY p.countryFk, s.itemFk, tm.period, t.warehouseFk;
|
||||||
END IF;
|
END IF;
|
||||||
|
|
|
@ -44,10 +44,9 @@ proc:BEGIN
|
||||||
LEFT JOIN saleTracking st ON st.saleFk = s.id
|
LEFT JOIN saleTracking st ON st.saleFk = s.id
|
||||||
JOIN ticket t ON t.id = s.ticketFk
|
JOIN ticket t ON t.id = s.ticketFk
|
||||||
JOIN client c on c.id = t.clientFk
|
JOIN client c on c.id = t.clientFk
|
||||||
JOIN clientType ct ON ct.id = c.clientTypeFk
|
|
||||||
WHERE t.shipped BETWEEN util.VN_CURDATE() AND util.dayend(util.VN_CURDATE())
|
WHERE t.shipped BETWEEN util.VN_CURDATE() AND util.dayend(util.VN_CURDATE())
|
||||||
AND st.saleFk IS NULL
|
AND st.saleFk IS NULL
|
||||||
AND ct.code IN ('normal', 'trust')
|
AND c.typeFk IN ('normal', 'trust')
|
||||||
GROUP BY s.itemFk
|
GROUP BY s.itemFk
|
||||||
) sub2 ON sub2.itemFk = sub.itemFk
|
) sub2 ON sub2.itemFk = sub.itemFk
|
||||||
UNION ALL
|
UNION ALL
|
||||||
|
@ -70,10 +69,9 @@ proc:BEGIN
|
||||||
LEFT JOIN saleTracking st ON st.saleFk = s.id
|
LEFT JOIN saleTracking st ON st.saleFk = s.id
|
||||||
JOIN ticket t ON t.id = s.ticketFk
|
JOIN ticket t ON t.id = s.ticketFk
|
||||||
JOIN client c on c.id = t.clientFk
|
JOIN client c on c.id = t.clientFk
|
||||||
JOIN clientType ct ON ct.id = c.clientTypeFk
|
|
||||||
WHERE t.shipped BETWEEN util.VN_CURDATE() AND util.dayend(util.VN_CURDATE())
|
WHERE t.shipped BETWEEN util.VN_CURDATE() AND util.dayend(util.VN_CURDATE())
|
||||||
AND st.saleFk IS NULL
|
AND st.saleFk IS NULL
|
||||||
AND ct.code IN ('normal', 'trust')
|
AND c.typeFk IN ('normal', 'trust')
|
||||||
GROUP BY s.itemFk
|
GROUP BY s.itemFk
|
||||||
) sub5 ON sub5.itemFk = v.item_id
|
) sub5 ON sub5.itemFk = v.item_id
|
||||||
WHERE v.calc_id = vCalcVisibleFk
|
WHERE v.calc_id = vCalcVisibleFk
|
||||||
|
|
|
@ -120,7 +120,7 @@ BEGIN
|
||||||
TRUE,
|
TRUE,
|
||||||
s.id,
|
s.id,
|
||||||
st.`order`,
|
st.`order`,
|
||||||
ct.`code`,
|
c.typeFk,
|
||||||
cb.claimFk,
|
cb.claimFk,
|
||||||
NULL
|
NULL
|
||||||
FROM sale s
|
FROM sale s
|
||||||
|
@ -128,7 +128,6 @@ BEGIN
|
||||||
LEFT JOIN ticketState ts ON ts.ticketFk = t.id
|
LEFT JOIN ticketState ts ON ts.ticketFk = t.id
|
||||||
LEFT JOIN state st ON st.`code` = ts.`code`
|
LEFT JOIN state st ON st.`code` = ts.`code`
|
||||||
JOIN client c ON c.id = t.clientFk
|
JOIN client c ON c.id = t.clientFk
|
||||||
JOIN clientType ct ON ct.id = c.clientTypeFk
|
|
||||||
JOIN state st2 ON st2.`code` = IF(t.shipped < util.VN_CURDATE(),
|
JOIN state st2 ON st2.`code` = IF(t.shipped < util.VN_CURDATE(),
|
||||||
'DELIVERED',
|
'DELIVERED',
|
||||||
IF (t.shipped > util.dayEnd(util.VN_CURDATE()),
|
IF (t.shipped > util.dayEnd(util.VN_CURDATE()),
|
||||||
|
|
|
@ -75,7 +75,7 @@ BEGIN
|
||||||
|
|
||||||
SET vDated = DATE(vTimed);
|
SET vDated = DATE(vTimed);
|
||||||
|
|
||||||
SELECT IF(pc.code = 'driveCE',
|
SELECT IF(pc.code = 'driverCE',
|
||||||
wc.dayBreakDriver,
|
wc.dayBreakDriver,
|
||||||
wc.dayBreak),
|
wc.dayBreak),
|
||||||
wc.shortWeekBreak,
|
wc.shortWeekBreak,
|
||||||
|
|
|
@ -23,6 +23,12 @@ BEGIN
|
||||||
|
|
||||||
IF vOldBusinessFk IS NULL THEN
|
IF vOldBusinessFk IS NULL THEN
|
||||||
CALL account.account_enable(vSelf);
|
CALL account.account_enable(vSelf);
|
||||||
|
|
||||||
|
UPDATE client c
|
||||||
|
JOIN payMethod pm ON pm.code = 'bankDraft'
|
||||||
|
SET c.payMethodFk = pm.id
|
||||||
|
WHERE c.id = vSelf
|
||||||
|
AND c.iban;
|
||||||
END IF;
|
END IF;
|
||||||
END$$
|
END$$
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
DELIMITER $$
|
||||||
|
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`entryDms_afterDelete`
|
||||||
|
AFTER DELETE ON `entryDms`
|
||||||
|
FOR EACH ROW
|
||||||
|
BEGIN
|
||||||
|
INSERT INTO entryLog
|
||||||
|
SET `action` = 'delete',
|
||||||
|
`changedModel` = 'EntryDms',
|
||||||
|
`changedModelId` = OLD.entryFk,
|
||||||
|
`userFk` = account.myUser_getId();
|
||||||
|
END$$
|
||||||
|
DELIMITER ;
|
|
@ -0,0 +1,8 @@
|
||||||
|
DELIMITER $$
|
||||||
|
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`entryDms_beforeInsert`
|
||||||
|
BEFORE INSERT ON `entryDms`
|
||||||
|
FOR EACH ROW
|
||||||
|
BEGIN
|
||||||
|
SET NEW.editorFk = account.myUser_getId();
|
||||||
|
END$$
|
||||||
|
DELIMITER ;
|
|
@ -0,0 +1,8 @@
|
||||||
|
DELIMITER $$
|
||||||
|
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`entryDms_beforeUpdate`
|
||||||
|
BEFORE UPDATE ON `entryDms`
|
||||||
|
FOR EACH ROW
|
||||||
|
BEGIN
|
||||||
|
SET NEW.editorFk = account.myUser_getId();
|
||||||
|
END$$
|
||||||
|
DELIMITER ;
|
|
@ -9,6 +9,10 @@ BEGIN
|
||||||
DECLARE vActive TINYINT;
|
DECLARE vActive TINYINT;
|
||||||
DECLARE vWithholdingSageFk INT;
|
DECLARE vWithholdingSageFk INT;
|
||||||
|
|
||||||
|
IF NOT util.checkPrintableChars(NEW.supplierRef) THEN
|
||||||
|
CALL util.throw('The invoiceIn reference contains invalid characters');
|
||||||
|
END IF;
|
||||||
|
|
||||||
SET NEW.editorFk = account.myUser_getId();
|
SET NEW.editorFk = account.myUser_getId();
|
||||||
|
|
||||||
SELECT withholdingSageFk INTO vWithholdingSageFk
|
SELECT withholdingSageFk INTO vWithholdingSageFk
|
||||||
|
|
|
@ -3,9 +3,12 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`invoiceIn_beforeUpdat
|
||||||
BEFORE UPDATE ON `invoiceIn`
|
BEFORE UPDATE ON `invoiceIn`
|
||||||
FOR EACH ROW
|
FOR EACH ROW
|
||||||
BEGIN
|
BEGIN
|
||||||
|
|
||||||
DECLARE vWithholdingSageFk INT;
|
DECLARE vWithholdingSageFk INT;
|
||||||
|
|
||||||
|
IF NOT (NEW.supplierRef <=> OLD.supplierRef) AND NOT util.checkPrintableChars(NEW.supplierRef) THEN
|
||||||
|
CALL util.throw('The invoiceIn reference contains invalid characters');
|
||||||
|
END IF;
|
||||||
|
|
||||||
SET NEW.editorFk = account.myUser_getId();
|
SET NEW.editorFk = account.myUser_getId();
|
||||||
|
|
||||||
IF (SELECT COUNT(*) FROM vn.invoiceIn
|
IF (SELECT COUNT(*) FROM vn.invoiceIn
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
DELIMITER $$
|
||||||
|
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`supplierDms_afterDelete`
|
||||||
|
AFTER DELETE ON `supplierDms`
|
||||||
|
FOR EACH ROW
|
||||||
|
BEGIN
|
||||||
|
INSERT INTO clientLog
|
||||||
|
SET `action` = 'delete',
|
||||||
|
`changedModel` = 'supplierDms',
|
||||||
|
`changedModelId` = OLD.dmsFk,
|
||||||
|
`userFk` = account.myUser_getId();
|
||||||
|
END$$
|
||||||
|
DELIMITER ;
|
|
@ -0,0 +1,8 @@
|
||||||
|
DELIMITER $$
|
||||||
|
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`supplierDms_beforeInsert`
|
||||||
|
BEFORE INSERT ON `supplierDms`
|
||||||
|
FOR EACH ROW
|
||||||
|
BEGIN
|
||||||
|
SET NEW.editorFk = account.myUser_getId();
|
||||||
|
END$$
|
||||||
|
DELIMITER ;
|
|
@ -0,0 +1,8 @@
|
||||||
|
DELIMITER $$
|
||||||
|
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`supplierDms_beforeUpdate`
|
||||||
|
BEFORE UPDATE ON `supplierDms`
|
||||||
|
FOR EACH ROW
|
||||||
|
BEGIN
|
||||||
|
SET NEW.editorFk = account.myUser_getId();
|
||||||
|
END$$
|
||||||
|
DELIMITER ;
|
|
@ -3,6 +3,8 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`travel_beforeUpdate`
|
||||||
BEFORE UPDATE ON `travel`
|
BEFORE UPDATE ON `travel`
|
||||||
FOR EACH ROW
|
FOR EACH ROW
|
||||||
BEGIN
|
BEGIN
|
||||||
|
DECLARE vHasAnyInvoiceBooked BOOL;
|
||||||
|
|
||||||
SET NEW.editorFk = account.myUser_getId();
|
SET NEW.editorFk = account.myUser_getId();
|
||||||
|
|
||||||
IF NOT (NEW.landed <=> OLD.landed)
|
IF NOT (NEW.landed <=> OLD.landed)
|
||||||
|
@ -17,5 +19,18 @@ BEGIN
|
||||||
IF NOT (NEW.warehouseInFk <=> OLD.warehouseInFk) THEN
|
IF NOT (NEW.warehouseInFk <=> OLD.warehouseInFk) THEN
|
||||||
CALL travel_checkWarehouseIsFeedStock(NEW.warehouseInFk);
|
CALL travel_checkWarehouseIsFeedStock(NEW.warehouseInFk);
|
||||||
END IF;
|
END IF;
|
||||||
|
|
||||||
|
IF NOT (NEW.awbFk <=> OLD.awbFk)THEN
|
||||||
|
SELECT COUNT(*) INTO vHasAnyInvoiceBooked
|
||||||
|
FROM travel t
|
||||||
|
JOIN entry e ON e.travelFk = t.id
|
||||||
|
JOIN invoiceIn ii ON ii.id = e.invoiceInFk
|
||||||
|
WHERE t.id = NEW.id
|
||||||
|
AND ii.isBooked;
|
||||||
|
|
||||||
|
IF vHasAnyInvoiceBooked THEN
|
||||||
|
CALL util.throw('The travel has entries with booked invoices');
|
||||||
|
END IF;
|
||||||
|
END IF;
|
||||||
END$$
|
END$$
|
||||||
DELIMITER ;
|
DELIMITER ;
|
||||||
|
|
|
@ -3,7 +3,7 @@ CREATE OR REPLACE DEFINER=`root`@`localhost`
|
||||||
VIEW `vn`.`saleValue`
|
VIEW `vn`.`saleValue`
|
||||||
AS SELECT `wh`.`name` AS `warehouse`,
|
AS SELECT `wh`.`name` AS `warehouse`,
|
||||||
`c`.`name` AS `client`,
|
`c`.`name` AS `client`,
|
||||||
`c`.`typeFk` AS `clientTypeFk`,
|
`c`.`typeFk` AS `typeFk`,
|
||||||
`u`.`name` AS `buyer`,
|
`u`.`name` AS `buyer`,
|
||||||
`it`.`id` AS `itemTypeFk`,
|
`it`.`id` AS `itemTypeFk`,
|
||||||
`it`.`name` AS `family`,
|
`it`.`name` AS `family`,
|
||||||
|
|
|
@ -34,7 +34,6 @@ AS SELECT `c`.`id` AS `id_cliente`,
|
||||||
`c`.`hasLcr` AS `hasLcr`,
|
`c`.`hasLcr` AS `hasLcr`,
|
||||||
`c`.`defaultAddressFk` AS `default_address`,
|
`c`.`defaultAddressFk` AS `default_address`,
|
||||||
`c`.`riskCalculated` AS `risk_calculated`,
|
`c`.`riskCalculated` AS `risk_calculated`,
|
||||||
`c`.`clientTypeFk` AS `clientes_tipo_id`,
|
|
||||||
`c`.`hasToInvoiceByAddress` AS `invoiceByAddress`,
|
`c`.`hasToInvoiceByAddress` AS `invoiceByAddress`,
|
||||||
`c`.`isTaxDataChecked` AS `contabilizado`,
|
`c`.`isTaxDataChecked` AS `contabilizado`,
|
||||||
`c`.`isFreezed` AS `congelado`,
|
`c`.`isFreezed` AS `congelado`,
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
CREATE OR REPLACE TABLE `vn`.`entryDms` (
|
||||||
|
`entryFk` int(11) NOT NULL,
|
||||||
|
`dmsFk` int(11) NOT NULL,
|
||||||
|
`editorFk` int(10) unsigned DEFAULT NULL,
|
||||||
|
PRIMARY KEY (`entryFk`,`dmsFk`),
|
||||||
|
KEY `gestdoc_id` (`dmsFk`),
|
||||||
|
KEY `entryDms_editor` (`editorFk`),
|
||||||
|
CONSTRAINT `entryDms_dms` FOREIGN KEY (`dmsFk`) REFERENCES `dms` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||||
|
CONSTRAINT `entryDms_editor` FOREIGN KEY (`editorFk`) REFERENCES `account`.`user` (`id`),
|
||||||
|
CONSTRAINT `entryDms_entry` FOREIGN KEY (`entryFk`) REFERENCES `entry` (`id`) ON UPDATE CASCADE
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
|
||||||
|
|
||||||
|
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`)
|
||||||
|
VALUES
|
||||||
|
('EntryDms', '*', '*', 'ALLOW', 'ROLE', 'employee');
|
|
@ -0,0 +1,2 @@
|
||||||
|
INSERT INTO `vn`.`dmsType` (code, name, path__, writeRoleFk, readRoleFk, monthToDelete)
|
||||||
|
VALUES('entry', 'Entrada', '', 1, 1, NULL);
|
|
@ -0,0 +1,6 @@
|
||||||
|
ALTER TABLE vn.client DROP FOREIGN KEY tipos_de_cliente;
|
||||||
|
ALTER TABLE vn.client CHANGE COLUMN clientTypeFk clientTypeFk__ INT NOT NULL DEFAULT 1 COMMENT '@deprecated 2024-02-20 refs #6784';
|
||||||
|
ALTER TABLE vn.clientType CHANGE COLUMN id id__ INT NOT NULL COMMENT '@deprecated 2024-02-20 refs #6784';
|
||||||
|
ALTER TABLE vn.clientType DROP PRIMARY KEY;
|
||||||
|
ALTER TABLE vn.clientType ADD PRIMARY KEY (code);
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
ALTER TABLE vn.professionalCategory DROP COLUMN IF EXISTS code;
|
||||||
|
ALTER TABLE IF EXISTS vn.professionalCategory ADD COLUMN code VARCHAR(25) UNIQUE DEFAULT NULL;
|
||||||
|
|
||||||
|
UPDATE vn.professionalCategory
|
||||||
|
SET code = 'driverCE'
|
||||||
|
WHERE name = 'Conductor C + E';
|
|
@ -0,0 +1,25 @@
|
||||||
|
DELETE FROM vn.supplierDms
|
||||||
|
WHERE dmsFk IN (
|
||||||
|
SELECT sd.dmsFk
|
||||||
|
FROM vn.supplierDms sd
|
||||||
|
LEFT JOIN vn.dms d ON d.id = sd.dmsFk
|
||||||
|
WHERE d.id IS NULL
|
||||||
|
);
|
||||||
|
|
||||||
|
DELETE FROM vn.supplierDms
|
||||||
|
WHERE supplierFk IN (
|
||||||
|
SELECT sd.supplierFk
|
||||||
|
FROM vn.supplierDms sd
|
||||||
|
LEFT JOIN vn.supplier s ON s.id = sd.supplierFk
|
||||||
|
WHERE s.id IS NULL
|
||||||
|
);
|
||||||
|
|
||||||
|
ALTER TABLE `vn`.`supplierDms`
|
||||||
|
MODIFY COLUMN supplierFk int(10) unsigned NOT NULL,
|
||||||
|
ADD editorFk INT UNSIGNED NULL,
|
||||||
|
ADD CONSTRAINT user_Fk FOREIGN KEY (editorFk) REFERENCES account.`user`(id),
|
||||||
|
ADD CONSTRAINT dms_Fk FOREIGN KEY (dmsFk) REFERENCES vn.dms(id) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||||
|
ADD CONSTRAINT supplier_Fk FOREIGN KEY (supplierFk) REFERENCES vn.supplier(id) ON UPDATE CASCADE;
|
||||||
|
|
||||||
|
ALTER TABLE `vn`.`supplierLog`
|
||||||
|
MODIFY COLUMN `changedModel` ENUM('Supplier','SupplierAddress','SupplierAccount','SupplierContact','SupplierDms') NOT NULL DEFAULT 'Supplier';
|
|
@ -0,0 +1,12 @@
|
||||||
|
ALTER TABLE vn.country
|
||||||
|
MODIFY COLUMN code varchar(2) NOT NULL;
|
||||||
|
|
||||||
|
ALTER TABLE vn.country
|
||||||
|
ADD CONSTRAINT country_unique UNIQUE KEY (code);
|
||||||
|
|
||||||
|
ALTER TABLE vn.transitoryDuaUnified
|
||||||
|
ADD countryCodeFk varchar(2) DEFAULT 'EC' NOT NULL;
|
||||||
|
|
||||||
|
ALTER TABLE vn.transitoryDuaUnified
|
||||||
|
ADD CONSTRAINT transitoryDuaUnified_country_FK FOREIGN KEY (countryCodeFk)
|
||||||
|
REFERENCES vn.country(code);
|
|
@ -333,9 +333,12 @@
|
||||||
"It was not able to remove the next expeditions:": "No se pudo eliminar las siguientes expediciones: {{expeditions}}",
|
"It was not able to remove the next expeditions:": "No se pudo eliminar las siguientes expediciones: {{expeditions}}",
|
||||||
"This claim has been updated": "La reclamación con Id: {{claimId}}, ha sido actualizada",
|
"This claim has been updated": "La reclamación con Id: {{claimId}}, ha sido actualizada",
|
||||||
"This user does not have an assigned tablet": "Este usuario no tiene tablet asignada",
|
"This user does not have an assigned tablet": "Este usuario no tiene tablet asignada",
|
||||||
"Incorrect pin": "Pin incorrecto",
|
"Field are invalid": "El campo '{{tag}}' no es válido",
|
||||||
|
"Incorrect pin": "Pin incorrecto.",
|
||||||
"You already have the mailAlias": "Ya tienes este alias de correo",
|
"You already have the mailAlias": "Ya tienes este alias de correo",
|
||||||
"The alias cant be modified": "Este alias de correo no puede ser modificado",
|
"The alias cant be modified": "Este alias de correo no puede ser modificado",
|
||||||
|
"No tickets to invoice": "No hay tickets para facturar",
|
||||||
|
"this warehouse has not dms": "El Almacén no acepta documentos",
|
||||||
"This ticket already has a cmr saved": "Este ticket ya tiene un cmr guardado",
|
"This ticket already has a cmr saved": "Este ticket ya tiene un cmr guardado",
|
||||||
"Name should be uppercase": "El nombre debe ir en mayúscula",
|
"Name should be uppercase": "El nombre debe ir en mayúscula",
|
||||||
"Bank entity must be specified": "La entidad bancaria es obligatoria",
|
"Bank entity must be specified": "La entidad bancaria es obligatoria",
|
||||||
|
@ -343,6 +346,5 @@
|
||||||
"You cannot update these fields": "No puedes actualizar estos campos",
|
"You cannot update these fields": "No puedes actualizar estos campos",
|
||||||
"CountryFK cannot be empty": "El país no puede estar vacío",
|
"CountryFK cannot be empty": "El país no puede estar vacío",
|
||||||
"Cmr file does not exist": "El archivo del cmr no existe",
|
"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",
|
"You are not allowed to modify the alias": "No estás autorizado a modificar el alias"
|
||||||
"No tickets to invoice": "No hay tickets para facturar"
|
|
||||||
}
|
}
|
|
@ -103,6 +103,20 @@
|
||||||
"video/mp4"
|
"video/mp4"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"entryStorage": {
|
||||||
|
"name": "entryStorage",
|
||||||
|
"connector": "loopback-component-storage",
|
||||||
|
"provider": "filesystem",
|
||||||
|
"root": "./storage/dms",
|
||||||
|
"maxFileSize": "31457280",
|
||||||
|
"allowedContentTypes": [
|
||||||
|
"image/png",
|
||||||
|
"image/jpeg",
|
||||||
|
"image/jpg",
|
||||||
|
"image/webp",
|
||||||
|
"video/mp4"
|
||||||
|
]
|
||||||
|
},
|
||||||
"accessStorage": {
|
"accessStorage": {
|
||||||
"name": "accessStorage",
|
"name": "accessStorage",
|
||||||
"connector": "loopback-component-storage",
|
"connector": "loopback-component-storage",
|
||||||
|
|
|
@ -26,23 +26,23 @@ module.exports = Self => {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
arg: 'street',
|
arg: 'street',
|
||||||
type: 'string'
|
type: 'any'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
arg: 'postcode',
|
arg: 'postcode',
|
||||||
type: 'string'
|
type: 'any'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
arg: 'city',
|
arg: 'city',
|
||||||
type: 'string'
|
type: 'any'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
arg: 'countryFk',
|
arg: 'countryFk',
|
||||||
type: 'number'
|
type: 'any'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
arg: 'provinceFk',
|
arg: 'provinceFk',
|
||||||
type: 'number'
|
type: 'any'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
arg: 'sageTaxTypeFk',
|
arg: 'sageTaxTypeFk',
|
||||||
|
@ -94,7 +94,7 @@ module.exports = Self => {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
arg: 'despiteOfClient',
|
arg: 'despiteOfClient',
|
||||||
type: 'number'
|
type: 'any'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
arg: 'hasIncoterms',
|
arg: 'hasIncoterms',
|
||||||
|
|
|
@ -7,12 +7,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"properties": {
|
"properties": {
|
||||||
"id": {
|
|
||||||
"type": "number",
|
|
||||||
"id": true
|
|
||||||
},
|
|
||||||
"code": {
|
"code": {
|
||||||
"type": "string"
|
"type": "string",
|
||||||
|
"id": true
|
||||||
},
|
},
|
||||||
"type": {
|
"type": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
|
|
|
@ -197,7 +197,7 @@
|
||||||
"type": {
|
"type": {
|
||||||
"type": "belongsTo",
|
"type": "belongsTo",
|
||||||
"model": "ClientType",
|
"model": "ClientType",
|
||||||
"foreignKey": "clientTypeFk"
|
"foreignKey": "typeFk"
|
||||||
},
|
},
|
||||||
"businessType": {
|
"businessType": {
|
||||||
"type": "belongsTo",
|
"type": "belongsTo",
|
||||||
|
|
|
@ -0,0 +1,59 @@
|
||||||
|
const UserError = require('vn-loopback/util/user-error');
|
||||||
|
|
||||||
|
module.exports = Self => {
|
||||||
|
Self.remoteMethodCtx('downloadFile', {
|
||||||
|
description: 'Get the entry file',
|
||||||
|
accessType: 'READ',
|
||||||
|
accepts: [
|
||||||
|
{
|
||||||
|
arg: 'id',
|
||||||
|
type: 'Number',
|
||||||
|
description: 'The document id',
|
||||||
|
http: {source: 'path'}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
returns: [
|
||||||
|
{
|
||||||
|
arg: 'body',
|
||||||
|
type: 'file',
|
||||||
|
root: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
arg: 'Content-Type',
|
||||||
|
type: 'String',
|
||||||
|
http: {target: 'header'}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
arg: 'Content-Disposition',
|
||||||
|
type: 'String',
|
||||||
|
http: {target: 'header'}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
http: {
|
||||||
|
path: `/:id/downloadFile`,
|
||||||
|
verb: 'GET'
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Self.downloadFile = async function(ctx, id) {
|
||||||
|
const models = Self.app.models;
|
||||||
|
const EntryContainer = models.EntryContainer;
|
||||||
|
const dms = await models.Dms.findById(id);
|
||||||
|
const pathHash = EntryContainer.getHash(dms.id);
|
||||||
|
try {
|
||||||
|
await EntryContainer.getFile(pathHash, dms.file);
|
||||||
|
} catch (e) {
|
||||||
|
if (e.code != 'ENOENT')
|
||||||
|
throw e;
|
||||||
|
|
||||||
|
const error = new UserError(`File doesn't exists`);
|
||||||
|
error.statusCode = 404;
|
||||||
|
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
|
||||||
|
const stream = EntryContainer.downloadStream(pathHash, dms.file);
|
||||||
|
|
||||||
|
return [stream, dms.contentType, `filename="${dms.file}"`];
|
||||||
|
};
|
||||||
|
};
|
|
@ -0,0 +1,53 @@
|
||||||
|
const UserError = require('vn-loopback/util/user-error');
|
||||||
|
|
||||||
|
module.exports = Self => {
|
||||||
|
Self.remoteMethodCtx('removeFile', {
|
||||||
|
description: 'Removes a entry document',
|
||||||
|
accessType: 'WRITE',
|
||||||
|
accepts: {
|
||||||
|
arg: 'id',
|
||||||
|
type: 'number',
|
||||||
|
description: 'The document id',
|
||||||
|
http: {source: 'path'}
|
||||||
|
},
|
||||||
|
returns: {
|
||||||
|
type: 'object',
|
||||||
|
root: true
|
||||||
|
},
|
||||||
|
http: {
|
||||||
|
path: `/:id/removeFile`,
|
||||||
|
verb: 'POST'
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Self.removeFile = async(ctx, id, options) => {
|
||||||
|
const myOptions = {};
|
||||||
|
let tx;
|
||||||
|
|
||||||
|
if (typeof options == 'object')
|
||||||
|
Object.assign(myOptions, options);
|
||||||
|
|
||||||
|
if (!myOptions.transaction) {
|
||||||
|
tx = await Self.beginTransaction({});
|
||||||
|
myOptions.transaction = tx;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
const targetEntryDms = await Self.findById(id, null, myOptions);
|
||||||
|
const targetDms = await Self.app.models.Dms.removeFile(ctx, targetEntryDms.dmsFk, myOptions);
|
||||||
|
|
||||||
|
if (!targetDms)
|
||||||
|
throw new UserError('Try again');
|
||||||
|
|
||||||
|
const entryDmsDestroyed = await targetEntryDms.destroy(myOptions);
|
||||||
|
|
||||||
|
if (tx) await tx.commit();
|
||||||
|
|
||||||
|
return entryDmsDestroyed;
|
||||||
|
} catch (e) {
|
||||||
|
if (tx) await tx.rollback();
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
|
@ -0,0 +1,86 @@
|
||||||
|
|
||||||
|
module.exports = Self => {
|
||||||
|
Self.remoteMethodCtx('uploadFile', {
|
||||||
|
description: 'Upload and attach a file',
|
||||||
|
accessType: 'WRITE',
|
||||||
|
accepts: [{
|
||||||
|
arg: 'id',
|
||||||
|
type: 'number',
|
||||||
|
description: 'The entry id',
|
||||||
|
http: {source: 'path'}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
arg: 'warehouseId',
|
||||||
|
type: 'number',
|
||||||
|
description: 'The warehouse id',
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
arg: 'companyId',
|
||||||
|
type: 'number',
|
||||||
|
description: 'The company id',
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
arg: 'dmsTypeId',
|
||||||
|
type: 'number',
|
||||||
|
description: 'The dms type id',
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
arg: 'reference',
|
||||||
|
type: 'string',
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
arg: 'description',
|
||||||
|
type: 'string',
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
arg: 'hasFile',
|
||||||
|
type: 'boolean',
|
||||||
|
description: 'True if has an attached file',
|
||||||
|
required: true
|
||||||
|
}],
|
||||||
|
returns: {
|
||||||
|
type: 'object',
|
||||||
|
root: true
|
||||||
|
},
|
||||||
|
http: {
|
||||||
|
path: `/:id/uploadFile`,
|
||||||
|
verb: 'POST'
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Self.uploadFile = async(ctx, id, options) => {
|
||||||
|
const {Dms, EntryDms} = Self.app.models;
|
||||||
|
const myOptions = {};
|
||||||
|
let tx;
|
||||||
|
|
||||||
|
if (typeof options == 'object')
|
||||||
|
Object.assign(myOptions, options);
|
||||||
|
|
||||||
|
if (!myOptions.transaction) {
|
||||||
|
tx = await Self.beginTransaction({});
|
||||||
|
myOptions.transaction = tx;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
const uploadedFiles = await Dms.uploadFile(ctx, myOptions);
|
||||||
|
|
||||||
|
const promises = uploadedFiles.map(dms => EntryDms.create({
|
||||||
|
entryFk: id,
|
||||||
|
dmsFk: dms.id
|
||||||
|
}, myOptions));
|
||||||
|
await Promise.all(promises);
|
||||||
|
|
||||||
|
if (tx) await tx.commit();
|
||||||
|
|
||||||
|
return uploadedFiles;
|
||||||
|
} catch (e) {
|
||||||
|
if (tx) await tx.rollback();
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
|
@ -2,6 +2,12 @@
|
||||||
"Entry": {
|
"Entry": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
},
|
},
|
||||||
|
"EntryDms": {
|
||||||
|
"dataSource": "vn"
|
||||||
|
},
|
||||||
|
"EntryContainer": {
|
||||||
|
"dataSource": "entryStorage"
|
||||||
|
},
|
||||||
"Buy": {
|
"Buy": {
|
||||||
"dataSource": "vn"
|
"dataSource": "vn"
|
||||||
},
|
},
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
{
|
||||||
|
"name": "EntryContainer",
|
||||||
|
"base": "Container",
|
||||||
|
"acls": [{
|
||||||
|
"accessType": "READ",
|
||||||
|
"principalType": "ROLE",
|
||||||
|
"principalId": "$everyone",
|
||||||
|
"permission": "ALLOW"
|
||||||
|
}]
|
||||||
|
}
|
|
@ -0,0 +1,13 @@
|
||||||
|
const UserError = require('vn-loopback/util/user-error');
|
||||||
|
|
||||||
|
module.exports = Self => {
|
||||||
|
require('../methods/entry-dms/removeFile')(Self);
|
||||||
|
require('../methods/entry-dms/downloadFile')(Self);
|
||||||
|
require('../methods/entry-dms/uploadFile')(Self);
|
||||||
|
|
||||||
|
Self.rewriteDbError(function(err) {
|
||||||
|
if (err.code === 'ER_DUP_ENTRY')
|
||||||
|
return new UserError('This document already exists on this entry');
|
||||||
|
return err;
|
||||||
|
});
|
||||||
|
};
|
|
@ -0,0 +1,36 @@
|
||||||
|
{
|
||||||
|
"name": "EntryDms",
|
||||||
|
"base": "VnModel",
|
||||||
|
"mixins": {
|
||||||
|
"Loggable": true
|
||||||
|
},
|
||||||
|
"options": {
|
||||||
|
"mysql": {
|
||||||
|
"table": "entryDms"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"allowedContentTypes": [
|
||||||
|
"image/png",
|
||||||
|
"image/jpeg",
|
||||||
|
"image/jpg"
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"dmsFk": {
|
||||||
|
"type": "number",
|
||||||
|
"id": true,
|
||||||
|
"required": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"relations": {
|
||||||
|
"entry": {
|
||||||
|
"type": "belongsTo",
|
||||||
|
"model": "Entry",
|
||||||
|
"foreignKey": "entryFk"
|
||||||
|
},
|
||||||
|
"dms": {
|
||||||
|
"type": "belongsTo",
|
||||||
|
"model": "Dms",
|
||||||
|
"foreignKey": "dmsFk"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -29,17 +29,11 @@ module.exports = Self => {
|
||||||
where: {id: orderId},
|
where: {id: orderId},
|
||||||
fields: ['isConfirmed', 'clientFk'],
|
fields: ['isConfirmed', 'clientFk'],
|
||||||
include: [
|
include: [
|
||||||
{relation: 'client',
|
{relation: 'client'}
|
||||||
scope: {
|
|
||||||
include: {
|
|
||||||
relation: 'type'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
]
|
||||||
}, myOptions);
|
}, myOptions);
|
||||||
|
|
||||||
if (exists && exists.client().type().code !== 'normal')
|
if (exists && exists.client().typeFk !== 'normal')
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (!exists || exists.isConfirmed === 1)
|
if (!exists || exists.isConfirmed === 1)
|
||||||
|
|
|
@ -49,17 +49,12 @@ module.exports = Self => {
|
||||||
where: {id: addressId},
|
where: {id: addressId},
|
||||||
fields: ['clientFk'],
|
fields: ['clientFk'],
|
||||||
include: [
|
include: [
|
||||||
{relation: 'client',
|
{relation: 'client'
|
||||||
scope: {
|
|
||||||
include: {
|
|
||||||
relation: 'type'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}, myOptions);
|
}, myOptions);
|
||||||
|
|
||||||
if (address.client().type().code === 'normal') {
|
if (address.client().typeFk === 'normal') {
|
||||||
if (!address.client().isActive)
|
if (!address.client().isActive)
|
||||||
throw new UserError(`You can't create an order for an inactive client`);
|
throw new UserError(`You can't create an order for an inactive client`);
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,8 @@ describe('Supplier newSupplier()', () => {
|
||||||
const options = {transaction: tx};
|
const options = {transaction: tx};
|
||||||
ctx.args = {
|
ctx.args = {
|
||||||
name: 'NEWSUPPLIER',
|
name: 'NEWSUPPLIER',
|
||||||
nif: '12345678Z'
|
nif: '12345678Z',
|
||||||
|
city: 'Gotham'
|
||||||
};
|
};
|
||||||
|
|
||||||
const result = await models.Supplier.newSupplier(ctx, options);
|
const result = await models.Supplier.newSupplier(ctx, options);
|
||||||
|
|
|
@ -19,7 +19,7 @@ module.exports = Self => {
|
||||||
type: 'any'
|
type: 'any'
|
||||||
}, {
|
}, {
|
||||||
arg: 'phone',
|
arg: 'phone',
|
||||||
type: 'string'
|
type: 'any'
|
||||||
}, {
|
}, {
|
||||||
arg: 'sageTaxTypeFk',
|
arg: 'sageTaxTypeFk',
|
||||||
type: 'any'
|
type: 'any'
|
||||||
|
@ -46,10 +46,10 @@ module.exports = Self => {
|
||||||
type: 'any'
|
type: 'any'
|
||||||
}, {
|
}, {
|
||||||
arg: 'supplierActivityFk',
|
arg: 'supplierActivityFk',
|
||||||
type: 'string'
|
type: 'any'
|
||||||
}, {
|
}, {
|
||||||
arg: 'healthRegister',
|
arg: 'healthRegister',
|
||||||
type: 'string'
|
type: 'any'
|
||||||
}, {
|
}, {
|
||||||
arg: 'isVies',
|
arg: 'isVies',
|
||||||
type: 'boolean'
|
type: 'boolean'
|
||||||
|
|
|
@ -129,10 +129,13 @@ describe('loopback model Supplier', () => {
|
||||||
const options = {transaction: tx};
|
const options = {transaction: tx};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const newSupplier = await models.Supplier.create({name: 'ALFRED PENNYWORTH'}, options);
|
const newSupplier = {
|
||||||
const fetchedSupplier = await models.Supplier.findById(newSupplier.id, null, options);
|
name: 'ALFRED PENNYWORTH', nif: '87805752D', city: 'Gotham'
|
||||||
|
};
|
||||||
|
const supplierCreated = await models.Supplier.create(newSupplier, options);
|
||||||
|
const fetchedSupplier = await models.Supplier.findById(supplierCreated.id, null, options);
|
||||||
|
|
||||||
expect(Number(fetchedSupplier.account)).toEqual(4100000000 + newSupplier.id);
|
expect(Number(fetchedSupplier.account)).toEqual(4100000000 + supplierCreated.id);
|
||||||
await tx.rollback();
|
await tx.rollback();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
await tx.rollback();
|
await tx.rollback();
|
||||||
|
|
|
@ -17,17 +17,13 @@ module.exports = Self => {
|
||||||
message: 'The social name cannot be empty'
|
message: 'The social name cannot be empty'
|
||||||
});
|
});
|
||||||
|
|
||||||
if (this.city) {
|
Self.validatesPresenceOf('city', {
|
||||||
Self.validatesPresenceOf('city', {
|
message: 'City cannot be empty'
|
||||||
message: 'City cannot be empty'
|
});
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.nif) {
|
Self.validatesPresenceOf('nif', {
|
||||||
Self.validatesPresenceOf('nif', {
|
message: 'The nif cannot be empty'
|
||||||
message: 'The nif cannot be empty'
|
});
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
Self.validatesUniquenessOf('nif', {
|
Self.validatesUniquenessOf('nif', {
|
||||||
message: 'TIN must be unique'
|
message: 'TIN must be unique'
|
||||||
|
|
|
@ -17,21 +17,16 @@ module.exports = Self => {
|
||||||
const alertLevel = state ? state.alertLevel : null;
|
const alertLevel = state ? state.alertLevel : null;
|
||||||
const ticket = await models.Ticket.findById(id, {
|
const ticket = await models.Ticket.findById(id, {
|
||||||
fields: ['clientFk'],
|
fields: ['clientFk'],
|
||||||
include: [{
|
include: {
|
||||||
relation: 'client',
|
relation: 'client'
|
||||||
scope: {
|
}
|
||||||
include: {
|
|
||||||
relation: 'type'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}]
|
|
||||||
}, myOptions);
|
}, myOptions);
|
||||||
|
|
||||||
const isLocked = await models.Ticket.isLocked(id, myOptions);
|
const isLocked = await models.Ticket.isLocked(id, myOptions);
|
||||||
const isWeekly = await models.TicketWeekly.findOne({where: {ticketFk: id}}, myOptions);
|
const isWeekly = await models.TicketWeekly.findOne({where: {ticketFk: id}}, myOptions);
|
||||||
|
|
||||||
const alertLevelGreaterThanZero = (alertLevel && alertLevel > 0);
|
const alertLevelGreaterThanZero = (alertLevel && alertLevel > 0);
|
||||||
const isNormalClient = ticket && ticket.client().type().code == 'normal';
|
const isNormalClient = ticket && ticket.client().typeFk == 'normal';
|
||||||
const isEditable = !(alertLevelGreaterThanZero && isNormalClient);
|
const isEditable = !(alertLevelGreaterThanZero && isNormalClient);
|
||||||
|
|
||||||
if (!ticket)
|
if (!ticket)
|
||||||
|
|
|
@ -77,12 +77,7 @@ module.exports = Self => {
|
||||||
where: {id: args.addressId},
|
where: {id: args.addressId},
|
||||||
fields: ['id', 'clientFk'],
|
fields: ['id', 'clientFk'],
|
||||||
include: {
|
include: {
|
||||||
relation: 'client',
|
relation: 'client'
|
||||||
scope: {
|
|
||||||
include: {
|
|
||||||
relation: 'type'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}, myOptions);
|
}, myOptions);
|
||||||
|
|
||||||
|
@ -93,7 +88,7 @@ module.exports = Self => {
|
||||||
if (args.agencyModeId)
|
if (args.agencyModeId)
|
||||||
agencyMode = await models.AgencyMode.findById(args.agencyModeId, null, myOptions);
|
agencyMode = await models.AgencyMode.findById(args.agencyModeId, null, myOptions);
|
||||||
|
|
||||||
if (address.client().type().code === 'normal' && (!agencyMode || agencyMode.code != 'refund')) {
|
if (address.client().typeFk === 'normal' && (!agencyMode || agencyMode.code != 'refund')) {
|
||||||
const canCreateTicket = await models.Client.canCreateTicket(args.clientId, myOptions);
|
const canCreateTicket = await models.Client.canCreateTicket(args.clientId, myOptions);
|
||||||
if (!canCreateTicket)
|
if (!canCreateTicket)
|
||||||
throw new UserError(`You can't create a ticket for an inactive client`);
|
throw new UserError(`You can't create a ticket for an inactive client`);
|
||||||
|
|
|
@ -41,7 +41,7 @@ module.exports = Self => {
|
||||||
include: {
|
include: {
|
||||||
relation: 'client',
|
relation: 'client',
|
||||||
scope: {
|
scope: {
|
||||||
fields: ['id', 'clientTypeFk'],
|
fields: ['id', 'typeFk'],
|
||||||
include: {
|
include: {
|
||||||
relation: 'type',
|
relation: 'type',
|
||||||
scope: {
|
scope: {
|
||||||
|
@ -52,7 +52,7 @@ module.exports = Self => {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
ctx.options);
|
ctx.options);
|
||||||
if (ticket?.client()?.type()?.code === 'loses') return;
|
if (ticket?.client()?.typeFk === 'loses') return;
|
||||||
|
|
||||||
const isRefund = await models.TicketRefund.findOne({
|
const isRefund = await models.TicketRefund.findOne({
|
||||||
fields: ['id'],
|
fields: ['id'],
|
||||||
|
|
|
@ -139,9 +139,12 @@ describe('Worker new', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should create a new worker', async() => {
|
it('should create a new worker', async() => {
|
||||||
const newWorker = await models.Worker.new({args: defaultWorker, req});
|
let newWorker;
|
||||||
|
try {
|
||||||
await removeWorker(newWorker.id);
|
newWorker = await models.Worker.new({args: defaultWorker, req});
|
||||||
|
} finally {
|
||||||
|
await removeWorker(newWorker.id);
|
||||||
|
}
|
||||||
|
|
||||||
expect(newWorker.id).toBeDefined();
|
expect(newWorker.id).toBeDefined();
|
||||||
});
|
});
|
||||||
|
@ -173,9 +176,12 @@ describe('Worker new', () => {
|
||||||
}),
|
}),
|
||||||
req
|
req
|
||||||
};
|
};
|
||||||
const newWorker = await models.Worker.new(newWorkerData);
|
let newWorker;
|
||||||
|
try {
|
||||||
await models.Worker.destroyById(newWorker.id);
|
newWorker = await models.Worker.new(newWorkerData);
|
||||||
|
} finally {
|
||||||
|
await models.Worker.destroyById(newWorker.id);
|
||||||
|
}
|
||||||
|
|
||||||
expect(newWorker.id).toEqual(bruceWayneId);
|
expect(newWorker.id).toEqual(bruceWayneId);
|
||||||
});
|
});
|
||||||
|
|
|
@ -3786,7 +3786,7 @@ packages:
|
||||||
resolution: {integrity: sha512-xq+q3SRMOxGivLhBNaUdC64hDTQwejJ+H0T/NB1XMtTVEwNTrfFF3gAxiyW0Bu/xWEGhjVKgUcMhCrUy2+uCWg==}
|
resolution: {integrity: sha512-xq+q3SRMOxGivLhBNaUdC64hDTQwejJ+H0T/NB1XMtTVEwNTrfFF3gAxiyW0Bu/xWEGhjVKgUcMhCrUy2+uCWg==}
|
||||||
dependencies:
|
dependencies:
|
||||||
base64-js: 1.5.1
|
base64-js: 1.5.1
|
||||||
ieee754: 1.1.13
|
ieee754: 1.2.1
|
||||||
isarray: 1.0.0
|
isarray: 1.0.0
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
|
@ -7288,8 +7288,8 @@ packages:
|
||||||
- supports-color
|
- supports-color
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/http-proxy-agent@7.0.0:
|
/http-proxy-agent@7.0.2:
|
||||||
resolution: {integrity: sha512-+ZT+iBxVUQ1asugqnD6oWoRiS25AkjNfG085dKJGtGxkdwLQrMKU5wJr2bOOFAXzKcTuqq+7fZlTMgG3SRfIYQ==}
|
resolution: {integrity: sha512-T1gkAiYYDWYx3V5Bmyu7HcfcvL7mUrTWiM6yOfa3PIphViJ/gFPbvidQ+veqSOHci/PxBcDabeUNCzpOODJZig==}
|
||||||
engines: {node: '>= 14'}
|
engines: {node: '>= 14'}
|
||||||
dependencies:
|
dependencies:
|
||||||
agent-base: 7.1.0
|
agent-base: 7.1.0
|
||||||
|
@ -7367,8 +7367,8 @@ packages:
|
||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
- supports-color
|
- supports-color
|
||||||
|
|
||||||
/https-proxy-agent@7.0.2:
|
/https-proxy-agent@7.0.4:
|
||||||
resolution: {integrity: sha512-NmLNjm6ucYwtcUmL7JQC1ZQ57LmHP4lT15FQ8D61nak1rO6DH+fz5qNK2Ap5UN4ZapYICE3/0KodcLYSPsPbaA==}
|
resolution: {integrity: sha512-wlwpilI7YdjSkWaQ/7omYBMTliDcmCN8OLihO6I9B86g06lMyAoqgoDpV0XqoaPOKj+0DIdAvnsWfyAAhmimcg==}
|
||||||
engines: {node: '>= 14'}
|
engines: {node: '>= 14'}
|
||||||
dependencies:
|
dependencies:
|
||||||
agent-base: 7.1.0
|
agent-base: 7.1.0
|
||||||
|
@ -9780,6 +9780,7 @@ packages:
|
||||||
|
|
||||||
/mkdirp-classic@0.5.3:
|
/mkdirp-classic@0.5.3:
|
||||||
resolution: {integrity: sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A==}
|
resolution: {integrity: sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A==}
|
||||||
|
requiresBuild: true
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
/mkdirp@0.3.0:
|
/mkdirp@0.3.0:
|
||||||
|
@ -10692,8 +10693,8 @@ packages:
|
||||||
agent-base: 7.1.0
|
agent-base: 7.1.0
|
||||||
debug: 4.3.4(supports-color@6.1.0)
|
debug: 4.3.4(supports-color@6.1.0)
|
||||||
get-uri: 6.0.2
|
get-uri: 6.0.2
|
||||||
http-proxy-agent: 7.0.0
|
http-proxy-agent: 7.0.2
|
||||||
https-proxy-agent: 7.0.2
|
https-proxy-agent: 7.0.4
|
||||||
pac-resolver: 7.0.0
|
pac-resolver: 7.0.0
|
||||||
socks-proxy-agent: 8.0.2
|
socks-proxy-agent: 8.0.2
|
||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
|
@ -11155,8 +11156,8 @@ packages:
|
||||||
dependencies:
|
dependencies:
|
||||||
agent-base: 7.1.0
|
agent-base: 7.1.0
|
||||||
debug: 4.3.4(supports-color@6.1.0)
|
debug: 4.3.4(supports-color@6.1.0)
|
||||||
http-proxy-agent: 7.0.0
|
http-proxy-agent: 7.0.2
|
||||||
https-proxy-agent: 7.0.2
|
https-proxy-agent: 7.0.4
|
||||||
lru-cache: 7.18.3
|
lru-cache: 7.18.3
|
||||||
pac-proxy-agent: 7.0.1
|
pac-proxy-agent: 7.0.1
|
||||||
proxy-from-env: 1.1.0
|
proxy-from-env: 1.1.0
|
||||||
|
@ -11288,6 +11289,7 @@ packages:
|
||||||
|
|
||||||
/queue-tick@1.0.1:
|
/queue-tick@1.0.1:
|
||||||
resolution: {integrity: sha512-kJt5qhMxoszgU/62PLP1CJytzd2NKetjSRnyuj31fDd3Rlcz3fzlFdFLD1SItunPwyqEOkca6GbV612BWfaBag==}
|
resolution: {integrity: sha512-kJt5qhMxoszgU/62PLP1CJytzd2NKetjSRnyuj31fDd3Rlcz3fzlFdFLD1SItunPwyqEOkca6GbV612BWfaBag==}
|
||||||
|
requiresBuild: true
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
/quick-lru@4.0.1:
|
/quick-lru@4.0.1:
|
||||||
|
|
|
@ -7,7 +7,8 @@ SELECT
|
||||||
s.discount,
|
s.discount,
|
||||||
s.itemFk,
|
s.itemFk,
|
||||||
s.concept,
|
s.concept,
|
||||||
tc.code vatType
|
tc.code vatType,
|
||||||
|
it.isPackaging
|
||||||
FROM vn.invoiceOut io
|
FROM vn.invoiceOut io
|
||||||
JOIN vn.ticket t ON t.refFk = io.ref
|
JOIN vn.ticket t ON t.refFk = io.ref
|
||||||
JOIN vn.supplier su ON su.id = io.companyFk
|
JOIN vn.supplier su ON su.id = io.companyFk
|
||||||
|
@ -34,9 +35,10 @@ SELECT
|
||||||
ts.quantity,
|
ts.quantity,
|
||||||
ts.price,
|
ts.price,
|
||||||
0 discount,
|
0 discount,
|
||||||
'',
|
NULL,
|
||||||
ts.description concept,
|
ts.description,
|
||||||
tc.code vatType
|
tc.code,
|
||||||
|
NULL
|
||||||
FROM vn.invoiceOut io
|
FROM vn.invoiceOut io
|
||||||
JOIN vn.ticket t ON t.refFk = io.ref
|
JOIN vn.ticket t ON t.refFk = io.ref
|
||||||
JOIN vn.ticketService ts ON ts.ticketFk = t.id
|
JOIN vn.ticketService ts ON ts.ticketFk = t.id
|
||||||
|
@ -46,3 +48,4 @@ SELECT
|
||||||
JOIN vn.supplierAccount sa ON sa.id = co.supplierAccountFk
|
JOIN vn.supplierAccount sa ON sa.id = co.supplierAccountFk
|
||||||
JOIN vn.taxClass tc ON tc.id = ts.taxClassFk
|
JOIN vn.taxClass tc ON tc.id = ts.taxClassFk
|
||||||
WHERE t.refFk = ?
|
WHERE t.refFk = ?
|
||||||
|
ORDER BY (isPackaging), concept, itemFk
|
||||||
|
|
Loading…
Reference in New Issue