From 3fd34e08618fe9ea1b260f8103bddb9b6d9421fd Mon Sep 17 00:00:00 2001 From: alexm Date: Mon, 25 Jul 2022 14:49:39 +0200 Subject: [PATCH 01/15] feat(claim_pickup_order): modify email --- db/dump/fixtures.sql | 256 +++++++++--------- modules/claim/front/basic-data/index.html | 4 +- modules/claim/front/basic-data/locale/es.yml | 4 +- modules/claim/front/descriptor/index.js | 5 +- modules/claim/front/summary/index.html | 47 ++-- .../claim-pickup-order.html | 9 +- .../claim-pickup-order/claim-pickup-order.js | 12 + .../email/claim-pickup-order/locale/es.yml | 13 +- .../claim-pickup-order.html | 9 +- .../claim-pickup-order/claim-pickup-order.js | 4 - .../reports/claim-pickup-order/locale/es.yml | 4 - .../claim-pickup-order/sql/claimConfig.sql | 2 - 12 files changed, 192 insertions(+), 177 deletions(-) delete mode 100644 print/templates/reports/claim-pickup-order/sql/claimConfig.sql diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql index 0609a6a6a..746e77ffd 100644 --- a/db/dump/fixtures.sql +++ b/db/dump/fixtures.sql @@ -1,7 +1,7 @@ CREATE SCHEMA IF NOT EXISTS `vn2008`; CREATE SCHEMA IF NOT EXISTS `tmp`; -UPDATE `util`.`config` +UPDATE `util`.`config` SET `environment`= 'test'; ALTER TABLE `vn`.`itemTaxCountry` AUTO_INCREMENT = 1; @@ -9,11 +9,11 @@ ALTER TABLE `vn`.`address` AUTO_INCREMENT = 1; ALTER TABLE `vn`.`zoneGeo` AUTO_INCREMENT = 1; ALTER TABLE `vn`.`ticket` AUTO_INCREMENT = 1; -INSERT INTO `salix`.`AccessToken` (`id`, `ttl`, `created`, `userId`) - VALUES +INSERT INTO `salix`.`AccessToken` (`id`, `ttl`, `created`, `userId`) + VALUES ('DEFAULT_TOKEN', '1209600', util.VN_CURDATE(), 66); -INSERT INTO `vn`.`ticketConfig` (`id`, `scopeDays`) +INSERT INTO `vn`.`ticketConfig` (`id`, `scopeDays`) VALUES ('1', '6'); @@ -22,11 +22,11 @@ INSERT INTO `vn`.`bionicConfig` (`generalInflationCoeficient`, `minimumDensityVo (1.30, 167.00, 138000, 71); INSERT INTO `vn`.`chatConfig` (`host`, `api`) - VALUES + VALUES ('https://chat.verdnatura.es', 'https://chat.verdnatura.es/api/v1'); -INSERT IGNORE INTO `vn`.`greugeConfig`(`id`, `freightPickUpPrice`) - VALUES +INSERT IGNORE INTO `vn`.`greugeConfig`(`id`, `freightPickUpPrice`) + VALUES ('1', '11'); INSERT INTO `vn`.`packagingConfig`(`upperGap`) @@ -52,11 +52,11 @@ INSERT INTO `account`.`account`(`id`) INSERT INTO `vn`.`educationLevel` (`id`, `name`) VALUES (1, 'ESTUDIOS PRIMARIOS COMPLETOS'), - (2, 'ENSEÑANZAS DE BACHILLERATO'); + (2, 'ENSEÑANZAS DE BACHILLERATO'); INSERT INTO `vn`.`worker`(`id`,`code`, `firstName`, `lastName`, `userFk`, `bossFk`) SELECT id,UPPER(LPAD(role, 3, '0')), name, name, id, 9 - FROM `vn`.`user`; + FROM `vn`.`user`; UPDATE `vn`.`worker` SET bossFk = NULL WHERE id = 20; UPDATE `vn`.`worker` SET bossFk = 20 WHERE id = 1 OR id = 9; @@ -69,7 +69,7 @@ INSERT INTO `hedera`.`tpvConfig`(`id`, `currency`, `terminal`, `transactionType` (1, 978, 1, 0, 2000, 9, 0); INSERT INTO `account`.`user`(`id`,`name`,`nickname`, `password`,`role`,`active`,`email`,`lang`, `image`) - VALUES + VALUES (1101, 'BruceWayne', 'Bruce Wayne', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'BruceWayne@mydomain.com', 'es', 'e7723f0b24ff05b32ed09d95196f2f29'), (1102, 'PetterParker', 'Petter Parker', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'PetterParker@mydomain.com', 'en', 'e7723f0b24ff05b32ed09d95196f2f29'), (1103, 'ClarkKent', 'Clark Kent', 'ac754a330530832ba1bf7687f577da91', 2, 1, 'ClarkKent@mydomain.com', 'fr', 'e7723f0b24ff05b32ed09d95196f2f29'), @@ -113,7 +113,7 @@ INSERT INTO `vn`.`worker`(`id`, `code`, `firstName`, `lastName`, `userFk`,`bossF (1107, 'ANT', 'Hank' , 'Pym' , 1107, 19, 432978107, NULL, 1), (1108, 'DCX', 'Charles' , 'Xavier', 1108, 19, 432978108, 1, NULL), (1109, 'HLK', 'Bruce' , 'Banner', 1109, 19, 432978109, 1, 2), - (1110, 'JJJ', 'Jessica' , 'Jones' , 1110, 19, 432978110, 2, 1); + (1110, 'JJJ', 'Jessica' , 'Jones' , 1110, 19, 432978110, 2, 1); INSERT INTO `vn`.`currency`(`id`, `code`, `name`, `ratio`) VALUES @@ -123,7 +123,7 @@ INSERT INTO `vn`.`currency`(`id`, `code`, `name`, `ratio`) (4, 'JPY', 'Yen Japones', 1); INSERT INTO `vn`.`country`(`id`, `country`, `isUeeMember`, `code`, `currencyFk`, `politicalCountryFk`, `ibanLength`, `continentFk`, `hasDailyInvoice`, `CEE`) - VALUES + VALUES (1, 'España', 1, 'ES', 1, 1, 24, 4, 0, 1), (2, 'Italia', 1, 'IT', 1, 2, 27, 4, 0, 1), (3, 'Alemania', 1, 'DE', 1, 3, 22, 4, 0, 1), @@ -153,19 +153,19 @@ INSERT INTO `vn`.`sector`(`id`, `description`, `warehouseFk`, `isPreviousPrepare (1, 'First sector', 1, 1, 'FIRST'), (2, 'Second sector', 2, 0, 'SECOND'); -INSERT INTO `vn`.`parking` (`id`, `column`, `row`, `sectorFk`, `code`, `pickingOrder`) - VALUES +INSERT INTO `vn`.`parking` (`id`, `column`, `row`, `sectorFk`, `code`, `pickingOrder`) + VALUES ('1', '700', '01', '1', '700-01', '70001'), ('2', '700', '02', '2', '700-02', '70002'); -INSERT INTO `vn`.`shelving` (`code`, `parkingFk`, `isPrinted`, `priority`, `parked`, `userFk`) - VALUES +INSERT INTO `vn`.`shelving` (`code`, `parkingFk`, `isPrinted`, `priority`, `parked`, `userFk`) + VALUES ('GVC', 1, 0, 1, 0, 1106), ('HEJ', 2, 0, 1, 0, 1106), ('UXN', 1, 0, 1, 0, 1106); INSERT INTO `vn`.`accountingType`(`id`, `description`, `receiptDescription`,`code`, `maxAmount`, `daysInFuture`) - VALUES + VALUES (1, 'CC and credit policies', 'Transfers', 'wireTransfer', NULL, 1), (2, 'Cash', 'Cash', 'cash', 1000, 0), (3, 'Credit card', 'Credit Card', 'creditCard', NULL, 0), @@ -180,8 +180,8 @@ INSERT INTO `vn`.`bankEntity`(`id`, `countryFk`, `name`, `bic`) (128, 1, 'The Best Bank', 'BBKKESMMMMMM'), (2100, 1, 'Caixa Bank', 'CAIXESBB'); -INSERT INTO `vn`.`bank`(`id`, `bank`, `account`, `cash`, `entityFk`, `isActive`, `currencyFk`) - VALUES +INSERT INTO `vn`.`bank`(`id`, `bank`, `account`, `cash`, `entityFk`, `isActive`, `currencyFk`) + VALUES (1, 'Pay on receipt', '5720000001', 3, 128, 1, 1), (2, 'Cash', '5700000001', 2, 128, 1, 1), (3, 'Compensation', '4000000000', 8, 128, 1, 1), @@ -235,7 +235,7 @@ UPDATE `vn`.`agencyMode` SET `web` = 1, `reportMail` = 'no-reply@gothamcity.com' UPDATE `vn`.`agencyMode` SET `code` = 'refund' WHERE `id` = 23; INSERT INTO `vn`.`payMethod`(`id`,`code`, `name`, `graceDays`, `outstandingDebt`, `isIbanRequiredForClients`, `isIbanRequiredForSuppliers`, `hasVerified`) - VALUES + VALUES (1, NULL, 'PayMethod one', 0, 001, 0, 0, 0), (2, NULL, 'PayMethod two', 10, 001, 0, 0, 1), (3, 'compensation', 'PayMethod three', 0, 001, 0, 0, 0), @@ -244,7 +244,7 @@ INSERT INTO `vn`.`payMethod`(`id`,`code`, `name`, `graceDays`, `outstandingDebt (8,'wireTransfer', 'WireTransfer', 5, 001, 1, 1, 0); INSERT INTO `vn`.`payDem`(`id`, `payDem`) - VALUES + VALUES (1, 10), (2, 20); @@ -273,7 +273,7 @@ INSERT INTO `vn`.`town`(`id`, `name`, `provinceFk`) (5, 'Quito', 5); INSERT INTO `vn`.`postCode`(`code`, `townFk`, `geoFk`) - VALUES + VALUES ('46000', 1, 6), ('46460', 2, 6), ('46680', 3, 6), @@ -481,7 +481,7 @@ INSERT INTO `vn`.`supplierActivity`(`code`, `name`) ('complements', 'Other complements'), ('flowerPlants', 'Wholesale of flowers and plants'), ('vegetablesFruits', 'Fruit and vegetable trade'); - + 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 (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'), @@ -498,7 +498,7 @@ INSERT INTO `vn`.`company`(`id`, `code`, `supplierAccountFk`, `workerManagerFk`, (442 , 'VNL', 241, 30, 2 , 1, NULL, 2, 'VNL Company - Plant passport'), (567 , 'VNH', NULL, 30, NULL, 4, NULL, 1, 'VNH Company - Plant passport'), (791 , 'FTH', NULL, 30, NULL, 3, '2015-11-30', 1, NULL), - (1381, 'ORN', NULL, 30, NULL, 7, NULL, 1, 'ORN Company - Plant passport'); + (1381, 'ORN', NULL, 30, NULL, 7, NULL, 1, 'ORN Company - Plant passport'); INSERT INTO `vn`.`taxArea` (`code`, `claveOperacionFactura`, `CodigoTransaccion`) VALUES @@ -519,7 +519,7 @@ INSERT INTO `vn`.`invoiceOutSerial` (`code`, `description`, `isTaxed`, `taxAreaF INSERT INTO `vn`.`invoiceOut`(`id`, `serial`, `amount`, `issued`,`clientFk`, `created`, `companyFk`, `dued`, `booked`, `bankFk`, `hasPdf`) VALUES (1, 'T', 1014.24, util.VN_CURDATE(), 1101, util.VN_CURDATE(), 442, util.VN_CURDATE(), util.VN_CURDATE(), 1, 0), - (2, 'T', 121.36, util.VN_CURDATE(), 1102, util.VN_CURDATE(), 442, util.VN_CURDATE(), util.VN_CURDATE(), 1, 0), + (2, 'T', 121.36, util.VN_CURDATE(), 1102, util.VN_CURDATE(), 442, util.VN_CURDATE(), util.VN_CURDATE(), 1, 0), (3, 'T', 8.88, util.VN_CURDATE(), 1103, util.VN_CURDATE(), 442, util.VN_CURDATE(), util.VN_CURDATE(), 1, 0), (4, 'T', 8.88, util.VN_CURDATE(), 1103, util.VN_CURDATE(), 442, util.VN_CURDATE(), util.VN_CURDATE(), 1, 0), (5, 'A', 8.88, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1103, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 442, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 0); @@ -531,7 +531,7 @@ UPDATE `vn`.`invoiceOut` SET ref = 'T4444444' WHERE id = 4; UPDATE `vn`.`invoiceOut` SET ref = 'A1111111' WHERE id = 5; INSERT INTO `vn`.`invoiceOutTax` (`invoiceOutFk`, `taxableBase`, `vat`, `pgcFk`) - VALUES + VALUES (1, 895.76, 89.58, 4722000010), (1, 33.80, 7.10, 4722000021), (2, 110.33, 11.03, 4770000010), @@ -552,7 +552,7 @@ INSERT INTO `vn`.`expence`(`id`, `taxTypeFk`, `name`, `isWithheld`) (7001000000, 1, 'Mercaderia', 0), (7050000000, 1, 'Prestacion de servicios', 1); - + INSERT INTO `vn`.`invoiceOutExpence`(`id`, `invoiceOutFk`, `amount`, `expenceFk`, `created`) VALUES (1, 1, 813.06, 2000000000, util.VN_CURDATE()), @@ -564,7 +564,7 @@ INSERT INTO `vn`.`invoiceOutExpence`(`id`, `invoiceOutFk`, `amount`, `expenceFk` (7, 5, 8.07, 2000000000, util.VN_CURDATE()); INSERT INTO `vn`.`zone` (`id`, `name`, `hour`, `agencyModeFk`, `travelingDays`, `price`, `bonus`, `itemMaxSize`) - VALUES + VALUES (1, 'Zone pickup A', CONCAT(util.VN_CURDATE(), ' ', TIME('23:59')), 1, 0, 0, 0, 100), (2, 'Zone pickup B', CONCAT(util.VN_CURDATE(), ' ', TIME('23:59')), 1, 0, 0, 0, 100), (3, 'Zone 247 A', CONCAT(util.VN_CURDATE(), ' ', TIME('23:59')), 7, 1, 2, 0, 100), @@ -580,7 +580,7 @@ INSERT INTO `vn`.`zone` (`id`, `name`, `hour`, `agencyModeFk`, `travelingDays`, (13, 'Zone quantum break', CONCAT(util.VN_CURDATE(), ' ', TIME('23:59')), 5, 0, 0, 0, 100); INSERT INTO `vn`.`zoneWarehouse` (`id`, `zoneFk`, `warehouseFk`) - VALUES + VALUES (1, 1, 1), (2, 2, 2), (3, 3, 1), @@ -596,7 +596,7 @@ INSERT INTO `vn`.`zoneWarehouse` (`id`, `zoneFk`, `warehouseFk`) (13, 13, 5); INSERT INTO `vn`.`zoneClosure` (`zoneFk`, `dated`, `hour`) - VALUES + VALUES (1, util.VN_CURDATE(), '23:59'), (2, util.VN_CURDATE(), '23:59'), (3, util.VN_CURDATE(), '23:59'), @@ -668,7 +668,7 @@ INSERT INTO `vn`.`ticketObservation`(`id`, `ticketFk`, `observationTypeFk`, `des (11, 24, 4, 'Reclama ticket: 7'), (12, 11, 3, 'Delivery after 10am'); --- FIX for state hours on local, inter_afterInsert +-- FIX for state hours on local, inter_afterInsert UPDATE vncontrol.inter SET odbc_date = DATE_ADD(util.VN_CURDATE(), INTERVAL -10 SECOND); INSERT INTO `vn`.`ticketTracking`(`ticketFk`, `stateFk`, `workerFk`, `created`) @@ -764,7 +764,7 @@ INSERT INTO `vn`.`itemCategory`(`id`, `name`, `display`, `color`, `icon`, `code` INSERT INTO `vn`.`temperature`(`code`, `name`, `description`) VALUES ('warm', 'Warm', 'Warm'), - ('cool', 'Cool', 'Cool'); + ('cool', 'Cool', 'Cool'); INSERT INTO `vn`.`itemType`(`id`, `code`, `name`, `categoryFk`, `warehouseFk`, `life`,`workerFk`, `isPackaging`, `temperatureFk`) VALUES @@ -818,7 +818,7 @@ INSERT INTO `vn`.`taxClassCode`(`taxClassFk`, `effectived`, `taxCodeFk`) (1, util.VN_CURDATE(), 1), (1, util.VN_CURDATE(), 21), (2, util.VN_CURDATE(), 2); - + INSERT INTO `vn`.`intrastat`(`id`, `description`, `taxClassFk`, `taxCodeFk`) VALUES (05080000, 'Coral y materiales similares', 2, 2), @@ -830,7 +830,7 @@ INSERT INTO `vn`.`itemFamily`(`code`, `description`) ('SER', 'Services'), ('VT', 'Sales'); -INSERT INTO `vn`.`item`(`id`, `typeFk`, `size`, `inkFk`, `stems`, `originFk`, `description`, `producerFk`, `intrastatFk`, `expenceFk`, +INSERT INTO `vn`.`item`(`id`, `typeFk`, `size`, `inkFk`, `stems`, `originFk`, `description`, `producerFk`, `intrastatFk`, `expenceFk`, `comment`, `relevancy`, `image`, `subName`, `minPrice`, `stars`, `family`, `isFloramondo`, `genericFk`, `itemPackingTypeFk`, `hasMinPrice`, `packingShelve`) VALUES (1, 2, 70, 'YEL', 1, 1, NULL, 1, 06021010, 2000000000, NULL, 0, '1', NULL, 0, 1, 'VT', 0, NULL, 'V', 0, 15), @@ -966,7 +966,7 @@ INSERT INTO `vn`.`saleComponent`(`saleFk`, `componentFk`, `value`) (3, 39, 0.994), (4, 28, 1.25), (4, 29, 0.42), - (4, 39, 0.017), + (4, 39, 0.017), (5, 17, 9.94), (5, 28, 50), (5, 29, 49.4), @@ -988,8 +988,8 @@ INSERT INTO `vn`.`saleComponent`(`saleFk`, `componentFk`, `value`) (9, 15, 3.0949), (9, 21, 0.001), (9, 28, 53), - (9, 29, 46.4), - (9, 39, 0.994), + (9, 29, 46.4), + (9, 39, 0.994), (10, 15, 0.0199), (10, 28, 7), (10, 29, 0), @@ -1088,14 +1088,14 @@ INSERT INTO `vn`.`saleComponent`(`saleFk`, `componentFk`, `value`) (32, 36, -92.324), (32, 39, 0.994); -INSERT INTO `vn`.`itemShelving` (`itemFk`, `shelvingFk`, `shelve`, `visible`, `grouping`, `packing`, `userFk`) - VALUES +INSERT INTO `vn`.`itemShelving` (`itemFk`, `shelvingFk`, `shelve`, `visible`, `grouping`, `packing`, `userFk`) + VALUES (2, 'GVC', 'A', 1, 1, 1, 1106), (4, 'HEJ', 'A', 1, 1, 1, 1106), (1, 'UXN', 'A', 2, 12, 12, 1106); -INSERT INTO `vn`.`itemShelvingSale` (`itemShelvingFk`, `saleFk`, `quantity`, `created`, `userFk`) - VALUES +INSERT INTO `vn`.`itemShelvingSale` (`itemShelvingFk`, `saleFk`, `quantity`, `created`, `userFk`) + VALUES ('1', '1', '1', '', '1106'), ('2', '2', '5', '', '1106'), ('1', '7', '1', '', '1106'), @@ -1137,8 +1137,8 @@ INSERT INTO `vn`.`ticketCollection`(`ticketFk`, `collectionFk`, `level`) (3, 2, NULL), (23, 1, NULL); -INSERT INTO `vn`.`parking` (`column`, `row`, `sectorFk`, `code`, `pickingOrder`) - VALUES +INSERT INTO `vn`.`parking` (`column`, `row`, `sectorFk`, `code`, `pickingOrder`) + VALUES ('100', '01', 1, '100-01', 1); INSERT INTO `vn`.`genus`(`id`, `name`) @@ -1292,7 +1292,7 @@ INSERT INTO `vn`.`itemTypeTag`(`id`, `itemTypeFk`, `tagFk`, `priority`) CALL `vn`.`itemRefreshTags`(NULL); INSERT INTO `vn`.`itemLog` (`id`, `originFk`, `userFk`, `action`, `description`) - VALUES + VALUES ('1', '1', '1', 'insert', 'We made a change!'); INSERT INTO `vn`.`recovery`(`id`, `clientFk`, `started`, `finished`, `amount`, `period`) @@ -1484,8 +1484,8 @@ INSERT INTO `hedera`.`orderRowComponent`(`rowFk`, `componentFk`, `price`) (4, 21, -0.001), (4, 28, 20.72), (4, 29, -19.72), - (4, 37, 2), - (4, 39, 0.01), + (4, 37, 2), + (4, 39, 0.01), (5, 15, 0.58), (5, 23, 6.5), (5, 28, 20.72), @@ -1704,7 +1704,7 @@ INSERT INTO `vn`.`workerManaExcluded`(`workerFk`) La otra manera es poner el calculo con los 2 trabajadores que utilizamos ahora mismo para los tickets */ -call vn.manaSpellersRequery(19); +call vn.manaSpellersRequery(19); call vn.manaSpellersRequery(18); INSERT INTO `vn`.`clientSample`(`id`, `clientFk`, `typeFk`, `created`, `workerFk`, `userFk`, `companyFk`) @@ -1772,8 +1772,8 @@ INSERT INTO `hedera`.`tpvMerchant`(`id`, `description`, `companyFk`, `bankFk`, ` (1, 'Arkham Bank', 442, 1, 'h12387193H10238'), (2, 'NewYork Bank', 442, 1, '7981ugsgd1hsdad'); -INSERT INTO `hedera`.`tpvTransaction`(`id`,`merchantFk`, `clientFk`,`receiptFk`, `amount`, `response`, `errorCode`, `status`, `created`) - VALUES +INSERT INTO `hedera`.`tpvTransaction`(`id`,`merchantFk`, `clientFk`,`receiptFk`, `amount`, `response`, `errorCode`, `status`, `created`) + VALUES (1, 1, 1101, NULL, 2000, NULL, 'SIS0042', 'ok', util.VN_CURDATE()), (2, 1, 1101, NULL, 1000, NULL, 'SIS0051', 'started', util.VN_CURDATE()), (3, 2, 1101, NULL, 7268, NULL, NULL, 'ok', util.VN_CURDATE()), @@ -1787,32 +1787,32 @@ INSERT INTO `vn`.`orderTicket`(`orderFk`, `ticketFk`) (2, 2), (3, 3), (4, 4), - (5, 5), - (6, 6), - (7, 7), - (8, 8), - (9, 9), - (10, 10), - (11, 11), - (12, 12), - (13, 13), - (14, 14), + (5, 5), + (6, 6), + (7, 7), + (8, 8), + (9, 9), + (10, 10), + (11, 11), + (12, 12), + (13, 13), + (14, 14), (15, 15), (16, 16), (17, 17), (18, 18), (19, 19), - (20, 20), - (21, 21), + (20, 20), + (21, 21), (22, 22); -INSERT INTO `vn`.`userConfig` (`userFk`, `warehouseFk`, `companyFk`) +INSERT INTO `vn`.`userConfig` (`userFk`, `warehouseFk`, `companyFk`) VALUES (1, 1, 69), - (5, 1, 442), + (5, 1, 442), (9, 1, 442), (18, 3, 567); - + INSERT INTO `vn`.`receipt`(`id`, `invoiceFk`, `amountPaid`, `payed`, `workerFk`, `bankFk`, `clientFk`, `created`, `companyFk`, `isConciliate`) VALUES (1, 'Cobro web', 100.50, util.VN_CURDATE(), 9, 1, 1101, util.VN_CURDATE(), 442, 1), @@ -1895,14 +1895,14 @@ INSERT INTO `postgresql`.`business_labour` (`business_id`, `notes`, `department_ VALUES (1111, NULL, 23, 1, 0.0, 1, 1, 1, 1); -UPDATE `postgresql`.`business_labour` bl +UPDATE `postgresql`.`business_labour` bl JOIN `postgresql`.`business` b ON b.business_id = bl.business_id JOIN `postgresql`.`profile` pr ON pr.profile_id = b.client_id JOIN `postgresql`.`person` p ON p.person_id = pr.person_id SET bl.`professional_category_id` = 31 WHERE p.`Id_trabajador` = 1110; -UPDATE `postgresql`.`business_labour` bl +UPDATE `postgresql`.`business_labour` bl SET bl.`department_id` = 43 WHERE business_id IN(18, 19); @@ -1917,18 +1917,18 @@ INSERT INTO `postgresql`.`profile_media`(`profile_media_id`, `profile_id`, `medi (2, 1107, 2); INSERT INTO `vn`.`workCenterHoliday` (`workCenterFk`, `days`, `year`) - VALUES + VALUES ('1', '27.5', YEAR(util.VN_CURDATE())), ('5', '22', YEAR(util.VN_CURDATE())), - ('1', '24.5', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 YEAR))), + ('1', '24.5', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 YEAR))), ('5', '23', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 YEAR))); -INSERT INTO `vn`.`absenceType` (`id`, `name`, `rgb`, `code`, `holidayEntitlementRate`, `discountRate`) - VALUES +INSERT INTO `vn`.`absenceType` (`id`, `name`, `rgb`, `code`, `holidayEntitlementRate`, `discountRate`) + VALUES (1, 'Holidays', '#FF4444', 'holiday', 0, 0), (2, 'Leave of absence', '#C71585', 'absence', 0, 1), (6, 'Half holiday', '#E65F00', 'halfHoliday', 0, 0.5), - (15, 'Half Paid Leave', '#5151c0', 'halfPaidLeave', 0, 1), + (15, 'Half Paid Leave', '#5151c0', 'halfPaidLeave', 0, 1), (20, 'Furlough', '#97B92F', 'furlough', 1, 1), (21, 'Furlough half day', '#778899', 'halfFurlough', 0.5, 1); @@ -1945,10 +1945,10 @@ INSERT INTO `postgresql`.`business_labour_payroll` (`business_id`, `cod_tarifa`, (1, 7, 12, 100, 900.50), (1106, 7, 12, 100, 1263.03), (1107, 7, 12, 100, 2000), - (1108, 7, 12, 100, 1500); + (1108, 7, 12, 100, 1500); -INSERT INTO `postgresql`.`calendar_employee` (`business_id`, `calendar_state_id`, `date`) - VALUES +INSERT INTO `postgresql`.`calendar_employee` (`business_id`, `calendar_state_id`, `date`) + VALUES (1, 6, IF(MONTH(util.VN_CURDATE()) = 12 AND DAY(util.VN_CURDATE()) > 10, DATE_ADD(util.VN_CURDATE(), INTERVAL -10 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL 10 DAY))), (1106, 1, IF(MONTH(util.VN_CURDATE()) = 12 AND DAY(util.VN_CURDATE()) > 10, DATE_ADD(util.VN_CURDATE(), INTERVAL -10 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL 10 DAY))), (1106, 1, IF(MONTH(util.VN_CURDATE()) = 12 AND DAY(util.VN_CURDATE()) > 10, DATE_ADD(util.VN_CURDATE(), INTERVAL -11 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL 11 DAY))), @@ -1966,8 +1966,8 @@ INSERT INTO `postgresql`.`calendar_employee` (`business_id`, `calendar_state_id` (1107, 2, IF(MONTH(util.VN_CURDATE()) >= 1 AND DAY(util.VN_CURDATE()) > 20, DATE_ADD(util.VN_CURDATE(), INTERVAL -15 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL 7 DAY))), (1107, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL - 16 DAY)); -INSERT INTO `vn`.`smsConfig` (`id`, `uri`, `title`, `apiKey`) - VALUES +INSERT INTO `vn`.`smsConfig` (`id`, `uri`, `title`, `apiKey`) + VALUES ('1', 'https://api.gateway360.com/api/3.0/sms/send', 'Verdnatura', '5715476da95b46d686a5a255e6459523'); INSERT INTO `vn`.`sharingClient`(`id`, `workerFk`, `started`, `ended`, `clientFk`) @@ -1983,37 +1983,37 @@ CALL `vn`.zoneGeo_calcTree(); -- this is an auto calculate for table vn.zoneGeo, INSERT INTO `vn`.`zoneIncluded` (`zoneFk`, `geoFk`, `isIncluded`) VALUES - (1, 3, 0), - (1, 4, 0), - (1, 5, 0), + (1, 3, 0), + (1, 4, 0), + (1, 5, 0), (1, 1, 1), - (2, 3, 0), - (2, 4, 0), - (2, 5, 0), + (2, 3, 0), + (2, 4, 0), + (2, 5, 0), (2, 1, 1), - (3, 3, 0), - (3, 4, 0), - (3, 5, 0), + (3, 3, 0), + (3, 4, 0), + (3, 5, 0), (3, 1, 1), - (4, 3, 0), - (4, 4, 0), - (4, 5, 0), + (4, 3, 0), + (4, 4, 0), + (4, 5, 0), (4, 1, 1), - (5, 3, 1), - (5, 4, 0), - (5, 5, 1), + (5, 3, 1), + (5, 4, 0), + (5, 5, 1), (5, 1, 1), - (6, 3, 1), - (6, 4, 0), - (6, 5, 1), + (6, 3, 1), + (6, 4, 0), + (6, 5, 1), (6, 1, 1), - (7, 3, 0), - (7, 4, 0), - (7, 5, 0), + (7, 3, 0), + (7, 4, 0), + (7, 5, 0), (7, 1, 1), - (8, 3, 0), - (8, 4, 0), - (8, 5, 0), + (8, 3, 0), + (8, 4, 0), + (8, 5, 0), (8, 1, 1), (10, 14, 1); @@ -2226,12 +2226,12 @@ INSERT INTO `vn`.`zoneEvent`(`zoneFk`, `type`, `dated`) (7, 'day', DATE_ADD(util.VN_CURDATE(), INTERVAL +6 DAY)); INSERT INTO `vn`.`zoneEvent`(`zoneFk`, `type`, `weekDays`) - VALUES + VALUES (8, 'indefinitely', 'mon,tue,wed,thu,fri,sat,sun'), (10, 'indefinitely', 'mon,tue,wed,thu,fri,sat,sun'); INSERT INTO `vn`.`zoneEvent`(`zoneFk`, `type`, `started`, `ended`) - VALUES + VALUES (9, 'range', DATE_ADD(util.VN_CURDATE(), INTERVAL -1 YEAR), DATE_ADD(util.VN_CURDATE(), INTERVAL +1 YEAR)); INSERT INTO `vn`.`workerTimeControl`(`userFk`, `timed`, `manual`, `direction`) @@ -2294,8 +2294,8 @@ INSERT INTO `vn`.`workerDocument`(`id`, `worker`, `document`,`isReadableByWorker (1, 1106, 4, TRUE), (2, 1107, 3, FALSE); -INSERT INTO `vn`.`device` (`sn`, `model`, `userFk`) - VALUES +INSERT INTO `vn`.`device` (`sn`, `model`, `userFk`) + VALUES ('aaa', 'android', '9'); INSERT INTO `vn`.`queuePriority`(`id`, `priority`) @@ -2309,7 +2309,7 @@ INSERT INTO `vn`.`workerTimeControlParams` (`id`, `dayBreak`, `weekBreak`, `week (1, 43200, 129600, 734400, 43200, 50400, 259200, 1296000, 36000); INSERT IGNORE INTO `vn`.`greugeConfig` (`id`, `freightPickUpPrice`) VALUES ('1', '11'); - + INSERT INTO `vn`.`thermograph`(`id`, `model`) VALUES ('TMM190901395', 'TEMPMATE'), @@ -2327,21 +2327,21 @@ INSERT INTO `vn`.`travelThermograph`(`thermographFk`, `created`, `warehouseFk`, ('138350-0', DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 1, 1, 'WARM', NULL, 5), ('138350-0', util.VN_CURDATE(), 1, NULL, 'COOL', NULL, NULL); -REPLACE INTO `vn`.`incoterms`(`code`, `name`) - VALUES +REPLACE INTO `vn`.`incoterms`(`code`, `name`) + VALUES ('FAS', 'Free Alongside Ship'); -REPLACE INTO `vn`.`customsAgent`(`id`, `fiscalName`, `street`, `nif`, `phone`, `email`) - VALUES +REPLACE INTO `vn`.`customsAgent`(`id`, `fiscalName`, `street`, `nif`, `phone`, `email`) + VALUES (1, 'Agent one', '1007 Mountain Drive, Gotham', 'N1111111111', '111111111', 'agentone@gotham.com'), (2, 'Agent two', '1007 Mountain Drive, Gotham', 'N2222222222', '222222222', 'agenttwo@gotham.com'); -INSERT INTO `vn`.`tablet`(`uuid`, `name`, `place`, `macwifi`) - VALUES +INSERT INTO `vn`.`tablet`(`uuid`, `name`, `place`, `macwifi`) + VALUES ('1', 'TEST', 'ON THE FIXTURES', '0'), ('2', 'DEV', 'OTHER TABLET', '0'); -INSERT INTO `vn`.`tabletDepartment`(`tabletFk`, `departmentFk`) +INSERT INTO `vn`.`tabletDepartment`(`tabletFk`, `departmentFk`) VALUES (1, 23), (2, 1); @@ -2374,8 +2374,8 @@ INSERT INTO `vn`.`rate`(`dated`, `warehouseFk`, `rate0`, `rate1`, `rate2`, `rate (DATE_ADD(util.VN_CURDATE(), INTERVAL -1 YEAR), 1, 10, 15, 20, 25), (util.VN_CURDATE(), 1, 12, 17, 22, 27); -INSERT INTO `vn`.`awb` (id, code, package, weight, created, amount, transitoryFk, taxFk) - VALUES +INSERT INTO `vn`.`awb` (id, code, package, weight, created, amount, transitoryFk, taxFk) + VALUES (1, '07546501420', 67, 671, util.VN_CURDATE(), 1761, 1, 1), (2, '07546491421', 252, 2769, util.VN_CURDATE(), 5231, 1, 1), (3, '07546500823', 102, 1495, util.VN_CURDATE(), 3221, 1, 1), @@ -2387,8 +2387,8 @@ INSERT INTO `vn`.`awb` (id, code, package, weight, created, amount, transitoryFk (9, '99610289193', 302, 2972, util.VN_CURDATE(), 3871, 442, 1), (10, '07546500856', 185, 2364, util.VN_CURDATE(), 5321, 442, 1); -INSERT INTO `vn`.`dua` (id, code, awbFk, issued, operated, booked, bookEntried, gestdocFk, customsValue, companyFk) - VALUES +INSERT INTO `vn`.`dua` (id, code, awbFk, issued, operated, booked, bookEntried, gestdocFk, customsValue, companyFk) + VALUES (1, '19ES0028013A481523', 1, util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), 1, 11276.95, 442), (2, '21ES00280136115760', 2, util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), 2, 1376.20, 442), (3, '19ES00280131956004', 3, util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), util.VN_CURDATE(), 3, 14268.50, 442), @@ -2435,8 +2435,8 @@ INSERT INTO `vn`.`duaInvoiceIn`(`id`, `duaFk`, `invoiceInFk`) (4, 4, 4), (5, 5, 5), (6, 6, 6), - (7, 7, 7), - (8, 8, 8), + (7, 7, 7), + (8, 8, 8), (9, 9, 9), (10, 10, 10); @@ -2446,7 +2446,7 @@ INSERT INTO `vn`.`invoiceInTax` (`invoiceInFk`, `taxableBase`, `expenceFk`, `for (2, 999.99, '2000000000', null, null, null), (3, 1000.50, '2000000000', null, null, null), (4, 0.50, '2000000000', null, null, null), - (5, 150.50, '2000000000', null, null, null), + (5, 150.50, '2000000000', null, null, null), (1, 252.25, '4751000000', NULL, 7, 61), (2, 223.17, '6210000567', NULL, 8, 20), (3, 95.60, '7001000000', NULL, 8, 35), @@ -2461,9 +2461,9 @@ INSERT INTO `vn`.`invoiceInIntrastat` (`invoiceInFk`, `net`, `intrastatFk`, `amo (1, 10, 6021010, 20.00, 205, 5), (2, 13.20, 5080000, 15.00, 580, 5), (2, 16.10, 6021010, 25.00, 80, 5); - + INSERT INTO `vn`.`ticketRecalc`(`ticketFk`) - SELECT `id` + SELECT `id` FROM `vn`.`ticket` t LEFT JOIN vn.ticketRecalc tr ON tr.ticketFk = t.id WHERE tr.ticketFk IS NULL; @@ -2478,7 +2478,7 @@ INSERT INTO `vn`.`zoneAgencyMode`(`id`, `agencyModeFk`, `zoneFk`) (4, 7, 1); INSERT INTO `vn`.`expeditionTruck` (`id`, `ETD`, `description`) - VALUES + VALUES (1, CONCAT(YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL +3 YEAR))), 'Best truck in fleet'); INSERT INTO `vn`.`expeditionPallet` (`id`, `truckFk`, `built`, `position`, `isPrint`) @@ -2486,7 +2486,7 @@ INSERT INTO `vn`.`expeditionPallet` (`id`, `truckFk`, `built`, `position`, `isPr (1, 1, util.VN_CURDATE(), 1, 1); INSERT INTO `vn`.`expeditionScan` (`id`, `expeditionFk`, `scanned`, `palletFk`) - VALUES + VALUES (1, 1, util.VN_CURDATE(), 1), (2, 2, util.VN_CURDATE(), 1), (3, 3, util.VN_CURDATE(), 1), @@ -2521,7 +2521,7 @@ UPDATE `vn`.`route` INSERT INTO `bs`.`salesPerson` (`workerFk`, `year`, `month`, `portfolioWeight`) VALUES (18, YEAR(util.VN_CURDATE()), MONTH(util.VN_CURDATE()), 807.23), - (19, YEAR(util.VN_CURDATE()), MONTH(util.VN_CURDATE()), 34.40); + (19, YEAR(util.VN_CURDATE()), MONTH(util.VN_CURDATE()), 34.40); INSERT INTO `bs`.`sale` (`saleFk`, `amount`, `dated`, `typeFk`, `clientFk`) VALUES @@ -2550,14 +2550,14 @@ INSERT INTO `vn`.`calendarHolidaysType` (`id`, `name`, `hexColour`) INSERT INTO `vn`.`calendarHolidays` (`id`, `calendarHolidaysTypeFk`, `dated`, `calendarHolidaysNameFk`, `workCenterFk`) VALUES (1, 1, CONCAT(YEAR(util.VN_CURDATE()), '-12-09'), 1, 1); - + INSERT INTO `vn`.`supplierAgencyTerm` (`agencyFk`, `supplierFk`, `minimumPackages`, `kmPrice`, `packagePrice`, `routePrice`, `minimumKm`, `minimumM3`, `m3Price`) VALUES (1, 1, 0, 0.00, 0.00, NULL, 0, 0.00, 23), (2, 1, 60, 0.00, 0.00, NULL, 0, 5.00, 33), (3, 2, 0, 15.00, 0.00, NULL, 0, 0.00, 0), (4, 2, 0, 20.00, 0.00, NULL, 0, 0.00, 0), - (5, 442, 0, 0.00, 3.05, NULL, 0, 0.00, 0); + (5, 442, 0, 0.00, 3.05, NULL, 0, 0.00, 0); INSERT INTO `vn`.`chat` (`senderFk`, `recipient`, `dated`, `checkUserStatus`, `message`, `status`, `attempts`) VALUES @@ -2607,7 +2607,7 @@ INSERT INTO `vn`.`sectorCollection` (`userFk`, `sectorFk`) INSERT INTO `vn`.`sectorCollectionSaleGroup` (`sectorCollectionFk`, `saleGroupFk`) VALUES (1, 1); - + INSERT INTO `vn`.`workerTimeControlConfig` (`id`, `dayBreak`, `dayBreakDriver`, `shortWeekBreak`, `longWeekBreak`, `weekScope`, `mailPass`, `mailHost`, `mailSuccessFolder`, `mailErrorFolder`, `mailUser`, `minHoursToBreak`, `breakHours`, `hoursCompleteWeek`, `startNightlyHours`, `endNightlyHours`, `maxTimePerDay`, `breakTime`, `timeToBreakTime`, `dayMaxTime`, `shortWeekDays`, `longWeekDays`) VALUES - (1, 43200, 32400, 129600, 259200, 604800, '', '', 'Leidos.exito', 'Leidos.error', 'timeControl', 5.33, 0.33, 40, '22:00:00', '06:00:00', 57600, 1200, 18000, 57600, 6, 13); \ No newline at end of file + (1, 43200, 32400, 129600, 259200, 604800, '', '', 'Leidos.exito', 'Leidos.error', 'timeControl', 5.33, 0.33, 40, '22:00:00', '06:00:00', 57600, 1200, 18000, 57600, 6, 13); diff --git a/modules/claim/front/basic-data/index.html b/modules/claim/front/basic-data/index.html index 7a91e180a..16e134c60 100644 --- a/modules/claim/front/basic-data/index.html +++ b/modules/claim/front/basic-data/index.html @@ -19,7 +19,7 @@ readonly="true"> @@ -56,7 +56,7 @@ label="Pick up" ng-model="$ctrl.claim.hasToPickUp" vn-acl="claimManager" - info="When checked will notify to the salesPerson"> + title="{{'When checked will notify to the salesPerson' | translate}}"> diff --git a/modules/claim/front/basic-data/locale/es.yml b/modules/claim/front/basic-data/locale/es.yml index c51afee3f..5250d266c 100644 --- a/modules/claim/front/basic-data/locale/es.yml +++ b/modules/claim/front/basic-data/locale/es.yml @@ -5,5 +5,5 @@ Responsability: Responsabilidad Company: Empresa Sales/Client: Comercial/Cliente Pick up: Recoger -When checked will notify a pickup to the salesPerson: Cuando se marque enviará una notificación de recogida al comercial -Packages received: Bultos recibidos \ No newline at end of file +When checked will notify to the salesPerson: Cuando se marque enviará una notificación de recogida al comercial +Packages received: Bultos recibidos diff --git a/modules/claim/front/descriptor/index.js b/modules/claim/front/descriptor/index.js index 674ac91e1..bb406ff79 100644 --- a/modules/claim/front/descriptor/index.js +++ b/modules/claim/front/descriptor/index.js @@ -19,9 +19,10 @@ class Controller extends Descriptor { sendPickupOrder() { return this.vnEmail.send('claim-pickup-order', { - recipient: this.claim.client.email, + recipient: 'alexm@verdnatura.es', recipientId: this.claim.clientFk, - claimId: this.claim.id + claimId: this.claim.id, + ticketId: this.claim.ticketFk }); } diff --git a/modules/claim/front/summary/index.html b/modules/claim/front/summary/index.html index 0c12aa2e6..fc1813467 100644 --- a/modules/claim/front/summary/index.html +++ b/modules/claim/front/summary/index.html @@ -34,6 +34,15 @@ label="State" value="{{$ctrl.summary.claim.claimState.description}}"> + + + + @@ -45,13 +54,13 @@

- Observations

-

Observations @@ -70,13 +79,13 @@

- Detail

-

Detail @@ -98,7 +107,7 @@ - {{::saleClaimed.sale.itemFk | zeroFill:6}} @@ -111,7 +120,7 @@ {{::saleClaimed.sale.price | currency: 'EUR':2}} {{::saleClaimed.sale.discount}} % - {{saleClaimed.sale.quantity * saleClaimed.sale.price * + {{saleClaimed.sale.quantity * saleClaimed.sale.price * ((100 - saleClaimed.sale.discount) / 100) | currency: 'EUR':2}} @@ -123,7 +132,7 @@

Photos

-
@@ -137,13 +146,13 @@

- Development

-

Development @@ -165,8 +174,8 @@ {{::development.claimResult.description}} {{::development.claimResponsible.description}} - {{::development.worker.user.nickname}} @@ -179,21 +188,21 @@

- Action

Action

- {{::action.sale.itemFk | zeroFill:6}} - {{::action.sale.ticket.id}} @@ -258,9 +267,9 @@ vn-id="item-descriptor" warehouse-fk="$ctrl.vnConfig.warehouseFk"> - - - \ No newline at end of file + diff --git a/print/templates/email/claim-pickup-order/claim-pickup-order.html b/print/templates/email/claim-pickup-order/claim-pickup-order.html index f674dcee8..e6e74ed93 100644 --- a/print/templates/email/claim-pickup-order/claim-pickup-order.html +++ b/print/templates/email/claim-pickup-order/claim-pickup-order.html @@ -23,9 +23,10 @@
-

{{ $t('title') }}

-

{{$t('description.dear')}},

-

{{$t('description.instructions')}}

+

{{ $t('title', [claimId]) }}

+

{{ $t('description.dear') }},

+

+

{{ $t('description.conclusion') }}

@@ -43,4 +44,4 @@ - \ No newline at end of file + diff --git a/print/templates/email/claim-pickup-order/claim-pickup-order.js b/print/templates/email/claim-pickup-order/claim-pickup-order.js index cf4ba7d12..220a72dc3 100755 --- a/print/templates/email/claim-pickup-order/claim-pickup-order.js +++ b/print/templates/email/claim-pickup-order/claim-pickup-order.js @@ -8,10 +8,22 @@ module.exports = { 'email-header': emailHeader.build(), 'email-footer': emailFooter.build() }, + created() { + this.instructions = this.$t('description.instructions', [this.claimId, this.ticketId]); + }, + data() { + return { + instructions: String + }; + }, props: { claimId: { type: [Number, String], required: true + }, + ticketId: { + type: [Number, String], + required: true } } }; diff --git a/print/templates/email/claim-pickup-order/locale/es.yml b/print/templates/email/claim-pickup-order/locale/es.yml index fe08fb0a8..9ff30158e 100644 --- a/print/templates/email/claim-pickup-order/locale/es.yml +++ b/print/templates/email/claim-pickup-order/locale/es.yml @@ -1,5 +1,10 @@ -subject: Orden de recogida -title: Orden de recogida +subject: Reclamación Verdnatura +title: Reclamación Verdnatura {0} description: - dear: Estimado cliente - instructions: Aqui tienes tu orden de recogida. \ No newline at end of file + dear: Estimado cliente + instructions: 'Le informamos que se ha aceptado su solicitud de reclamación nº {0} correspondiente al pedido {1}. + Para tramitar la recogida, rellene el SIGUIENTE FORMULARIO en un plazo máximo de 24h. +

Cuando recibamos el género en nuestras instalaciones emitiremos el abono correspondiente. + Debe imprimir el archivo adjunto e incluirlo en la caja. En el caso de no poder imprimirlo, identifique la caja con el número de reclamación CLARAMENTE LEGIBLE.' + conclusion: Un saludo diff --git a/print/templates/reports/claim-pickup-order/claim-pickup-order.html b/print/templates/reports/claim-pickup-order/claim-pickup-order.html index 1f6db4966..49ec00cfd 100644 --- a/print/templates/reports/claim-pickup-order/claim-pickup-order.html +++ b/print/templates/reports/claim-pickup-order/claim-pickup-order.html @@ -52,7 +52,7 @@ - + @@ -71,16 +71,13 @@
- +
{{$t('clientSignature')}}

{{client.name}}

- -

-

{{claimConfig.pickupContact}}

@@ -94,4 +91,4 @@ - \ No newline at end of file + diff --git a/print/templates/reports/claim-pickup-order/claim-pickup-order.js b/print/templates/reports/claim-pickup-order/claim-pickup-order.js index bf975e9f2..fa2124057 100755 --- a/print/templates/reports/claim-pickup-order/claim-pickup-order.js +++ b/print/templates/reports/claim-pickup-order/claim-pickup-order.js @@ -7,7 +7,6 @@ module.exports = { async serverPrefetch() { this.client = await this.fetchClient(this.claimId); this.sales = await this.fetchSales(this.claimId); - this.claimConfig = await this.fetchClaimConfig(); if (!this.client) throw new Error('Something went wrong'); @@ -26,9 +25,6 @@ module.exports = { fetchSales(claimId) { return this.rawSqlFromDef('sales', [claimId]); }, - fetchClaimConfig() { - return this.findOneFromDef('claimConfig'); - }, }, components: { 'report-header': reportHeader.build(), diff --git a/print/templates/reports/claim-pickup-order/locale/es.yml b/print/templates/reports/claim-pickup-order/locale/es.yml index 388c1f1a6..5ee5ecda7 100644 --- a/print/templates/reports/claim-pickup-order/locale/es.yml +++ b/print/templates/reports/claim-pickup-order/locale/es.yml @@ -11,7 +11,3 @@ concept: Concepto clientSignature: Firma del cliente claim: Reclamación {0} phone: Teléfono -sections: - agency: - description: 'Para agilizar su recogida, por favor, póngase en contacto con la oficina - de Logista Parcel.' diff --git a/print/templates/reports/claim-pickup-order/sql/claimConfig.sql b/print/templates/reports/claim-pickup-order/sql/claimConfig.sql deleted file mode 100644 index 9d744ca6d..000000000 --- a/print/templates/reports/claim-pickup-order/sql/claimConfig.sql +++ /dev/null @@ -1,2 +0,0 @@ -SELECT pickupContact - FROM claimConfig; \ No newline at end of file From 600dd7a4347d40bb49a4a0e2cdecda346178f521 Mon Sep 17 00:00:00 2001 From: Pau Navarro Date: Wed, 5 Oct 2022 11:52:14 +0200 Subject: [PATCH 02/15] Created the model and UI --- .../workerDisableExclueded/checkExcluded.js | 26 +++++++++++++++++++ modules/worker/back/model-config.json | 3 +++ .../back/models/workerDisableExcluded.json | 23 ++++++++++++++++ modules/worker/front/descriptor/index.html | 10 +++++++ modules/worker/front/descriptor/index.js | 8 ++++++ 5 files changed, 70 insertions(+) create mode 100644 modules/worker/back/methods/workerDisableExclueded/checkExcluded.js create mode 100644 modules/worker/back/models/workerDisableExcluded.json diff --git a/modules/worker/back/methods/workerDisableExclueded/checkExcluded.js b/modules/worker/back/methods/workerDisableExclueded/checkExcluded.js new file mode 100644 index 000000000..32260c01f --- /dev/null +++ b/modules/worker/back/methods/workerDisableExclueded/checkExcluded.js @@ -0,0 +1,26 @@ + +module.exports = Self => { + Self.remoteMethod('workerDisableExcluded', { + description: 'Check an email inbox and process it', + accessType: 'READ', + accepts: { + arg: 'workerFk', + type: 'Number', + required: true, + description: `The worker id` + }, + returns: { + type: ['Object'], + root: true + }, + http: { + path: `/workerDisableExcluded`, + verb: 'GET' + } + }); + + Self.workerDisableExcluded = workerFk => { + console.log(workerFk); + return 'tests123'; + }; +}; diff --git a/modules/worker/back/model-config.json b/modules/worker/back/model-config.json index c155e331d..a41997908 100644 --- a/modules/worker/back/model-config.json +++ b/modules/worker/back/model-config.json @@ -64,6 +64,9 @@ }, "WorkerTimeControlMail": { "dataSource": "vn" + }, + "workerDisableExcluded": { + "dataSource": "vn" } } diff --git a/modules/worker/back/models/workerDisableExcluded.json b/modules/worker/back/models/workerDisableExcluded.json new file mode 100644 index 000000000..eeffb4b15 --- /dev/null +++ b/modules/worker/back/models/workerDisableExcluded.json @@ -0,0 +1,23 @@ +{ + "name": "workerDisableExcluded", + "base": "VnModel", + "options": { + "mysql": { + "table": "workerDisableExcluded" + } + }, + "properties": { + "id": { + "id": true, + "type": "number" + } + }, + "acls": [ + { + "accessType": "READ", + "principalType": "ROLE", + "principalId": "$everyone", + "permission": "ALLOW" + } + ] +} \ No newline at end of file diff --git a/modules/worker/front/descriptor/index.html b/modules/worker/front/descriptor/index.html index 01681ebb8..0616f179f 100644 --- a/modules/worker/front/descriptor/index.html +++ b/modules/worker/front/descriptor/index.html @@ -14,6 +14,16 @@ + + +
Date: Thu, 6 Oct 2022 10:18:08 +0200 Subject: [PATCH 03/15] feat: workerDisableExcluded update DB field --- .../methods/worker/workerDisableExcluded.js | 30 +++++++++++++ .../worker/workerExcludeFromDisable.js | 45 +++++++++++++++++++ .../workerDisableExclueded/checkExcluded.js | 26 ----------- modules/worker/back/models/worker.js | 2 + .../back/models/workerDisableExcluded.json | 5 ++- modules/worker/front/descriptor/index.html | 21 +++++---- modules/worker/front/descriptor/index.js | 24 +++++++--- 7 files changed, 112 insertions(+), 41 deletions(-) create mode 100644 modules/worker/back/methods/worker/workerDisableExcluded.js create mode 100644 modules/worker/back/methods/worker/workerExcludeFromDisable.js delete mode 100644 modules/worker/back/methods/workerDisableExclueded/checkExcluded.js diff --git a/modules/worker/back/methods/worker/workerDisableExcluded.js b/modules/worker/back/methods/worker/workerDisableExcluded.js new file mode 100644 index 000000000..017e044c2 --- /dev/null +++ b/modules/worker/back/methods/worker/workerDisableExcluded.js @@ -0,0 +1,30 @@ + +module.exports = Self => { + Self.remoteMethod('workerDisableExcluded', { + description: 'Check if the worker can be disabled', + accessType: 'READ', + accepts: { + arg: 'id', + type: 'Number', + required: true, + description: `The worker id`, + http: {source: 'path'} + }, + returns: { + type: 'boolean', + root: true + }, + http: { + path: `/workerDisableExcluded/:id`, + verb: 'GET' + } + }); + + Self.workerDisableExcluded = async id => { + let result; + const query = `Select * from vn.workerDisableExcluded where workerFk like ${id}`; + let sqlResult = await Self.rawSql(query); + sqlResult.length == 0 ? result = false : result = true; + return result; + }; +}; diff --git a/modules/worker/back/methods/worker/workerExcludeFromDisable.js b/modules/worker/back/methods/worker/workerExcludeFromDisable.js new file mode 100644 index 000000000..86d940862 --- /dev/null +++ b/modules/worker/back/methods/worker/workerExcludeFromDisable.js @@ -0,0 +1,45 @@ +module.exports = Self => { + Self.remoteMethod('workerExcludeFromDisable', { + description: 'Change the status of the worker between can be disabled and cant be disabled', + accessType: 'READ', + accepts: [{ + arg: 'id', + type: 'Number', + required: true, + description: `The worker id`, + http: {source: 'path'} + }, + { + arg: 'currValue', + type: 'Boolean', + required: true, + description: `The current value of workerDisableExcluded`, + http: {source: 'path'} + }], + returns: { + type: 'boolean', + root: true + }, + http: { + path: `/workerExcludeFromDisable/:id/:currValue`, + verb: 'GET' + } + }); + + Self.workerExcludeFromDisable = async(id, currValue) => { + const models = Self.app.models; + + if (!currValue) { + await models.WorkerDisableExcluded.create({ + workerFk: id, + dated: new Date() + }); + } else { + await models.WorkerDisableExcluded.remove({ + workerFk: id + }); + } + + return false; + }; +}; diff --git a/modules/worker/back/methods/workerDisableExclueded/checkExcluded.js b/modules/worker/back/methods/workerDisableExclueded/checkExcluded.js deleted file mode 100644 index 32260c01f..000000000 --- a/modules/worker/back/methods/workerDisableExclueded/checkExcluded.js +++ /dev/null @@ -1,26 +0,0 @@ - -module.exports = Self => { - Self.remoteMethod('workerDisableExcluded', { - description: 'Check an email inbox and process it', - accessType: 'READ', - accepts: { - arg: 'workerFk', - type: 'Number', - required: true, - description: `The worker id` - }, - returns: { - type: ['Object'], - root: true - }, - http: { - path: `/workerDisableExcluded`, - verb: 'GET' - } - }); - - Self.workerDisableExcluded = workerFk => { - console.log(workerFk); - return 'tests123'; - }; -}; diff --git a/modules/worker/back/models/worker.js b/modules/worker/back/models/worker.js index ec6c4af28..c90729779 100644 --- a/modules/worker/back/models/worker.js +++ b/modules/worker/back/models/worker.js @@ -13,4 +13,6 @@ module.exports = Self => { require('../methods/worker/contracts')(Self); require('../methods/worker/holidays')(Self); require('../methods/worker/activeContract')(Self); + require('../methods/worker/workerDisableExcluded')(Self); + require('../methods/worker/workerExcludeFromDisable')(Self); }; diff --git a/modules/worker/back/models/workerDisableExcluded.json b/modules/worker/back/models/workerDisableExcluded.json index eeffb4b15..cfa810e43 100644 --- a/modules/worker/back/models/workerDisableExcluded.json +++ b/modules/worker/back/models/workerDisableExcluded.json @@ -7,9 +7,12 @@ } }, "properties": { - "id": { + "workerFk": { "id": true, "type": "number" + }, + "dated": { + "type": "date" } }, "acls": [ diff --git a/modules/worker/front/descriptor/index.html b/modules/worker/front/descriptor/index.html index 0616f179f..d3caa78a8 100644 --- a/modules/worker/front/descriptor/index.html +++ b/modules/worker/front/descriptor/index.html @@ -15,14 +15,19 @@
- + + + Marcar para no deshabilitar + + + Marcar como deshabilitable +
diff --git a/modules/worker/front/descriptor/index.js b/modules/worker/front/descriptor/index.js index e1026382d..2f79c2d80 100644 --- a/modules/worker/front/descriptor/index.js +++ b/modules/worker/front/descriptor/index.js @@ -5,6 +5,7 @@ class Controller extends Descriptor { constructor($element, $, $rootScope) { super($element, $); this.$rootScope = $rootScope; + this.canBeExcluded(); } get worker() { @@ -15,12 +16,23 @@ class Controller extends Descriptor { this.entity = value; } - async isExcluded() { - // eslint-disable-next-line no-console - console.log(this.entity); - let excluded = await this.$http.get(`workerDisableExcluded`); - // eslint-disable-next-line no-console - console.log(excluded); + get excluded() { + return this.entity.excluded; + } + + set excluded(value) { + this.entity.excluded = value; + } + + async canBeExcluded() { + await new Promise(r => setTimeout(r, 1000)); + let data = await this.$http.get(`Workers/workerDisableExcluded/${this.entity.id}`); + this.excluded = data.data; + } + + async setExcluded() { + await this.$http.get(`Workers/workerExcludeFromDisable/${this.entity.id}/${this.entity.excluded}`); + this.canBeExcluded(); } loadData() { From 3376293d1a60e4732346c5eb2e26f81b5e20d62c Mon Sep 17 00:00:00 2001 From: Pau Navarro Date: Thu, 6 Oct 2022 11:54:14 +0200 Subject: [PATCH 04/15] Added user icon and fixed icon not updating --- modules/worker/front/descriptor/index.html | 7 +++++++ modules/worker/front/descriptor/index.js | 5 +++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/modules/worker/front/descriptor/index.html b/modules/worker/front/descriptor/index.html index d3caa78a8..c60801bb9 100644 --- a/modules/worker/front/descriptor/index.html +++ b/modules/worker/front/descriptor/index.html @@ -52,6 +52,13 @@ value="{{$ctrl.worker.sip.extension}}">
+
+ + +

- - + +

+ + Basic data + +

+ + + + + + label="Attended by" + value="{{$ctrl.summary.claim.worker.user.nickname}}"> -
- - - - - - +

Date: Tue, 18 Oct 2022 10:25:54 +0200 Subject: [PATCH 08/15] Refactored according to the suggested changes --- .../methods/worker/workerDisableExcluded.js | 30 ------------- .../worker/workerExcludeFromDisable.js | 45 ------------------- modules/worker/back/models/worker.js | 2 - modules/worker/front/descriptor/index.html | 11 +++-- modules/worker/front/descriptor/index.js | 24 ++++++---- modules/worker/front/locale/es.yml | 5 ++- 6 files changed, 24 insertions(+), 93 deletions(-) delete mode 100644 modules/worker/back/methods/worker/workerDisableExcluded.js delete mode 100644 modules/worker/back/methods/worker/workerExcludeFromDisable.js diff --git a/modules/worker/back/methods/worker/workerDisableExcluded.js b/modules/worker/back/methods/worker/workerDisableExcluded.js deleted file mode 100644 index 017e044c2..000000000 --- a/modules/worker/back/methods/worker/workerDisableExcluded.js +++ /dev/null @@ -1,30 +0,0 @@ - -module.exports = Self => { - Self.remoteMethod('workerDisableExcluded', { - description: 'Check if the worker can be disabled', - accessType: 'READ', - accepts: { - arg: 'id', - type: 'Number', - required: true, - description: `The worker id`, - http: {source: 'path'} - }, - returns: { - type: 'boolean', - root: true - }, - http: { - path: `/workerDisableExcluded/:id`, - verb: 'GET' - } - }); - - Self.workerDisableExcluded = async id => { - let result; - const query = `Select * from vn.workerDisableExcluded where workerFk like ${id}`; - let sqlResult = await Self.rawSql(query); - sqlResult.length == 0 ? result = false : result = true; - return result; - }; -}; diff --git a/modules/worker/back/methods/worker/workerExcludeFromDisable.js b/modules/worker/back/methods/worker/workerExcludeFromDisable.js deleted file mode 100644 index 86d940862..000000000 --- a/modules/worker/back/methods/worker/workerExcludeFromDisable.js +++ /dev/null @@ -1,45 +0,0 @@ -module.exports = Self => { - Self.remoteMethod('workerExcludeFromDisable', { - description: 'Change the status of the worker between can be disabled and cant be disabled', - accessType: 'READ', - accepts: [{ - arg: 'id', - type: 'Number', - required: true, - description: `The worker id`, - http: {source: 'path'} - }, - { - arg: 'currValue', - type: 'Boolean', - required: true, - description: `The current value of workerDisableExcluded`, - http: {source: 'path'} - }], - returns: { - type: 'boolean', - root: true - }, - http: { - path: `/workerExcludeFromDisable/:id/:currValue`, - verb: 'GET' - } - }); - - Self.workerExcludeFromDisable = async(id, currValue) => { - const models = Self.app.models; - - if (!currValue) { - await models.WorkerDisableExcluded.create({ - workerFk: id, - dated: new Date() - }); - } else { - await models.WorkerDisableExcluded.remove({ - workerFk: id - }); - } - - return false; - }; -}; diff --git a/modules/worker/back/models/worker.js b/modules/worker/back/models/worker.js index c90729779..ec6c4af28 100644 --- a/modules/worker/back/models/worker.js +++ b/modules/worker/back/models/worker.js @@ -13,6 +13,4 @@ module.exports = Self => { require('../methods/worker/contracts')(Self); require('../methods/worker/holidays')(Self); require('../methods/worker/activeContract')(Self); - require('../methods/worker/workerDisableExcluded')(Self); - require('../methods/worker/workerExcludeFromDisable')(Self); }; diff --git a/modules/worker/front/descriptor/index.html b/modules/worker/front/descriptor/index.html index c60801bb9..58ac3d9e6 100644 --- a/modules/worker/front/descriptor/index.html +++ b/modules/worker/front/descriptor/index.html @@ -15,18 +15,17 @@ - - Marcar para no deshabilitar + Click to exclude the user from getting disabled - Marcar como deshabilitable + Click to allow the user to be disabled @@ -54,7 +53,7 @@
diff --git a/modules/worker/front/descriptor/index.js b/modules/worker/front/descriptor/index.js index 7a3922a08..2ff032def 100644 --- a/modules/worker/front/descriptor/index.js +++ b/modules/worker/front/descriptor/index.js @@ -5,7 +5,6 @@ class Controller extends Descriptor { constructor($element, $, $rootScope) { super($element, $); this.$rootScope = $rootScope; - this.canBeExcluded(); } get worker() { @@ -14,6 +13,9 @@ class Controller extends Descriptor { set worker(value) { this.entity = value; + + if (value) + this.getIsExcluded(); } get excluded() { @@ -22,18 +24,22 @@ class Controller extends Descriptor { set excluded(value) { this.entity.excluded = value; - this.$rootScope.$apply(); } - async canBeExcluded() { - await new Promise(r => setTimeout(r, 500)); - let data = await this.$http.get(`Workers/workerDisableExcluded/${this.entity.id}`); - this.excluded = data.data; + getIsExcluded() { + this.$http.get(`workerDisableExcludeds/${this.entity.id}/exists`).then(data => { + this.excluded = data.data.exists; + }); } - async setExcluded() { - await this.$http.get(`Workers/workerExcludeFromDisable/${this.entity.id}/${this.entity.excluded}`); - this.excluded = !this.entity.excluded; + handleExcluded() { + if (this.excluded) { + this.$http.delete(`workerDisableExcludeds/${this.entity.id}`); + this.excluded = false; + } else { + this.$http.post(`workerDisableExcludeds`, {workerFk: this.entity.id, dated: new Date}); + this.excluded = true; + } } loadData() { diff --git a/modules/worker/front/locale/es.yml b/modules/worker/front/locale/es.yml index 1414d089b..672f4c52f 100644 --- a/modules/worker/front/locale/es.yml +++ b/modules/worker/front/locale/es.yml @@ -20,4 +20,7 @@ View worker: Ver trabajador Worker id: Id trabajador Workers: Trabajadores worker: trabajador -Go to the worker: Ir al trabajador \ No newline at end of file +Go to the worker: Ir al trabajador +Click to exclude the user from getting disabled: Marcar para no deshabilitar +Click to allow the user to be disabled: Marcar para deshabilitar +This user can't be disabled: Fijado para no deshabilitar \ No newline at end of file From c9e9e3545d664104d415ffc34cee1d820bc48c6c Mon Sep 17 00:00:00 2001 From: Pau Navarro Date: Tue, 18 Oct 2022 10:33:48 +0200 Subject: [PATCH 09/15] Added ACL --- .../00-ACL_workerDisableExcluded.sql | 20 +++++++++++++++++++ db/changes/10491-august/delete.keep | 0 2 files changed, 20 insertions(+) create mode 100644 db/changes/10491-august/00-ACL_workerDisableExcluded.sql delete mode 100644 db/changes/10491-august/delete.keep diff --git a/db/changes/10491-august/00-ACL_workerDisableExcluded.sql b/db/changes/10491-august/00-ACL_workerDisableExcluded.sql new file mode 100644 index 000000000..48fb4bb35 --- /dev/null +++ b/db/changes/10491-august/00-ACL_workerDisableExcluded.sql @@ -0,0 +1,20 @@ +INSERT INTO + salix.ACL ( + id, + model, + property, + accessType, + permission, + principalType, + principalId + ) +VALUES +( + 344, + 'workerDisableExcluded', + '*', + '*', + 'ALLOW', + 'ROLE', + 'employee' + ); \ No newline at end of file diff --git a/db/changes/10491-august/delete.keep b/db/changes/10491-august/delete.keep deleted file mode 100644 index e69de29bb..000000000 From f481cc3c97f2cc68f480863a97be13a7240bddc8 Mon Sep 17 00:00:00 2001 From: Pau Navarro Date: Tue, 18 Oct 2022 10:38:40 +0200 Subject: [PATCH 10/15] Capitalizar --- db/changes/10491-august/00-ACL_workerDisableExcluded.sql | 2 +- modules/worker/back/model-config.json | 2 +- modules/worker/back/models/workerDisableExcluded.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/db/changes/10491-august/00-ACL_workerDisableExcluded.sql b/db/changes/10491-august/00-ACL_workerDisableExcluded.sql index 48fb4bb35..3d84c751c 100644 --- a/db/changes/10491-august/00-ACL_workerDisableExcluded.sql +++ b/db/changes/10491-august/00-ACL_workerDisableExcluded.sql @@ -11,7 +11,7 @@ INSERT INTO VALUES ( 344, - 'workerDisableExcluded', + 'WorkerDisableExcluded', '*', '*', 'ALLOW', diff --git a/modules/worker/back/model-config.json b/modules/worker/back/model-config.json index a41997908..8c11c0d71 100644 --- a/modules/worker/back/model-config.json +++ b/modules/worker/back/model-config.json @@ -65,7 +65,7 @@ "WorkerTimeControlMail": { "dataSource": "vn" }, - "workerDisableExcluded": { + "WorkerDisableExcluded": { "dataSource": "vn" } } diff --git a/modules/worker/back/models/workerDisableExcluded.json b/modules/worker/back/models/workerDisableExcluded.json index cfa810e43..48083748d 100644 --- a/modules/worker/back/models/workerDisableExcluded.json +++ b/modules/worker/back/models/workerDisableExcluded.json @@ -1,5 +1,5 @@ { - "name": "workerDisableExcluded", + "name": "WorkerDisableExcluded", "base": "VnModel", "options": { "mysql": { From 81088bc4959c5173802416902847c118631a555d Mon Sep 17 00:00:00 2001 From: Pau Navarro Date: Tue, 18 Oct 2022 10:46:14 +0200 Subject: [PATCH 11/15] Fixed ACL --- .../00-ACL_workerDisableExcluded.sql | 22 ++----------------- 1 file changed, 2 insertions(+), 20 deletions(-) diff --git a/db/changes/10491-august/00-ACL_workerDisableExcluded.sql b/db/changes/10491-august/00-ACL_workerDisableExcluded.sql index 3d84c751c..7a23ca68a 100644 --- a/db/changes/10491-august/00-ACL_workerDisableExcluded.sql +++ b/db/changes/10491-august/00-ACL_workerDisableExcluded.sql @@ -1,20 +1,2 @@ -INSERT INTO - salix.ACL ( - id, - model, - property, - accessType, - permission, - principalType, - principalId - ) -VALUES -( - 344, - 'WorkerDisableExcluded', - '*', - '*', - 'ALLOW', - 'ROLE', - 'employee' - ); \ No newline at end of file +INSERT INTO `salix`.`ACL` (model,property,accessType,permission,principalId) + VALUES ('WorkerDisableExcluded','*','*','ALLOW','employee'); From 6f7ec12cb2119ce6584811d7d4228bdd8df499fb Mon Sep 17 00:00:00 2001 From: vicent Date: Wed, 19 Oct 2022 10:35:41 +0200 Subject: [PATCH 12/15] feat: response as 'reply' and not as 'internNote' --- back/methods/osticket/closeTicket.js | 48 ++++++++++++++----- back/models/osticket-config.json | 12 +++-- db/changes/10481-june/00-osTicketConfig.sql | 6 +-- db/changes/10491-august/00-osTicketConfig.sql | 8 ++++ db/dump/fixtures.sql | 4 ++ package.json | 1 + 6 files changed, 58 insertions(+), 21 deletions(-) create mode 100644 db/changes/10491-august/00-osTicketConfig.sql diff --git a/back/methods/osticket/closeTicket.js b/back/methods/osticket/closeTicket.js index 87d54d3b8..33fe5958b 100644 --- a/back/methods/osticket/closeTicket.js +++ b/back/methods/osticket/closeTicket.js @@ -1,12 +1,13 @@ const jsdom = require('jsdom'); const mysql = require('mysql'); +const FormData = require('form-data'); module.exports = Self => { Self.remoteMethodCtx('closeTicket', { description: 'Close tickets without response from the user', accessType: 'READ', returns: { - type: 'Object', + type: 'object', root: true }, http: { @@ -54,9 +55,9 @@ module.exports = Self => { }); }); - await requestToken(); + await getRequestToken(); - async function requestToken() { + async function getRequestToken() { const response = await fetch(ostUri); const result = response.headers.get('set-cookie'); @@ -93,24 +94,45 @@ module.exports = Self => { await close(token, secondCookie); } + async function getLockCode(token, secondCookie, ticketId) { + const ostUri = `${config.host}/ajax.php/lock/ticket/${ticketId}`; + const params = { + method: 'POST', + headers: { + 'X-CSRFToken': token, + 'Cookie': secondCookie + } + }; + const response = await fetch(ostUri, params); + const body = await response.text(); + const json = JSON.parse(body); + + return json.code; + } + async function close(token, secondCookie) { for (const ticketId of ticketsId) { - const ostUri = `${config.host}/ajax.php/tickets/${ticketId}/status`; - const data = { - status_id: config.newStatusId, - comments: config.comment, - undefined: config.action - }; + const lockCode = await getLockCode(token, secondCookie, ticketId); + let form = new FormData(); + form.append('__CSRFToken__', token); + form.append('id', ticketId); + form.append('a', config.responseType); + form.append('lockCode', lockCode); + form.append('from_email_id', config.fromEmailId); + form.append('reply-to', config.replyTo); + form.append('cannedResp', 0); + form.append('response', config.comment); + form.append('signature', 'none'); + form.append('reply_status_id', config.newStatusId); + + const ostUri = `${config.host}/tickets.php?id=${ticketId}`; const params = { method: 'POST', - body: new URLSearchParams(data), + body: form, headers: { - 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8', - 'X-CSRFToken': token, 'Cookie': secondCookie } }; - return fetch(ostUri, params); } } diff --git a/back/models/osticket-config.json b/back/models/osticket-config.json index d42632c6a..5a863e7bc 100644 --- a/back/models/osticket-config.json +++ b/back/models/osticket-config.json @@ -27,9 +27,6 @@ "newStatusId": { "type": "number" }, - "action": { - "type": "string" - }, "day": { "type": "number" }, @@ -47,6 +44,15 @@ }, "portDb": { "type": "number" + }, + "responseType": { + "type": "string" + }, + "fromEmailId": { + "type": "number" + }, + "replyTo": { + "type": "string" } } } \ No newline at end of file diff --git a/db/changes/10481-june/00-osTicketConfig.sql b/db/changes/10481-june/00-osTicketConfig.sql index ad6662715..8727c816d 100644 --- a/db/changes/10481-june/00-osTicketConfig.sql +++ b/db/changes/10481-june/00-osTicketConfig.sql @@ -13,8 +13,4 @@ CREATE TABLE `vn`.`osTicketConfig` ( `passwordDb` varchar(100) COLLATE utf8mb3_unicode_ci DEFAULT NULL, `portDb` int(11) DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; - -INSERT INTO `vn`.`osTicketConfig`(`id`, `host`, `user`, `password`, `oldStatus`, `newStatusId`, `action`, `day`, `comment`, `hostDb`, `userDb`, `passwordDb`, `portDb`) - VALUES - (0, 'https://cau.verdnatura.es/scp', NULL, NULL, 'open', 3, 'Cerrar', 60, 'Este CAU se ha cerrado automáticamente', NULL, NULL, NULL, NULL); \ No newline at end of file +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci; \ No newline at end of file diff --git a/db/changes/10491-august/00-osTicketConfig.sql b/db/changes/10491-august/00-osTicketConfig.sql new file mode 100644 index 000000000..10a58b6c8 --- /dev/null +++ b/db/changes/10491-august/00-osTicketConfig.sql @@ -0,0 +1,8 @@ +ALTER TABLE `vn`.`osTicketConfig` DROP COLUMN `action`; +ALTER TABLE `vn`.`osTicketConfig` ADD responseType varchar(100) NULL; +ALTER TABLE `vn`.`osTicketConfig` ADD fromEmailId INT NULL; +ALTER TABLE `vn`.`osTicketConfig` ADD replyTo varchar(100) NULL; + +UPDATE `vn`.`osTicketConfig` + SET responseType='reply', fromEmailId=5, replyTo='all' +WHERE id=0; \ No newline at end of file diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql index 7e59c1a54..b3f2d9c26 100644 --- a/db/dump/fixtures.sql +++ b/db/dump/fixtures.sql @@ -2667,3 +2667,7 @@ INSERT INTO `vn`.`ticketCollection` (`ticketFk`, `collectionFk`, `created`, `lev UPDATE `account`.`user` SET `hasGrant` = 1 WHERE `id` = 66; + +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', 'open', 3, 60, 'Este CAU se ha cerrado automáticamente. Si el problema persiste responda a este mensaje.', 'localhost', 'osticket', 'osticket', 40003, 'reply', 1, 'all'); \ No newline at end of file diff --git a/package.json b/package.json index 26c164832..5ab329875 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "bcrypt": "^5.0.1", "bmp-js": "^0.1.0", "compression": "^1.7.3", + "form-data": "^4.0.0", "fs-extra": "^5.0.0", "ftps": "^1.2.0", "got": "^10.7.0", From 23598c993b74572e0a658d66560636197832d9b4 Mon Sep 17 00:00:00 2001 From: Pau Navarro Date: Tue, 25 Oct 2022 09:25:15 +0200 Subject: [PATCH 13/15] Change ACL from employee to hr --- db/changes/10491-august/00-ACL_workerDisableExcluded.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/changes/10491-august/00-ACL_workerDisableExcluded.sql b/db/changes/10491-august/00-ACL_workerDisableExcluded.sql index 7a23ca68a..2fd9e8b12 100644 --- a/db/changes/10491-august/00-ACL_workerDisableExcluded.sql +++ b/db/changes/10491-august/00-ACL_workerDisableExcluded.sql @@ -1,2 +1,2 @@ INSERT INTO `salix`.`ACL` (model,property,accessType,permission,principalId) - VALUES ('WorkerDisableExcluded','*','*','ALLOW','employee'); + VALUES ('WorkerDisableExcluded','*','*','ALLOW','hr'); \ No newline at end of file From 9225e8f176c192464bae875f4324ca393ab8734e Mon Sep 17 00:00:00 2001 From: alexm Date: Thu, 27 Oct 2022 15:11:57 +0200 Subject: [PATCH 14/15] fix tests --- back/methods/chat/sendCheckingPresence.js | 4 ++ .../10500-november/00-deletePickupContact.sql | 1 + db/dump/fixtures.sql | 8 ++-- .../back/methods/claim/claimPickupEmail.js | 41 +++++++++---------- modules/claim/front/descriptor/index.js | 5 +-- modules/claim/front/descriptor/index.spec.js | 12 +----- package.json | 2 +- .../claim-pickup-order/claim-pickup-order.js | 21 +++++----- .../email/claim-pickup-order/sql/ticket.sql | 4 ++ 9 files changed, 47 insertions(+), 51 deletions(-) create mode 100644 db/changes/10500-november/00-deletePickupContact.sql create mode 100644 print/templates/email/claim-pickup-order/sql/ticket.sql diff --git a/back/methods/chat/sendCheckingPresence.js b/back/methods/chat/sendCheckingPresence.js index 3bc022429..556a16260 100644 --- a/back/methods/chat/sendCheckingPresence.js +++ b/back/methods/chat/sendCheckingPresence.js @@ -25,6 +25,7 @@ module.exports = Self => { }); Self.sendCheckingPresence = async(ctx, recipientId, message, options) => { + console.log(ctx, recipientId, message, options); if (!recipientId) return false; const myOptions = {}; @@ -38,7 +39,10 @@ module.exports = Self => { const recipient = await models.Account.findById(recipientId, null, myOptions); // Prevent sending messages to yourself + console.log('llega'); + console.log(recipientId, userId); if (recipientId == userId) return false; + console.log('llega2'); if (!recipient) throw new Error(`Could not send message "${message}" to worker id ${recipientId} from user ${userId}`); diff --git a/db/changes/10500-november/00-deletePickupContact.sql b/db/changes/10500-november/00-deletePickupContact.sql new file mode 100644 index 000000000..6bfa662c5 --- /dev/null +++ b/db/changes/10500-november/00-deletePickupContact.sql @@ -0,0 +1 @@ +ALTER TABLE `vn`.`claimConfig` DROP COLUMN `pickupContact`; diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql index 9a0a1fff6..34e592b9a 100644 --- a/db/dump/fixtures.sql +++ b/db/dump/fixtures.sql @@ -1778,10 +1778,10 @@ INSERT INTO `vn`.`claimEnd`(`id`, `saleFk`, `claimFk`, `workerFk`, `claimDestina (1, 31, 4, 21, 2), (2, 32, 3, 21, 3); -INSERT INTO `vn`.`claimConfig`(`id`, `pickupContact`, `maxResponsibility`) +INSERT INTO `vn`.`claimConfig`(`id`, `maxResponsibility`) VALUES - (1, 'Contact description', 50), - (2, 'Contact description', 30); + (1, 50), + (2, 30); INSERT INTO `vn`.`claimRatio`(`clientFk`, `yearSale`, `claimAmount`, `claimingRate`, `priceIncreasing`, `packingRate`) VALUES @@ -1791,7 +1791,7 @@ INSERT INTO `vn`.`claimRatio`(`clientFk`, `yearSale`, `claimAmount`, `claimingRa (1104, 2500, 150.00, 0.02, 0.10, 1.00); INSERT INTO vn.claimRma (`id`, `code`, `created`, `workerFk`) -VALUES + VALUES (1, '02676A049183', DEFAULT, 1106), (2, '02676A049183', DEFAULT, 1106), (3, '02676A049183', DEFAULT, 1107), diff --git a/modules/claim/back/methods/claim/claimPickupEmail.js b/modules/claim/back/methods/claim/claimPickupEmail.js index 4c9b86502..23f0e31ef 100644 --- a/modules/claim/back/methods/claim/claimPickupEmail.js +++ b/modules/claim/back/methods/claim/claimPickupEmail.js @@ -9,7 +9,7 @@ module.exports = Self => { arg: 'id', type: 'number', required: true, - description: 'The client id', + description: 'The claim id', http: {source: 'path'} }, { @@ -29,24 +29,6 @@ module.exports = Self => { type: 'number', description: 'The recipient id to send to the recipient preferred language', required: false - }, - { - arg: 'ticketId', - type: 'number', - description: 'The ticket id', - required: true - }, - { - arg: 'salesPersonId', - type: 'number', - description: 'The salesPerson id', - required: false - }, - { - arg: 'clientName', - type: 'string', - description: 'The client name', - required: true } ], returns: { @@ -75,14 +57,29 @@ module.exports = Self => { for (const param in args) params[param] = args[param]; + const claim = await models.Claim.findById(args.id, { + fields: ['id', 'clientFk'], + include: { + relation: 'client', + scope: { + fields: ['name', 'salesPersonFk'] + } + } + }); + console.log(claim); + const message = $t('Claim pickup order sent', { claimId: args.id, - clientName: args.clientName, + clientName: claim.client.name, claimUrl: `${origin}/#!/claim/${args.id}/summary`, }); - if (args.salesPersonId) - await models.Chat.sendCheckingPresence(ctx, args.salesPersonId, message); + console.log(claim.client()); + const salesPersonId = claim.client().salesPersonFk; + if (claim.client().salesPersonFk) + console.log(await models.Chat.sendCheckingPresence(ctx, 25, message)); + + console.log(claim.client().salesPersonFk); await models.ClaimLog.create({ originFk: args.id, diff --git a/modules/claim/front/descriptor/index.js b/modules/claim/front/descriptor/index.js index b36fae321..0dddadbe1 100644 --- a/modules/claim/front/descriptor/index.js +++ b/modules/claim/front/descriptor/index.js @@ -19,10 +19,7 @@ class Controller extends Descriptor { sendPickupOrder() { return this.vnEmail.send(`Claims/${this.claim.id}/claim-pickup-email`, { recipient: this.claim.client.email, - recipientId: this.claim.clientFk, - clientName: this.claim.client.name, - ticketId: this.claim.ticket.id, - salesPersonId: this.claim.client.salesPersonFk + recipientId: this.claim.clientFk }); } diff --git a/modules/claim/front/descriptor/index.spec.js b/modules/claim/front/descriptor/index.spec.js index 18ccdaff5..e6785d3d8 100644 --- a/modules/claim/front/descriptor/index.spec.js +++ b/modules/claim/front/descriptor/index.spec.js @@ -7,12 +7,7 @@ describe('Item Component vnClaimDescriptor', () => { const claim = { id: 2, clientFk: 1101, - client: { - email: 'client@email', - name: 'clientName', - salesPersonFk: 18 - }, - ticket: {id: 2} + client: {email: 'client@email'} }; beforeEach(ngModule('claim')); @@ -45,10 +40,7 @@ describe('Item Component vnClaimDescriptor', () => { const params = { recipient: claim.client.email, - recipientId: claim.clientFk, - clientName: claim.client.name, - ticketId: claim.ticket.id, - salesPersonId: claim.client.salesPersonFk + recipientId: claim.clientFk }; controller.sendPickupOrder(); diff --git a/package.json b/package.json index 26c164832..be6db46a8 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,7 @@ "node-ssh": "^11.0.0", "object-diff": "0.0.4", "object.pick": "^1.3.0", - "puppeteer": "^18.0.5", + "puppeteer": "^19.2.0", "read-chunk": "^3.2.0", "require-yaml": "0.0.1", "sharp": "^0.31.0", diff --git a/print/templates/email/claim-pickup-order/claim-pickup-order.js b/print/templates/email/claim-pickup-order/claim-pickup-order.js index 51db21cb5..b8804c604 100755 --- a/print/templates/email/claim-pickup-order/claim-pickup-order.js +++ b/print/templates/email/claim-pickup-order/claim-pickup-order.js @@ -8,22 +8,23 @@ module.exports = { 'email-header': emailHeader.build(), 'email-footer': emailFooter.build() }, - created() { - this.instructions = this.$t('description.instructions', [this.id, this.ticketId]); + async serverPrefetch() { + this.ticket = await this.fetchTicket(this.id); + + if (!this.ticket) + throw new Error('Something went wrong'); + console.log(); + this.instructions = this.$t('description.instructions', [this.id, this.ticket.id]); }, - data() { - return { - instructions: String - }; + methods: { + fetchTicket(id) { + return this.findOneFromDef('ticket', [id]); + } }, props: { id: { type: [Number, String], required: true - }, - ticketId: { - type: [Number, String], - required: true } } }; diff --git a/print/templates/email/claim-pickup-order/sql/ticket.sql b/print/templates/email/claim-pickup-order/sql/ticket.sql new file mode 100644 index 000000000..28b78c987 --- /dev/null +++ b/print/templates/email/claim-pickup-order/sql/ticket.sql @@ -0,0 +1,4 @@ +SELECT + c.ticketFk as id +FROM claim c +WHERE c.id = ? From 9170c22d6f80515a3251ba003ac8494fc0c5b262 Mon Sep 17 00:00:00 2001 From: alexm Date: Fri, 28 Oct 2022 09:21:28 +0200 Subject: [PATCH 15/15] fix send email --- back/methods/chat/sendCheckingPresence.js | 4 ---- modules/claim/back/methods/claim/claimPickupEmail.js | 10 +++------- .../email/claim-pickup-order/claim-pickup-order.js | 2 +- 3 files changed, 4 insertions(+), 12 deletions(-) diff --git a/back/methods/chat/sendCheckingPresence.js b/back/methods/chat/sendCheckingPresence.js index 556a16260..3bc022429 100644 --- a/back/methods/chat/sendCheckingPresence.js +++ b/back/methods/chat/sendCheckingPresence.js @@ -25,7 +25,6 @@ module.exports = Self => { }); Self.sendCheckingPresence = async(ctx, recipientId, message, options) => { - console.log(ctx, recipientId, message, options); if (!recipientId) return false; const myOptions = {}; @@ -39,10 +38,7 @@ module.exports = Self => { const recipient = await models.Account.findById(recipientId, null, myOptions); // Prevent sending messages to yourself - console.log('llega'); - console.log(recipientId, userId); if (recipientId == userId) return false; - console.log('llega2'); if (!recipient) throw new Error(`Could not send message "${message}" to worker id ${recipientId} from user ${userId}`); diff --git a/modules/claim/back/methods/claim/claimPickupEmail.js b/modules/claim/back/methods/claim/claimPickupEmail.js index 23f0e31ef..c688d6ded 100644 --- a/modules/claim/back/methods/claim/claimPickupEmail.js +++ b/modules/claim/back/methods/claim/claimPickupEmail.js @@ -66,20 +66,16 @@ module.exports = Self => { } } }); - console.log(claim); const message = $t('Claim pickup order sent', { claimId: args.id, - clientName: claim.client.name, + clientName: claim.client().name, claimUrl: `${origin}/#!/claim/${args.id}/summary`, }); - console.log(claim.client()); const salesPersonId = claim.client().salesPersonFk; - if (claim.client().salesPersonFk) - console.log(await models.Chat.sendCheckingPresence(ctx, 25, message)); - - console.log(claim.client().salesPersonFk); + if (salesPersonId) + await models.Chat.sendCheckingPresence(ctx, salesPersonId, message); await models.ClaimLog.create({ originFk: args.id, diff --git a/print/templates/email/claim-pickup-order/claim-pickup-order.js b/print/templates/email/claim-pickup-order/claim-pickup-order.js index b8804c604..29f295b1e 100755 --- a/print/templates/email/claim-pickup-order/claim-pickup-order.js +++ b/print/templates/email/claim-pickup-order/claim-pickup-order.js @@ -13,7 +13,7 @@ module.exports = { if (!this.ticket) throw new Error('Something went wrong'); - console.log(); + this.instructions = this.$t('description.instructions', [this.id, this.ticket.id]); }, methods: {