diff --git a/back/methods/chat/send.js b/back/methods/chat/send.js index 67e0dbb87..fcb49f4b8 100644 --- a/back/methods/chat/send.js +++ b/back/methods/chat/send.js @@ -30,8 +30,13 @@ module.exports = Self => { const sender = await models.Account.findById(accessToken.userId); const recipient = to.replace('@', ''); - if (sender.name != recipient) - return sendMessage(sender, to, message); + if (sender.name != recipient) { + await sendMessage(sender, to, message); + + return true; + } + + return false; }; async function sendMessage(sender, channel, message) { diff --git a/back/methods/chat/sendCheckingPresence.js b/back/methods/chat/sendCheckingPresence.js index 429ecdab0..5c27d72fd 100644 --- a/back/methods/chat/sendCheckingPresence.js +++ b/back/methods/chat/sendCheckingPresence.js @@ -5,7 +5,7 @@ module.exports = Self => { description: 'Sends a RocketChat message to a connected user or department channel', accessType: 'WRITE', accepts: [{ - arg: 'recipientId', + arg: 'workerId', type: 'number', required: true, description: 'The recipient user id' diff --git a/db/changes/10420-valentines/00-ImportTicketAcl.sql b/db/changes/10420-valentines/00-ImportTicketAcl.sql index 98192a39c..df61fd5b8 100644 --- a/db/changes/10420-valentines/00-ImportTicketAcl.sql +++ b/db/changes/10420-valentines/00-ImportTicketAcl.sql @@ -1,2 +1,2 @@ -DELETE FROM salix.ACL +DELETE FROM `salix`.`ACL` WHERE model = 'ClaimEnd' AND property = 'importTicketSales'; diff --git a/db/changes/10420-valentines/00-aclCollection.sql b/db/changes/10420-valentines/00-aclCollection.sql index 81e53049c..57774ba29 100644 --- a/db/changes/10420-valentines/00-aclCollection.sql +++ b/db/changes/10420-valentines/00-aclCollection.sql @@ -1,3 +1,3 @@ -INSERT INTO salix.ACL +INSERT INTO `salix`.`ACL` (model, property, accessType, permission, principalType, principalId) VALUES('Collection', 'setSaleQuantity', '*', 'ALLOW', 'ROLE', 'employee'); \ No newline at end of file diff --git a/db/changes/10420-valentines/00-aclDocuware.sql b/db/changes/10420-valentines/00-aclDocuware.sql index 21ed66c4c..c2d47d4ea 100644 --- a/db/changes/10420-valentines/00-aclDocuware.sql +++ b/db/changes/10420-valentines/00-aclDocuware.sql @@ -1,3 +1,3 @@ -INSERT INTO salix.ACL +INSERT INTO `salix`.`ACL` (model, property, accessType, permission, principalType, principalId) VALUES('Docuware', '*', '*', 'ALLOW', 'ROLE', 'employee'); \ No newline at end of file diff --git a/db/changes/10420-valentines/00-defaultViewConfig.sql b/db/changes/10420-valentines/00-defaultViewConfig.sql index c65c1f403..e0d75e9d4 100644 --- a/db/changes/10420-valentines/00-defaultViewConfig.sql +++ b/db/changes/10420-valentines/00-defaultViewConfig.sql @@ -1,3 +1,3 @@ -UPDATE salix.defaultViewConfig +UPDATE `salix`.`defaultViewConfig` SET `columns`='{"intrastat":false,"stemMultiplier":false,"landed":false,"producer":false}' WHERE tableCode ='itemsIndex'; diff --git a/db/changes/10430-ash/00-aclAgencyTerm.sql b/db/changes/10430-ash/00-aclAgencyTerm.sql index d3e11e53e..c43965ed0 100644 --- a/db/changes/10430-ash/00-aclAgencyTerm.sql +++ b/db/changes/10430-ash/00-aclAgencyTerm.sql @@ -1,2 +1,2 @@ -INSERT INTO salix.ACL (model,property,accessType,principalId) +INSERT INTO `salix`.`ACL` (model,property,accessType,principalId) VALUES ('AgencyTerm','*','*','administrative'); diff --git a/db/changes/10430-ash/00-deliveryBoss.sql b/db/changes/10430-ash/00-deliveryBoss.sql index a4bcdcd0c..ac07bfa31 100644 --- a/db/changes/10430-ash/00-deliveryBoss.sql +++ b/db/changes/10430-ash/00-deliveryBoss.sql @@ -1,3 +1 @@ -UPDATE `account`.`user` -SET `role` = 57 -WHERE id IN (2294, 4365, 7294); \ No newline at end of file +UPDATE `account`.`user` SET `role` = 57 WHERE id IN (2294, 4365, 7294); \ No newline at end of file diff --git a/db/changes/10440-fallas/00-travelThermograph.sql b/db/changes/10440-fallas/00-travelThermograph.sql new file mode 100644 index 000000000..f76f070a0 --- /dev/null +++ b/db/changes/10440-fallas/00-travelThermograph.sql @@ -0,0 +1,16 @@ +DROP TRIGGER `vn`.`travelThermograph_beforeInsert`; + +ALTER TABLE `vn`.`travelThermograph` CHANGE `temperature` `temperature__` enum('COOL','WARM','DRY') CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL NULL; + +CREATE OR REPLACE +ALGORITHM = UNDEFINED VIEW `vn2008`.`travel_thermograph` AS +select + `tt`.`thermographFk` AS `thermograph_id`, + `tt`.`created` AS `odbc_date`, + `tt`.`warehouseFk` AS `warehouse_id`, + `tt`.`travelFk` AS `travel_id`, + `tt`.`temperatureFk` AS `temperature`, + `tt`.`result` AS `result`, + `tt`.`dmsFk` AS `gestdoc_id` +from + `vn`.`travelThermograph` `tt`; \ No newline at end of file diff --git a/db/changes/10450-april/00-timeControl_getError.sql b/db/changes/10450-april/00-timeControl_getError.sql new file mode 100644 index 000000000..0caf8ab62 --- /dev/null +++ b/db/changes/10450-april/00-timeControl_getError.sql @@ -0,0 +1,73 @@ +DROP PROCEDURE IF EXISTS vn.timeControl_getError; + +DELIMITER $$ +$$ +CREATE DEFINER=`root`@`localhost` PROCEDURE `vn`.`timeControl_getError`(vDatedFrom DATETIME, vDatedTo DATETIME) +BEGIN +/* + * @param vDatedFrom + * @param vDatedTo + * @table tmp.`user`(userFk) + * Fichadas incorrectas de las cuales no se puede calcular horas trabajadas + * @return tmp.timeControlError (id) + */ + DECLARE vDayMaxTime INTEGER; + + SET @journeyCounter := 0; + SET @lastUserFk := NULL; + + SELECT dayMaxTime INTO vDayMaxTime + FROM workerTimeControlConfig LIMIT 1; + + DROP TEMPORARY TABLE IF EXISTS tmp.timeControl; + CREATE TEMPORARY TABLE tmp.timeControl + (INDEX(id), INDEX(journeyCounter)) + ENGINE = MEMORY + SELECT sub.id, + sub.direction, + sub.timed, + IF(sub.direction = 'in' OR @hasOut OR sub.userFk <> @lastUserFk, @journeyCounter := @journeyCounter + 1, @journeyCounter) journeyCounter, + @lastUserFk := sub.userFk workerFk, + IF(sub.direction = 'out', @hasOut:= TRUE, @hasOut:= FALSE) + FROM ( + SELECT DISTINCT wtc.id, + wtc.direction, + wtc.timed, + wtc.userFk + FROM workerTimeControl wtc + JOIN tmp.`user` w ON w.userFk = wtc.userFk + WHERE wtc.timed BETWEEN DATE_SUB(vDatedFrom, INTERVAL 1 DAY) AND DATE_ADD(vDatedTo, INTERVAL 1 DAY) + ORDER BY wtc.userFk, wtc.timed + ) sub; + + DROP TEMPORARY TABLE IF EXISTS tmp.timeControlAux; + CREATE TEMPORARY TABLE tmp.timeControlAux + (INDEX(id), INDEX(journeyCounter)) + ENGINE = MEMORY + SELECT * FROM tmp.timeControl; + + DROP TEMPORARY TABLE IF EXISTS tmp.timeControlError; + CREATE TEMPORARY TABLE tmp.timeControlError + (INDEX(id)) + ENGINE = MEMORY + SELECT id + FROM tmp.timeControlAux tca + JOIN (SELECT journeyCounter, + UNIX_TIMESTAMP(MAX(timed)) - UNIX_TIMESTAMP(MIN(timed)) timeWork, + SUM(direction = 'in') totalIn, + SUM(direction = 'out') totalOut, + timed + FROM tmp.timeControl + GROUP BY journeyCounter + HAVING COUNT(*) MOD 2 = 1 + OR totalIn <> 1 + OR totalOut <> 1 + OR timeWork >= vDayMaxTime + )sub ON sub.journeyCounter = tca.journeyCounter + WHERE sub.timed BETWEEN vDatedFrom AND vDatedTo; + + DROP TEMPORARY TABLE IF EXISTS tmp.timeControl; + DROP TEMPORARY TABLE IF EXISTS tmp.timeControlAux; + +END$$ +DELIMITER ; diff --git a/db/changes/10450-april/delete.keep b/db/changes/10450-april/delete.keep new file mode 100644 index 000000000..e69de29bb diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql index e8302b1a2..5bd89ebd2 100644 --- a/db/dump/fixtures.sql +++ b/db/dump/fixtures.sql @@ -292,10 +292,10 @@ INSERT INTO `vn`.`contactChannel`(`id`, `name`) 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`,`mailAddress`,`hasToInvoiceByAddress`,`isTaxDataChecked`,`isFreezed`,`creditInsurance`,`isCreatedAsServed`,`hasInvoiceSimplified`,`salesPersonFk`,`isVies`,`eypbc`, `businessTypeFk`) VALUES (1101, 'Bruce Wayne', '84612325V', 'Batman', 'Alfred', '1007 Mountain Drive, Gotham', 'Silla', 46460, 1111111111, 222222222, 1, 'BruceWayne@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1, 'florist'), - (1102, 'Petter Parker', '87945234L', 'Spider man', 'Aunt May', '20 Ingram Street, Queens, USA', 'Silla', 46460, 1111111111, 222222222, 1, 'PetterParker@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1, 'florist'), - (1103, 'Clark Kent', '06815934E', 'Super man', 'lois lane', '344 Clinton Street, Apartament 3-D', 'Silla', 46460, 1111111111, 222222222, 1, 'ClarkKent@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 0, 19, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1, 'florist'), - (1104, 'Tony Stark', '06089160W', 'Iron man', 'Pepper Potts', '10880 Malibu Point, 90265', 'Silla', 46460, 1111111111, 222222222, 1, 'TonyStark@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1, 'florist'), - (1105, 'Max Eisenhardt', '251628698', 'Magneto', 'Rogue', 'Unknown Whereabouts', 'Silla', 46460, 1111111111, 222222222, 1, 'MaxEisenhardt@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 8, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 1, 1, NULL, 0, 0, 18, 0, 1, 'florist'), + (1102, 'Petter Parker', '87945234L', 'Spider man', 'Aunt May', '20 Ingram Street, Queens, USA', 'Silla', 46460, 1111111111, 222222222, 1, 'PetterParker@mydomain.com', NULL, 0, 1234567890, 0, 2, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1, 'florist'), + (1103, 'Clark Kent', '06815934E', 'Super man', 'lois lane', '344 Clinton Street, Apartament 3-D', 'Silla', 46460, 1111111111, 222222222, 1, 'ClarkKent@mydomain.com', NULL, 0, 1234567890, 0, 3, 1, 0, 19, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1, 'florist'), + (1104, 'Tony Stark', '06089160W', 'Iron man', 'Pepper Potts', '10880 Malibu Point, 90265', 'Silla', 46460, 1111111111, 222222222, 1, 'TonyStark@mydomain.com', NULL, 0, 1234567890, 0, 2, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1, 'florist'), + (1105, 'Max Eisenhardt', '251628698', 'Magneto', 'Rogue', 'Unknown Whereabouts', 'Silla', 46460, 1111111111, 222222222, 1, 'MaxEisenhardt@mydomain.com', NULL, 0, 1234567890, 0, 3, 1, 300, 8, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 1, 1, NULL, 0, 0, 18, 0, 1, 'florist'), (1106, 'DavidCharlesHaller', '53136686Q', 'Legion', 'Charles Xavier', 'City of New York, New York, USA', 'Silla', 46460, 1111111111, 222222222, 1, 'DavidCharlesHaller@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 0, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 1, 0, NULL, 0, 0, 19, 0, 1, 'florist'), (1107, 'Hank Pym', '09854837G', 'Ant man', 'Hawk', 'Anthill, San Francisco, California', 'Silla', 46460, 1111111111, 222222222, 1, 'HankPym@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 0, 0, NULL, 0, 0, 19, 0, 1, 'florist'), (1108, 'Charles Xavier', '22641921P', 'Professor X', 'Beast', '3800 Victory Pkwy, Cincinnati, OH 45207, USA', 'Silla', 46460, 1111111111, 222222222, 1, 'CharlesXavier@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, 1, 1, NULL, 0, 0, 19, 0, 1, 'florist'), diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index 21ed27158..62c32434a 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -392,7 +392,6 @@ export default { name: 'vn-item-basic-data vn-textfield[ng-model="$ctrl.item.name"]', relevancy: 'vn-item-basic-data vn-input-number[ng-model="$ctrl.item.relevancy"]', origin: 'vn-autocomplete[ng-model="$ctrl.item.originFk"]', - compression: 'vn-item-basic-data vn-input-number[ng-model="$ctrl.item.compression"]', generic: 'vn-autocomplete[ng-model="$ctrl.item.genericFk"]', isFragile: 'vn-check[ng-model="$ctrl.item.isFragile"]', longName: 'vn-textfield[ng-model="$ctrl.item.longName"]', diff --git a/e2e/paths/03-worker/04_time_control.spec.js b/e2e/paths/03-worker/04_time_control.spec.js index 137d94c74..5709e6207 100644 --- a/e2e/paths/03-worker/04_time_control.spec.js +++ b/e2e/paths/03-worker/04_time_control.spec.js @@ -99,8 +99,8 @@ describe('Worker time control path', () => { expect(result).toEqual(scanTime); }); - // 3736 check proc vn.timeControl_calculate - xit(`should check Hank Pym worked 6:40 hours`, async() => { + + it(`should check Hank Pym worked 6:40 hours`, async() => { await page.waitForTextInElement(selectors.workerTimeControl.mondayWorkedHours, '06:40 h.'); }); }); diff --git a/e2e/paths/04-item/02_basic_data.spec.js b/e2e/paths/04-item/02_basic_data.spec.js index 0bbb6ad12..a663ea3bb 100644 --- a/e2e/paths/04-item/02_basic_data.spec.js +++ b/e2e/paths/04-item/02_basic_data.spec.js @@ -30,8 +30,6 @@ describe('Item Edit basic data path', () => { await page.autocompleteSearch(selectors.itemBasicData.origin, 'Spain'); await page.clearInput(selectors.itemBasicData.relevancy); await page.write(selectors.itemBasicData.relevancy, '1'); - await page.clearInput(selectors.itemBasicData.compression); - await page.write(selectors.itemBasicData.compression, '2'); await page.clearInput(selectors.itemBasicData.generic); await page.autocompleteSearch(selectors.itemBasicData.generic, '16'); await page.waitToClick(selectors.itemBasicData.isActiveCheckbox); @@ -96,13 +94,6 @@ describe('Item Edit basic data path', () => { expect(result).toEqual('Spain'); }); - it(`should confirm the item compression was edited`, async() => { - const result = await page - .waitToGetProperty(selectors.itemBasicData.compression, 'value'); - - expect(result).toEqual('2'); - }); - it(`should confirm the item generic was edited`, async() => { const result = await page .waitToGetProperty(selectors.itemBasicData.generic, 'value'); diff --git a/modules/claim/back/methods/claim/filter.js b/modules/claim/back/methods/claim/filter.js index f4eecae6d..17e07d67c 100644 --- a/modules/claim/back/methods/claim/filter.js +++ b/modules/claim/back/methods/claim/filter.js @@ -97,11 +97,16 @@ module.exports = Self => { {'cl.socialName': {like: `%${value}%`}} ] }; + case 'client': + return {'cl.socialName': {like: `%${value}%`}}; + case 'clientFk': + return {'cl.clientFk': value}; case 'id': case 'claimStateFk': case 'priority': return {[`cl.${param}`]: value}; case 'salesPersonFk': + return {'cl.salesPersonFk': value}; case 'attenderFk': return {'cl.workerFk': value}; case 'created': @@ -129,7 +134,8 @@ module.exports = Self => { cs.description, cl.created, cs.priority, - cl.claimStateFk + cl.claimStateFk, + c.salesPersonFk FROM claim cl LEFT JOIN client c ON c.id = cl.clientFk LEFT JOIN worker w ON w.id = cl.workerFk diff --git a/modules/client/back/methods/client/checkDuplicated.js b/modules/client/back/methods/client/checkDuplicated.js new file mode 100644 index 000000000..acaffbf42 --- /dev/null +++ b/modules/client/back/methods/client/checkDuplicated.js @@ -0,0 +1,64 @@ +module.exports = Self => { + Self.remoteMethod('checkDuplicatedData', { + description: 'Checks if a client has same email, mobile or phone than other client and send an email', + accepts: [{ + arg: 'id', + type: 'number', + required: true, + description: 'The client id' + }], + returns: { + type: 'object', + root: true + }, + http: { + verb: 'GET', + path: '/:id/checkDuplicatedData' + } + }); + + Self.checkDuplicatedData = async function(id, options) { + const myOptions = {}; + + if (typeof options == 'object') + Object.assign(myOptions, options); + + const client = await Self.app.models.Client.findById(id, myOptions); + + const emails = client.email ? client.email.split(',') : null; + + const findParams = []; + if (emails.length) { + for (let email of emails) + findParams.push({email: email}); + } + + if (client.phone) + findParams.push({phone: client.phone}); + + if (client.mobile) + findParams.push({mobile: client.mobile}); + + const filterObj = { + where: { + and: [ + {or: findParams}, + {id: {neq: client.id}} + ] + } + }; + + const clientSameData = await Self.findOne(filterObj, myOptions); + + if (clientSameData) { + await Self.app.models.Mail.create({ + receiver: 'direccioncomercial@verdnatura.es', + subject: `Cliente con email/teléfono/móvil duplicados`, + body: 'El cliente ' + client.id + ' comparte alguno de estos datos con el cliente ' + clientSameData.id + + '\n- Email: ' + client.email + + '\n- Teléfono: ' + client.phone + + '\n- Móvil: ' + client.mobile + }, myOptions); + } + }; +}; diff --git a/modules/client/back/methods/client/specs/checkDuplicated.spec.js b/modules/client/back/methods/client/specs/checkDuplicated.spec.js new file mode 100644 index 000000000..1b682ca35 --- /dev/null +++ b/modules/client/back/methods/client/specs/checkDuplicated.spec.js @@ -0,0 +1,24 @@ +const models = require('vn-loopback/server/server').models; + +describe('client checkDuplicated()', () => { + it('should send an mail if mobile/phone/email is duplicated', async() => { + const tx = await models.Client.beginTransaction({}); + + try { + const options = {transaction: tx}; + + const id = 1110; + const mailModel = models.Mail; + spyOn(mailModel, 'create'); + + await models.Client.checkDuplicatedData(id, options); + + expect(mailModel.create).toHaveBeenCalled(); + + await tx.rollback(); + } catch (e) { + await tx.rollback(); + throw e; + } + }); +}); diff --git a/modules/client/back/methods/client/specs/sendSms.spec.js b/modules/client/back/methods/client/specs/sendSms.spec.js index 121d427ce..47e788184 100644 --- a/modules/client/back/methods/client/specs/sendSms.spec.js +++ b/modules/client/back/methods/client/specs/sendSms.spec.js @@ -1,9 +1,7 @@ const models = require('vn-loopback/server/server').models; -const soap = require('soap'); describe('client sendSms()', () => { it('should now send a message and log it', async() => { - spyOn(soap, 'createClientAsync').and.returnValue('a so fake client'); const tx = await models.Client.beginTransaction({}); try { diff --git a/modules/client/back/methods/client/specs/updatePortfolio.spec.js b/modules/client/back/methods/client/specs/updatePortfolio.spec.js index 2554daf3d..4830156fc 100644 --- a/modules/client/back/methods/client/specs/updatePortfolio.spec.js +++ b/modules/client/back/methods/client/specs/updatePortfolio.spec.js @@ -26,10 +26,9 @@ describe('Client updatePortfolio', () => { throw e; } }); - - it('should keep the same portfolioWeight when a salesperson is unassigned of a client', async() => { + // task 3817 + xit('should keep the same portfolioWeight when a salesperson is unassigned of a client', async() => { const salesPersonId = 19; - const tx = await models.Client.beginTransaction({}); try { diff --git a/modules/client/back/methods/defaulter/filter.js b/modules/client/back/methods/defaulter/filter.js index 095b9b1c1..813d63d3f 100644 --- a/modules/client/back/methods/defaulter/filter.js +++ b/modules/client/back/methods/defaulter/filter.js @@ -80,6 +80,7 @@ module.exports = Self => { stmt.merge(conn.makeWhere(filter.where)); stmt.merge(`GROUP BY d.clientFk`); stmt.merge(conn.makeOrderBy(filter.order)); + stmt.merge(conn.makeLimit(filter)); const itemsIndex = stmts.push(stmt) - 1; const sql = ParameterizedSQL.join(stmts, ';'); diff --git a/modules/client/back/models/client.js b/modules/client/back/models/client.js index 9ec45f58d..5ccc1ec64 100644 --- a/modules/client/back/models/client.js +++ b/modules/client/back/models/client.js @@ -30,6 +30,7 @@ module.exports = Self => { require('../methods/client/consumption')(Self); require('../methods/client/createReceipt')(Self); require('../methods/client/updatePortfolio')(Self); + require('../methods/client/checkDuplicated')(Self); // Validations diff --git a/modules/client/front/balance/create/index.js b/modules/client/front/balance/create/index.js index 591af2839..454e5e44d 100644 --- a/modules/client/front/balance/create/index.js +++ b/modules/client/front/balance/create/index.js @@ -6,8 +6,11 @@ class Controller extends Dialog { super($element, $, $transclude); this.vnReport = vnReport; + + const tomorrow = new Date(); + tomorrow.setDate(tomorrow.getDate() + 1); this.receipt = { - payed: new Date() + payed: tomorrow }; } diff --git a/modules/client/front/basic-data/index.js b/modules/client/front/basic-data/index.js index 055733289..418663952 100644 --- a/modules/client/front/basic-data/index.js +++ b/modules/client/front/basic-data/index.js @@ -12,6 +12,7 @@ export default class Controller extends Section { return this.$.watcher.submit().then(() => { const query = `Clients/updatePortfolio`; this.$http.get(query); + this.$http.get(`Clients/${this.$params.id}/checkDuplicatedData`); }); } } diff --git a/modules/client/front/create/index.js b/modules/client/front/create/index.js index 1aa21c91e..9ca58ed10 100644 --- a/modules/client/front/create/index.js +++ b/modules/client/front/create/index.js @@ -10,9 +10,10 @@ export default class Controller extends Section { } onSubmit() { - return this.$.watcher.submit().then( - json => this.$state.go('client.card.basicData', {id: json.data.id}) - ); + return this.$.watcher.submit().then(json => { + this.$state.go('client.card.basicData', {id: json.data.id}); + this.$http.get(`Clients/${this.client.id}/checkDuplicatedData`); + }); } get province() { diff --git a/modules/client/front/main/index.js b/modules/client/front/main/index.js index 61cde8b22..1069d3487 100644 --- a/modules/client/front/main/index.js +++ b/modules/client/front/main/index.js @@ -23,6 +23,7 @@ export default class Client extends ModuleMain { case 'id': case 'fi': case 'postcode': + case 'provinceFk': case 'salesPersonFk': return {[param]: value}; } diff --git a/modules/client/front/notification/index.html b/modules/client/front/notification/index.html index f503c95c8..49e4e3c3f 100644 --- a/modules/client/front/notification/index.html +++ b/modules/client/front/notification/index.html @@ -67,7 +67,7 @@