Compare commits

...

123 Commits

Author SHA1 Message Date
Javier Segarra 6b37f23349 Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 5666-loggable_to_mixin
gitea/salix/pipeline/head This commit looks good Details
2023-12-21 13:06:52 +01:00
Alex Moreno 38279b0786 refs #6594 deploy: init version 24.02
gitea/salix/pipeline/head This commit looks good Details
2023-12-21 08:37:30 +01:00
Alex Moreno f4489a7b56 Merge branch 'test' of https://gitea.verdnatura.es/verdnatura/salix into dev 2023-12-21 08:34:44 +01:00
Alex Moreno 7b0c5fe0a0 refs #5739 fix: sql
gitea/salix/pipeline/head This commit looks good Details
2023-12-21 08:33:50 +01:00
Alex Moreno 3094c330df Merge branch 'test' of https://gitea.verdnatura.es/verdnatura/salix into dev 2023-12-21 07:47:07 +01:00
Alex Moreno f2dcbe214a Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into test 2023-12-21 07:44:41 +01:00
Guillermo Bonet f64cddd374 Merge pull request 'feat: refs #6582 routesMonitorTraduction' (!1899) from 6582-routesMonitorTraduction into dev
gitea/salix/pipeline/head This commit looks good Details
Reviewed-on: #1899
Reviewed-by: Carlos Andrés <carlosap@verdnatura.es>
2023-12-20 13:56:35 +00:00
Guillermo Bonet 5f83fc158c Merge branch 'dev' into 6582-routesMonitorTraduction
gitea/salix/pipeline/head This commit looks good Details
2023-12-20 13:03:57 +00:00
Javier Segarra 08228c065c Merge pull request '#5878 - Remove . for This ticket is locked' (!1894) from 6172_transfer_ticket_message_error into dev
gitea/salix/pipeline/head This commit looks good Details
Reviewed-on: #1894
Reviewed-by: Javi Gallego <jgallego@verdnatura.es>
Reviewed-by: Alex Moreno <alexm@verdnatura.es>
2023-12-20 11:14:33 +00:00
Javier Segarra 01e6e7dc39 Merge branch 'dev' into 6172_transfer_ticket_message_error
gitea/salix/pipeline/head This commit looks good Details
2023-12-20 11:02:00 +00:00
Javier Segarra 19bd02f952 Merge pull request '#6264 - renewToken' (!1824) from 6264-renewToken into dev
gitea/salix/pipeline/head This commit looks good Details
Reviewed-on: #1824
Reviewed-by: Javi Gallego <jgallego@verdnatura.es>
Reviewed-by: Alex Moreno <alexm@verdnatura.es>
Reviewed-by: Juan Ferrer <juan@verdnatura.es>
2023-12-20 09:22:25 +00:00
Juan Ferrer 10bfafdd3c Merge branch 'dev' into 6264-renewToken
gitea/salix/pipeline/head This commit looks good Details
2023-12-20 09:05:53 +00:00
Alex Moreno 351a12204a Merge branch 'dev' into 6172_transfer_ticket_message_error
gitea/salix/pipeline/head This commit looks good Details
2023-12-20 08:07:30 +00:00
David Domenech f33e343acb Merge pull request 'refs #6398' (!1896) from 6398-changes into dev
gitea/salix/pipeline/head This commit looks good Details
Reviewed-on: #1896
Reviewed-by: Alex Moreno <alexm@verdnatura.es>
2023-12-20 08:01:09 +00:00
Guillermo Bonet 753c6e9ec5 feat: refs #6582 Added traductions
gitea/salix/pipeline/head This commit looks good Details
2023-12-20 07:28:54 +01:00
Guillermo Bonet 516a3760a1 feat: refs #6582 Added traductions
gitea/salix/pipeline/head This commit looks good Details
2023-12-20 07:27:13 +01:00
David Domenech 5936a129da refs #6398
gitea/salix/pipeline/head This commit looks good Details
2023-12-19 12:58:20 +01:00
David Domenech 86f340248f Merge pull request 'fix: refs #6398 Changed alias of views' (!1895) from 6398-fix into dev
gitea/salix/pipeline/head This commit looks good Details
Reviewed-on: #1895
Reviewed-by: Alex Moreno <alexm@verdnatura.es>
2023-12-19 10:04:56 +00:00
Guillermo Bonet 17e177b788 fix: refs #6398 Fix tests back
gitea/salix/pipeline/head This commit looks good Details
2023-12-19 10:12:03 +01:00
David Domenech d60f2a7f88 fix: refs #6398 Changed alias of views
gitea/salix/pipeline/head There was a failure building this commit Details
2023-12-19 09:43:09 +01:00
Carlos Satorres 6ff7edfada Merge pull request '6220-addressFilter' (!1886) from 6220-addressFilter into dev
gitea/salix/pipeline/head This commit looks good Details
Reviewed-on: #1886
Reviewed-by: Javi Gallego <jgallego@verdnatura.es>
2023-12-18 11:45:09 +00:00
Carlos Satorres e4de704b4c Merge branch 'dev' into 6220-addressFilter
gitea/salix/pipeline/head This commit looks good Details
2023-12-18 11:16:58 +00:00
Javier Segarra 7723b244d0 Merge branch 'dev' into 6172_transfer_ticket_message_error
gitea/salix/pipeline/head This commit looks good Details
2023-12-18 07:17:51 +00:00
Javier Segarra 1810377738 Merge pull request '#2051 - DMS unify methods' (!1888) from 2051_dms_methods_refactor into dev
gitea/salix/pipeline/head This commit looks good Details
Reviewed-on: #1888
Reviewed-by: Javi Gallego <jgallego@verdnatura.es>
2023-12-18 07:14:35 +00:00
Javier Segarra 8d650cf6c0 refs #6172 test: remove message code
gitea/salix/pipeline/head This commit looks good Details
2023-12-18 08:09:44 +01:00
Javier Segarra 1515b55f7d Merge branch 'dev' into 2051_dms_methods_refactor
gitea/salix/pipeline/head This commit looks good Details
2023-12-15 12:06:07 +00:00
Javier Segarra 29a7d9b941 Merge branch '2051_dms_methods_refactor' of https://gitea.verdnatura.es/verdnatura/salix into 2051_dms_methods_refactor
gitea/salix/pipeline/head This commit looks good Details
2023-12-15 13:01:47 +01:00
Javier Segarra dc98436b85 refs #2051 perf: rename variable 2023-12-15 13:01:44 +01:00
Javier Segarra c9af8cba81 refs #5878 feat: remove . for this message
gitea/salix/pipeline/head There was a failure building this commit Details
2023-12-15 12:50:05 +01:00
Alex Moreno d47a4a7c16 Merge branch 'dev' into 6264-renewToken
gitea/salix/pipeline/head There was a failure building this commit Details
2023-12-15 11:12:47 +00:00
Guillermo Bonet e89ec55839 fix: refs #6172
gitea/salix/pipeline/head This commit looks good Details
2023-12-14 15:09:07 +01:00
Carlos Satorres fe184156a1 Merge branch 'dev' into 6220-addressFilter
gitea/salix/pipeline/head This commit looks good Details
2023-12-14 13:51:09 +00:00
Carlos Satorres f73f3813b3 Merge branch '6220-addressFilter' of https://gitea.verdnatura.es/verdnatura/salix into 6220-addressFilter
gitea/salix/pipeline/head This commit looks good Details
2023-12-14 14:37:22 +01:00
Carlos Satorres bbb9f58a9e refs #6220 fix(client_filter): fix where 2023-12-14 14:37:14 +01:00
Javier Segarra 043c411f68 Merge branch 'dev' into 2051_dms_methods_refactor
gitea/salix/pipeline/head This commit looks good Details
2023-12-14 11:41:11 +00:00
Javier Segarra 9316c31180 refs #6264 perf: rename variable when destroy ids
gitea/salix/pipeline/head This commit looks good Details
2023-12-14 12:36:36 +01:00
Javier Segarra 1939c65fab refs #6264 test: remove force describe for dms test 2023-12-14 12:35:54 +01:00
Javier Segarra d0af29c0c5 refs #6264 test: remove force describe for dms test
gitea/salix/pipeline/head This commit looks good Details
2023-12-14 12:28:41 +01:00
Javier Segarra d2461d67c9 refs #6264 test: perf renew-token.spec.js
gitea/salix/pipeline/head This commit looks good Details
2023-12-14 12:25:40 +01:00
Javier Segarra acf192f7e4 Merge branch '6264-renewToken' of https://gitea.verdnatura.es/verdnatura/salix into 6264-renewToken
gitea/salix/pipeline/head There was a failure building this commit Details
2023-12-14 12:21:12 +01:00
Javier Segarra 8d29850917 refs #6264 perf: remove UserError exception 2023-12-14 12:21:07 +01:00
Javier Segarra dddc749744 Merge branch 'dev' into 6264-renewToken
gitea/salix/pipeline/head There was a failure building this commit Details
2023-12-14 11:05:00 +00:00
Javier Segarra 61a323078b refs #6264 fix: remove DEFAULT_COURTESY_TIME
gitea/salix/pipeline/head There was a failure building this commit Details
2023-12-14 12:04:05 +01:00
Alex Moreno d7454cdb19 refs #6576 fix: correct version
gitea/salix/pipeline/head This commit looks good Details
2023-12-14 11:41:59 +01:00
Alex Moreno e7911738c6 Merge branch 'test' of https://gitea.verdnatura.es/verdnatura/salix into dev
gitea/salix/pipeline/head This commit looks good Details
2023-12-14 08:50:20 +01:00
Alex Moreno 157fe6f32f Merge branch 'master' of https://gitea.verdnatura.es/verdnatura/salix into test
gitea/salix/pipeline/head This commit looks good Details
2023-12-14 08:16:58 +01:00
Javier Segarra 397eb4d32b Merge branch 'dev' into 2051_dms_methods_refactor
gitea/salix/pipeline/head There was a failure building this commit Details
2023-12-14 06:22:22 +00:00
Javier Segarra 485968037b Merge branch 'dev' into 6264-renewToken
gitea/salix/pipeline/head This commit looks good Details
2023-12-14 06:22:17 +00:00
Sergio De la torre 0130130cee Merge pull request '6275-silex-to-salix' (!1878) from 6275-silex-to-salix into dev
gitea/salix/pipeline/head This commit looks good Details
Reviewed-on: #1878
Reviewed-by: Javi Gallego <jgallego@verdnatura.es>
2023-12-14 05:52:08 +00:00
Sergio De la torre af83519ee6 Merge branch 'dev' into 6275-silex-to-salix
gitea/salix/pipeline/head This commit looks good Details
2023-12-13 15:12:39 +00:00
Javier Segarra 1e89ed6cdc Merge branch 'dev' into 6264-renewToken
gitea/salix/pipeline/head There was a failure building this commit Details
2023-12-13 14:39:10 +00:00
Javier Segarra 06bae44824 refs #2051 perf: uploadFile after review
gitea/salix/pipeline/head There was a failure building this commit Details
2023-12-13 15:38:46 +01:00
Carlos Satorres 9a5536a3a3 Merge branch 'dev' into 6220-addressFilter
gitea/salix/pipeline/head This commit looks good Details
2023-12-13 14:05:51 +00:00
Carlos Satorres cfa08963fb Merge branch '6220-addressFilter' of https://gitea.verdnatura.es/verdnatura/salix into 6220-addressFilter
gitea/salix/pipeline/head This commit looks good Details
2023-12-13 15:05:43 +01:00
Carlos Satorres 40499e44cf refs #6220 remove concat 2023-12-13 15:05:41 +01:00
Javier Segarra 7b9e3b0985 refs #2051 perf: removeFile after review 2023-12-13 14:24:05 +01:00
Javier Segarra 7bdb1b2078 Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 2051_dms_methods_refactor 2023-12-13 13:49:38 +01:00
Javier Segarra bdf5dd6e3c refs #2051 feat: restore dms methods 2023-12-13 13:48:22 +01:00
Javier Segarra a5ecec9603 refs #2051 feat: remove front methods refactor 2023-12-13 13:47:30 +01:00
Javier Segarra d364a50ec4 refs #6264 feat: remove validateToken endpoint
gitea/salix/pipeline/head There was a failure building this commit Details
2023-12-13 13:39:43 +01:00
David Domenech e7db97a671 Merge pull request 'refactor(renameTable): refs #6125 clientCreditLimit to roleCreditLimit' (!1890) from 6125-roleCreditLimitFix into dev
gitea/salix/pipeline/head This commit looks good Details
Reviewed-on: #1890
Reviewed-by: Javi Gallego <jgallego@verdnatura.es>
2023-12-13 11:46:39 +00:00
David Domenech 9bcd0a3c98 Merge branch 'dev' into 6125-roleCreditLimitFix
gitea/salix/pipeline/head This commit looks good Details
2023-12-13 11:29:46 +00:00
David Domenech fb74ea3b2c Merge pull request 'refactor(ticketTracking.userFk): refs #6398 workerFk to userFk' (!1874) from 6398-ticketTracking-change-workerFk-to-userFk into dev
gitea/salix/pipeline/head This commit looks good Details
Reviewed-on: #1874
Reviewed-by: Alex Moreno <alexm@verdnatura.es>
2023-12-13 11:20:22 +00:00
David Domenech d4fa1e9aca refs #6398
gitea/salix/pipeline/head This commit looks good Details
2023-12-13 12:04:07 +01:00
David Domenech 2f61b648f7 refs #6398
gitea/salix/pipeline/head This commit looks good Details
2023-12-13 09:49:03 +01:00
David Domenech ee6ad55e66 Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 6398-ticketTracking-change-workerFk-to-userFk
gitea/salix/pipeline/head This commit looks good Details
2023-12-13 09:43:20 +01:00
Pablo Natek f63b26b71f Merge branch 'dev' into 6125-roleCreditLimitFix
gitea/salix/pipeline/head There was a failure building this commit Details
2023-12-13 07:52:36 +00:00
Carlos Satorres 371a202230 Merge branch 'dev' into 6220-addressFilter
gitea/salix/pipeline/head This commit looks good Details
2023-12-13 07:51:23 +00:00
Pablo Natek 69dd34665f refactor(renameTable): refs #6125 clientCreditLimit to roleCreditLimit
gitea/salix/pipeline/head This commit looks good Details
2023-12-13 08:50:17 +01:00
Sergio De la torre 435819cf3c refs #6275 feat:Silex_to_Salix test getExpeditionSummary
gitea/salix/pipeline/head There was a failure building this commit Details
2023-12-13 07:24:13 +01:00
Javier Segarra d44cdcbd13 Merge branch 'dev' into 6264-renewToken
gitea/salix/pipeline/head There was a failure building this commit Details
2023-12-13 06:14:55 +00:00
Javier Segarra 8441877f36 refs #6264 perf: remove field's query
gitea/salix/pipeline/head There was a failure building this commit Details
2023-12-12 19:43:32 +01:00
Javier Segarra 0ae75d973f refs #6264 perf: remove async keyword 2023-12-12 19:42:46 +01:00
Sergio De la torre e22201c840 Merge branch 'dev' into 6275-silex-to-salix
gitea/salix/pipeline/head This commit looks good Details
2023-12-12 14:50:25 +00:00
Javier Segarra d206c93305 refs #2051 feat: getAllowedContentTypes approach
gitea/salix/pipeline/head There was a failure building this commit Details
2023-12-12 15:03:00 +01:00
Javier Segarra 6334431d2b refs #2051 feat: uploadFile approach 2023-12-12 14:00:35 +01:00
Javier Segarra 6b70f8b3eb refs #2051 feat: uploadFile approach 2023-12-12 13:49:14 +01:00
Carlos Satorres 16a76f0bbf Merge branch 'dev' into 6220-addressFilter
gitea/salix/pipeline/head This commit looks good Details
2023-12-12 12:21:12 +00:00
Carlos Satorres 78aa25d74f refs #6220 fix testback
gitea/salix/pipeline/head This commit looks good Details
2023-12-12 13:21:08 +01:00
Carlos Satorres 6cefc982e4 refs #6220 add filter address
gitea/salix/pipeline/head There was a failure building this commit Details
2023-12-12 13:14:41 +01:00
Javier Segarra ae76776245 refs #2051 feat: removeFile approach 2023-12-12 12:09:06 +01:00
Carlos Satorres 7e6f311a43 refs #6220 address filter
gitea/salix/pipeline/head There was a failure building this commit Details
2023-12-11 14:51:11 +01:00
Carlos Satorres c81ca94d2e refs #6220 add filter address
gitea/salix/pipeline/head There was a failure building this commit Details
2023-12-11 14:44:33 +01:00
Pablo Natek 350fb7d652 Merge pull request 'feat: refs #6548 add buyer department to salesPerson list in client BasicData' (!1885) from 6548-addBuyerToSalesPersonList into test
gitea/salix/pipeline/head This commit looks good Details
Reviewed-on: #1885
Reviewed-by: Javi Gallego <jgallego@verdnatura.es>
2023-12-11 06:39:33 +00:00
Pablo Natek 5a99408ba7 feat: refs #6548 add buyer department to salesPerson list in client BasicData
gitea/salix/pipeline/head This commit looks good Details
2023-12-11 07:31:57 +01:00
Sergio De la torre 9937fbed5e REFS #6275 feat:Silex_to_Salix
gitea/salix/pipeline/head This commit looks good Details
2023-12-07 11:59:01 +01:00
Sergio De la torre fa65cc84a9 REFS #6275 feat:Silex_to_Salix
gitea/salix/pipeline/head There was a failure building this commit Details
2023-12-07 11:39:22 +01:00
Sergio De la torre 61ed53bd1d REFS #6275 feat:Silex_to_Salix
gitea/salix/pipeline/head This commit looks good Details
2023-12-07 10:37:06 +01:00
Javier Segarra d37083b3a4 Merge pull request 'Merge dev - test' (!1881) from dev into test
gitea/salix/pipeline/head This commit looks good Details
Reviewed-on: #1881
Reviewed-by: Javi Gallego <jgallego@verdnatura.es>
2023-12-07 08:28:24 +00:00
Javier Segarra a5fb07bf12 refs #6264 perf remove unnecessary code
gitea/salix/pipeline/head There was a failure building this commit Details
2023-12-05 13:05:26 +01:00
Sergio De la torre 3692021b12 Merge branch 'dev' into 6275-silex-to-salix
gitea/salix/pipeline/head This commit looks good Details
2023-12-05 07:26:22 +00:00
Sergio De la torre 318f7e3c0d REFS #6275 feat:Silex_to_Salix
gitea/salix/pipeline/head This commit looks good Details
2023-12-05 08:20:55 +01:00
Javier Segarra a8b0a7a5b3 Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 6264-renewToken
gitea/salix/pipeline/head There was a failure building this commit Details
2023-12-04 14:46:21 +01:00
Javier Segarra 5656ed7a2b refs #6264 perf: use functions extracted previously 2023-12-04 14:46:05 +01:00
Javier Segarra b9671c0b67 refs #6264 perf: remove files related to token 2023-12-04 14:44:50 +01:00
Pablo Natek 303b6f5240 fix(expencefk): refs #6398 expenceFk to expenseFk
gitea/salix/pipeline/head This commit looks good Details
2023-12-01 13:48:56 +01:00
Pablo Natek bec1ff71ef Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 6398-ticketTracking-change-workerFk-to-userFk 2023-12-01 13:43:27 +01:00
Pablo Natek 758b468c68 Merge pull request 'test' (!1873) from test into master
gitea/salix/pipeline/head This commit looks good Details
Reviewed-on: #1873
Reviewed-by: Alex Moreno <alexm@verdnatura.es>
2023-12-01 06:11:22 +00:00
David Domenech eb0766bafd Merge branch 'dev' into 6398-ticketTracking-change-workerFk-to-userFk
gitea/salix/pipeline/head There was a failure building this commit Details
2023-11-30 14:08:47 +00:00
David Domenech 8ab981907d refactor(ticketTracking.userFk): refs #6398 workerFk to userFk
gitea/salix/pipeline/head This commit looks good Details
2023-11-30 14:25:00 +01:00
Javier Segarra d4cd23853f refs #6264 perf: try to remove jasmine.clock()
gitea/salix/pipeline/head There was a failure building this commit Details
2023-11-30 07:32:16 +01:00
Javier Segarra 97d7f8356f Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 6264-renewToken 2023-11-30 07:08:23 +01:00
Javier Segarra 9da5fb9a14 refs #6264 other: rename camel-case variable
gitea/salix/pipeline/head There was a failure building this commit Details
2023-11-27 10:24:25 +01:00
Javier Segarra 901a44cc62 Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 6264-renewToken
gitea/salix/pipeline/head There was a failure building this commit Details
2023-11-27 09:48:31 +01:00
Javier Segarra 81be3b18f7 refs #6264 test: validate-token and renew-token 2023-11-27 09:48:15 +01:00
Javier Segarra 72a0932e35 refs #6264 other: rename camel-case variable 2023-11-27 09:46:27 +01:00
Javi Gallego 4071c06b5f feat: refs #6275 getTickets con los campos de silex
gitea/salix/pipeline/head This commit looks good Details
2023-11-24 08:15:39 +01:00
Javi Gallego aa0794e136 Merge branch 'dev' into 6275-silex-to-salix
gitea/salix/pipeline/head This commit looks good Details
2023-11-24 06:31:25 +01:00
Javi Gallego a0a9e299d9 feat: refs #6275 getTickets with phone
gitea/salix/pipeline/head This commit looks good Details
2023-11-22 12:39:21 +01:00
Alex Moreno 7951b874a6 Merge branch 'dev' into 6264-renewToken
gitea/salix/pipeline/head There was a failure building this commit Details
2023-11-20 06:39:50 +00:00
Javi Gallego 3f7663da97 feat: refs #6275 crea back etExpeditionSummary
gitea/salix/pipeline/head This commit looks good Details
2023-11-15 10:09:04 +01:00
Javier Segarra bcccd1894c refs #6264 test: init test
gitea/salix/pipeline/head There was a failure building this commit Details
2023-11-10 13:13:17 +01:00
Javier Segarra 784f5bb7f9 refs #6264 perf: replace now with vnNew
gitea/salix/pipeline/head There was a failure building this commit Details
2023-11-07 23:23:02 +01:00
Javier Segarra 0c2b2b25b7 refs #6264 fix: remove unnecessary file
gitea/salix/pipeline/head This commit looks good Details
2023-11-04 18:07:37 +01:00
Javier Segarra 5601ce5dac refs #6264 fix: rename variable
gitea/salix/pipeline/head This commit looks good Details
2023-11-04 17:25:30 +01:00
Javier Segarra 43366d1ba8 refs #6264 feat: update fixture.sql 2023-11-04 17:24:04 +01:00
Javier Segarra 21028e3b79 refs #6264 feat: db changes 2023-11-04 17:23:44 +01:00
Javier Segarra 67faf076d2 refs '#6264' feat: memoization accessTokenConfig 2023-11-04 16:51:25 +01:00
Javier Segarra b02e1f000e handle expired token while exists in BD
gitea/salix/pipeline/head This commit looks good Details
2023-11-04 14:39:59 +01:00
Javier Segarra 8c6eab23e5 handle expired token and return new token 2023-11-04 14:39:26 +01:00
Javier Segarra 82ee4f6e5b remove auth:before middleware 2023-11-04 14:38:21 +01:00
Javier Segarra 38d1e2b14f renew-token middleware definition 2023-11-03 16:11:35 +01:00
Javier Segarra 98f237b4bd new middleware for auth:before 2023-11-03 16:10:46 +01:00
63 changed files with 1656 additions and 280 deletions

View File

@ -11,6 +11,9 @@
"[javascript]": {
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
},
"[json]": {
"editor.defaultFormatter": "vscode.json-language-features"
},
"cSpell.words": [
"salix",
"fdescribe",

View File

@ -5,7 +5,13 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [2352.01] - 2023-12-28
## [2402.01] - 2024-01-11
### Added
### Changed
### Fixed
## [2400.01] - 2024-01-04
### Added
### Changed
@ -13,9 +19,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [2350.01] - 2023-12-14
### Added
### Changed
### Fixed
### Características Añadidas 🆕
- **Tickets → Expediciones:** Añadido soporte para Viaexpress
## [2348.01] - 2023-11-30

View File

@ -22,8 +22,8 @@ module.exports = Self => {
Self.removeFile = async(ctx, id, options) => {
const models = Self.app.models;
let tx;
const myOptions = {};
let tx;
if (typeof options == 'object')
Object.assign(myOptions, options);

View File

@ -1,5 +1,14 @@
const UserError = require('vn-loopback/util/user-error');
const {models} = require('vn-loopback/server/server');
const handlePromiseLogout = (Self, {id}, courtesyTime) => {
new Promise(res => {
setTimeout(() => {
res(Self.logout(id));
}
, courtesyTime * 1000);
});
};
module.exports = Self => {
Self.remoteMethodCtx('renewToken', {
description: 'Checks if the token has more than renewPeriod seconds to live and if so, renews it',
@ -16,23 +25,32 @@ module.exports = Self => {
});
Self.renewToken = async function(ctx) {
const models = Self.app.models;
const token = ctx.req.accessToken;
const {accessToken: token} = ctx.req;
const now = new Date();
const differenceMilliseconds = now - token.created;
const differenceSeconds = Math.floor(differenceMilliseconds / 1000);
// Check if current token is valid
const isValid = await validateToken(token);
if (isValid)
return token;
const fields = ['renewPeriod', 'courtesyTime'];
const accessTokenConfig = await models.AccessTokenConfig.findOne({fields});
const {courtesyTime} = await models.AccessTokenConfig.findOne({fields: ['courtesyTime']});
if (differenceSeconds < accessTokenConfig.renewPeriod - accessTokenConfig.courtesyTime)
throw new UserError(`The renew period has not been exceeded`, 'periodNotExceeded');
// Schedule to remove current token
handlePromiseLogout(Self, token, courtesyTime);
await Self.logout(token.id);
// Create new accessToken
const user = await Self.findById(token.userId);
const accessToken = await user.createAccessToken();
return {id: accessToken.id, ttl: accessToken.ttl};
};
async function validateToken(token) {
const accessTokenConfig = await models.AccessTokenConfig.findOne({fields: ['renewPeriod', 'courtesyTime']});
const now = Date.now();
const differenceMilliseconds = now - token.created;
const differenceSeconds = Math.floor(differenceMilliseconds / 1000);
const isValid = differenceSeconds < accessTokenConfig.renewPeriod - accessTokenConfig.courtesyTime;
return isValid;
}
};

View File

@ -0,0 +1,49 @@
const {models} = require('vn-loopback/server/server');
describe('Renew Token', () => {
const startingTime = Date.now();
let ctx = null;
beforeAll(async() => {
const unAuthCtx = {
req: {
headers: {},
connection: {
remoteAddress: '127.0.0.1'
},
getLocale: () => 'en'
},
args: {}
};
let login = await models.VnUser.signIn(unAuthCtx, 'salesAssistant', 'nightmare');
let accessToken = await models.AccessToken.findById(login.token);
ctx = {req: {accessToken: accessToken}};
});
beforeEach(() => {
jasmine.clock().install();
jasmine.clock().mockDate(new Date(startingTime));
});
afterEach(() => {
jasmine.clock().uninstall();
});
it('should renew process', async() => {
jasmine.clock().mockDate(new Date(startingTime + 21600000));
const {id} = await models.VnUser.renewToken(ctx);
expect(id).not.toEqual(ctx.req.accessToken.id);
});
it('NOT should renew', async() => {
let error;
let response;
try {
response = await models.VnUser.renewToken(ctx);
} catch (e) {
error = e;
}
expect(error).toBeUndefined();
expect(response.id).toEqual(ctx.req.accessToken.id);
});
});

View File

@ -1,17 +0,0 @@
module.exports = Self => {
Self.remoteMethod('validateToken', {
description: 'Validates the current logged user token',
returns: {
type: 'Boolean',
root: true
},
http: {
path: `/validateToken`,
verb: 'GET'
}
});
Self.validateToken = async function() {
return true;
};
};

View File

@ -10,7 +10,6 @@ module.exports = function(Self) {
require('../methods/vn-user/sign-in')(Self);
require('../methods/vn-user/acl')(Self);
require('../methods/vn-user/recover-password')(Self);
require('../methods/vn-user/validate-token')(Self);
require('../methods/vn-user/privileges')(Self);
require('../methods/vn-user/validate-auth')(Self);
require('../methods/vn-user/renew-token')(Self);

View File

@ -107,13 +107,6 @@
"permission": "ALLOW"
},
{
"property": "validateToken",
"accessType": "EXECUTE",
"principalType": "ROLE",
"principalId": "$authenticated",
"permission": "ALLOW"
},
{
"property": "validateAuth",
"accessType": "EXECUTE",
"principalType": "ROLE",

View File

@ -0,0 +1,4 @@
-- Auto-generated SQL script #202311061003
UPDATE salix.accessTokenConfig
SET courtesyTime=60
WHERE id=1;

View File

@ -0,0 +1,46 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`delivery_beforeInsert`
BEFORE INSERT ON `delivery`
FOR EACH ROW
BEGIN
IF (NEW.longitude IS NOT NULL AND NEW.latitude IS NOT NULL AND NEW.ticketFK IS NOT NULL)
THEN
UPDATE address
SET longitude = NEW.longitude,
latitude = NEW.latitude
WHERE id IN (
SELECT addressFK
FROM ticket
WHERE id = NEW.ticketFk
);
END IF;
END$$
DELIMITER ;
DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`delivery_beforeUpdate`
BEFORE UPDATE ON `delivery`
FOR EACH ROW
BEGIN
IF (NEW.longitude IS NOT NULL AND NEW.latitude IS NOT NULL AND NEW.ticketFK IS NOT NULL)
THEN
UPDATE address
SET longitude = NEW.longitude,
latitude = NEW.latitude
WHERE id IN (
SELECT addressFK
FROM ticket
WHERE id = NEW.ticketFk
);
END IF;
END$$
DELIMITER ;
ALTER TABLE `vn`.`address` MODIFY COLUMN longitude decimal(11,7) DEFAULT NULL NULL COMMENT 'Indica la última longitud proporcionada por tabla delivery';
ALTER TABLE `vn`.`address` MODIFY COLUMN latitude decimal(11,7) DEFAULT NULL NULL COMMENT 'Indica la última latitud proporcionada por tabla delivery';

View File

@ -0,0 +1 @@
ALTER TABLE `vn`.`ticketTracking` CHANGE `workerFk` `userFk` int(10) unsigned DEFAULT NULL NULL;

View File

@ -0,0 +1,4 @@
RENAME TABLE `vn`.`clientCreditLimit` TO `vn`.`roleCreditLimit`;
ALTER TABLE `vn`.`roleCreditLimit` DROP FOREIGN KEY `clientCreditLimit_FK`;
ALTER TABLE `vn`.`roleCreditLimit` ADD CONSTRAINT `roleCreditLimit_FK` FOREIGN KEY (`roleFk`) REFERENCES `account`.`role`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,56 @@
CREATE SCHEMA IF NOT EXISTS `vn2008`;
USE `vn`;
CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `ticketState`
AS SELECT `tt`.`created` AS `updated`,
`tt`.`stateFk` AS `stateFk`,
`tt`.`userFk` AS `workerFk`,
`tls`.`ticketFk` AS `ticketFk`,
`s`.`id` AS `state`,
`s`.`order` AS `productionOrder`,
`s`.`alertLevel` AS `alertLevel`,
`s`.`code` AS `code`,
`tls`.`ticketFk` AS `ticket`,
`tt`.`userFk` AS `worker`,
`s`.`isPreviousPreparable` AS `isPreviousPreparable`,
`s`.`isPicked` AS `isPicked`
FROM (
(
`ticketLastState` `tls`
JOIN `ticketTracking` `tt` ON(`tt`.`id` = `tls`.`ticketTrackingFk`)
)
JOIN `state` `s` ON(`s`.`id` = `tt`.`stateFk`)
);
CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `vn2008`.`v_inter`
AS SELECT `tt`.`id` AS `inter_id`,
`tt`.`stateFk` AS `state_id`,
`tt`.`notes` AS `nota`,
`tt`.`created` AS `odbc_date`,
`tt`.`ticketFk` AS `Id_Ticket`,
`tt`.`userFk` AS `Id_Trabajador`,
`tt`.`supervisorFk` AS `Id_supervisor`
FROM `vn`.`ticketTracking` `tt`;
CREATE OR REPLACE DEFINER=`root`@`localhost`
SQL SECURITY DEFINER
VIEW `ticketStateToday`
AS SELECT
`ts`.`ticket` AS `ticket`,
`ts`.`state` AS `state`,
`ts`.`productionOrder` AS `productionOrder`,
`ts`.`alertLevel` AS `alertLevel`,
`ts`.`worker` AS `worker`,
`ts`.`code` AS `code`,
`ts`.`updated` AS `updated`,
`ts`.`isPicked` AS `isPicked`
FROM
(`ticketState` `ts`
JOIN `ticket` `t` ON
(`t`.`id` = `ts`.`ticket`))
WHERE
`t`.`shipped` BETWEEN `util`.`VN_CURDATE`() AND `MIDNIGHT`(`util`.`VN_CURDATE`());

View File

@ -493,7 +493,7 @@ INSERT INTO `vn`.`clientCredit`(`clientFk`, `workerFk`, `amount`, `created`)
(1104, 9, 90 , util.VN_CURDATE()),
(1105, 9, 90 , util.VN_CURDATE());
INSERT INTO `vn`.`clientCreditLimit`(`id`, `maxAmount`, `roleFk`)
INSERT INTO `vn`.`roleCreditLimit`(`id`, `maxAmount`, `roleFk`)
VALUES
(1, 9999999, 20),
(2, 10000, 21),
@ -771,7 +771,7 @@ INSERT INTO `vn`.`ticketObservation`(`id`, `ticketFk`, `observationTypeFk`, `des
-- 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`)
INSERT INTO `vn`.`ticketTracking`(`ticketFk`, `stateFk`, `userFk`, `created`)
VALUES
(1, 16, 5 , DATE_ADD(util.VN_NOW(), INTERVAL -1 MONTH)),
(2, 16, 5 , DATE_ADD(util.VN_NOW(), INTERVAL -1 MONTH)),
@ -815,6 +815,7 @@ INSERT INTO `vn`.`config`(`id`, `mdbServer`, `fakeEmail`, `defaultersMaxAmount`,
VALUES
(1, 'beta-server', 'nightmare@mydomain.com', '200', DATE_ADD(util.VN_CURDATE(),INTERVAL -1 MONTH));
INSERT INTO `vn`.`greugeType`(`id`, `name`, `code`)
VALUES
(1, 'Diff', 'diff'),
@ -2966,9 +2967,9 @@ INSERT INTO `vn`.`wagonTypeTray` (`id`, `typeFk`, `height`, `colorFk`)
(2, 1, 50, 2),
(3, 1, 0, 3);
INSERT INTO `salix`.`accessTokenConfig` (`id`, `renewPeriod`, `renewInterval`)
INSERT INTO `salix`.`accessTokenConfig` (`id`, `renewPeriod`, `courtesyTime`, `renewInterval`)
VALUES
(1, 21600, 300);
(1, 21600, 60, 300);
INSERT INTO `vn`.`travelConfig` (`id`, `warehouseInFk`, `warehouseOutFk`, `agencyFk`, `companyFk`)
VALUES

View File

@ -26391,6 +26391,7 @@ CREATE TABLE `cplusCorrectingType` (
) ENGINE=InnoDBDEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `cplusRectificationType`
--

View File

@ -26,7 +26,7 @@ describe('Route create path', () => {
await page.waitToClick(selectors.createRouteView.submitButton);
const message = await page.waitForSnackbar();
expect(message.text).toContain('Access denied');
expect(message.text).toContain('Access Denied');
});
});

View File

@ -3,4 +3,4 @@ Could not contact the server: Could not contact the server, make sure you have a
Please enter your username: Please enter your username
It seems that the server has fall down: It seems that the server has fall down, wait a few minutes and try again
Session has expired: Your session has expired, please login again
Access denied: Access denied
Access Denied: Access Denied

View File

@ -3,5 +3,5 @@ Could not contact the server: No se ha podido contactar con el servidor, asegura
Please enter your username: Por favor introduce tu nombre de usuario
It seems that the server has fall down: Parece que el servidor se ha caído, espera unos minutos e inténtalo de nuevo
Session has expired: Tu sesión ha expirado, por favor vuelve a iniciar sesión
Access denied: Acción no permitida
Access Denied: Acción no permitida
Direction not found: Dirección no encontrada

View File

@ -82,7 +82,7 @@ export default class Token {
if (!data) return;
this.renewPeriod = data.renewPeriod;
this.stopRenewer();
this.inservalId = setInterval(() => this.checkValidity(), data.renewInterval * 1000);
this.intervalId = setInterval(() => this.checkValidity(), data.renewInterval * 1000);
});
}
@ -103,17 +103,13 @@ export default class Token {
const token = res.data;
this.set(token.id, now, token.ttl, this.remember);
})
.catch(res => {
if (res.data?.error?.code !== 'periodNotExceeded')
throw res;
})
.finally(() => {
this.checking = false;
});
}
stopRenewer() {
clearInterval(this.inservalId);
clearInterval(this.intervalId);
}
}
Token.$inject = ['vnInterceptor', '$http', '$rootScope'];

View File

@ -18,7 +18,7 @@ Show summary: Mostrar vista previa
What is new: Novedades de la versión
Settings: Ajustes
There is a new version, click here to reload: Hay una nueva versión, pulse aquí para recargar
This ticket is locked.: Este ticket está bloqueado
This ticket is locked: Este ticket está bloqueado
# Actions

View File

@ -120,7 +120,7 @@ function $exceptionHandler(vnApp, $window, $state, $injector) {
messageT = 'Invalid login';
break;
case 403:
messageT = exception.data?.error?.message || 'Access denied';
messageT = exception.data?.error?.message || 'Access Denied';
break;
case 502:
messageT = 'It seems that the server has fall down';

View File

@ -183,7 +183,7 @@
"Social name should be uppercase": "Social name should be uppercase",
"Street should be uppercase": "Street should be uppercase",
"You don't have enough privileges.": "You don't have enough privileges.",
"This ticket is locked.": "This ticket is locked.",
"This ticket is locked": "This ticket is locked",
"This ticket is not editable.": "This ticket is not editable.",
"The ticket doesn't exist.": "The ticket doesn't exist.",
"The sales do not exists": "The sales do not exists",
@ -201,4 +201,4 @@
"keepPrice": "keepPrice",
"Cannot past travels with entries": "Cannot past travels with entries",
"It was not able to remove the next expeditions:": "It was not able to remove the next expeditions: {{expeditions}}"
}
}

View File

@ -312,7 +312,7 @@
"You cannot assign/remove an alias that you are not assigned to": "No puede asignar/eliminar un alias que no tenga asignado",
"This invoice has a linked vehicle.": "Esta factura tiene un vehiculo vinculado",
"You don't have enough privileges.": "No tienes suficientes permisos.",
"This ticket is locked.": "Este ticket está bloqueado.",
"This ticket is locked": "Este ticket está bloqueado.",
"This ticket is not editable.": "Este ticket no es editable.",
"The ticket doesn't exist.": "No existe el ticket.",
"Social name should be uppercase": "La razón social debe ir en mayúscula",
@ -330,4 +330,4 @@
"quantityLessThanMin": "La cantidad no puede ser menor que la cantidad mínima",
"Cannot past travels with entries": "No se pueden pasar envíos con entradas",
"It was not able to remove the next expeditions:": "No se pudo eliminar las siguientes expediciones: {{expeditions}}"
}
}

View File

@ -1,6 +1,5 @@
module.exports = () => {
Date.vnUTC = () => {
const env = process.env.NODE_ENV;
Date.vnUTC = (env = process.env.NODE_ENV) => {
if (!env || env === 'development')
return new Date(Date.UTC(2001, 0, 1, 11));

View File

@ -39,7 +39,7 @@
"./middleware/salix-version": {}
},
"parse": {
"body-parser#json":{}
"body-parser#json":{}
},
"routes": {
"loopback#rest": {

View File

@ -2,7 +2,7 @@ const {models} = require('vn-loopback/server/server');
describe('account changePassword()', () => {
const userId = 70;
const unauthCtx = {
const unAuthCtx = {
req: {
headers: {},
connection: {
@ -79,7 +79,7 @@ describe('account changePassword()', () => {
passExpired: yesterday
}
, options);
await models.VnUser.signIn(unauthCtx, 'trainee', 'nightmare', options);
await models.VnUser.signIn(unAuthCtx, 'trainee', 'nightmare', options);
} catch (e) {
if (e.message != 'Pass expired')
throw e;

View File

@ -123,7 +123,7 @@ module.exports = Self => {
await models.TicketTracking.create({
ticketFk: newRefundTicket.id,
stateFk: state.id,
workerFk: worker.id
userFk: worker.id
}, myOptions);
const salesToRefund = await models.ClaimBeginning.find(salesFilter, myOptions);

View File

@ -1,3 +1,5 @@
const UserError = require('vn-loopback/util/user-error');
module.exports = Self => {
Self.remoteMethodCtx('removeFile', {
description: 'Removes a claim document',
@ -19,8 +21,8 @@ module.exports = Self => {
});
Self.removeFile = async(ctx, id, options) => {
let tx;
const myOptions = {};
let tx;
if (typeof options == 'object')
Object.assign(myOptions, options);
@ -31,19 +33,18 @@ module.exports = Self => {
}
try {
const models = Self.app.models;
const targetClaimDms = await models.ClaimDms.findById(id, null, myOptions);
const targetDms = await models.Dms.findById(targetClaimDms.dmsFk, null, myOptions);
const trashDmsType = await models.DmsType.findOne({where: {code: 'trash'}}, myOptions);
const claimDms = await Self.findById(id, null, myOptions);
await models.Dms.removeFile(ctx, targetClaimDms.dmsFk, myOptions);
await targetClaimDms.destroy(myOptions);
const targetDms = await Self.app.models.Dms.removeFile(ctx, claimDms.dmsFk, myOptions);
await targetDms.updateAttribute('dmsTypeFk', trashDmsType.id, myOptions);
if (!targetDms || ! claimDms)
throw new UserError('Try again');
const claimDmsDestroyed = await claimDms.destroy(myOptions);
if (tx) await tx.commit();
return targetDms;
return claimDmsDestroyed;
} catch (e) {
if (tx) await tx.rollback();
throw e;

View File

@ -1,6 +1,3 @@
const UserError = require('vn-loopback/util/user-error');
const fs = require('fs-extra');
const path = require('path');
module.exports = Self => {
Self.remoteMethodCtx('uploadFile', {
@ -57,96 +54,33 @@ module.exports = Self => {
});
Self.uploadFile = async(ctx, id, options) => {
const tx = await Self.beginTransaction({});
const {Dms, ClaimDms} = Self.app.models;
const myOptions = {};
let tx;
if (typeof options == 'object')
Object.assign(myOptions, options);
if (!myOptions.transaction)
if (!myOptions.transaction) {
tx = await Self.beginTransaction({});
myOptions.transaction = tx;
}
const models = Self.app.models;
const promises = [];
const TempContainer = models.TempContainer;
const ClaimContainer = models.ClaimContainer;
const fileOptions = {};
const args = ctx.args;
let srcFile;
try {
const hasWriteRole = await models.DmsType.hasWriteRole(ctx, args.dmsTypeId, myOptions);
if (!hasWriteRole)
throw new UserError(`You don't have enough privileges`);
const uploadedFiles = await Dms.uploadFile(ctx, myOptions);
// Upload file to temporary path
const tempContainer = await TempContainer.container('dms');
const uploaded = await TempContainer.upload(tempContainer.name, ctx.req, ctx.result, fileOptions);
const files = Object.values(uploaded.files).map(file => {
return file[0];
});
const addedDms = [];
for (const uploadedFile of files) {
const newDms = await createDms(ctx, uploadedFile, myOptions);
const pathHash = ClaimContainer.getHash(newDms.id);
const file = await TempContainer.getFile(tempContainer.name, uploadedFile.name);
srcFile = path.join(file.client.root, file.container, file.name);
const claimContainer = await ClaimContainer.container(pathHash);
const dstFile = path.join(claimContainer.client.root, pathHash, newDms.file);
await fs.move(srcFile, dstFile, {
overwrite: true
});
addedDms.push(newDms);
}
addedDms.forEach(dms => {
const newClaimDms = models.ClaimDms.create({
claimFk: id,
dmsFk: dms.id
}, myOptions);
promises.push(newClaimDms);
});
const resolvedPromises = await Promise.all(promises);
const promises = uploadedFiles.map(dms => ClaimDms.create({
claimFk: id,
dmsFk: dms.id
}, myOptions));
await Promise.all(promises);
if (tx) await tx.commit();
return resolvedPromises;
return uploadedFiles;
} catch (e) {
if (tx) await tx.rollback();
if (fs.existsSync(srcFile))
await fs.unlink(srcFile);
throw e;
}
};
async function createDms(ctx, file, myOptions) {
const models = Self.app.models;
const myUserId = ctx.req.accessToken.userId;
const args = ctx.args;
const newDms = await models.Dms.create({
workerFk: myUserId,
dmsTypeFk: args.dmsTypeId,
companyFk: args.companyId,
warehouseFk: args.warehouseId,
reference: args.reference,
description: args.description,
contentType: file.type,
hasFile: args.hasFile
}, myOptions);
let fileName = file.name;
const extension = models.DmsContainer.getFileExtension(fileName);
fileName = `${newDms.id}.${extension}`;
return newDms.updateAttribute('file', fileName, myOptions);
}
};

View File

@ -19,9 +19,8 @@ module.exports = Self => {
});
Self.removeFile = async(ctx, id, options) => {
const models = Self.app.models;
let tx;
const myOptions = {};
let tx;
if (typeof options == 'object')
Object.assign(myOptions, options);
@ -34,13 +33,16 @@ module.exports = Self => {
try {
const clientDms = await Self.findById(id, null, myOptions);
await models.Dms.removeFile(ctx, clientDms.dmsFk, myOptions);
const targetDms = await Self.app.models.Dms.removeFile(ctx, clientDms.dmsFk, myOptions);
const destroyedClient = await clientDms.destroy(myOptions);
if (!targetDms || !clientDms)
throw new UserError('Try again');
const clientDmsDestroyed = await clientDms.destroy(myOptions);
if (tx) await tx.commit();
return destroyedClient;
return clientDmsDestroyed;
} catch (e) {
if (tx) await tx.rollback();
throw e;

View File

@ -107,17 +107,29 @@ module.exports = Self => {
return {or: [
{'c.phone': {like: `%${value}%`}},
{'c.mobile': {like: `%${value}%`}},
{'a.phone': {like: `%${value}%`}},
]};
case 'zoneFk':
param = 'a.postalCode';
return {[param]: {inq: postalCode}};
return {'a.postalCode': {inq: postalCode}};
case 'city':
return {or: [
{'c.city': {like: `%${value}%`}},
{'a.city': {like: `%${value}%`}}
]};
case 'postcode':
return {or: [
{'c.postcode': value},
{'a.postalCode': value}
]};
case 'provinceFk':
return {or: [
{'p.id': value},
{'a.provinceFk': value}
]};
case 'name':
case 'salesPersonFk':
case 'fi':
case 'socialName':
case 'city':
case 'postcode':
case 'provinceFk':
case 'email':
param = `c.${param}`;
return {[param]: {like: `%${value}%`}};
@ -134,24 +146,29 @@ module.exports = Self => {
c.fi,
c.socialName,
c.phone,
a.phone,
c.mobile,
c.city,
a.city,
c.postcode,
a.postalCode,
c.email,
c.isActive,
c.isFreezed,
p.id AS provinceFk,
p.id AS provinceClientFk,
a.provinceFk AS provinceAddressFk,
p.name AS province,
u.id AS salesPersonFk,
u.name AS salesPerson
FROM client c
LEFT JOIN account.user u ON u.id = c.salesPersonFk
LEFT JOIN province p ON p.id = c.provinceFk
JOIN vn.address a ON a.clientFk = c.id
JOIN address a ON a.clientFk = c.id
`
);
stmt.merge(conn.makeWhere(filter.where));
stmt.merge('GROUP BY c.id');
stmt.merge(conn.makePagination(filter));
const clientsIndex = stmts.push(stmt) - 1;

View File

@ -55,9 +55,9 @@ module.exports = Self => {
});
Self.uploadFile = async(ctx, id, options) => {
const models = Self.app.models;
let tx;
const {Dms, ClientDms} = Self.app.models;
const myOptions = {};
let tx;
if (typeof options == 'object')
Object.assign(myOptions, options);
@ -67,23 +67,20 @@ module.exports = Self => {
myOptions.transaction = tx;
}
const promises = [];
try {
const uploadedFiles = await models.Dms.uploadFile(ctx, myOptions);
uploadedFiles.forEach(dms => {
const newClientDms = models.ClientDms.create({
const uploadedFiles = await Dms.uploadFile(ctx, myOptions);
const promises = uploadedFiles.map(dms =>
ClientDms.create({
clientFk: id,
dmsFk: dms.id
}, myOptions);
}, myOptions)
promises.push(newClientDms);
});
const resolvedPromises = await Promise.all(promises);
);
await Promise.all(promises);
if (tx) await tx.commit();
return resolvedPromises;
return uploadedFiles;
} catch (e) {
if (tx) await tx.rollback();
throw e;

View File

@ -29,7 +29,7 @@
"ClientCredit": {
"dataSource": "vn"
},
"ClientCreditLimit": {
"RoleCreditLimit": {
"dataSource": "vn"
},
"ClientConsumptionQueue": {

View File

@ -463,7 +463,7 @@ module.exports = Self => {
throw new UserError(`You can't change the credit set to zero from a financialBoss`);
}
const creditLimits = await models.ClientCreditLimit.find({
const creditLimits = await models.RoleCreditLimit.find({
fields: ['roleFk'],
where: {
maxAmount: {gte: changes.credit}

View File

@ -1,9 +1,9 @@
{
"name": "ClientCreditLimit",
"name": "RoleCreditLimit",
"base": "VnModel",
"options": {
"mysql": {
"table": "clientCreditLimit"
"table": "roleCreditLimit"
}
},
"properties": {

View File

@ -62,7 +62,7 @@
<vn-worker-autocomplete
vn-one
ng-model="$ctrl.client.salesPersonFk"
departments="['VT']"
departments="['VT', 'shopping']"
show-field="nickname"
label="Salesperson"
vn-acl="salesAssistant">

View File

@ -17,3 +17,18 @@ columns:
agencyModeFk: agency
routeFk: route
zoneFk: zone
name: name
beachFk: beach
ticketPacked: tickets packed
ticketFree: tickets free
ticketProduction: tickets production
packages: packages
note: note
dated: dated
dockFk: dock
priority: priority
etd: etd
expeditionTruckFk: truck
m3boxes: m3 boxes
bufferFk: buffer
isPickingAllowed: is picking allowed

View File

@ -17,3 +17,18 @@ columns:
agencyModeFk: agencia
routeFk: ruta
zoneFk: zona
name: nombre
beachFk: playa
ticketPacked: tickets encajados
ticketFree: tickets libres
ticketProduction: tickets producción
packages: paquetes
note: nota
dated: fecha
dockFk: muelle
priority: prioridad
etd: etd
expeditionTruckFk: camión
m3boxes: m3 cajas
bufferFk: buffer
isPickingAllowed: está permitido recoger

View File

@ -0,0 +1,64 @@
module.exports = Self => {
Self.remoteMethod('getExpeditionSummary', {
description: 'Get summary of expeditions for a given route',
accepts: [
{
arg: 'routeFk',
type: 'number',
required: true,
description: 'Foreign key for Route'
}
],
returns: {
type: 'object',
root: true
},
http: {
path: '/getExpeditionSummary',
verb: 'get'
}
});
Self.getExpeditionSummary = async(routeFk, options) => {
const myOptions = {};
if (typeof options == 'object')
Object.assign(myOptions, options);
const query = `
SELECT routeFk,
addressFk,
SUM(total) total,
SUM(delivery) delivery,
SUM(lost) lost,
SUM(delivered) delivered,
GROUP_CONCAT(totalPacking ORDER BY total DESC SEPARATOR ' ') itemPackingType
FROM (
SELECT r.id AS routeFk,
t.addressFk,
CONCAT (IFNULL(e.itemPackingTypeFk,'-'), '', COUNT(*)) totalPacking,
COUNT(*) total,
SUM(est.code = 'ON DELIVERY') delivery,
SUM(est.code = 'LOST') lost,
SUM(est.code = 'DELIVERED') delivered,
t.priority
FROM vn.ticket t
JOIN vn.route r ON r.id = t.routeFk
JOIN vn.expedition e ON e.ticketFk = t.id
LEFT JOIN vn.expeditionStateType est ON est.id = e.stateTypeFk
JOIN vn.agencyMode am ON am.id = r.agencyModeFk
JOIN vn.agency ag ON ag.id = am.agencyFk
LEFT JOIN vn.userConfig uc ON uc.userFk = account.myUser_getId()
WHERE (r.created = util.VN_CURDATE() OR r.created = util.yesterday())
AND t.routeFk = ?
GROUP BY t.addressFk, e.itemPackingTypeFk
) sub
GROUP BY addressFk
ORDER BY priority DESC
`;
const results = await Self.rawSql(query, [routeFk], myOptions);
return results;
};
};

View File

@ -3,7 +3,7 @@ const ParameterizedSQL = require('loopback-connector').ParameterizedSQL;
module.exports = Self => {
Self.remoteMethod('getTickets', {
description: 'Return the tickets information displayed on the route module',
description: 'Find all instances of the model matched by filter from the data source.',
accessType: 'READ',
accepts: [
{
@ -40,22 +40,32 @@ module.exports = Self => {
t.clientFk,
t.priority,
t.addressFk,
st.code AS ticketStateCode,
st.name AS ticketStateName,
wh.name AS warehouseName,
tob.description AS ticketObservation,
st.code ticketStateCode,
st.name ticketStateName,
wh.name warehouseName,
tob.description ticketObservation,
a.street,
a.postalCode,
a.city,
am.name AS agencyModeName,
u.nickname AS userNickname,
vn.ticketTotalVolume(t.id) AS volume,
am.name agencyModeName,
u.nickname userNickname,
vn.ticketTotalVolume(t.id) volume,
tob.description,
GROUP_CONCAT(DISTINCT i.itemPackingTypeFk ORDER BY i.itemPackingTypeFk) ipt
GROUP_CONCAT(DISTINCT i.itemPackingTypeFk ORDER BY i.itemPackingTypeFk) ipt,
c.phone clientPhone,
c.mobile clientMobile,
a.phone addressPhone,
a.mobile addressMobile,
a.longitude,
a.latitude,
wm.mediaValue salePersonPhone,
t.cmrFk,
t.isSigned signed
FROM vn.route r
JOIN ticket t ON t.routeFk = r.id
JOIN vn.sale s ON s.ticketFk = t.id
JOIN vn.item i ON i.id = s.itemFk
JOIN client c ON t.clientFk = c.id
LEFT JOIN vn.sale s ON s.ticketFk = t.id
LEFT JOIN vn.item i ON i.id = s.itemFk
LEFT JOIN ticketState ts ON ts.ticketFk = t.id
LEFT JOIN state st ON st.id = ts.stateFk
LEFT JOIN warehouse wh ON wh.id = t.warehouseFk
@ -65,7 +75,8 @@ module.exports = Self => {
LEFT JOIN address a ON a.id = t.addressFk
LEFT JOIN agencyMode am ON am.id = t.agencyModeFk
LEFT JOIN account.user u ON u.id = r.workerFk
LEFT JOIN vehicle v ON v.id = r.vehicleFk`
LEFT JOIN vehicle v ON v.id = r.vehicleFk
LEFT JOIN workerMedia wm ON wm.workerFk = c.salesPersonFk`
);
if (!filter.where) filter.where = {};

View File

@ -0,0 +1,10 @@
const app = require('vn-loopback/server/server');
describe('route getExpeditionSummary()', () => {
const routeId = 1;
it('should return a summary of expeditions for a route', async() => {
const result = await app.models.Route.getExpeditionSummary(routeId);
expect(result.every(route => route.id = routeId)).toBeTruthy();
});
});

View File

@ -17,6 +17,7 @@ module.exports = Self => {
require('../methods/route/cmr')(Self);
require('../methods/route/getExternalCmrs')(Self);
require('../methods/route/downloadCmrsZip')(Self);
require('../methods/route/getExpeditionSummary')(Self);
require('../methods/route/getByWorker')(Self);
Self.validate('kmStart', validateDistance, {

View File

@ -19,7 +19,6 @@ module.exports = Self => {
});
Self.removeFile = async(ctx, id, options) => {
const models = Self.app.models;
const myOptions = {};
let tx;
@ -32,18 +31,18 @@ module.exports = Self => {
}
try {
const targetTicketDms = await models.TicketDms.findById(id, null, myOptions);
const targetDms = await models.Dms.findById(targetTicketDms.dmsFk, null, myOptions);
const trashDmsType = await models.DmsType.findOne({where: {code: 'trash'}}, myOptions);
const ticketDms = await Self.findById(id, null, myOptions);
await models.Dms.removeFile(ctx, targetTicketDms.dmsFk, myOptions);
await targetTicketDms.destroy(myOptions);
const targetDms = await Self.app.models.Dms.removeFile(ctx, ticketDms.dmsFk, myOptions);
await targetDms.updateAttribute('dmsTypeFk', trashDmsType.id, myOptions);
if (!targetDms || !ticketDms)
throw new UserError('Try again');
const ticketDmsDestroyed = await ticketDms.destroy(myOptions);
if (tx) await tx.commit();
return targetDms;
return ticketDmsDestroyed;
} catch (e) {
if (tx) await tx.rollback();
throw e;

View File

@ -41,7 +41,7 @@ module.exports = Self => {
throw new ForbiddenError(`This ticket is not editable.`);
if (isLocked && !isWeekly)
throw new ForbiddenError(`This ticket is locked.`);
throw new ForbiddenError(`This ticket is locked`);
if (isWeekly && !canEditWeeklyTicket)
throw new ForbiddenError(`You don't have enough privileges.`);

View File

@ -89,6 +89,6 @@ describe('ticket addSale()', () => {
error = e;
}
expect(error.message).toEqual(`This ticket is locked.`);
expect(error.message).toEqual(`This ticket is locked`);
});
});

View File

@ -40,7 +40,7 @@ describe('ticket isEditableOrThrow()', () => {
expect(error.message).toEqual(`This ticket is not editable.`);
});
it('should throw an error as this ticket is locked.', async() => {
it('should throw an error as This ticket is locked', async() => {
const tx = await models.Ticket.beginTransaction({});
let error;
try {
@ -57,7 +57,7 @@ describe('ticket isEditableOrThrow()', () => {
await tx.rollback();
}
expect(error.message).toEqual(`This ticket is locked.`);
expect(error.message).toEqual(`This ticket is locked`);
});
it('should throw an error as you do not have enough privileges.', async() => {

View File

@ -39,6 +39,6 @@ describe('ticket recalculateComponents()', () => {
error = e;
}
expect(error).toEqual(new ForbiddenError(`This ticket is locked.`));
expect(error).toEqual(new ForbiddenError(`This ticket is locked`));
});
});

View File

@ -94,10 +94,10 @@ describe('ticket state()', () => {
const ticketTracking = await models.Ticket.state(ctx, params, options);
expect(ticketTracking.__data.ticketFk).toBe(params.ticketFk);
expect(ticketTracking.__data.stateFk).toBe(params.stateFk);
expect(ticketTracking.__data.workerFk).toBe(49);
expect(ticketTracking.__data.id).toBeDefined();
expect(ticketTracking.ticketFk).toBe(params.ticketFk);
expect(ticketTracking.stateFk).toBe(params.stateFk);
expect(ticketTracking.userFk).toBe(49);
expect(ticketTracking.id).toBeDefined();
await tx.rollback();
} catch (e) {
@ -116,14 +116,14 @@ describe('ticket state()', () => {
const ticket = await models.Ticket.create(sampleTicket, options);
const ctx = {req: {accessToken: {userId: 18}}};
const assignedState = await models.State.findOne({where: {code: 'PICKER_DESIGNED'}}, options);
const params = {ticketFk: ticket.id, stateFk: assignedState.id, workerFk: 1};
const params = {ticketFk: ticket.id, stateFk: assignedState.id, userFk: 1};
const res = await models.Ticket.state(ctx, params, options);
expect(res.__data.ticketFk).toBe(params.ticketFk);
expect(res.__data.stateFk).toBe(params.stateFk);
expect(res.__data.workerFk).toBe(params.workerFk);
expect(res.__data.workerFk).toBe(1);
expect(res.__data.id).toBeDefined();
expect(res.ticketFk).toBe(params.ticketFk);
expect(res.stateFk).toBe(params.stateFk);
expect(res.userFk).toBe(params.userFk);
expect(res.userFk).toBe(1);
expect(res.id).toBeDefined();
await tx.rollback();
} catch (e) {

View File

@ -23,7 +23,7 @@ describe('Ticket transferClient()', () => {
error = e;
}
expect(error.message).toEqual(`This ticket is locked.`);
expect(error.message).toEqual(`This ticket is locked`);
});
it('should be assigned a different clientFk', async() => {

View File

@ -51,12 +51,12 @@ module.exports = Self => {
params.stateFk = state.id;
}
if (!params.workerFk) {
if (!params.userFk) {
const worker = await models.Worker.findOne({
where: {id: userId}
}, myOptions);
params.workerFk = worker.id;
params.userFk = worker.id;
}
const ticketState = await models.TicketState.findById(params.ticketFk, {

View File

@ -47,7 +47,7 @@ module.exports = Self => {
});
Self.uploadFile = async(ctx, id, options) => {
const models = Self.app.models;
const {Dms, TicketDms} = Self.app.models;
const myOptions = {};
let tx;
@ -59,22 +59,19 @@ module.exports = Self => {
myOptions.transaction = tx;
}
const promises = [];
try {
const uploadedFiles = await models.Dms.uploadFile(ctx, myOptions);
uploadedFiles.forEach(dms => {
const newTicketDms = models.TicketDms.create({
ticketFk: id,
dmsFk: dms.id
}, myOptions);
const uploadedFiles = await Dms.uploadFile(ctx, myOptions);
promises.push(newTicketDms);
});
const resolvedPromises = await Promise.all(promises);
const promises = uploadedFiles.map(dms => TicketDms.create({
ticketFk: id,
dmsFk: dms.id
}, myOptions));
await Promise.all(promises);
if (tx) await tx.commit();
return resolvedPromises;
return uploadedFiles;
} catch (e) {
if (tx) await tx.rollback();
throw e;

View File

@ -24,5 +24,12 @@
"userFk": {
"type": "number"
}
},
"relations": {
"expeditionStateType": {
"type": "belongsTo",
"model": "ExpeditionStateType",
"foreignKey": "typeFk"
}
}
}

View File

@ -33,9 +33,9 @@
"model": "State",
"foreignKey": "stateFk"
},
"worker": {
"user": {
"type": "belongsTo",
"model": "Worker",
"model": "VnUser",
"foreignKey": "workerFk"
}
}

View File

@ -2,5 +2,5 @@ module.exports = function(Self) {
require('../methods/ticket-tracking/setDelivered')(Self);
Self.validatesPresenceOf('stateFk', {message: 'State cannot be blank'});
Self.validatesPresenceOf('workerFk', {message: 'Worker cannot be blank'});
Self.validatesPresenceOf('userFk', {message: 'Worker cannot be blank'});
};

View File

@ -11,21 +11,21 @@
},
"properties": {
"id": {
"id": true,
"type": "number",
"forceId": false
"id": true,
"type": "number",
"forceId": false
},
"created": {
"type": "date"
"type": "date"
},
"ticketFk": {
"type": "number"
"type": "number"
},
"stateFk": {
"type": "number"
"type": "number"
},
"workerFk": {
"type": "number"
"userFk": {
"type": "number"
}
},
"relations": {
@ -39,10 +39,10 @@
"model": "State",
"foreignKey": "stateFk"
},
"worker": {
"user": {
"type": "belongsTo",
"model": "Worker",
"foreignKey": "workerFk"
"model": "VnUser",
"foreignKey": "userFk"
}
}
}

View File

@ -7,15 +7,9 @@ class Controller extends Section {
this.filter = {
include: [
{
relation: 'worker',
relation: 'user',
scope: {
fields: ['id'],
include: {
relation: 'user',
scope: {
fields: ['name']
}
}
fields: ['name']
}
}, {
relation: 'state',

View File

@ -18,13 +18,35 @@ module.exports = Self => {
}
});
Self.removeFile = async(ctx, id) => {
const models = Self.app.models;
const workerDms = await Self.findById(id);
Self.removeFile = async(ctx, dmsFk, options) => {
const myOptions = {};
let tx;
if (typeof options == 'object')
Object.assign(myOptions, options);
await models.Dms.removeFile(ctx, workerDms.dmsFk);
if (!myOptions.transaction) {
tx = await Self.beginTransaction({});
myOptions.transaction = tx;
}
return workerDms.destroy();
try {
const WorkerDms = await Self.findOne({
where: {document: dmsFk}
}, myOptions);
const targetDms = await Self.app.models.Dms.removeFile(ctx, dmsFk, myOptions);
if (!targetDms || !WorkerDms)
throw new UserError('Try again');
const workerDmsDestroyed = await WorkerDms.destroy(myOptions);
if (tx) await tx.commit();
return workerDmsDestroyed;
} catch (e) {
await tx.rollback();
throw e;
}
};
};

View File

@ -47,30 +47,33 @@ module.exports = Self => {
});
Self.uploadFile = async(ctx, id) => {
const models = Self.app.models;
const promises = [];
const tx = await Self.beginTransaction({});
const {Dms, WorkerDms} = Self.app.models;
const myOptions = {};
let tx;
if (typeof options == 'object')
Object.assign(myOptions, options);
if (!myOptions.transaction) {
tx = await Self.beginTransaction({});
myOptions.transaction = tx;
}
try {
const options = {transaction: tx};
const uploadedFiles = await models.Dms.uploadFile(ctx, options);
uploadedFiles.forEach(dms => {
const newWorkerDms = models.WorkerDms.create({
const uploadedFiles = await Dms.uploadFile(ctx, myOptions);
const promises = uploadedFiles.map(dms =>
WorkerDms.create({
workerFk: id,
dmsFk: dms.id
}, options);
}, myOptions));
await Promise.all(promises);
promises.push(newWorkerDms);
});
const resolvedPromises = await Promise.all(promises);
if (tx) await tx.commit();
await tx.commit();
return resolvedPromises;
} catch (err) {
await tx.rollback();
throw err;
return uploadedFiles;
} catch (e) {
if (tx) await tx.rollback();
throw e;
}
};
};

View File

@ -64,7 +64,7 @@ module.exports = Self => {
promises.push(models.TicketTracking.create({
ticketFk: ticket.id,
stateFk: fixingState.id,
workerFk: worker.id
userFk: worker.id
}, myOptions));
}
}

4
package-lock.json generated
View File

@ -1,12 +1,12 @@
{
"name": "salix-back",
"version": "23.50.01",
"version": "24.02.01",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "salix-back",
"version": "23.50.01",
"version": "24.02.01",
"license": "GPL-3.0",
"dependencies": {
"axios": "^1.2.2",

View File

@ -1,6 +1,6 @@
{
"name": "salix-back",
"version": "23.52.01",
"version": "24.02.01",
"author": "Verdnatura Levante SL",
"description": "Salix backend",
"license": "GPL-3.0",