Compare commits

...

175 Commits

Author SHA1 Message Date
Robert Ferrús d86eaf5471 Merge branch 'dev' into 6822-entryTransfer
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-10-25 05:28:54 +00:00
Guillermo Bonet 8569bec34a feat: refs #7266 Minor change
gitea/salix/pipeline/head This commit looks good Details
2024-10-24 12:18:09 +02:00
Guillermo Bonet f6d818f58e Merge pull request 'feat: refs #7266 First commit' (!3129) from 7266-itemLabels into dev
gitea/salix/pipeline/head This commit looks good Details
Reviewed-on: #3129
Reviewed-by: Javi Gallego <jgallego@verdnatura.es>
2024-10-24 09:42:50 +00:00
Guillermo Bonet f97f1c2b9a Merge branch 'dev' into 7266-itemLabels
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-10-24 09:31:14 +00:00
Alex Moreno 7ae99fe6a1 Merge branch 'test' of https://gitea.verdnatura.es/verdnatura/salix into dev
gitea/salix/pipeline/head This commit looks good Details
2024-10-24 07:47:54 +02:00
Alex Moreno 4660118211 Merge branch 'master' of https://gitea.verdnatura.es/verdnatura/salix into test
gitea/salix/pipeline/head This commit looks good Details
2024-10-24 07:47:41 +02:00
Guillermo Bonet 4d96b1df68 Merge branch '7266-itemLabels' of https://gitea.verdnatura.es/verdnatura/salix into 7266-itemLabels
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-10-24 07:31:30 +02:00
Guillermo Bonet 4c529da620 feat: refs #7266 Requested changes and query optimization 2024-10-24 07:31:26 +02:00
Guillermo Bonet 4c9682e107 Merge branch 'dev' into 7266-itemLabels
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-10-24 05:16:16 +00:00
Javi Gallego ed6a062ca3 Merge pull request 'feat: refs #8083 add field' (!3143) from 8083-hotfix-insertRecord into master
gitea/salix/pipeline/head This commit looks good Details
Reviewed-on: #3143
Reviewed-by: Javi Gallego <jgallego@verdnatura.es>
2024-10-23 14:25:41 +00:00
Jorge Penadés 43f8b22593 feat: refs #8083 add field
gitea/salix/pipeline/pr-master This commit looks good Details
2024-10-23 16:10:00 +02:00
Sergio De la torre 5a8f43d0ea Merge pull request 'feat: refs #8020 machineWorkerDeprecated' (!3141) from 8020-mahineWorkerDeprecated into dev
gitea/salix/pipeline/head This commit looks good Details
Reviewed-on: #3141
Reviewed-by: Javi Gallego <jgallego@verdnatura.es>
2024-10-23 12:14:36 +00:00
Guillermo Bonet db4b540958 Merge branch 'test' into dev
gitea/salix/pipeline/head This commit looks good Details
2024-10-23 12:44:55 +02:00
Guillermo Bonet fc56dbc5fb Merge branch 'master' into test
gitea/salix/pipeline/head This commit looks good Details
2024-10-23 12:44:35 +02:00
Guillermo Bonet 9341a51ed4 Merge pull request 'feat: refs #8119 itemCampaignQuantity' (!3117) from 8119-itemCampaignQuantity into master
gitea/salix/pipeline/head This commit looks good Details
Reviewed-on: #3117
Reviewed-by: Javi Gallego <jgallego@verdnatura.es>
2024-10-23 10:40:42 +00:00
Guillermo Bonet 9eaa5a7585 Merge branch 'master' into 8119-itemCampaignQuantity
gitea/salix/pipeline/pr-master This commit looks good Details
2024-10-23 10:38:00 +00:00
Sergio De la torre 3da08e3a23 feat: refs #8020 machineWorkerDeprecated
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-10-23 11:33:45 +02:00
Guillermo Bonet b1a295dca4 feat: refs #7266 Print corrections
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-10-23 09:46:06 +02:00
Guillermo Bonet 3cde6b6bc6 feat: refs #8119 Requested changes
gitea/salix/pipeline/pr-master This commit looks good Details
2024-10-23 08:30:21 +02:00
Guillermo Bonet 31c89538bc feat: refs #8119 Requested changes
gitea/salix/pipeline/pr-master This commit looks good Details
2024-10-23 08:27:07 +02:00
Guillermo Bonet 37050361c2 feat: refs #8119 Requested changes
gitea/salix/pipeline/pr-master This commit looks good Details
2024-10-23 08:26:36 +02:00
Guillermo Bonet baec188ff5 feat: refs #8119 Requested changes
gitea/salix/pipeline/pr-master This commit looks good Details
2024-10-23 08:23:28 +02:00
Javi Gallego 2f5f4ecc7c Merge pull request 'feat: refs #7943 quitar lectura en metodos comunes' (!3136) from 7943-permisosWorker into dev
gitea/salix/pipeline/head This commit looks good Details
Reviewed-on: #3136
Reviewed-by: Alex Moreno <alexm@verdnatura.es>
2024-10-23 05:53:03 +00:00
Javi Gallego 62f9f31279 feat: refs #7943 usa back con permisos
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-10-23 07:44:41 +02:00
Guillermo Bonet 30c1a57b68 Merge branch 'test' into dev
gitea/salix/pipeline/head This commit looks good Details
2024-10-23 07:19:07 +02:00
Guillermo Bonet fe3e7342bc fix: refs #7935 version
gitea/salix/pipeline/pr-dev This commit looks good Details
gitea/salix/pipeline/head This commit looks good Details
2024-10-23 07:14:07 +02:00
Alex Moreno b4e1b015de Merge branch 'test' of https://gitea.verdnatura.es/verdnatura/salix into dev
gitea/salix/pipeline/head This commit looks good Details
2024-10-22 15:08:29 +02:00
Alex Moreno f47043cae4 Merge branch 'master' of https://gitea.verdnatura.es/verdnatura/salix into test
gitea/salix/pipeline/head This commit looks good Details
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-10-22 15:07:24 +02:00
Guillermo Bonet 6227ef0821 Merge branch '8119-itemCampaignQuantity' of https://gitea.verdnatura.es/verdnatura/salix into 8119-itemCampaignQuantity
gitea/salix/pipeline/pr-master There was a failure building this commit Details
2024-10-22 15:00:17 +02:00
Guillermo Bonet 1afb33c306 feat: refs #8119 Requested changes 2024-10-22 15:00:16 +02:00
Jorge Penadés 15fee5ac8d Merge pull request '#8083 add prop' (!3140) from 8083-hotfix-changeState into master
gitea/salix/pipeline/head This commit looks good Details
Reviewed-on: #3140
Reviewed-by: Alex Moreno <alexm@verdnatura.es>
2024-10-22 12:50:10 +00:00
Jorge Penadés 13a30783d9 Merge pull request 'feat: refs #8083 add prop' (!3115) from 8083-changeState into dev
gitea/salix/pipeline/head This commit looks good Details
Reviewed-on: #3115
Reviewed-by: Alex Moreno <alexm@verdnatura.es>
2024-10-22 12:47:51 +00:00
Jorge Penadés e772776028 Merge branch 'dev' into 8083-changeState
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-10-22 12:45:56 +00:00
Jorge Penadés a543fca01a Merge branch 'master' of https://gitea.verdnatura.es/verdnatura/salix into 8083-hotfix-changeState
gitea/salix/pipeline/pr-master This commit looks good Details
2024-10-22 14:23:53 +02:00
Javi Gallego 4844bcf06f Merge pull request '#7524 myteam filter' (!3134) from 7524-hotfix-myTeamFilter into master
gitea/salix/pipeline/head This commit looks good Details
Reviewed-on: #3134
Reviewed-by: Javi Gallego <jgallego@verdnatura.es>
2024-10-22 11:59:44 +00:00
Guillermo Bonet c3f8da52c6 feat: refs #7266 Item label barcode
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-10-22 13:43:54 +02:00
Jorge Penadés 1c5e4f40ce feat: refs #8083 add prop
gitea/salix/pipeline/pr-master This commit looks good Details
2024-10-22 12:39:51 +02:00
Jorge Penadés e2b57d695e Merge branch 'master' of https://gitea.verdnatura.es/verdnatura/salix into 7524-hotfix-myTeamFilter
gitea/salix/pipeline/pr-master This commit looks good Details
2024-10-22 12:25:43 +02:00
Jorge Penadés ee0c0996f6 feat: refs #7524 add e2e
gitea/salix/pipeline/pr-master There was a failure building this commit Details
2024-10-22 12:16:26 +02:00
Guillermo Bonet 0af58b20be feat: refs #7266 Item label QR finished
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-10-22 12:02:04 +02:00
Sergio De la torre 29745d0af4 Merge pull request 'fix: refs #6861 fixTransactionCommit' (!3139) from 6861-Reservas into master
gitea/salix/pipeline/head This commit looks good Details
Reviewed-on: #3139
Reviewed-by: Guillermo Bonet <guillermo@verdnatura.es>
2024-10-22 08:13:00 +00:00
Sergio De la torre 6ef7760498 fix: refs #6861 fixTransactionCommit
gitea/salix/pipeline/pr-master This commit looks good Details
2024-10-22 10:06:59 +02:00
Guillermo Bonet b4d2c69b37 Merge branch 'master' into 8119-itemCampaignQuantity
gitea/salix/pipeline/pr-master This commit looks good Details
2024-10-22 06:42:02 +00:00
Guillermo Bonet 5162c2037b feat: refs #8119 Requested changes
gitea/salix/pipeline/pr-master There was a failure building this commit Details
2024-10-22 08:41:46 +02:00
Alex Moreno db8573dd40 Merge pull request '8144-devToTest_2444' (!3137) from 8144-devToTest_2444 into test
gitea/salix/pipeline/pr-dev This commit looks good Details
gitea/salix/pipeline/head This commit looks good Details
Reviewed-on: #3137
Reviewed-by: Carlos Satorres <carlossa@verdnatura.es>
2024-10-22 06:07:14 +00:00
Guillermo Bonet bf2d7541a5 feat: refs #7266 Item label QR
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-10-21 14:57:55 +02:00
Carlos Satorres 56cba385cf Merge pull request 'fix: refs #6850 remove notifyPickUp' (!3132) from 6850-removeChandgeUpdateClaim into dev
gitea/salix/pipeline/head This commit looks good Details
gitea/salix/pipeline/pr-test This commit looks good Details
Reviewed-on: #3132
Reviewed-by: Alex Moreno <alexm@verdnatura.es>
2024-10-21 12:31:30 +00:00
Jorge Penadés 1efe258ea0 fix: refs #7524 filter by department
gitea/salix/pipeline/pr-master This commit looks good Details
2024-10-21 14:30:45 +02:00
Carlos Satorres aad616ff83 Merge branch 'dev' into 6850-removeChandgeUpdateClaim
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-10-21 12:26:53 +00:00
Carlos Satorres f8c83c8f68 Merge pull request 'fix: refs #6831 filter observation' (!3131) from 6831-observationDefaulterEmail into dev
gitea/salix/pipeline/head This commit looks good Details
Reviewed-on: #3131
Reviewed-by: Alex Moreno <alexm@verdnatura.es>
2024-10-21 12:26:04 +00:00
Carlos Satorres c3ffb31348 Merge branch 'dev' into 6831-observationDefaulterEmail
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-10-21 12:23:39 +00:00
Javi Gallego 2b05e8c48e feat: refs #7943 quitar lectura en metodos comunes
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-10-21 13:29:33 +02:00
Jorge Penadés b76b1c6d50 Merge pull request '#7919 delete if ticketRefund' (!3091) from 7919-deleteTicketRefund into dev
gitea/salix/pipeline/head This commit looks good Details
Reviewed-on: #3091
Reviewed-by: Carlos Andrés <carlosap@verdnatura.es>
Reviewed-by: Alex Moreno <alexm@verdnatura.es>
2024-10-21 11:21:34 +00:00
Jorge Penadés 2f77359892 Merge branch 'dev' into 7919-deleteTicketRefund
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-10-21 11:00:31 +00:00
Pablo Natek 69a34ab0fa Merge pull request 'fix: add date format on insert data' (!3135) from fixNightProc into dev
gitea/salix/pipeline/head This commit looks good Details
Reviewed-on: #3135
Reviewed-by: Javi Gallego <jgallego@verdnatura.es>
2024-10-21 10:25:41 +00:00
Pablo Natek 1731af13ea Merge branch 'fixNightProc' of https://gitea.verdnatura.es/verdnatura/salix into fixNightProc
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-10-21 12:19:22 +02:00
Pablo Natek e479873547 fix: restore cursor 2024-10-21 12:19:20 +02:00
Alex Moreno 15a8a70201 Merge branch 'dev' into 8083-changeState
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-10-21 10:11:56 +00:00
Pablo Natek 92f699aac3 Merge branch 'dev' into fixNightProc
gitea/salix/pipeline/pr-dev There was a failure building this commit Details
2024-10-21 09:37:07 +00:00
Pablo Natek e38c061deb fix: add date format on insert data
gitea/salix/pipeline/pr-dev There was a failure building this commit Details
2024-10-21 11:36:44 +02:00
Jon Elias d75a032d75 Merge pull request 'Added new filter param in item request' (!3094) from Fix-ItemRequest into dev
gitea/salix/pipeline/head This commit looks good Details
Reviewed-on: #3094
Reviewed-by: Javi Gallego <jgallego@verdnatura.es>
2024-10-21 09:34:53 +00:00
Jon Elias 158f701f1e Merge branch 'dev' into Fix-ItemRequest
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-10-21 09:31:29 +00:00
Jorge Penadés cb4e8355ba feat: refs #7524 myteam filter
gitea/salix/pipeline/pr-master This commit looks good Details
2024-10-21 10:58:36 +02:00
Jorge Penadés 288dc1c598 feat: refs #7524 myteam filter wip
gitea/salix/pipeline/pr-master This commit looks good Details
2024-10-21 10:05:58 +02:00
Carlos Satorres bf0cc687e1 Merge branch 'dev' into 6850-removeChandgeUpdateClaim
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-10-21 07:27:46 +00:00
Guillermo Bonet 5d55fb287d Merge branch 'test' into dev
gitea/salix/pipeline/head Build queued... Details
2024-10-21 09:25:39 +02:00
Guillermo Bonet dead904c19 Merge branch 'master' into test
gitea/salix/pipeline/head This commit looks good Details
gitea/salix/pipeline/pr-dev There was a failure building this commit Details
2024-10-21 09:25:29 +02:00
Carlos Satorres eea09a9d4a fix: refs #6850 add code
gitea/salix/pipeline/pr-dev Build queued... Details
2024-10-21 09:24:53 +02:00
Guillermo Bonet ca81c2c440 Merge pull request 'fix: refs #230926 item_getSimilar' (!3133) from 230926-hotfix into master
gitea/salix/pipeline/head This commit looks good Details
Reviewed-on: #3133
Reviewed-by: Javi Gallego <jgallego@verdnatura.es>
2024-10-21 06:42:32 +00:00
Guillermo Bonet bbc17d1ff8 fix: refs #230926 item_getSimilar
gitea/salix/pipeline/pr-master This commit looks good Details
2024-10-21 08:33:16 +02:00
Javi Gallego be9f711cc1 Merge pull request 'feat: refs #7348 hasDailyInvoice from client' (!3110) from 7348-autonomyDailyInvoice into dev
gitea/salix/pipeline/head This commit looks good Details
Reviewed-on: #3110
Reviewed-by: Carlos Andrés <carlosap@verdnatura.es>
Reviewed-by: Alex Moreno <alexm@verdnatura.es>
2024-10-21 06:31:17 +00:00
Carlos Satorres 19fbb836a6 fix: refs #6850 fix model
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-10-21 08:30:39 +02:00
Javi Gallego da772cf504 Merge pull request '7744-closeAllTest' (!3114) from 7744-closeAllTest into dev
gitea/salix/pipeline/head There was a failure building this commit Details
Reviewed-on: #3114
Reviewed-by: Alex Moreno <alexm@verdnatura.es>
2024-10-21 06:29:17 +00:00
Carlos Satorres b88dc1c70f fix: refs #6850 remove notifyPickUp
gitea/salix/pipeline/pr-dev There was a failure building this commit Details
2024-10-20 16:23:24 +02:00
Carlos Satorres b8e782d3a5 fix: refs #6831 filter observation
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-10-20 15:59:24 +02:00
Jorge Penadés 28db5f221b Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 8083-changeState
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-10-18 16:38:20 +02:00
Jon Elias 9e9773578a Merge branch 'dev' into Fix-ItemRequest
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-10-18 11:22:35 +00:00
Guillermo Bonet 34deba406b feat: refs #7266 First commit
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-10-18 12:59:52 +02:00
Carlos Satorres a5bbdd7a01 Merge pull request 'fix: refs #7906 remake method' (!3109) from 7906-notDeleteZone into dev
gitea/salix/pipeline/head This commit looks good Details
Reviewed-on: #3109
Reviewed-by: Alex Moreno <alexm@verdnatura.es>
2024-10-18 08:33:03 +00:00
Carlos Satorres ed69604767 Merge branch 'dev' into 7906-notDeleteZone
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-10-18 08:31:38 +00:00
Guillermo Bonet 939f083671 Merge pull request 'refactor: refs #8106 Optimized ticket_getTax' (!3122) from 8106-negativeBasesOptimize into dev
gitea/salix/pipeline/head This commit looks good Details
Reviewed-on: #3122
Reviewed-by: Carlos Andrés <carlosap@verdnatura.es>
2024-10-18 08:27:08 +00:00
Jon Elias 35621e9051 Merge pull request '#7010 added filter fields to show packing type field in ticket list' (!3024) from 7010-AddPackingField into dev
gitea/salix/pipeline/head This commit looks good Details
Reviewed-on: #3024
Reviewed-by: Alex Moreno <alexm@verdnatura.es>
2024-10-18 07:40:35 +00:00
Carlos Satorres 5a14aed73a Merge branch 'dev' into 7906-notDeleteZone
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-10-18 07:40:04 +00:00
Jon Elias 3139d99130 Merge branch 'dev' into 7010-AddPackingField
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-10-18 07:30:43 +00:00
Guillermo Bonet 46c7745128 Merge pull request 'refactor: refs #7811 Deleted pm2' (!3127) from 7811-byePm2 into dev
gitea/salix/pipeline/head This commit looks good Details
Reviewed-on: #3127
Reviewed-by: Juan Ferrer <juan@verdnatura.es>
2024-10-18 07:30:13 +00:00
Jon Elias 46993ad103 refactor: refs #7010 deleted distinct
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-10-18 09:29:01 +02:00
Carlos Satorres 1273e895af fix: refs #7906 fix test back
gitea/salix/pipeline/pr-dev There was a failure building this commit Details
2024-10-18 09:27:43 +02:00
Carlos Satorres 8609e85ba1 Merge pull request '7986-workerMoto' (!3095) from 7986-workerMoto into dev
gitea/salix/pipeline/head This commit looks good Details
Reviewed-on: #3095
Reviewed-by: Alex Moreno <alexm@verdnatura.es>
2024-10-18 07:24:49 +00:00
Carlos Satorres 50a2f6081e Merge branch 'dev' into 7986-workerMoto
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-10-18 07:20:06 +00:00
Jon Elias f68584b3fa Merge branch 'dev' into Fix-ItemRequest
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-10-18 06:53:38 +00:00
Carlos Satorres 02dc952024 fix: refs #7906 add test
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-10-18 08:28:08 +02:00
Robert Ferrús 8479dd76cd Merge pull request 'feat: refs #8108 create tables itemTag' (!3102) from 8108-itemTags into master
gitea/salix/pipeline/head This commit looks good Details
Reviewed-on: #3102
Reviewed-by: Javi Gallego <jgallego@verdnatura.es>
2024-10-18 06:25:57 +00:00
Ivan Mas d7fd1b7ee5 Merge pull request 'refactor: refs #7865 delete client.gestdocFk from TPV' (!3123) from 7865-deleteClientGestdocFkTPV into dev
gitea/salix/pipeline/head This commit looks good Details
Reviewed-on: #3123
Reviewed-by: Javi Gallego <jgallego@verdnatura.es>
2024-10-18 06:22:58 +00:00
Ivan Mas f4b041c9b1 Merge branch 'dev' into 7865-deleteClientGestdocFkTPV
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-10-18 06:20:38 +00:00
Guillermo Bonet 44dc84be9f Merge branch 'dev' into 7811-byePm2
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-10-18 06:02:20 +00:00
Guillermo Bonet 93494c3eb0 refactor: refs #7811 Deleted pm2
gitea/salix/pipeline/pr-dev Build queued... Details
2024-10-18 08:02:06 +02:00
Carlos Satorres b15b2d578d Merge pull request 'fix: refs #7230 producer fix' (!3112) from 7230-deliveryNoteProducer into dev
gitea/salix/pipeline/head This commit looks good Details
Reviewed-on: #3112
Reviewed-by: Alex Moreno <alexm@verdnatura.es>
2024-10-18 05:56:29 +00:00
Carlos Satorres 541990efb7 Merge branch 'dev' into 7230-deliveryNoteProducer
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-10-18 05:53:34 +00:00
Guillermo Bonet 7e604f1a19 feat: refs #8119 Requested changes
gitea/salix/pipeline/pr-master This commit looks good Details
2024-10-18 07:44:28 +02:00
Guillermo Bonet 4bd28c62b9 feat: refs #8119 Requested changes
gitea/salix/pipeline/pr-master This commit looks good Details
2024-10-18 07:35:36 +02:00
Guillermo Bonet 865da7bba2 refactor: refs #8106 Requested changes
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-10-18 07:15:26 +02:00
Alex Moreno d93653372a Merge branch 'test' of https://gitea.verdnatura.es/verdnatura/salix into dev
gitea/salix/pipeline/head This commit looks good Details
2024-10-18 07:12:18 +02:00
Alex Moreno 08e22db950 Merge pull request 'master' (!3125) from master into test
gitea/salix/pipeline/pr-dev This commit looks good Details
gitea/salix/pipeline/head This commit looks good Details
Reviewed-on: #3125
Reviewed-by: Alex Moreno <alexm@verdnatura.es>
2024-10-18 05:09:32 +00:00
Guillermo Bonet 5017b344d4 Merge pull request 'refactor: refs #7930 Deleted HEALTHCHECK of back dockerfile' (!3118) from 7930-healthcheckDockerfile into dev
gitea/salix/pipeline/head This commit looks good Details
Reviewed-on: #3118
Reviewed-by: Juan Ferrer <juan@verdnatura.es>
2024-10-18 05:06:52 +00:00
Robert Ferrús ddf7215084 Merge branch 'master' into 8108-itemTags
gitea/salix/pipeline/pr-master This commit looks good Details
2024-10-18 04:57:37 +00:00
Sergio De la torre 90a3f369b6 Merge pull request 'fix: refs #6861 saleTrackingAdd' (!3121) from 6861-ReserveSaleTracking into master
gitea/salix/pipeline/head This commit looks good Details
gitea/salix/pipeline/pr-test This commit looks good Details
Reviewed-on: #3121
Reviewed-by: Carlos Andrés <carlosap@verdnatura.es>
2024-10-17 15:29:12 +00:00
Sergio De la torre 8df09bc64a Merge branch 'master' into 6861-ReserveSaleTracking
gitea/salix/pipeline/pr-master This commit looks good Details
2024-10-17 15:23:05 +00:00
Sergio De la torre 3463036086 fix: refs #6861 saleTrackingAdd
gitea/salix/pipeline/pr-master There was a failure building this commit Details
2024-10-17 17:20:21 +02:00
Ivan Mas 7dc35458e8 refactor: refs #7865 delete client.gestdocFk from TPV
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-10-17 17:05:08 +02:00
Sergio De la torre 63c0ec308f fix: refs #6861 saleTrackingAdd
gitea/salix/pipeline/pr-master This commit looks good Details
2024-10-17 17:01:44 +02:00
Guillermo Bonet 28e957fecd refactor: refs #8106 refs #1406 Optimized ticket_getTax
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-10-17 14:46:19 +02:00
Sergio De la torre cb53962405 fix: refs #6861 saleTrackingAdd
gitea/salix/pipeline/pr-master There was a failure building this commit Details
2024-10-17 13:58:21 +02:00
Robert Ferrús 0e2dcbce0c Merge branch 'master' into 8108-itemTags
gitea/salix/pipeline/pr-master This commit looks good Details
2024-10-17 11:31:52 +00:00
Robert Ferrús faecbbb373 feat: refs #8108 saltos de linea
gitea/salix/pipeline/pr-master There was a failure building this commit Details
2024-10-17 13:08:58 +02:00
Guillermo Bonet a188efb1e3 refactor: refs #7930 Deleted HEALTHCHECK of back dockerfile
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-10-17 11:45:13 +02:00
Guillermo Bonet f85267db92 feat: refs #8119 Fix test
gitea/salix/pipeline/pr-master This commit looks good Details
2024-10-17 11:06:11 +02:00
Guillermo Bonet 2bd98b7fb6 feat: refs #8119 Minor change
gitea/salix/pipeline/pr-master There was a failure building this commit Details
2024-10-17 10:29:35 +02:00
Guillermo Bonet 8ca69d3574 feat: refs #8119 Minor change
gitea/salix/pipeline/pr-master There was a failure building this commit Details
2024-10-17 10:21:39 +02:00
Guillermo Bonet 41d078aaf1 feat: refs #8119 itemCampaignQuantity
gitea/salix/pipeline/pr-master There was a failure building this commit Details
2024-10-17 10:16:26 +02:00
Guillermo Bonet 3628abd5bf feat: refs #8119 itemCampaignQuantity
gitea/salix/pipeline/pr-master There was a failure building this commit Details
2024-10-17 10:15:45 +02:00
Guillermo Bonet 410c6f2d83 Merge branch '8119-itemCampaignQuantity' of https://gitea.verdnatura.es/verdnatura/salix into 8119-itemCampaignQuantity
gitea/salix/pipeline/pr-master There was a failure building this commit Details
2024-10-17 10:09:58 +02:00
Guillermo Bonet ec13c41be3 feat: refs #8119 itemCampaignQuantity 2024-10-17 10:09:57 +02:00
Guillermo Bonet a8525c5ba8 Merge branch 'master' into 8119-itemCampaignQuantity
gitea/salix/pipeline/pr-master There was a failure building this commit Details
2024-10-17 08:08:48 +00:00
Guillermo Bonet 999cb2dbb4 feat: refs #8119 itemCampaignQuantity
gitea/salix/pipeline/pr-master There was a failure building this commit Details
2024-10-17 10:08:27 +02:00
Alex Moreno 76415e507d Merge pull request 'MASTER feat(Docuware): refs #8066 use oath' (!3084) from 8066-docuware_oauth into master
gitea/salix/pipeline/head This commit looks good Details
Reviewed-on: #3084
Reviewed-by: Javi Gallego <jgallego@verdnatura.es>
2024-10-17 07:09:07 +00:00
Jorge Penadés de0fe37ffe feat: refs #8083 add prop
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-10-16 16:16:51 +02:00
Javi Gallego 681f82a3ae feat: refs #7744 test back ok
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-10-16 16:09:53 +02:00
Carlos Satorres 37d3ef5f16 Merge branch 'dev' into 7986-workerMoto
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-10-16 12:10:13 +00:00
Carlos Satorres 3f3b936255 fix: refs #7906 remove code
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-10-16 13:56:42 +02:00
Carlos Satorres 5de4a11e8b fix: refs #7230 fix line
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-10-16 13:53:20 +02:00
Carlos Satorres 3e443ad5ce fix: refs #7230 producer fix
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-10-16 12:22:57 +02:00
Carlos Satorres a282170016 fix: refs #7906 fix method
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-10-16 11:36:48 +02:00
Alex Moreno cb7575d821 Merge pull request 'fix: refs #7353 redirect to lilium' (!3111) from 7353-fixRedirect into dev
gitea/salix/pipeline/head This commit looks good Details
Reviewed-on: #3111
Reviewed-by: Alex Moreno <alexm@verdnatura.es>
2024-10-16 07:39:10 +00:00
Jorge Penadés 8f01e4d110 fix: refs #7353 redirect to lilium
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-10-16 09:32:15 +02:00
Carlos Satorres c5aa7dc44e fix: refs #7906 edit test
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-10-16 09:30:37 +02:00
Jorge Penadés 8ca097d4a9 chore: refs #7919 change var name
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-10-16 09:23:39 +02:00
Javi Gallego f78aad0874 Merge branch 'dev' into 7744-closeAllTest 2024-10-16 09:09:41 +02:00
Alex Moreno c355fcfece test(docuware_core): refs #8066 adapt
gitea/salix/pipeline/pr-master This commit looks good Details
2024-10-16 09:03:47 +02:00
Javi Gallego aac4dd0a6d feat: refs #7348 minor bug
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-10-16 08:52:27 +02:00
Alex Moreno ccaec1a2cf Merge branch 'master' of https://gitea.verdnatura.es/verdnatura/salix into 8066-docuware_oauth 2024-10-16 08:41:50 +02:00
Javi Gallego c6e764b478 feat: refs #7348 hasDailyInvoice from client
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-10-16 08:32:10 +02:00
Carlos Satorres 46e657675b fix: refs #7906 remake method
gitea/salix/pipeline/pr-dev There was a failure building this commit Details
2024-10-16 08:26:39 +02:00
Sergio De la torre a989bef78c Merge pull request 'master' (!3108) from master into test
gitea/salix/pipeline/head This commit looks good Details
gitea/salix/pipeline/pr-dev This commit looks good Details
Reviewed-on: #3108
Reviewed-by: Robert Ferrús <robert@verdnatura.es>
2024-10-16 06:16:36 +00:00
Sergio De la torre 15622a3e68 Merge pull request 'fix: refs #6861 getTickets' (!3106) from 6861-itemShelvingSaleTickets into master
gitea/salix/pipeline/head This commit looks good Details
gitea/salix/pipeline/pr-test This commit looks good Details
Reviewed-on: #3106
Reviewed-by: Carlos Andrés <carlosap@verdnatura.es>
2024-10-16 05:58:52 +00:00
Sergio De la torre 12abca0a2d fix: refs #6861 getTickets
gitea/salix/pipeline/pr-master This commit looks good Details
2024-10-15 18:12:07 +02:00
Jorge Penadés d57f4fc44a chore: refs #7919 refactor, drop relation on back
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-10-15 17:24:14 +02:00
Sergio De la torre 2adc424ccb fix: refs #6861 getTickets
gitea/salix/pipeline/pr-master There was a failure building this commit Details
2024-10-15 17:07:35 +02:00
Jorge Penadés 6f8a005726 Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 7919-deleteTicketRefund
gitea/salix/pipeline/pr-dev There was a failure building this commit Details
2024-10-15 17:01:29 +02:00
Sergio De la torre b592ccc162 fix: refs #6861 getTickets
gitea/salix/pipeline/pr-master There was a failure building this commit Details
2024-10-15 17:01:09 +02:00
Javi Gallego 4a88ba5078 feat: refs #7744 closeAll Test 2024-10-15 15:43:12 +02:00
Carlos Satorres 099fe8f950 fix: refs #7986 fix model
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-10-15 14:42:35 +02:00
Robert Ferrús 8da005f08a feat: refs #8108 refs #9108
gitea/salix/pipeline/pr-master This commit looks good Details
2024-10-15 11:19:08 +02:00
Robert Ferrús da55fffef0 feat: refs #8108 addMoreTablesTag
gitea/salix/pipeline/pr-master There was a failure building this commit Details
2024-10-15 11:18:04 +02:00
Alex Moreno b1b36a33a0 chore(docuware_core): refs #8066 add returns
gitea/salix/pipeline/pr-master There was a failure building this commit Details
2024-10-15 09:47:39 +02:00
Carlos Satorres c73fd51a9c fix: refs #7986 add acl
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-10-15 09:45:14 +02:00
Jon Elias e334152acc refactor: deleted comment
gitea/salix/pipeline/pr-dev There was a failure building this commit Details
2024-10-15 09:03:15 +02:00
Robert Ferrús 52e573501a feat: refs #8108 create tables itemTag
gitea/salix/pipeline/pr-master This commit looks good Details
2024-10-15 08:46:43 +02:00
Alex Moreno 3c881d5e48 refactor(docuware): refs #8066 use Authorization
gitea/salix/pipeline/pr-master There was a failure building this commit Details
2024-10-15 08:00:19 +02:00
Jorge Penadés 6d4c71d465 feat: refs #7919 test
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-10-14 17:14:40 +02:00
Jorge Penadés a35208d903 feat: refs #7919 test 2024-10-14 17:14:01 +02:00
Jorge Penadés ccf9dbde8e feat: refs #7919 test
gitea/salix/pipeline/pr-dev There was a failure building this commit Details
2024-10-14 17:11:12 +02:00
Jorge Penadés 32756dabae Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 7919-deleteTicketRefund
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-10-14 16:49:11 +02:00
Carlos Satorres 68469e2ba8 Merge branch 'dev' of https: refs #7986//gitea.verdnatura.es/verdnatura/salix into 7986-workerMoto
gitea/salix/pipeline/pr-dev There was a failure building this commit Details
2024-10-14 13:52:08 +02:00
Jon Elias 07849ebeb8 fix: myTeam param
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-10-14 13:25:09 +02:00
Alex Moreno 394cf0d18b Merge branch 'master' of https://gitea.verdnatura.es/verdnatura/salix into 8066-docuware_oauth
gitea/salix/pipeline/pr-master There was a failure building this commit Details
2024-10-14 12:31:20 +02:00
Jon Elias 4ee6a46bd5 feat: added new filter param
gitea/salix/pipeline/pr-dev There was a failure building this commit Details
2024-10-14 11:29:49 +02:00
Jorge Penadés 770c604d6b chore: refs #7919 delete if ticketRefund
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-10-10 16:30:04 +02:00
Carlos Satorres 39e808bca7 fix: refs #7986 fix model 2024-10-08 16:06:38 +02:00
Alex Moreno 9695fea48f feat(Docuware): refs #8066 add username and password
gitea/salix/pipeline/pr-master There was a failure building this commit Details
2024-10-08 12:05:19 +02:00
Carlos Satorres b4dc5276dd fix: refs #7986 create fk 2024-10-08 08:36:17 +02:00
Alex Moreno 952f8f3dfc feat(Docuware): refs #8066 use oath
gitea/salix/pipeline/pr-master There was a failure building this commit Details
2024-10-07 15:14:03 +02:00
Jon Elias cbc8cc6210 Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 7010-AddPackingField 2024-10-03 09:14:16 +02:00
Jon Elias b55db4bdc0 feat: refs #7010 added subquery to avoid using group by in sql
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-09-30 14:09:57 +02:00
Jon Elias b547858820 perf: refs #7010 showing field correctly
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-09-27 08:28:12 +02:00
Jon Elias 4ebda1a06f feat: refs #7010 added filter fields to show packing type field in ticket list
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-09-26 14:06:45 +02:00
115 changed files with 1793 additions and 1119 deletions

View File

@ -32,8 +32,7 @@ RUN apt-get update \
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
samba-common-bin samba-dsdb-modules\
&& rm -rf /var/lib/apt/lists/* \
&& npm -g install pm2
&& rm -rf /var/lib/apt/lists/*
# Salix
@ -55,7 +54,4 @@ COPY \
README.md \
./
CMD ["pm2-runtime", "./back/process.yml"]
HEALTHCHECK --interval=15s --timeout=10s \
CMD curl -f http://localhost:3000/api/Applications/status || exit 1
CMD ["node", "--tls-min-v1.0", "--openssl-legacy-provider", "./loopback/server/server.js"]

View File

@ -62,7 +62,8 @@ module.exports = Self => {
p.code parkingCodePrevia,
p.pickingOrder pickingOrderPrevia,
iss.id itemShelvingSaleFk,
iss.isPicked
iss.isPicked,
iss.itemShelvingFk
FROM ticketCollection tc
LEFT JOIN collection c ON c.id = tc.collectionFk
JOIN sale s ON s.ticketFk = tc.ticketFk
@ -102,7 +103,8 @@ module.exports = Self => {
p.code,
p.pickingOrder,
iss.id itemShelvingSaleFk,
iss.isPicked
iss.isPicked,
iss.itemShelvingFk
FROM sectorCollection sc
JOIN sectorCollectionSaleGroup ss ON ss.sectorCollectionFk = sc.id
JOIN saleGroup sg ON sg.id = ss.saleGroupFk

View File

@ -4,21 +4,45 @@ module.exports = Self => {
/**
* Returns basic headers
*
* @param {string} cookie - The docuware cookie
* @return {object} - The headers
*/
Self.getOptions = async() => {
const docuwareConfig = await Self.app.models.DocuwareConfig.findOne();
const now = Date.vnNow();
let {url, username, password, token, expired} = docuwareConfig;
if (process.env.NODE_ENV && (!expired || expired < now + 60)) {
const {data: {IdentityServiceUrl}} = await axios.get(`${url}/Home/IdentityServiceInfo`);
const {data: {token_endpoint}} = await axios.get(`${IdentityServiceUrl}/.well-known/openid-configuration`);
const {data} = await axios.post(token_endpoint, {
grant_type: 'password',
scope: 'docuware.platform',
client_id: 'docuware.platform.net.client',
username,
password
}, {headers: {
'Accept': 'application/json',
'Content-Type': 'application/x-www-form-urlencoded'
}});
const newToken = data.access_token;
token = data.token_type + ' ' + newToken;
await docuwareConfig.updateAttributes({
token,
expired: now + data.expires_in
});
}
const headers = {
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json',
'Cookie': docuwareConfig.cookie
'Authorization': token
}
};
return {
url: docuwareConfig.url,
url,
headers
};
};

View File

@ -2,87 +2,54 @@ const axios = require('axios');
const models = require('vn-loopback/server/server').models;
describe('Docuware core', () => {
beforeAll(() => {
const fileCabinetCode = 'deliveryNote';
beforeAll(async() => {
process.env.NODE_ENV = 'testing';
});
afterAll(() => {
delete process.env.NODE_ENV;
});
describe('getOptions()', () => {
it('should return url and headers', async() => {
const result = await models.Docuware.getOptions();
expect(result.url).toBeDefined();
expect(result.headers).toBeDefined();
const docuwareInfo = await models.Docuware.findOne({
where: {
code: fileCabinetCode
}
});
});
describe('getDialog()', () => {
it('should return dialogId', async() => {
const dialogs = {
data: {
Dialog: [
{
DisplayName: 'find',
Id: 'getDialogTest'
}
]
}
};
spyOn(axios, 'get').and.returnValue(new Promise(resolve => resolve(dialogs)));
const result = await models.Docuware.getDialog('deliveryNote', 'find', 'randomFileCabinetId');
spyOn(axios, 'get').and.callFake(url => {
if (url.includes('IdentityServiceInfo')) return {data: {IdentityServiceUrl: 'IdentityServiceUrl'}};
if (url.includes('IdentityServiceUrl')) return {data: {token_endpoint: 'token_endpoint'}};
if (url.includes('dialogs')) {
return {
data: {
Dialog: [
{
DisplayName: 'find',
Id: 'getDialogTest'
}
]
}
};
}
expect(result).toEqual('getDialogTest');
});
});
describe('getFileCabinet()', () => {
it('should return fileCabinetId', async() => {
const code = 'deliveryNote';
const docuwareInfo = await models.Docuware.findOne({
where: {
code
}
});
const dialogs = {
data: {
if (url.includes('FileCabinets')) {
return {data: {
FileCabinet: [
{
Name: docuwareInfo.fileCabinetName,
Id: 'getFileCabinetTest'
}
]
}
};
spyOn(axios, 'get').and.returnValue(new Promise(resolve => resolve(dialogs)));
const result = await models.Docuware.getFileCabinet(code);
expect(result).toEqual('getFileCabinetTest');
});
});
describe('get()', () => {
it('should return data without parse', async() => {
spyOn(models.Docuware, 'getFileCabinet').and.returnValue((new Promise(resolve => resolve(Math.random()))));
spyOn(models.Docuware, 'getDialog').and.returnValue((new Promise(resolve => resolve(Math.random()))));
const data = {
data: {
id: 1
}
};
spyOn(axios, 'post').and.returnValue(new Promise(resolve => resolve(data)));
const result = await models.Docuware.get('deliveryNote');
expect(result.id).toEqual(1);
}};
}
});
it('should return data with parse', async() => {
spyOn(models.Docuware, 'getFileCabinet').and.returnValue((new Promise(resolve => resolve(Math.random()))));
spyOn(models.Docuware, 'getDialog').and.returnValue((new Promise(resolve => resolve(Math.random()))));
const data = {
data: {
spyOn(axios, 'post').and.callFake(url => {
if (url.includes('token_endpoint')) {
return {data: {
access_token: 'access_token',
token_type: 'bearer',
expires_in: 10000
}};
}
if (url.includes('DialogExpression')) {
return {data: {
Items: [{
Fields: [
{
@ -103,12 +70,52 @@ describe('Docuware core', () => {
]
}]
}
};
};
}
});
});
afterAll(() => {
delete process.env.NODE_ENV;
});
describe('getOptions()', () => {
it('should return url and headers', async() => {
const result = await models.Docuware.getOptions();
expect(result.url).toBeDefined();
expect(result.headers).toBeDefined();
});
});
describe('Dialog()', () => {
it('should return dialogId', async() => {
const result = await models.Docuware.getDialog('deliveryNote', 'find', 'randomFileCabinetId');
expect(result).toEqual('getDialogTest');
});
});
describe('getFileCabinet()', () => {
it('should return fileCabinetId', async() => {
const result = await models.Docuware.getFileCabinet(fileCabinetCode);
expect(result).toEqual('getFileCabinetTest');
});
});
describe('get()', () => {
it('should return data without parse', async() => {
const [result] = await models.Docuware.get('deliveryNote');
expect(result.firstRequiredField).toEqual(1);
});
it('should return data with parse', async() => {
const parse = {
'firstRequiredField': 'id',
'secondRequiredField': 'name',
};
spyOn(axios, 'post').and.returnValue(new Promise(resolve => resolve(data)));
const [result] = await models.Docuware.get('deliveryNote', null, parse);
expect(result.id).toEqual(1);
@ -119,17 +126,14 @@ describe('Docuware core', () => {
describe('getById()', () => {
it('should return data', async() => {
spyOn(models.Docuware, 'getFileCabinet').and.returnValue((new Promise(resolve => resolve(Math.random()))));
spyOn(models.Docuware, 'getDialog').and.returnValue((new Promise(resolve => resolve(Math.random()))));
const data = {
data: {
id: 1
}
};
spyOn(axios, 'post').and.returnValue(new Promise(resolve => resolve(data)));
const result = await models.Docuware.getById('deliveryNote', 1);
spyOn(models.Docuware, 'get');
await models.Docuware.getById('deliveryNote', 1);
expect(result.id).toEqual(1);
expect(models.Docuware.get).toHaveBeenCalledWith(
'deliveryNote',
{condition: [Object({DBName: 'N__ALBAR_N', Value: [1]})]},
undefined
);
});
});
});

View File

@ -143,7 +143,7 @@ module.exports = Self => {
headers: {
'Content-Type': 'multipart/form-data',
'X-File-ModifiedDate': Date.vnNew(),
'Cookie': docuwareOptions.headers.headers.Cookie,
'Authorization': docuwareOptions.headers.headers.Authorization,
...data.getHeaders()
},
};

View File

@ -1,132 +0,0 @@
const {models} = require('vn-loopback/server/server');
describe('machineWorker updateInTime()', () => {
const itBoss = 104;
const davidCharles = 1106;
beforeAll(async() => {
ctx = {
req: {
accessToken: {},
headers: {origin: 'http://localhost'},
__: value => value
}
};
});
it('should throw an error if the plate does not exist', async() => {
const tx = await models.MachineWorker.beginTransaction({});
const options = {transaction: tx};
const plate = 'RE-123';
ctx.req.accessToken.userId = 1106;
try {
await models.MachineWorker.updateInTime(ctx, plate, options);
await tx.rollback();
} catch (e) {
const error = e;
expect(error.message).toContain('the plate does not exist');
await tx.rollback();
}
});
it('should grab a machine where is not in use', async() => {
const tx = await models.MachineWorker.beginTransaction({});
const options = {transaction: tx};
const plate = 'RE-003';
ctx.req.accessToken.userId = 1107;
try {
const totalBefore = await models.MachineWorker.find(null, options);
await models.MachineWorker.updateInTime(ctx, plate, options);
const totalAfter = await models.MachineWorker.find(null, options);
expect(totalAfter.length).toEqual(totalBefore.length + 1);
await tx.rollback();
} catch (e) {
await tx.rollback();
}
});
describe('less than 12h', () => {
const plate = 'RE-001';
it('should trow an error if it is not himself', async() => {
const tx = await models.MachineWorker.beginTransaction({});
const options = {transaction: tx};
ctx.req.accessToken.userId = davidCharles;
try {
await models.MachineWorker.updateInTime(ctx, plate, options);
await tx.rollback();
} catch (e) {
const error = e;
expect(error.message).toContain('This machine is already in use');
await tx.rollback();
}
});
it('should throw an error if it is himself with a different machine', async() => {
const tx = await models.MachineWorker.beginTransaction({});
const options = {transaction: tx};
ctx.req.accessToken.userId = itBoss;
const plate = 'RE-003';
try {
await models.MachineWorker.updateInTime(ctx, plate, options);
await tx.rollback();
} catch (e) {
const error = e;
expect(error.message).toEqual('You are already using a machine');
await tx.rollback();
}
});
it('should set the out time if it is himself', async() => {
const tx = await models.MachineWorker.beginTransaction({});
const options = {transaction: tx};
ctx.req.accessToken.userId = itBoss;
try {
const isNotParked = await models.MachineWorker.findOne({
where: {workerFk: itBoss}
}, options);
await models.MachineWorker.updateInTime(ctx, plate, options);
const isParked = await models.MachineWorker.findOne({
where: {workerFk: itBoss}
}, options);
expect(isNotParked.outTime).toBeNull();
expect(isParked.outTime).toBeDefined();
await tx.rollback();
} catch (e) {
await tx.rollback();
}
});
});
describe('equal or more than 12h', () => {
const plate = 'RE-002';
it('should set the out time and grab the machine', async() => {
const tx = await models.MachineWorker.beginTransaction({});
const options = {transaction: tx};
ctx.req.accessToken.userId = davidCharles;
const filter = {
where: {workerFk: davidCharles, machineFk: 2}
};
try {
const isNotParked = await models.MachineWorker.findOne(filter, options);
const totalBefore = await models.MachineWorker.find(null, options);
await models.MachineWorker.updateInTime(ctx, plate, options);
const isParked = await models.MachineWorker.findOne(filter, options);
const totalAfter = await models.MachineWorker.find(null, options);
expect(isNotParked.outTime).toBeNull();
expect(isParked.outTime).toBeDefined();
expect(totalAfter.length).toEqual(totalBefore.length + 1);
await tx.rollback();
} catch (e) {
await tx.rollback();
}
});
});
});

View File

@ -1,77 +0,0 @@
const UserError = require('vn-loopback/util/user-error');
module.exports = Self => {
Self.remoteMethodCtx('updateInTime', {
description: 'Updates the corresponding registry if the worker has been registered in the last few hours',
accessType: 'WRITE',
accepts: [
{
arg: 'plate',
type: 'string',
}
],
http: {
path: `/updateInTime`,
verb: 'POST'
}
});
Self.updateInTime = async(ctx, plate, options) => {
const models = Self.app.models;
const userId = ctx.req.accessToken.userId;
const $t = ctx.req.__;
let tx;
const myOptions = {};
if (typeof options == 'object')
Object.assign(myOptions, options);
if (!myOptions.transaction) {
tx = await Self.beginTransaction({});
myOptions.transaction = tx;
}
try {
const machine = await models.Machine.findOne({
fields: ['id', 'plate'],
where: {plate}
}, myOptions);
if (!machine)
throw new UserError($t('the plate does not exist', {plate}));
const machineWorker = await Self.findOne({
where: {
or: [{machineFk: machine.id}, {workerFk: userId}],
outTime: null,
}
}, myOptions);
const {maxHours} = await models.MachineWorkerConfig.findOne({fields: ['maxHours']}, myOptions);
const hoursDifference = (Date.vnNow() - machineWorker?.inTime?.getTime() ?? 0) / (60 * 60 * 1000);
if (machineWorker) {
const isHimself = userId == machineWorker.workerFk;
const isSameMachine = machine.id == machineWorker.machineFk;
if (hoursDifference < maxHours && !isHimself)
throw new UserError($t('This machine is already in use.'));
if (hoursDifference < maxHours && isHimself && !isSameMachine)
throw new UserError($t('You are already using a machine'));
await machineWorker.updateAttributes({
outTime: Date.vnNew()
}, myOptions);
}
if (!machineWorker || hoursDifference >= maxHours)
await models.MachineWorker.create({machineFk: machine.id, workerFk: userId}, myOptions);
if (tx) await tx.commit();
} catch (e) {
if (tx) await tx.rollback();
throw e;
}
};
};

View File

@ -88,12 +88,6 @@
"Machine": {
"dataSource": "vn"
},
"MachineWorker": {
"dataSource": "vn"
},
"MachineWorkerConfig": {
"dataSource": "vn"
},
"MobileAppVersionControl": {
"dataSource": "vn"
},

View File

@ -16,6 +16,10 @@
"name": {
"type": "string",
"required": true
},
"hasDailyInvoice": {
"type": "boolean",
"description": "Indicates if the autonomy has daily invoice enabled"
}
},
"relations": {
@ -40,4 +44,4 @@
"permission": "ALLOW"
}
]
}
}

View File

@ -28,6 +28,10 @@
},
"continentFk": {
"type": "number"
},
"hasDailyInvoice": {
"type": "boolean",
"description": "Indicates if the autonomy has daily invoice enabled"
}
},
"relations": {

View File

@ -16,17 +16,17 @@
"url": {
"type": "string"
},
"cookie": {
"token": {
"type": "string"
},
"username": {
"type": "string"
},
"password": {
"type": "string"
},
"expired":{
"type": "number"
}
},
"acls": [
{
"property": "*",
"accessType": "*",
"principalType": "ROLE",
"principalId": "$everyone",
"permission": "ALLOW"
}
]
}
}

View File

@ -1,18 +0,0 @@
{
"name": "MachineWorkerConfig",
"base": "VnModel",
"options": {
"mysql": {
"table": "vn.machineWorkerConfig"
}
},
"properties": {
"id": {
"type": "number",
"id": true
},
"maxHours": {
"type": "number"
}
}
}

View File

@ -1,3 +0,0 @@
module.exports = Self => {
require('../methods/machine-worker/updateInTime')(Self);
};

View File

@ -1,33 +0,0 @@
{
"name": "MachineWorker",
"base": "VnModel",
"options": {
"mysql": {
"table": "vn.machineWorker"
}
},
"properties": {
"id": {
"type": "number",
"id": true
},
"workerFk": {
"type": "number"
},
"machineFk": {
"type": "number"
},
"inTime": {
"type": "date",
"mysql": {
"columnName": "inTimed"
}
},
"outTime": {
"type": "date",
"mysql": {
"columnName": "outTimed"
}
}
}
}

View File

@ -16,6 +16,9 @@
"name": {
"type": "string",
"required": true
},
"autonomyFk": {
"type": "number"
}
},
"relations": {
@ -55,4 +58,4 @@
"permission": "ALLOW"
}
]
}
}

View File

@ -1,7 +0,0 @@
apps:
- script: ./loopback/server/server.js
name: salix-back
instances: 1
max_restarts: 0
autorestart: false
node_args: --tls-min-v1.0 --openssl-legacy-provider

View File

@ -1723,7 +1723,6 @@ INSERT INTO `ACL` VALUES (378,'OsTicket','osTicketReportEmail','WRITE','ALLOW','
INSERT INTO `ACL` VALUES (379,'Item','buyerWasteEmail','WRITE','ALLOW','ROLE','system',NULL);
INSERT INTO `ACL` VALUES (380,'Claim','claimPickupPdf','READ','ALLOW','ROLE','employee',NULL);
INSERT INTO `ACL` VALUES (381,'Claim','claimPickupEmail','WRITE','ALLOW','ROLE','claimManager',NULL);
INSERT INTO `ACL` VALUES (382,'Item','labelPdf','READ','ALLOW','ROLE','employee',NULL);
INSERT INTO `ACL` VALUES (383,'Sector','*','READ','ALLOW','ROLE','employee',NULL);
INSERT INTO `ACL` VALUES (384,'Sector','*','WRITE','ALLOW','ROLE','employee',NULL);
INSERT INTO `ACL` VALUES (385,'Route','driverRoutePdf','READ','ALLOW','ROLE','employee',NULL);

View File

@ -388,23 +388,23 @@ INSERT INTO `vn`.`contactChannel`(`id`, `name`)
(4, 'GCN Channel'),
(5, 'The Newspaper');
INSERT INTO `vn`.`client`(`id`,`name`,`fi`,`socialName`,`contact`,`street`,`city`,`postcode`,`phone`,`mobile`,`isRelevant`,`email`,`iban`,`dueDay`,`accountingAccount`,`isEqualizated`,`provinceFk`,`hasToInvoice`,`credit`,`countryFk`,`isActive`,`gestdocFk`,`quality`,`payMethodFk`,`created`,`isToBeMailed`,`contactChannelFk`,`hasSepaVnl`,`hasCoreVnl`,`hasCoreVnh`,`riskCalculated`, `hasToInvoiceByAddress`,`isTaxDataChecked`,`isFreezed`,`creditInsurance`,`isCreatedAsServed`,`hasInvoiceSimplified`,`salesPersonFk`,`isVies`,`businessTypeFk`,`typeFk`)
INSERT INTO `vn`.`client`(`id`,`name`,`fi`,`socialName`,`contact`,`street`,`city`,`postcode`,`phone`,`mobile`,`isRelevant`,`email`,`iban`,`dueDay`,`accountingAccount`,`isEqualizated`,`provinceFk`,`hasToInvoice`,`credit`,`countryFk`,`isActive`,`quality`,`payMethodFk`,`created`,`isToBeMailed`,`contactChannelFk`,`hasSepaVnl`,`hasCoreVnl`,`hasCoreVnh`,`riskCalculated`, `hasToInvoiceByAddress`,`isTaxDataChecked`,`isFreezed`,`creditInsurance`,`isCreatedAsServed`,`hasInvoiceSimplified`,`salesPersonFk`,`isVies`,`businessTypeFk`,`typeFk`)
VALUES
(1101, 'Bruce Wayne', '84612325V', 'BATMAN', 'Alfred', '1007 MOUNTAIN DRIVE, GOTHAM', 'Gotham', 46460, 1111111111, 222222222, 1, 'BruceWayne@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, NULL, 0, 0, 18, 0, 'florist','normal'),
(1102, 'Petter Parker', '87945234L', 'SPIDER MAN', 'Aunt May', '20 INGRAM STREET, QUEENS, USA', 'Gotham', 46460, 1111111111, 222222222, 1, 'PetterParker@mydomain.com', NULL, 0, 1234567890, 0, 2, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, NULL, 0, 0, 18, 0, 'florist','normal'),
(1103, 'Clark Kent', '06815934E', 'SUPER MAN', 'lois lane', '344 CLINTON STREET, APARTAMENT 3-D', 'Gotham', 46460, 1111111111, 222222222, 1, 'ClarkKent@mydomain.com', NULL, 0, 1234567890, 0, 3, 1, 0, 19, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, NULL, 0, 0, 18, 0, 'florist','normal'),
(1104, 'Tony Stark', '06089160W', 'IRON MAN', 'Pepper Potts', '10880 MALIBU POINT, 90265', 'Gotham', 46460, 1111111111, 222222222, 1, 'TonyStark@mydomain.com', NULL, 0, 1234567890, 0, 2, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, NULL, 0, 0, 18, 0, 'florist','normal'),
(1105, 'Max Eisenhardt', '251628698', 'MAGNETO', 'Rogue', 'UNKNOWN WHEREABOUTS', 'Gotham', 46460, 1111111111, 222222222, 1, 'MaxEisenhardt@mydomain.com', NULL, 0, 1234567890, 0, 3, 1, 300, 8, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, NULL, 0, 0, 18, 0, 'florist','normal'),
(1106, 'DavidCharlesHaller', '53136686Q', 'LEGION', 'Charles Xavier', 'CITY OF NEW YORK, NEW YORK, USA', 'Gotham', 46460, 1111111111, 222222222, 1, 'DavidCharlesHaller@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 0, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, NULL, 0, 0, 19, 0, 'florist','normal'),
(1107, 'Hank Pym', '09854837G', 'ANT MAN', 'Hawk', 'ANTHILL, SAN FRANCISCO, CALIFORNIA', 'Gotham', 46460, 1111111111, 222222222, 1, 'HankPym@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 0, 0, NULL, 0, 0, 19, 0, 'florist','normal'),
(1108, 'Charles Xavier', '22641921P', 'PROFESSOR X', 'Beast', '3800 VICTORY PKWY, CINCINNATI, OH 45207, USA', 'Gotham', 46460, 1111111111, 222222222, 1, 'CharlesXavier@mydomain.com', NULL, 0, 1234567890, 0, 5, 1, 300, 13, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, NULL, 0, 0, 19, 0, 'florist','normal'),
(1109, 'Bruce Banner', '16104829E', 'HULK', 'Black widow', 'SOMEWHERE IN NEW YORK', 'Gotham', 46460, 1111111111, 222222222, 1, 'BruceBanner@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 0, 0, NULL, 0, 0, 9, 0, 'florist','normal'),
(1110, 'Jessica Jones', '58282869H', 'JESSICA JONES', 'Luke Cage', 'NYCC 2015 POSTER', 'Gotham', 46460, 1111111111, 222222222, 1, 'JessicaJones@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, NULL, 0, 0, NULL, 1, 'florist','normal'),
(1111, 'Missing', NULL, 'MISSING MAN', 'Anton', 'THE SPACE, UNIVERSE FAR AWAY', 'Gotham', 46460, 1111111111, 222222222, 1, NULL, NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 0, 1, 0, NULL, 1, 0, NULL, 0, 'others','loses'),
(1112, 'Trash', NULL, 'GARBAGE MAN', 'Unknown name', 'NEW YORK CITY, UNDERGROUND', 'Gotham', 46460, 1111111111, 222222222, 1, NULL, NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, NULL, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 0, 1, 0, NULL, 1, 0, NULL, 0, 'others','loses');
(1101, 'Bruce Wayne', '84612325V', 'BATMAN', 'Alfred', '1007 MOUNTAIN DRIVE, GOTHAM', 'Gotham', 46460, 1111111111, 222222222, 1, 'BruceWayne@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, NULL, 0, 0, 18, 0, 'florist','normal'),
(1102, 'Petter Parker', '87945234L', 'SPIDER MAN', 'Aunt May', '20 INGRAM STREET, QUEENS, USA', 'Gotham', 46460, 1111111111, 222222222, 1, 'PetterParker@mydomain.com', NULL, 0, 1234567890, 0, 2, 1, 300, 1, 1, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, NULL, 0, 0, 18, 0, 'florist','normal'),
(1103, 'Clark Kent', '06815934E', 'SUPER MAN', 'lois lane', '344 CLINTON STREET, APARTAMENT 3-D', 'Gotham', 46460, 1111111111, 222222222, 1, 'ClarkKent@mydomain.com', NULL, 0, 1234567890, 0, 3, 1, 0, 19, 1, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, NULL, 0, 0, 18, 0, 'florist','normal'),
(1104, 'Tony Stark', '06089160W', 'IRON MAN', 'Pepper Potts', '10880 MALIBU POINT, 90265', 'Gotham', 46460, 1111111111, 222222222, 1, 'TonyStark@mydomain.com', NULL, 0, 1234567890, 0, 2, 1, 300, 1, 1, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, NULL, 0, 0, 18, 0, 'florist','normal'),
(1105, 'Max Eisenhardt', '251628698', 'MAGNETO', 'Rogue', 'UNKNOWN WHEREABOUTS', 'Gotham', 46460, 1111111111, 222222222, 1, 'MaxEisenhardt@mydomain.com', NULL, 0, 1234567890, 0, 3, 1, 300, 8, 1, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, NULL, 0, 0, 18, 0, 'florist','normal'),
(1106, 'DavidCharlesHaller', '53136686Q', 'LEGION', 'Charles Xavier', 'CITY OF NEW YORK, NEW YORK, USA', 'Gotham', 46460, 1111111111, 222222222, 1, 'DavidCharlesHaller@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 0, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, NULL, 0, 0, 19, 0, 'florist','normal'),
(1107, 'Hank Pym', '09854837G', 'ANT MAN', 'Hawk', 'ANTHILL, SAN FRANCISCO, CALIFORNIA', 'Gotham', 46460, 1111111111, 222222222, 1, 'HankPym@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 0, 0, NULL, 0, 0, 19, 0, 'florist','normal'),
(1108, 'Charles Xavier', '22641921P', 'PROFESSOR X', 'Beast', '3800 VICTORY PKWY, CINCINNATI, OH 45207, USA', 'Gotham', 46460, 1111111111, 222222222, 1, 'CharlesXavier@mydomain.com', NULL, 0, 1234567890, 0, 5, 1, 300, 13, 1, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 1, NULL, 0, 0, 19, 0, 'florist','normal'),
(1109, 'Bruce Banner', '16104829E', 'HULK', 'Black widow', 'SOMEWHERE IN NEW YORK', 'Gotham', 46460, 1111111111, 222222222, 1, 'BruceBanner@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 0, 0, NULL, 0, 0, 9, 0, 'florist','normal'),
(1110, 'Jessica Jones', '58282869H', 'JESSICA JONES', 'Luke Cage', 'NYCC 2015 POSTER', 'Gotham', 46460, 1111111111, 222222222, 1, 'JessicaJones@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 1, 1, 0, NULL, 0, 0, NULL, 1, 'florist','normal'),
(1111, 'Missing', NULL, 'MISSING MAN', 'Anton', 'THE SPACE, UNIVERSE FAR AWAY', 'Gotham', 46460, 1111111111, 222222222, 1, NULL, NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 0, 1, 0, NULL, 1, 0, NULL, 0, 'others','loses'),
(1112, 'Trash', NULL, 'GARBAGE MAN', 'Unknown name', 'NEW YORK CITY, UNDERGROUND', 'Gotham', 46460, 1111111111, 222222222, 1, NULL, NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, 10, 5, util.VN_CURDATE(), 1, 5, 1, 1, 1, '0000-00-00', 0, 1, 0, NULL, 1, 0, NULL, 0, 'others','loses');
INSERT INTO `vn`.`client`(`id`, `name`, `fi`, `socialName`, `contact`, `street`, `city`, `postcode`, `isRelevant`, `email`, `iban`,`dueDay`,`accountingAccount`, `isEqualizated`, `provinceFk`, `hasToInvoice`, `credit`, `countryFk`, `isActive`, `gestdocFk`, `quality`, `payMethodFk`,`created`, `isTaxDataChecked`)
SELECT id, name, CONCAT(RPAD(CONCAT(id,9),8,id),'A'), UPPER(CONCAT(name, 'Social')), CONCAT(name, 'Contact'), CONCAT(name, 'Street'), 'GOTHAM', 46460, 1, CONCAT(name,'@mydomain.com'), NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1,NULL, 10, 5, util.VN_CURDATE(), 1
INSERT INTO `vn`.`client`(`id`, `name`, `fi`, `socialName`, `contact`, `street`, `city`, `postcode`, `isRelevant`, `email`, `iban`,`dueDay`,`accountingAccount`, `isEqualizated`, `provinceFk`, `hasToInvoice`, `credit`, `countryFk`, `isActive`, `quality`, `payMethodFk`,`created`, `isTaxDataChecked`)
SELECT id, name, CONCAT(RPAD(CONCAT(id,9),8,id),'A'), UPPER(CONCAT(name, 'Social')), CONCAT(name, 'Contact'), UPPER(CONCAT(name, 'Street')), 'GOTHAM', 46460, 1, CONCAT(name,'@mydomain.com'), NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1, 10, 5, util.VN_CURDATE(), 1
FROM `account`.`role` `r`
WHERE `r`.`hasLogin` = 1;
@ -632,14 +632,21 @@ INSERT INTO vn.invoiceOutConfig
SET id = 1,
parallelism = 8;
INSERT INTO `vn`.`invoiceOutSerial` (`code`, `description`, `isTaxed`, `taxAreaFk`, `isCEE`, `type`)
INSERT INTO `vn`.`invoiceOutSerial`
(`code`,`description`, `isTaxed`, `taxAreaFk`, `isCEE`, `type`)
VALUES
('A', 'Global nacional', 1, 'NATIONAL', 0, 'global'),
('T', 'Española rapida', 1, 'NATIONAL', 0, 'quick'),
('V', 'Intracomunitaria global', 0, 'CEE', 1, 'global'),
('M', 'Múltiple nacional', 1, 'NATIONAL', 0, 'multiple'),
('R', 'Rectificativa', 1, 'NATIONAL', 0, NULL),
('E', 'Exportación rápida', 0, 'WORLD', 0, 'quick');
('A', 'Global nacional', 1, 'NATIONAL', 0, 'global'),
('T', 'Española rapida', 1, 'NATIONAL', 0, 'quick'),
('V', 'Intracomunitaria global', 0, 'CEE', 1, 'global'),
('M', 'Múltiple nacional', 1, 'NATIONAL', 0, 'multiple'),
('R', 'Rectificativa', 1, 'NATIONAL', 0, NULL),
('E', 'Exportación rápida', 0, 'WORLD', 0, 'quick'),
('H', 'Intracomunitaria rápida', 0, 'CEE', 1, 'quick'),
('P', 'Factura simplificada', 1, 'NATIONAL', 0, NULL),
('PE', 'COOPERATIE FLORAHOLLAND UA', 0, 'CEE', 1, NULL),
('S', 'Simplificada', 1, 'NATIONAL', 0, NULL),
('X', 'Exportación global', 0, 'WORLD', 0, 'global'),
('N', 'Múltiple Intracomunitaria', 0, 'CEE', 1, 'multiple');
INSERT INTO `vn`.`invoiceOut`(`id`, `serial`, `amount`, `issued`,`clientFk`, `created`, `companyFk`, `dued`, `booked`, `bankFk`, `hasPdf`)
VALUES
@ -2835,12 +2842,6 @@ INSERT INTO `vn`.`machine` (`plate`, `maker`, `model`, `warehouseFk`, `departmen
('RE-001', 'STILL', 'LTX-20', 60, 23, 'ELECTRIC TOW', 'Drag cars', 2020, 103, 442),
('RE-002', 'STILL', 'LTX-20', 60, 23, 'ELECTRIC TOW', 'Drag cars', 2020, 103, 442);
INSERT INTO `vn`.`machineWorker` (`workerFk`, `machineFk`, `inTimed`, `outTimed`)
VALUES
(1106, 1, util.VN_CURDATE(), util.VN_CURDATE()),
(1106, 1, DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL +1 DAY)),
(1106, 2, util.VN_CURDATE(), NULL),
(1106, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL + 1 DAY), DATE_ADD(util.VN_CURDATE(), INTERVAL +1 DAY));
INSERT INTO `vn`.`zoneExclusion` (`id`, `zoneFk`, `dated`, `created`, `userFk`)
VALUES
@ -2911,7 +2912,8 @@ INSERT INTO `util`.`notification` (`id`, `name`, `description`)
(6, 'book-entry-deleted', 'accounting entries deleted'),
(7, 'zone-included','An email to notify zoneCollisions'),
(8, 'backup-printer-selected','A backup printer has been selected'),
(9, 'mrw-deadline','The MRW deadline has passed');
(9, 'mrw-deadline','The MRW deadline has passed'),
(10,'invoice-ticket-closure','Tickets not invoiced during the nightly closure ticket process');
TRUNCATE `util`.`notificationAcl`;
INSERT INTO `util`.`notificationAcl` (`notificationFk`, `roleFk`)
@ -3823,8 +3825,6 @@ UPDATE vn.collection
UPDATE vn.sale
SET isPicked =FALSE;
INSERT INTO vn.machineWorkerConfig(id, maxHours)
VALUES(1, 12);
INSERT INTO vn.workerAppTester(workerFk) VALUES(66);
@ -3832,9 +3832,6 @@ INSERT INTO `vn`.`machine` (`plate`, `maker`, `model`, `warehouseFk`, `departmen
VALUES
('RE-003', 'IRON', 'JPH-24', 60, 23, 'ELECTRIC TOW', 'Drag cars', 2020, 103, 442);
INSERT INTO vn.machineWorker(workerFk,machineFk,inTimed) VALUES (104,1,'2001-01-01 10:00:00.00.000');
UPDATE vn.buy SET itemOriginalFk = 1 WHERE id = 1;
UPDATE vn.saleTracking SET stateFk = 26 WHERE id = 5;
@ -3943,9 +3940,9 @@ INSERT INTO vn.medicalReview
(id, workerFk, centerFk, `date`, `time`, isFit, amount, invoice, remark)
VALUES(3, 9, 2, '2000-01-01', '8:00', 1, 150.0, NULL, NULL);
INSERT INTO vn.stockBought (workerFk, bought, reserve, dated)
VALUES(35, 1.00, 1.00, '2001-01-01');
INSERT INTO vn.auctionConfig (id,conversionCoefficient,warehouseFk)
INSERT INTO vn.stockBought (workerFk, bought, reserve, dated)
VALUES(35, 1.00, 1.00, '2001-01-01');
INSERT INTO vn.auctionConfig (id,conversionCoefficient,warehouseFk)
VALUES (1,0.6,6);
INSERT INTO vn.payrollComponent

View File

@ -6,25 +6,27 @@ BLOCK1: BEGIN
DECLARE vShipped DATE;
DECLARE vPreviousShipped DATE;
DECLARE vDone boolean;
DECLARE cur cursor for
SELECT clientFk, firstShipped
FROM bs.clientNewBorn;
DECLARE cur CURSOR FOR
SELECT clientFk, firstShipped
FROM bs.clientNewBorn;
DECLARE continue HANDLER FOR NOT FOUND SET vDone = TRUE;
SET vDone := FALSE;
DELETE FROM bs.clientNewBorn WHERE isModified = FALSE;
INSERT INTO clientNewBorn(clientFk, firstShipped, lastShipped)
SELECT c.id, MAX(t.shipped), MAX(t.shipped)
FROM vn.client c
JOIN vn.ticket t on t.clientFk = c.id
LEFT JOIN clientNewBorn cb on cb.clientFk = c.id
WHERE t.shipped BETWEEN TIMESTAMPADD(YEAR, -1, util.VN_CURDATE()) AND util.VN_CURDATE() AND cb.isModified is null
GROUP BY c.id;
INSERT INTO clientNewBorn(clientFk, firstShipped, lastShipped)
SELECT c.id, DATE(MAX(t.shipped)), DATE(MAX(t.shipped))
FROM vn.client c
JOIN vn.ticket t ON t.clientFk = c.id
LEFT JOIN clientNewBorn cb ON cb.clientFk = c.id
WHERE t.shipped BETWEEN util.VN_CURDATE() - INTERVAL 1 YEAR
AND util.VN_CURDATE()
AND cb.isModified IS NULL
GROUP BY c.id;
OPEN cur;
LOOP1: LOOP
SET vDone := FALSE;
FETCH cur INTO vClientFk, vShipped;

View File

@ -4,5 +4,8 @@ CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `salix`.`ACL_beforeInsert`
FOR EACH ROW
BEGIN
SET NEW.editorFk = account.myUser_getId();
IF NEW.`property` = '*' THEN
CALL util.throw('The property field cannot be *');
END IF;
END$$
DELIMITER ;

View File

@ -0,0 +1,8 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`vn`@`localhost` EVENT `vn`.`itemCampaig_add`
ON SCHEDULE EVERY 1 DAY
STARTS '2024-10-18 03:00:00.000'
ON COMPLETION PRESERVE
ENABLE
DO CALL itemCampaign_add()$$
DELIMITER ;

View File

@ -0,0 +1,31 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`buy_getUltimate`(
vItemFk INT,
vWarehouseFk INT,
vDated DATE
)
RETURNS int(11)
DETERMINISTIC
BEGIN
/**
* Calcula las últimas compras realizadas hasta una fecha.
*
* @param vItemFk Id del artículo
* @param vWarehouseFk Id del almacén
* @param vDated Compras hasta fecha
* @return Id de compra
*/
DECLARE vBuyFk INT;
CALL buy_getUltimate(vItemFk, vWarehouseFk, vDated);
SELECT buyFk INTO vBuyFk
FROM tmp.buyUltimate;
DROP TEMPORARY TABLE IF EXISTS
tmp.buyUltimate,
tmp.buyUltimateFromInterval;
RETURN vBuyFk;
END$$
DELIMITER ;

View File

@ -1,23 +0,0 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`workerMachinery_isRegistered`(vWorkerFk VARCHAR(10))
RETURNS tinyint(1)
NOT DETERMINISTIC
READS SQL DATA
BEGIN
/**
* Comprueba si existen registros en las últimas horas (maxHours de machineWorkerConfig) del trabajador vWorkerFk y si tiene a nulo la hora outTimed (indica la hora que deja el vehículo)
*
* @param vWorkerFk id del trabajador
* @return Devuelve TRUE/FALSE en caso de que haya o no registros
*/
IF (SELECT COUNT(*)
FROM machineWorker m
WHERE m.workerFk = vWorkerFk
AND m.inTimed >= TIMESTAMPADD(HOUR , -(SELECT maxHours from machineWorkerConfig), util.VN_NOW()) AND ISNULL(m.outTimed))
THEN
RETURN TRUE;
ELSE
RETURN FALSE;
END IF;
END$$
DELIMITER ;

View File

@ -1,7 +1,7 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`buy_getUltimate`(
vItemFk INT,
vWarehouseFk SMALLINT,
vWarehouseFk INT,
vDated DATE
)
BEGIN

View File

@ -34,22 +34,19 @@ BEGIN
DECLARE vIsTaxDataChecked TINYINT(1);
DECLARE vHasCoreVnl BOOLEAN;
DECLARE vMandateTypeFk INT;
DECLARE vHasDailyInvoice BOOLEAN;
SELECT cc.defaultPayMethodFk,
cc.defaultDueDay,
cc.defaultCredit,
cc.defaultIsTaxDataChecked,
cc.defaultHasCoreVnl,
cc.defaultMandateTypeFk,
c.hasDailyInvoice
cc.defaultMandateTypeFk
INTO vPayMethodFk,
vDueDay,
vDefaultCredit,
vIsTaxDataChecked,
vHasCoreVnl,
vMandateTypeFk,
vHasDailyInvoice
vMandateTypeFk
FROM clientConfig cc
LEFT JOIN province p ON p.id = vProvinceFk
LEFT JOIN country c ON c.id = p.countryFk;
@ -70,8 +67,7 @@ BEGIN
credit = vDefaultCredit,
isTaxDataChecked = vIsTaxDataChecked,
hasCoreVnl = vHasCoreVnl,
isEqualizated = FALSE,
hasDailyInvoice = vHasDailyInvoice
isEqualizated = FALSE
ON duplicate KEY UPDATE
payMethodFk = vPayMethodFk,
dueDay = vDueDay,

View File

@ -37,23 +37,23 @@ BEGIN
WHERE t.id = vTicketFk;
CALL cache.available_refresh(
vCacheAvailableFk,
vCacheAvailableFk,
FALSE,
vWarehouseFk,
vWarehouseFk,
util.VN_CURDATE());
SELECT available INTO vAvailable
FROM cache.available
WHERE calc_id = vCacheAvailableFk
WHERE calc_id = vCacheAvailableFk
AND item_id = vItemFk;
IF vAvailable < vQuantity THEN
SET vHasThrow = TRUE;
ELSE
SELECT `name`,
CONCAT(getUser(), ' ', DATE_FORMAT(util.VN_NOW(), '%H:%i'), ' ', name)
CONCAT(getUser(), ' ', DATE_FORMAT(util.VN_NOW(), '%H:%i'), ' ', name)
INTO vItemName, vConcept
FROM item
FROM item
WHERE id = vItemFk;
START TRANSACTION;
@ -69,7 +69,7 @@ BEGIN
CALL sale_calculateComponent(vSaleFk, NULL);
CALL itemShelvingSale_addBySale(vSaleFk, vSectorFk);
IF NOT EXISTS (SELECT TRUE FROM itemShelvingSale WHERE saleFk = vSaleFk LIMIT 1) THEN
SET vHasThrow = TRUE;
END IF;
@ -78,13 +78,13 @@ BEGIN
IF vHasThrow THEN
CALL util.throw("There is no available for the selected item");
END IF;
IF vSaleGroupFk THEN
INSERT INTO saleGroupDetail
SET saleFk = vSaleFk,
saleGroupFk = vSaleGroupFk;
END IF;
COMMIT;
END$$
DELIMITER ;

View File

@ -0,0 +1,54 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`itemCampaign_add`()
proc: BEGIN
/**
* Añade registros a tabla itemCampaign.
*
* @param vDateFrom Fecha desde
* @param vDateTo Fecha hasta
* @param vCampaign Código de la campaña
*/
DECLARE vYesterday DATE;
DECLARE vCampaign VARCHAR(100);
DECLARE vScopeDays INT;
DECLARE vPreviousDays INT;
DECLARE vDateSumFrom DATE;
DECLARE vDateSumTo DATE;
SET vYesterday = util.yesterday();
SELECT dated, code, scopeDays, previousDays
INTO vDateSumTo, vCampaign, vScopeDays, vPreviousDays
FROM campaign
WHERE dated >= vYesterday
ORDER BY dated
LIMIT 1;
IF vCampaign IS NULL THEN
CALL util.throw('Missing data in campaign table');
END IF;
IF NOT vYesterday BETWEEN vDateSumTo - INTERVAL vPreviousDays DAY
AND vDateSumTo THEN
LEAVE proc;
END IF;
SET vDateSumFrom = vDateSumTo - INTERVAL vScopeDays DAY;
SET vDateSumTo = vDateSumTo - INTERVAL 1 DAY;
INSERT INTO itemCampaign(dated, itemFk, quantity, total, campaign)
SELECT vYesterday,
s.itemFk,
SUM(s.quantity) quantity,
SUM((s.quantity * s.price) * (100 - s.discount) / 100) total,
vCampaign
FROM sale s
JOIN ticket t ON t.id = s.ticketFk
JOIN client c ON c.id = t.clientFk
WHERE t.shipped BETWEEN vDateSumFrom AND util.dayEnd(vDateSumTo)
AND c.typeFk = 'normal'
AND NOT t.isDeleted
GROUP BY s.itemFk
HAVING quantity;
END$$
DELIMITER ;

View File

@ -18,8 +18,9 @@ proc: BEGIN
DECLARE vReservedQuantity INT;
DECLARE vOutStanding INT;
DECLARE vUserFk INT;
DECLARE vTotalReservedQuantity INT;
DECLARE vTotalReservedQuantity INT;
DECLARE vSaleQuantity INT;
DECLARE vIsRequiredTx BOOL DEFAULT NOT @@in_transaction;
DECLARE vItemShelvingAvailable CURSOR FOR
SELECT ish.id itemShelvingFk,
@ -29,7 +30,7 @@ proc: BEGIN
JOIN shelving sh ON sh.code = ish.shelvingFk
JOIN parking p ON p.id = sh.parkingFk
JOIN sector sc ON sc.id = p.sectorFk
JOIN productionConfig pc
JOIN productionConfig pc
WHERE s.id = vSaleFk
AND NOT sc.isHideForPickers
AND (sc.id = vSectorFk OR vSectorFk IS NULL)
@ -44,15 +45,15 @@ proc: BEGIN
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
DECLARE EXIT HANDLER FOR SQLEXCEPTION
BEGIN
ROLLBACK;
CALL util.tx_rollback(vIsRequiredTx);
RESIGNAL;
END;
START TRANSACTION;
CALL util.tx_start(vIsRequiredTx);
SELECT id INTO vSaleFk
FROM sale
WHERE id = vSaleFk
WHERE id = vSaleFk
FOR UPDATE;
SELECT MAX(p.pickingOrder), s.quantity - SUM(IFNULL(iss.quantity, 0)), s.quantity
@ -65,7 +66,7 @@ proc: BEGIN
WHERE s.id = vSaleFk;
IF vOutStanding <= 0 THEN
COMMIT;
CALL util.tx_commit(vIsRequiredTx);
LEAVE proc;
END IF;
@ -85,7 +86,7 @@ proc: BEGIN
IF vTotalReservedQuantity <> vSaleQuantity THEN
CALL util.debugAdd('itemShelvingSale_addBySale',
CONCAT(vSaleFk, ' - ', vSaleQuantity,' - ', vTotalReservedQuantity,'-', vOutStanding,'-', account.myUser_getId()));
UPDATE sale
SET quantity = vTotalReservedQuantity
WHERE id = vSaleFk;
@ -93,7 +94,7 @@ proc: BEGIN
LEAVE l;
END IF;
SELECT id INTO vItemShelvingFk
SELECT id INTO vItemShelvingFk
FROM itemShelving
WHERE id = vItemShelvingFk
FOR UPDATE;
@ -102,19 +103,19 @@ proc: BEGIN
SET vOutStanding = vOutStanding - vReservedQuantity;
IF vReservedQuantity > 0 THEN
CALL util.debugAdd('itemShelvingSale_addBySale_reservedQuantity',
CONCAT(vSaleFk, ' - ', vReservedQuantity, ' - ', vOutStanding, account.myUser_getId()));
INSERT INTO itemShelvingSale(
itemShelvingFk,
saleFk,
quantity,
userFk,
isPicked)
SELECT vItemShelvingFk,
vSaleFk,
vReservedQuantity,
vUserFk,
FALSE;
CALL util.debugAdd('itemShelvingSale_addBySale_reservedQuantity',
CONCAT(vSaleFk, ' - ', vReservedQuantity, ' - ', vOutStanding, account.myUser_getId()));
INSERT INTO itemShelvingSale(
itemShelvingFk,
saleFk,
quantity,
userFk,
isPicked)
SELECT vItemShelvingFk,
vSaleFk,
vReservedQuantity,
vUserFk,
FALSE;
UPDATE itemShelving
SET available = available - vReservedQuantity
@ -123,6 +124,6 @@ proc: BEGIN
END IF;
END LOOP;
CLOSE vItemShelvingAvailable;
COMMIT;
CALL util.tx_commit(vIsRequiredTx);
END$$
DELIMITER ;

View File

@ -24,6 +24,7 @@ BEGIN
CALL cache.available_refresh(vAvailableCalcFk, FALSE, vWarehouseFk, vDated);
CALL cache.visible_refresh(vVisibleCalcFk, FALSE, vWarehouseFk);
CALL buy_getUltimate(NULL, vWarehouseFk, vDated);
WITH itemTags AS (
SELECT i.id,
@ -74,14 +75,13 @@ BEGIN
AND a.calc_id = vAvailableCalcFk
LEFT JOIN cache.visible v ON v.item_id = i.id
AND v.calc_id = vVisibleCalcFk
LEFT JOIN cache.last_buy lb ON lb.item_id = i.id
AND lb.warehouse_id = vWarehouseFk
LEFT JOIN tmp.buyUltimate bu ON bu.itemFk = i.id
LEFT JOIN vn.itemProposal ip ON ip.mateFk = i.id
AND ip.itemFk = vSelf
LEFT JOIN vn.itemTag it ON it.itemFk = i.id
AND it.priority = vPriority
LEFT JOIN vn.tag t ON t.id = it.tagFk
LEFT JOIN vn.buy b ON b.id = lb.buy_id
LEFT JOIN vn.buy b ON b.id = bu.buyFk
JOIN itemTags its
WHERE a.available > 0
AND (i.typeFk = its.typeFk OR NOT vShowType)
@ -98,5 +98,7 @@ BEGIN
(i.tag8 = its.tag8) DESC,
match8 DESC
LIMIT 100;
DROP TEMPORARY TABLE tmp.buyUltimate;
END$$
DELIMITER ;

View File

@ -1,22 +0,0 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`machineWorker_add`(vPlate VARCHAR(10), vWorkerFk INT)
BEGIN
/**
* Inserta registro si el vWorkerFk no ha registrado nada en las últimas 12 horas
* @param vPlate número de matrícula
* @param vWorkerFk id del worker
*
*/
UPDATE vn.machineWorker mw
JOIN vn.machine m ON m.id = mw.machineFk
SET mw.outTimed = util.VN_NOW()
WHERE (mw.workerFk = vWorkerFk OR m.plate = vPlate)
AND ISNULL(mw.outTimed);
INSERT INTO machineWorker (machineFk, workerFk)
SELECT m.id, vWorkerFk
FROM machine m
WHERE m.plate= vPlate;
END$$
DELIMITER ;

View File

@ -1,21 +0,0 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`machineWorker_getHistorical`(vPlate VARCHAR(20), vWorkerFk INT)
BEGIN
/**
* Obtiene historial de la matrícula vPlate que el trabajador vWorkerFk escanea,
* si es jefe de producción muestra el historial completo.
*
* @param vPlate número de matrícula
* @param vWorkerFk id del trabajador
*
*/
DECLARE vWorkerName VARCHAR(255) DEFAULT account.user_getNameFromId(vWorkerFk);
SELECT mw.inTimed,account.user_getNameFromId(mw.workerFk) as workerName, mw.outTimed
FROM machineWorker mw
JOIN machine m ON m.plate = vPlate
WHERE mw.machineFk = m.id
AND mw.workerFk = IF(account.user_hasRole(vWorkerName, 'coolerAssist'), mw.workerFk, vWorkerFk)
ORDER BY mw.inTimed DESC;
END$$
DELIMITER ;

View File

@ -1,38 +0,0 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`machineWorker_update`(vPlate VARCHAR(10), vWorkerFk INT)
BEGIN
/**
* Actualiza el registro correspondiente si el vWorkerFk se ha registrado en las últimas horas (campo maxHours de machineWorkerConfig) con vPlate,
*
* @param vPlate número de matrícula
* @param vWorkerFk id del trabajador
*
*/
DECLARE vMachineFk INT(10);
DECLARE vMaxHours INT(10);
SELECT m.id INTO vMachineFk
FROM machine m
WHERE m.plate = vPlate;
SELECT maxHours INTO vMaxHours
FROM machineWorkerConfig;
IF (SELECT COUNT(*)
FROM machineWorker m
WHERE m.workerFk = vWorkerFk
AND m.inTimed >= TIMESTAMPADD(HOUR , -vMaxHours, util.VN_NOW()) AND ISNULL(m.outTimed)) THEN
UPDATE machineWorker m
SET m.outTimed = CURRENT_TIMESTAMP()
WHERE m.workerFk = vWorkerFk
AND m.inTimed >= TIMESTAMPADD(HOUR , -vMaxHours, util.VN_NOW())
AND ISNULL(m.outTimed)
AND m.machineFk = vMachineFk;
END IF;
END$$
DELIMITER ;

View File

@ -1,16 +0,0 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`machine_getWorkerPlate`(vWorkerFk INT)
BEGIN
/**
* Selecciona la matrícula del vehículo del workerfk
*
* @param vWorkerFk el id del trabajador
*/
SELECT m.plate
FROM machine m
JOIN machineWorker mw ON mw.machineFk = m.id
WHERE mw.inTimed >= TIMESTAMPADD(HOUR , -12,util.VN_NOW())
AND ISNULL(mw.outTimed)
AND mw.workerFk = vWorkerFk;
END$$
DELIMITER ;

View File

@ -0,0 +1,20 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`saleTracking_sectorCollectionAddPrevOK`(
vSectorCollectionFk INT
)
BEGIN
/**
* Inserta los registros de sectorCollection con el estado PREVIA OK si la reserva está picked
*
* @param vSectorCollectionFk Identificador de vn.sectorCollection
*/
REPLACE saleTracking(saleFk, isChecked, workerFk, stateFk)
SELECT sgd.saleFk, TRUE, sc.userFk, s.id
FROM sectorCollection sc
JOIN sectorCollectionSaleGroup scsg ON scsg.sectorCollectionFk = sc.id
JOIN saleGroupDetail sgd ON sgd.saleGroupFk = scsg.saleGroupFk
JOIN state s ON s.code = 'OK PREVIOUS'
JOIN itemShelvingSale iss ON iss.saleFk = sgd.saleFk
WHERE sc.id = vSectorCollectionFk AND iss.isPicked;
END$$
DELIMITER ;

View File

@ -51,7 +51,8 @@ BEGIN
origin.companyFk futureCompanyFk,
IFNULL(dest.nickname, origin.nickname) nickname,
dest.landed,
dest.preparation
dest.preparation,
origin.departmentFk
FROM (
SELECT s.ticketFk,
c.salesPersonFk workerFk,
@ -71,9 +72,11 @@ BEGIN
t.addressFk,
t.warehouseFk,
t.companyFk,
t.agencyModeFk
t.agencyModeFk,
wd.departmentFk
FROM ticket t
JOIN client c ON c.id = t.clientFk
JOIN workerDepartment wd ON wd.workerFk = c.salesPersonFk
JOIN sale s ON s.ticketFk = t.id
JOIN saleVolume sv ON sv.saleFk = s.id
JOIN item i ON i.id = s.itemFk

View File

@ -43,7 +43,7 @@ BEGIN
c.isTaxDataChecked,
t.companyFk,
t.shipped,
IFNULL(a.hasDailyInvoice, co.hasDailyInvoice),
c.hasDailyInvoice,
w.isManaged,
c.hasToInvoice
INTO vClientFk,
@ -55,9 +55,6 @@ BEGIN
vHasToInvoice
FROM ticket t
JOIN `client` c ON c.id = t.clientFk
JOIN province p ON p.id = c.provinceFk
LEFT JOIN autonomy a ON a.id = p.autonomyFk
JOIN country co ON co.id = p.countryFk
JOIN warehouse w ON w.id = t.warehouseFk
WHERE t.id = vCurTicketFk;
@ -85,7 +82,7 @@ BEGIN
IF(vHasDailyInvoice) AND vHasToInvoice THEN
SELECT invoiceSerial(vClientFk, vCompanyFk, 'quick') INTO vSerial;
IF vSerial IS NULL THEN
IF vSerial IS NULL THEN
CALL util.throw('Cannot booking without a serial');
END IF;

View File

@ -1,5 +1,7 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`ticket_getTax`(IN vTaxArea VARCHAR(25))
CREATE OR REPLACE DEFINER=`vn`@`localhost` PROCEDURE `vn`.`ticket_getTax`(
vTaxArea VARCHAR(25)
)
BEGIN
/**
* Calcula la base imponible, el IVA y el recargo de equivalencia para
@ -33,30 +35,39 @@ BEGIN
CREATE OR REPLACE TEMPORARY TABLE tmp.ticketTax
(PRIMARY KEY (ticketFk, code, rate))
ENGINE = MEMORY
SELECT * FROM (
SELECT tmpTicket.ticketFk,
bp.pgcFk,
SUM(s.quantity * s.price * (100 - s.discount) / 100 ) taxableBase,
pgc.rate,
tc.code,
bp.priority
FROM tmp.ticket tmpTicket
JOIN sale s ON s.ticketFk = tmpTicket.ticketFk
JOIN item i ON i.id = s.itemFk
JOIN ticket t ON t.id = tmpTicket.ticketFk
JOIN supplier su ON su.id = t.companyFk
WITH sales AS (
SELECT s.ticketFk,
s.itemFk,
s.quantity * s.price * (100 - s.discount) / 100 total,
t.companyFk,
t.addressFk,
su.countryFk,
ata.areaFk,
itc.taxClassFk
FROM vn.sale s
JOIN tmp.ticket tmp ON tmp.ticketFk = s.ticketFk
JOIN vn.ticket t ON t.id = s.ticketFk
JOIN vn.supplier su ON su.id = t.companyFk
JOIN tmp.addressTaxArea ata ON ata.addressFk = t.addressFk
AND ata.companyFk = t.companyFk
JOIN itemTaxCountry itc ON itc.itemFk = i.id
JOIN vn.itemTaxCountry itc ON itc.itemFk = s.itemFk
AND itc.countryFk = su.countryFk
JOIN bookingPlanner bp ON bp.countryFk = su.countryFk
AND bp.taxAreaFk = ata.areaFk
AND bp.taxClassFk = itc.taxClassFk
JOIN pgc ON pgc.code = bp.pgcFk
JOIN taxClass tc ON tc.id = bp.taxClassFk
GROUP BY tmpTicket.ticketFk, pgc.code, pgc.rate
HAVING taxableBase
) t3
HAVING total
)
SELECT s.ticketFk,
bp.pgcFk,
SUM(s.total) taxableBase,
pgc.rate,
tc.code,
bp.priority
FROM sales s
JOIN vn.bookingPlanner bp ON bp.countryFk = s.countryFk
AND bp.taxAreaFk = s.areaFk
AND bp.taxClassFk = s.taxClassFk
JOIN vn.pgc ON pgc.code = bp.pgcFk
JOIN vn.taxClass tc ON tc.id = bp.taxClassFk
GROUP BY s.ticketFk, pgc.code, pgc.rate
HAVING taxableBase
ORDER BY priority;
CREATE OR REPLACE TEMPORARY TABLE tmp.ticketServiceTax

View File

@ -3,10 +3,10 @@ CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`itemShelvingSale_afterI
AFTER INSERT ON `itemShelvingSale`
FOR EACH ROW
BEGIN
UPDATE sale s
JOIN operator o ON o.workerFk = account.myUser_getId()
SET s.isPicked = IF(o.isOnReservationMode, s.isPicked, TRUE)
WHERE id = NEW.saleFk;
JOIN sector se ON se.id = o.sectorFk
SET s.isPicked = IF(IFNULL(se.isOnReservationMode, o.isOnReservationMode), s.isPicked, TRUE)
WHERE s.id = NEW.saleFk;
END$$
DELIMITER ;

View File

@ -10,11 +10,10 @@ FROM (
`vn`.`collection` `c`
JOIN `vn`.`client` `cl` ON(`cl`.`id` = `c`.`workerFk`)
)
LEFT JOIN `vn`.`machineWorker` `mw` ON(
`mw`.`workerFk` = `c`.`workerFk`
AND `mw`.`inTimed` > `util`.`VN_CURDATE`()
JOIN `vn`.`operator` `o` ON(
`o`.`workerFk` = `c`.`workerFk`
)
)
WHERE `c`.`created` > `util`.`VN_CURDATE`()
AND `mw`.`workerFk` IS NULL
AND `o`.`machineFk` IS NULL
GROUP BY `c`.`workerFk`

View File

@ -22,7 +22,6 @@ AS SELECT `c`.`id` AS `id_cliente`,
`c`.`credit` AS `credito`,
`c`.`countryFk` AS `Id_Pais`,
`c`.`isActive` AS `activo`,
`c`.`gestdocFk` AS `gestdoc_id`,
`c`.`quality` AS `calidad`,
`c`.`payMethodFk` AS `pay_met_id`,
`c`.`created` AS `created`,

View File

@ -0,0 +1,6 @@
ALTER TABLE `vn`.`operator`
ADD COLUMN `machineFk` int(11) DEFAULT NULL,
ADD CONSTRAINT `operator_machine_FK` FOREIGN KEY (`machineFk`) REFERENCES `vn`.`machine` (`id`) ON DELETE SET NULL ON UPDATE CASCADE;
INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId)
VALUES ('Machine','*','*','ALLOW','ROLE','productionBoss');

View File

@ -0,0 +1,4 @@
ALTER TABLE vn.docuwareConfig ADD IF NOT EXISTS username varchar(100) NULL;
ALTER TABLE vn.docuwareConfig ADD IF NOT EXISTS password varchar(100) NULL;
ALTER TABLE vn.docuwareConfig ADD IF NOT EXISTS token text NULL;
ALTER TABLE vn.docuwareConfig ADD IF NOT EXISTS expired int(11) NULL;

View File

@ -0,0 +1,137 @@
CREATE TABLE IF NOT EXISTS `vn`.`itemFarmingTag` (
`id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
`name` varchar(50) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `name_UNIQUE` (`name`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT
CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
INSERT IGNORE INTO `vn`.`itemFarmingTag` (`name`) VALUES ('Enraizado');
UPDATE vn.tag
SET isFree=0,
sourceTable='itemFarmingTag'
WHERE name= 'cultivo';
CREATE TABLE IF NOT EXISTS `vn`.`itemWrappingTag` (
`id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
`name` varchar(50) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `name_UNIQUE` (`name`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT
CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
INSERT IGNORE INTO `vn`.`itemWrappingTag` (`name`) VALUES ('Bolsa');
INSERT IGNORE INTO `vn`.`itemWrappingTag` (`name`) VALUES ('Caja cartón');
INSERT IGNORE INTO `vn`.`itemWrappingTag` (`name`) VALUES ('Caja decorativa');
INSERT IGNORE INTO `vn`.`itemWrappingTag` (`name`) VALUES ('Celofán');
INSERT IGNORE INTO `vn`.`itemWrappingTag` (`name`) VALUES ('Papel kraft');
INSERT IGNORE INTO `vn`.`itemWrappingTag` (`name`) VALUES ('Plástico');
INSERT IGNORE INTO `vn`.`itemWrappingTag` (`name`) VALUES ('Variable');
UPDATE vn.tag
SET isFree=0,
sourceTable='itemWrappingTag'
WHERE name= 'Envoltorio';
CREATE TABLE IF NOT EXISTS `vn`.`itemLanguageTag` (
`id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
`name` varchar(50) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `name_UNIQUE` (`name`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT
CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
INSERT IGNORE INTO `vn`.`itemLanguageTag` (`name`) VALUES ('Castellano');
INSERT IGNORE INTO `vn`.`itemLanguageTag` (`name`) VALUES ('Catalán');
INSERT IGNORE INTO `vn`.`itemLanguageTag` (`name`) VALUES ('Euskera');
INSERT IGNORE INTO `vn`.`itemLanguageTag` (`name`) VALUES ('Francés');
INSERT IGNORE INTO `vn`.`itemLanguageTag` (`name`) VALUES ('Gallego');
INSERT IGNORE INTO `vn`.`itemLanguageTag` (`name`) VALUES ('Inglés');
INSERT IGNORE INTO `vn`.`itemLanguageTag` (`name`) VALUES ('Portugués');
UPDATE vn.tag
SET isFree=0,
sourceTable='itemLanguageTag'
WHERE name= 'Idioma';
CREATE TABLE IF NOT EXISTS `vn`.`itemStemTag` (
`id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
`name` varchar(50) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `name_UNIQUE` (`name`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT
CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
INSERT IGNORE INTO `vn`.`itemStemTag` (`name`) VALUES ('Natural');
INSERT IGNORE INTO `vn`.`itemStemTag` (`name`) VALUES ('Seminatural');
INSERT IGNORE INTO `vn`.`itemStemTag` (`name`) VALUES ('Sintético');
UPDATE vn.tag
SET isFree=0,
sourceTable='itemStemTag'
WHERE name= 'Tronco';
CREATE TABLE IF NOT EXISTS `vn`.`itemBreederTag` (
`id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
`name` varchar(50) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `name_UNIQUE` (`name`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT
CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
INSERT IGNORE INTO `vn`.`itemBreederTag` (`name`) VALUES ('David Austin');
UPDATE vn.tag
SET isFree=0,
sourceTable='itemBreederTag'
WHERE name= 'Obtentor';
CREATE TABLE IF NOT EXISTS `vn`.`itemBaseTag` (
`id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
`name` varchar(50) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `name_UNIQUE` (`name`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT
CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
INSERT IGNORE INTO `vn`.`itemBaseTag` (`name`) VALUES ('Biodegradable');
INSERT IGNORE INTO `vn`.`itemBaseTag` (`name`) VALUES ('Caballete');
INSERT IGNORE INTO `vn`.`itemBaseTag` (`name`) VALUES ('Cerámica');
INSERT IGNORE INTO `vn`.`itemBaseTag` (`name`) VALUES ('Cristal');
INSERT IGNORE INTO `vn`.`itemBaseTag` (`name`) VALUES ('Plástico por inyección');
INSERT IGNORE INTO `vn`.`itemBaseTag` (`name`) VALUES ('Madera');
INSERT IGNORE INTO `vn`.`itemBaseTag` (`name`) VALUES ('Plástico');
INSERT IGNORE INTO `vn`.`itemBaseTag` (`name`) VALUES ('Rígido');
INSERT IGNORE INTO `vn`.`itemBaseTag` (`name`) VALUES ('Ruedas');
INSERT IGNORE INTO `vn`.`itemBaseTag` (`name`) VALUES ('Sin soporte rígido');
UPDATE vn.tag
SET isFree=0,
sourceTable='itemBaseTag'
WHERE name= 'Soporte';
CREATE TABLE IF NOT EXISTS `vn`.`itemVatRateTag` (
`id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
`name` varchar(50) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `name_UNIQUE` (`name`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT
CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
INSERT IGNORE INTO `vn`.`itemVatRateTag` (`name`) VALUES ('General');
INSERT IGNORE INTO `vn`.`itemVatRateTag` (`name`) VALUES ('Reducido');
UPDATE vn.tag
SET isFree=0,
sourceTable='itemVatRateTag'
WHERE name= 'Tipo de IVA';
GRANT SELECT, UPDATE, INSERT, DELETE ON TABLE vn.itemFarmingTag TO logisticAssist;
GRANT SELECT, UPDATE, INSERT, DELETE ON TABLE vn.itemWrappingTag TO logisticAssist;
GRANT SELECT, UPDATE, INSERT, DELETE ON TABLE vn.itemLanguageTag TO logisticAssist;
GRANT SELECT, UPDATE, INSERT, DELETE ON TABLE vn.itemStemTag TO logisticAssist;
GRANT SELECT, UPDATE, INSERT, DELETE ON TABLE vn.itemWrappingTag TO logisticAssist;
GRANT SELECT, UPDATE, INSERT, DELETE ON TABLE vn.itemBaseTag TO logisticAssist;
GRANT SELECT, UPDATE, INSERT, DELETE ON TABLE vn.itemBreederTag TO logisticAssist;

View File

@ -0,0 +1,13 @@
UPDATE `vn`.`client` c
JOIN `vn`.`country` co ON co.id=c.countryFk
SET c.hasDailyInvoice = co.hasDailyInvoice
WHERE co.hasDailyInvoice IS NOT NULL
AND c.hasDailyInvoice = FALSE;
UPDATE `vn`.`client` c
JOIN `vn`.`province` p ON p.id=c.provinceFk
JOIN `vn`.`autonomy` a ON a.id = p.autonomyFk
SET c.hasDailyInvoice = a.hasDailyInvoice
WHERE a.hasDailyInvoice IS NOT NULL
AND c.hasDailyInvoice = FALSE;

View File

@ -0,0 +1,25 @@
CREATE TABLE IF NOT EXISTS `vn`.`itemCampaign` (
`id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT,
dated date NOT NULL,
itemFk int(11) NOT NULL,
quantity decimal(10,2) NOT NULL,
total decimal(10,2) NOT NULL,
campaign varchar(100) NOT NULL,
UNIQUE KEY `itemCampaign_UNIQUE` (`dated`,`itemFk`),
CONSTRAINT itemCampaign_item_FK FOREIGN KEY (itemFk) REFERENCES vn.item(id) ON DELETE RESTRICT ON UPDATE CASCADE
)
ENGINE=InnoDB
DEFAULT CHARSET=utf8mb3
COLLATE=utf8mb3_unicode_ci
COMMENT='Tallos confirmados por día en los días de más producción de una campaña. La tabla está pensada para que sea una foto.';
ALTER TABLE vn.campaign
ADD previousDays int(10) unsigned DEFAULT 30 NOT NULL COMMENT 'Días previos para calcular e insertar en la tabla itemCampaign';
UPDATE vn.campaign
SET previousDays = 90
WHERE code = 'allSaints';
UPDATE vn.campaign
SET previousDays = 60
WHERE code IN ('valentinesDay', 'mothersDay');

View File

@ -0,0 +1 @@
ALTER TABLE vn.client CHANGE gestdocFk gestdocFk__ int(11) DEFAULT NULL NULL COMMENT '@deprecated 2024-10-17';

View File

@ -0,0 +1,3 @@
DELETE FROM `salix`.`ACL`
WHERE `model` = 'Worker'
AND `property` IN ('find', 'findById', 'findOne');

View File

@ -0,0 +1,3 @@
DELETE FROM salix.ACL
WHERE property = 'labelPdf'
AND model = 'Item';

View File

@ -0,0 +1,9 @@
USE vn;
RENAME TABLE machineWorker TO machineWorker__;
ALTER TABLE machineWorker__ COMMENT = '@deprecated 2024-10-23 not used';
RENAME TABLE machineWorkerConfig TO machineWorkerConfig__;
ALTER TABLE machineWorkerConfig__ COMMENT = '@deprecated 2024-10-23 not used';
DELETE FROM salix.ACL WHERE model = 'MachineWorker';

View File

@ -0,0 +1,3 @@
INSERT INTO vn.report (name, `method`)
VALUES ('LabelItemBarcode','Items/{id}/label-barcode-pdf'),
('LabelItemQr','Items/{id}/label-qr-pdf');

View File

@ -240,5 +240,6 @@
"There is already a tray with the same height": "There is already a tray with the same height",
"The height must be greater than 50cm": "The height must be greater than 50cm",
"The maximum height of the wagon is 200cm": "The maximum height of the wagon is 200cm",
"The quantity claimed cannot be greater than the quantity of the line": "The quantity claimed cannot be greater than the quantity of the line"
"The quantity claimed cannot be greater than the quantity of the line": "The quantity claimed cannot be greater than the quantity of the line",
"There are tickets for this area, delete them first": "There are tickets for this area, delete them first"
}

View File

@ -350,6 +350,7 @@
"Cmr file does not exist": "El archivo del cmr no existe",
"You are not allowed to modify the alias": "No estás autorizado a modificar el alias",
"The address of the customer must have information about Incoterms and Customs Agent": "El consignatario del cliente debe tener informado Incoterms y Agente de aduanas",
"No invoice series found for these parameters": "No se encontró una serie para estos parámetros",
"The line could not be marked": "La linea no puede ser marcada",
"Through this procedure, it is not possible to modify the password of users with verified email": "Mediante este procedimiento, no es posible modificar la contraseña de usuarios con correo verificado",
"They're not your subordinate": "No es tu subordinado/a.",
@ -382,5 +383,7 @@
"This buyer has already made a reservation for this date": "Este comprador ya ha hecho una reserva para esta fecha",
"No valid travel thermograph found": "No se encontró un termógrafo válido",
"The quantity claimed cannot be greater than the quantity of the line": "La cantidad reclamada no puede ser mayor que la cantidad de la línea",
"type cannot be blank": "Se debe rellenar el tipo"
"type cannot be blank": "Se debe rellenar el tipo",
"There are tickets for this area, delete them first": "Hay tickets para esta sección, borralos primero",
"There is no company associated with that warehouse": "No hay ninguna empresa asociada a ese almacén"
}

View File

@ -350,6 +350,7 @@
"Cmr file does not exist": "Le fichier cmr n'existe pas",
"You are not allowed to modify the alias": "Vous n'êtes pas autorisé à modifier l'alias",
"The address of the customer must have information about Incoterms and Customs Agent": "L'adresse du client doit contenir des informations sur les Incoterms et l'agent des douanes",
"No invoice series found for these parameters": "Aucune série de facture trouvée pour ces paramètres",
"The line could not be marked": "La ligne ne peut pas être marquée",
"This password can only be changed by the user themselves": "Ce mot de passe ne peut être modifié que par l'utilisateur lui-même",
"They're not your subordinate": "Ce n'est pas votre subordonné.",

View File

@ -350,6 +350,7 @@
"Cmr file does not exist": "O arquivo CMR não existe",
"You are not allowed to modify the alias": "Você não tem permissão para modificar o alias",
"The address of the customer must have information about Incoterms and Customs Agent": "O endereço do cliente deve ter informações sobre Incoterms e Agente Aduaneiro",
"No invoice series found for these parameters": "Nenhuma série de fatura encontrada para esses parâmetros",
"The line could not be marked": "A linha não pôde ser marcada",
"This password can only be changed by the user themselves": "Esta senha só pode ser alterada pelo próprio usuário",
"They're not your subordinate": "Eles não são seus subordinados.",

View File

@ -85,16 +85,11 @@ module.exports = Self => {
const updatedClaim = await claim.updateAttributes(args, myOptions);
const salesPerson = claim.client().salesPersonUser();
if (salesPerson) {
if (changedPickup && updatedClaim.pickup)
await notifyPickUp(ctx, salesPerson.id, claim);
if (args.claimStateFk) {
const newState = await models.ClaimState.findById(args.claimStateFk, null, myOptions);
await notifyStateChange(ctx, salesPerson.id, claim, newState.description);
if (newState.code == 'canceled')
await notifyStateChange(ctx, claim.workerFk, claim, newState.description);
}
if (salesPerson && args.claimStateFk) {
const newState = await models.ClaimState.findById(args.claimStateFk, null, myOptions);
await notifyStateChange(ctx, salesPerson.id, claim, newState.description);
if (newState.code == 'canceled')
await notifyStateChange(ctx, claim.workerFk, claim, newState.description);
}
if (tx) await tx.commit();
@ -119,18 +114,4 @@ module.exports = Self => {
});
await models.Chat.sendCheckingPresence(ctx, workerId, message);
}
async function notifyPickUp(ctx, workerId, claim) {
const models = Self.app.models;
const url = await models.Url.getUrl();
const $t = ctx.req.__; // $translate
const message = $t('Claim will be picked', {
claimId: claim.id,
clientName: claim.client().name,
claimUrl: `${url}claim/${claim.id}/summary`,
claimPickup: $t(claim.pickup)
});
await models.Chat.sendCheckingPresence(ctx, workerId, message);
}
};

View File

@ -43,6 +43,23 @@ module.exports = function(Self) {
};
try {
const province = await models.Province.findOne({
where: {id: data.provinceFk},
fields: ['autonomyFk']
});
const autonomy = province ? await models.Autonomy.findOne({
where: {id: province.autonomyFk},
fields: ['hasDailyInvoice']
}) : null;
const country = await models.Country.findOne({
where: {id: data.countryFk},
fields: ['hasDailyInvoice']
});
const hasDailyInvoice = (autonomy?.hasDailyInvoice ?? country?.hasDailyInvoice) || false;
const account = await models.VnUser.create(user, myOptions);
const client = await Self.create({
id: account.id,
@ -57,7 +74,8 @@ module.exports = function(Self) {
provinceFk: data.provinceFk,
countryFk: data.countryFk,
isEqualizated: data.isEqualizated,
businessTypeFk: data.businessTypeFk
businessTypeFk: data.businessTypeFk,
hasDailyInvoice: hasDailyInvoice
}, myOptions);
const address = await models.Address.create({

View File

@ -1,67 +1,78 @@
const models = require('vn-loopback/server/server').models;
describe('Client Create', () => {
const newAccount = {
userName: 'deadpool',
email: 'deadpool@marvel.com',
fi: '16195279J',
name: 'Wade',
socialName: 'DEADPOOL MARVEL',
street: 'WALL STREET',
city: 'New York',
businessTypeFk: 'florist',
provinceFk: 1
};
const newAccountWithoutEmail = JSON.parse(JSON.stringify(newAccount));
delete newAccountWithoutEmail.email;
let options;
let tx;
beforeAll.mockLoopBackContext();
it(`should not find deadpool as he's not created yet`, async() => {
const tx = await models.Client.beginTransaction({});
beforeEach(async() => {
tx = await models.Client.beginTransaction({});
options = {transaction: tx};
});
afterEach(async() => await tx.rollback());
it('should not find deadpool as he is not created yet', async() => {
try {
const options = {transaction: tx};
const account = await models.VnUser.findOne({where: {name: 'deadpool'}}, options);
const client = await models.Client.findOne({where: {name: 'Wade'}}, options);
const account = await models.VnUser.findOne({where: {name: newAccount.userName}}, options);
const client = await models.Client.findOne({where: {name: newAccount.name}}, options);
expect(account).toEqual(null);
expect(client).toEqual(null);
await tx.rollback();
expect(account).toBeNull();
expect(client).toBeNull();
} catch (e) {
await tx.rollback();
throw e;
}
});
it('should not create a new account', async() => {
const tx = await models.Client.beginTransaction({});
it('should throw an error when creating a new account without email', async() => {
let error;
const newAccountWithoutEmail = {
userName: 'deadpool',
fi: '16195279J',
name: 'Wade',
socialName: 'DEADPOOL MARVEL',
street: 'WALL STREET',
city: 'New York',
businessTypeFk: 'florist',
provinceFk: 1
};
try {
const options = {transaction: tx};
await models.Client.createWithUser(newAccountWithoutEmail, options);
await tx.rollback();
} catch (e) {
error = e.message;
await tx.rollback();
error = e;
}
expect(error).toEqual(`An email is necessary`);
expect(error.message).toEqual('An email is necessary');
});
it('should create a new account', async() => {
const tx = await models.Client.beginTransaction({});
it('should create a new account with dailyInvoice', async() => {
const newAccount = {
userName: 'deadpool',
email: 'deadpool@marvel.com',
fi: '16195279J',
name: 'Wade',
socialName: 'DEADPOOL MARVEL',
street: 'WALL STREET',
city: 'New York',
businessTypeFk: 'florist',
provinceFk: 1
};
try {
const options = {transaction: tx};
const province = await models.Province.findById(newAccount.provinceFk, {
fields: ['id', 'name', 'autonomyFk'],
include: {
relation: 'autonomy'
}
}, options);
const client = await models.Client.createWithUser(newAccount, options);
const account = await models.VnUser.findOne({where: {name: newAccount.userName}}, options);
expect(province.autonomy().hasDailyInvoice).toBeTruthy();
expect(account.name).toEqual(newAccount.userName);
expect(client.id).toEqual(account.id);
expect(client.name).toEqual(newAccount.name);
@ -69,8 +80,38 @@ describe('Client Create', () => {
expect(client.fi).toEqual(newAccount.fi);
expect(client.socialName).toEqual(newAccount.socialName);
expect(client.businessTypeFk).toEqual(newAccount.businessTypeFk);
expect(client.hasDailyInvoice).toBeTruthy();
} catch (e) {
await tx.rollback();
throw e;
}
});
it('should create a new account without dailyInvoice', async() => {
const newAccount = {
userName: 'deadpool',
email: 'deadpool@marvel.com',
fi: '16195279J',
name: 'Wade',
socialName: 'DEADPOOL MARVEL',
street: 'WALL STREET',
city: 'New York',
businessTypeFk: 'florist',
provinceFk: 3
};
try {
const province = await models.Province.findById(newAccount.provinceFk, {
fields: ['id', 'name', 'autonomyFk'],
include: {
relation: 'autonomy'
}
}, options);
const client = await models.Client.createWithUser(newAccount, options);
expect(province.autonomy.hasDailyInvoice).toBeFalsy();
expect(client.hasDailyInvoice).toBeFalsy();
} catch (e) {
await tx.rollback();
throw e;
@ -78,26 +119,25 @@ describe('Client Create', () => {
});
it('should not be able to create a user if exists', async() => {
const tx = await models.Client.beginTransaction({});
let error;
const newAccount = {
userName: 'deadpool',
email: 'deadpool@marvel.com',
fi: '16195279J',
name: 'Wade',
socialName: 'DEADPOOL MARVEL',
street: 'WALL STREET',
city: 'New York',
businessTypeFk: 'florist',
provinceFk: 1
};
try {
const options = {transaction: tx};
await models.Client.createWithUser(newAccount, options);
const client = await models.Client.createWithUser(newAccount, options);
expect(client).toBeNull();
await tx.rollback();
await models.Client.createWithUser(newAccount, options);
} catch (e) {
await tx.rollback();
error = e;
}
const errorName = error.details.codes.name[0];
expect(errorName).toEqual('uniqueness');
expect(error.message).toContain('already exists');
});
});

View File

@ -74,7 +74,8 @@ module.exports = Self => {
pm.name payMethod,
r.finished IS NULL hasRecovery,
dp.id departmentFk,
dp.name departmentName
dp.name departmentName,
dp.notificationEmail departmentEmail
FROM defaulter d
JOIN client c ON c.id = d.clientFk
JOIN country cn ON cn.id = c.countryFk

View File

@ -47,7 +47,7 @@ module.exports = Self => {
await models.Mail.create({
subject: $t('Comment added to client', {clientFk: defaulter.clientFk}),
body: body,
receiver: `${defaulter.salesPersonName}@verdnatura.es`,
receiver: `${defaulter.departmentEmail}`,
replyTo: `${user.name}@verdnatura.es`
}, myOptions);
}

View File

@ -37,7 +37,7 @@ module.exports = Self => {
const tickets = await models.Ticket.find({
where: {refFk: invoiceOut.ref}
}, myOptions);
const [bookEntry] = await models.Xdiario.find({
where: {
SERIE: invoiceOut.ref[0],
@ -55,13 +55,13 @@ module.exports = Self => {
if (bookEntry) {
if (bookEntry.enlazadoSage) {
const params = {
bookEntry: bookEntry.ASIEN,
bookEntry: bookEntry.ASIEN,
invoiceOutRef: invoiceOut.ref
}
};
await Self.rawSql(`SELECT util.notification_send('book-entry-deleted', ?, NULL)`,
[JSON.stringify(params)],
myOptions);
};
}
await models.Xdiario.destroyAll({
ASIEN: bookEntry.ASIEN

View File

@ -48,13 +48,13 @@ module.exports = Self => {
let stmt;
stmts.push(new ParameterizedSQL(
`CREATE OR REPLACE TEMPORARY TABLE tmp.ticket
(KEY (ticketFk))
(INDEX (ticketFk))
ENGINE = MEMORY
SELECT id ticketFk
FROM ticket t
FROM ticket
WHERE shipped BETWEEN ? AND util.dayEnd(?)
AND refFk IS NULL`, [args.from, args.to]));
stmts.push(`CALL vn.ticket_getTax(NULL)`);
stmts.push(`CALL ticket_getTax(NULL)`);
stmts.push(new ParameterizedSQL(
`CREATE OR REPLACE TEMPORARY TABLE tmp.filter
ENGINE = MEMORY
@ -71,12 +71,12 @@ module.exports = Self => {
c.isTaxDataChecked,
w.id comercialId,
u.name workerName
FROM vn.ticket t
JOIN vn.company co ON co.id = t.companyFk
JOIN vn.sale s ON s.ticketFk = t.id
JOIN vn.client c ON c.id = t.clientFk
JOIN vn.country cou ON cou.id = c.countryFk
LEFT JOIN vn.worker w ON w.id = c.salesPersonFk
FROM ticket t
JOIN company co ON co.id = t.companyFk
JOIN sale s ON s.ticketFk = t.id
JOIN client c ON c.id = t.clientFk
JOIN country cou ON cou.id = c.countryFk
LEFT JOIN worker w ON w.id = c.salesPersonFk
JOIN account.user u ON u.id = w.id
LEFT JOIN (
SELECT ticketFk, taxableBase

View File

@ -79,6 +79,8 @@ module.exports = Self => {
type
],
myOptions);
if (!serial)
throw new UserError('No invoice series found for these parameters');
const invoiceOutSerial = await Self.app.models.InvoiceOutSerial.findById(serial);
if (invoiceOutSerial?.taxAreaFk == 'WORLD') {

View File

@ -1,6 +1,6 @@
module.exports = Self => {
Self.remoteMethodCtx('labelPdf', {
description: 'Returns the item label pdf',
Self.remoteMethodCtx('labelBarcodePdf', {
description: 'Returns the item label pdf with barcode',
accessType: 'READ',
accepts: [
{
@ -9,28 +9,24 @@ module.exports = Self => {
required: true,
description: 'The item id',
http: {source: 'path'}
},
{
arg: 'recipientId',
type: 'number',
description: 'The recipient id',
required: false
},
{
}, {
arg: 'warehouseId',
type: 'number',
description: 'The warehouse id',
required: true
},
{
arg: 'labelNumber',
}, {
arg: 'packing',
type: 'number',
required: false
},
{
arg: 'totalLabels',
}, {
arg: 'copies',
type: 'number',
required: false
}, {
arg: 'userId',
type: 'number',
description: 'The user id from accessToken',
http: ctx => ctx.req.accessToken.userId,
required: true
}
],
returns: [
@ -49,11 +45,11 @@ module.exports = Self => {
}
],
http: {
path: '/:id/label-pdf',
path: '/:id/label-barcode-pdf',
verb: 'GET'
},
accessScopes: ['DEFAULT', 'read:multimedia']
});
Self.labelPdf = (ctx, id) => Self.printReport(ctx, id, 'item-label');
Self.labelBarcodePdf = (ctx, id) => Self.printReport(ctx, id, 'item-label-barcode');
};

View File

@ -0,0 +1,55 @@
module.exports = Self => {
Self.remoteMethodCtx('labelQrPdf', {
description: 'Returns the item label pdf with qr',
accessType: 'READ',
accepts: [
{
arg: 'id',
type: 'number',
required: true,
description: 'The item id',
http: {source: 'path'}
}, {
arg: 'warehouseId',
type: 'number',
required: true
}, {
arg: 'packing',
type: 'number',
required: false
}, {
arg: 'copies',
type: 'number',
required: false
}, {
arg: 'userId',
type: 'number',
description: 'The user id from accessToken',
http: ctx => ctx.req.accessToken.userId,
required: true
}
],
returns: [
{
arg: 'body',
type: 'file',
root: true
}, {
arg: 'Content-Type',
type: 'String',
http: {target: 'header'}
}, {
arg: 'Content-Disposition',
type: 'String',
http: {target: 'header'}
}
],
http: {
path: '/:id/label-qr-pdf',
verb: 'GET'
},
accessScopes: ['DEFAULT', 'read:multimedia']
});
Self.labelQrPdf = (ctx, id) => Self.printReport(ctx, id, 'item-label-qr');
};

View File

@ -15,7 +15,8 @@ module.exports = Self => {
require('../methods/item/getWasteByItem')(Self);
require('../methods/item/createIntrastat')(Self);
require('../methods/item/buyerWasteEmail')(Self);
require('../methods/item/labelPdf')(Self);
require('../methods/item/labelBarcodePdf')(Self);
require('../methods/item/labelQrPdf')(Self);
require('../methods/item/setVisibleDiscard')(Self);
require('../methods/item/get')(Self);

View File

@ -11,26 +11,26 @@
<vn-card class="vn-pa-lg">
<vn-vertical>
<vn-textfield
label="Code"
label="Code"
ng-model="$ctrl.itemType.code"
rule
vn-focus>
</vn-textfield>
<vn-textfield
label="Name"
label="Name"
ng-model="$ctrl.itemType.name"
rule>
</vn-textfield>
<vn-autocomplete
label="Worker"
label="Worker"
ng-model="$ctrl.itemType.workerFk"
url="Workers"
show-field="firstName"
url="Workers/search"
show-field="nickname"
value-field="id"
rule>
</vn-autocomplete>
<vn-autocomplete
label="Category"
label="Category"
ng-model="$ctrl.itemType.categoryFk"
url="ItemCategories"
show-field="name"
@ -38,7 +38,7 @@
rule>
</vn-autocomplete>
<vn-autocomplete
label="Temperature"
label="Temperature"
ng-model="$ctrl.itemType.temperatureFk"
url="Temperatures"
show-field="name"
@ -59,4 +59,4 @@
ng-click="watcher.loadOriginalData()">
</vn-button>
</vn-button-bar>
</form>
</form>

View File

@ -12,26 +12,26 @@
<vn-card class="vn-pa-lg">
<vn-vertical>
<vn-textfield
label="Code"
label="Code"
ng-model="$ctrl.itemType.code"
rule
vn-focus>
</vn-textfield>
<vn-textfield
label="Name"
label="Name"
ng-model="$ctrl.itemType.name"
rule>
</vn-textfield>
<vn-autocomplete
label="Worker"
label="Worker"
ng-model="$ctrl.itemType.workerFk"
url="Workers"
show-field="firstName"
url="Workers/search"
show-field="nickname"
value-field="id"
rule>
</vn-autocomplete>
<vn-autocomplete
label="Category"
label="Category"
ng-model="$ctrl.itemType.categoryFk"
url="ItemCategories"
show-field="name"
@ -39,7 +39,7 @@
rule>
</vn-autocomplete>
<vn-autocomplete
label="Temperature"
label="Temperature"
ng-model="$ctrl.itemType.temperatureFk"
url="Temperatures"
show-field="name"

View File

@ -0,0 +1,16 @@
Tickets monitor: Monitor de tickets
Clients on website: Clientes activos en la web
Recent order actions: Acciones recientes en pedidos
Search tickets: Buscar tickets
Delete selected elements: Eliminar los elementos seleccionados
All the selected elements will be deleted. Are you sure you want to continue?: Todos los elementos seleccionados serán eliminados. ¿Seguro que quieres continuar?
Component lack: Faltan componentes
Ticket too little: Ticket demasiado pequeño
Minimize/Maximize: Minimizar/Maximizar
Problems: Problemas
Theoretical: Teórica
Practical: Práctica
Preparation: Preparación
Auto-refresh: Auto-refresco
Toggle auto-refresh every 2 minutes: Conmuta el refresco automático cada 2 minutos
Is fragile: Es frágil

View File

@ -29,7 +29,7 @@ module.exports = Self => {
Object.assign(myOptions, options);
const stmt = new ParameterizedSQL(
`SELECT es.created, u.name, u.id workerFk, est.description state
`SELECT es.created, u.name, u.id workerFk, est.description state, es.isScanned
FROM vn.expeditionState es
JOIN vn.expeditionStateType est ON est.id = es.typeFk
JOIN account.user u ON u.id = es.userFk

View File

@ -31,6 +31,6 @@ module.exports = Self => {
const usesMana = departments.find(department => department.id == workerDepartment.departmentFk);
return usesMana ? true : false;
return !!usesMana;
};
};

View File

@ -59,6 +59,11 @@ module.exports = Self => {
arg: 'state',
type: 'string',
description: `Search request by request state`
},
{
arg: 'myTeam',
type: 'boolean',
description: `Team partners`
}
],
returns: {
@ -75,6 +80,8 @@ module.exports = Self => {
const conn = Self.dataSource.connector;
const userId = ctx.req.accessToken.userId;
const myOptions = {};
const models = Self.app.models;
const args = ctx.args;
if (typeof options == 'object')
Object.assign(myOptions, options);
@ -82,6 +89,21 @@ module.exports = Self => {
if (ctx.args.mine)
ctx.args.attenderFk = userId;
const teamMembersId = [];
if (args.myTeam != null) {
const worker = await models.Worker.findById(userId, {
include: {
relation: 'collegues'
}
}, myOptions);
const collegues = worker.collegues() || [];
for (let collegue of collegues)
teamMembersId.push(collegue.collegueFk);
if (teamMembersId.length == 0)
teamMembersId.push(userId);
}
let where = buildFilter(ctx.args, (param, value) => {
switch (param) {
case 'search':
@ -113,6 +135,11 @@ module.exports = Self => {
return {'w.id': value};
case 'salesPersonFk':
return {'c.salesPersonFk': value};
case 'myTeam':
if (value)
return {'tr.requesterFk': {inq: teamMembersId}};
else
return {'tr.requesterFk': {nin: teamMembersId}};
}
});

View File

@ -1,11 +1,17 @@
const UserError = require('vn-loopback/util/user-error');
const closure = require('./closure');
module.exports = Self => {
Self.remoteMethodCtx('closeAll', {
description: 'Makes the closure process from all warehouses',
accessType: 'WRITE',
accepts: [],
accepts: [
{
arg: 'options',
type: 'object',
http: {source: 'body'},
description: 'Optional parameters, including transaction.'
}
],
returns: {
type: 'object',
root: true
@ -16,21 +22,20 @@ module.exports = Self => {
}
});
Self.closeAll = async ctx => {
Self.closeAll = async(ctx, options) => {
const userId = ctx.req.accessToken.userId;
const myOptions = {userId};
if (typeof options == 'object')
Object.assign(myOptions, options);
let tx;
// IMPORTANT: Due to its high cost in production, wrapping this process in a transaction may cause timeouts.
const toDate = Date.vnNew();
toDate.setHours(0, 0, 0, 0);
toDate.setDate(toDate.getDate() - 1);
const todayMinDate = Date.vnNew();
todayMinDate.setHours(0, 0, 0, 0);
const todayMaxDate = Date.vnNew();
todayMaxDate.setHours(23, 59, 59, 59);
// Prevent closure for current day
if (toDate >= todayMinDate && toDate <= todayMaxDate)
throw new UserError('You cannot close tickets for today');
const tickets = await Self.rawSql(`
SELECT t.id,
t.clientFk,
@ -41,7 +46,7 @@ module.exports = Self => {
c.salesPersonFk,
c.isToBeMailed,
c.hasToInvoice,
co.hasDailyInvoice,
c.hasDailyInvoice,
eu.email salesPersonEmail,
t.addressFk
FROM ticket t
@ -58,12 +63,12 @@ module.exports = Self => {
AND t.shipped BETWEEN ? - INTERVAL tc.closureDaysAgo DAY AND util.dayEnd(?)
AND t.refFk IS NULL
GROUP BY t.id
`, [toDate, toDate]);
`, [toDate, toDate], myOptions);
const ticketIds = tickets.map(ticket => ticket.id);
await Self.rawSql(`
INSERT INTO util.debug (variable, value)
VALUES ('nightInvoicing', ?)
`, [ticketIds.join(',')]);
`, [ticketIds.join(',')], myOptions);
await Self.rawSql(`
WITH ticketNotInvoiceable AS(
@ -120,7 +125,7 @@ module.exports = Self => {
WHERE (al.code = 'PACKED' OR (am.code = 'refund' AND al.code <> 'delivered'))
AND t.shipped BETWEEN ? - INTERVAL tc.closureDaysAgo DAY AND util.dayEnd(?)
AND t.refFk IS NULL
AND IFNULL(a.hasDailyInvoice, co.hasDailyInvoice)
AND c.hasDailyInvoice
GROUP BY ticketFk
HAVING hasErrorToInvoice
OR hasErrorTaxDataChecked
@ -133,9 +138,9 @@ module.exports = Self => {
) SELECT IF(errors = '{"tickets": null}',
'No errors',
util.notification_send('invoice-ticket-closure', errors, NULL))
FROM ticketNotInvoiceable`, [toDate, toDate]);
FROM ticketNotInvoiceable`, [toDate, toDate], myOptions);
await closure(ctx, Self, tickets);
await closure(ctx, Self, tickets, myOptions);
await Self.rawSql(`
UPDATE ticket t
@ -150,7 +155,10 @@ module.exports = Self => {
AND al.code NOT IN ('DELIVERED', 'PACKED')
AND NOT t.packages
AND tob.id IS NULL
AND t.routeFk`, [toDate, toDate], {userId: ctx.req.accessToken.userId});
AND t.routeFk`, [toDate, toDate], myOptions);
if (tx)
await tx.commit();
return {
message: 'Success'

View File

@ -50,7 +50,7 @@ module.exports = Self => {
c.salesPersonFk,
c.isToBeMailed,
c.hasToInvoice,
co.hasDailyInvoice,
c.hasDailyInvoice,
eu.email salesPersonEmail,
t.addressFk
FROM expedition e
@ -58,8 +58,6 @@ module.exports = Self => {
JOIN ticketState ts ON ts.ticketFk = t.id
JOIN alertLevel al ON al.id = ts.alertLevel
JOIN client c ON c.id = t.clientFk
JOIN province p ON p.id = c.provinceFk
JOIN country co ON co.id = p.countryFk
LEFT JOIN account.emailUser eu ON eu.userFk = c.salesPersonFk
WHERE al.code = 'PACKED'
AND t.id = ?

View File

@ -19,9 +19,14 @@ module.exports = async function(ctx, Self, tickets, options) {
const failedtickets = [];
for (const ticket of tickets) {
try {
await Self.rawSql(`CALL util.debugAdd('invoicingTicket', ?)`, [ticket.id], {userId});
await Self.rawSql(`CALL util.debugAdd('invoicingTicket', ?)`, [ticket.id], myOptions);
await Self.app.models.InvoiceOut.getSerial(ticket.clientFk, ticket.companyFk, ticket.addressFk, 'quick');
await Self.app.models.InvoiceOut.getSerial(
ticket.clientFk,
ticket.companyFk,
ticket.addressFk,
'quick',
myOptions);
await Self.rawSql(
`CALL vn.ticket_closeByTicket(?)`,
[ticket.id],

View File

@ -228,52 +228,57 @@ module.exports = Self => {
stmt = new ParameterizedSQL(`
CREATE OR REPLACE TEMPORARY TABLE tmp.filter
(INDEX (id))
ENGINE = MEMORY
ENGINE = InnoDB
SELECT t.id,
t.shipped,
CAST(DATE(t.shipped) AS CHAR) shippedDate,
HOUR(t.shipped) shippedHour,
t.nickname,
t.refFk,
t.routeFk,
t.warehouseFk,
t.clientFk,
t.totalWithoutVat,
t.totalWithVat,
io.id invoiceOutId,
a.provinceFk,
p.name province,
w.name warehouse,
am.name agencyMode,
am.id agencyModeFk,
st.name state,
st.classColor,
wk.lastName salesPerson,
ts.stateFk stateFk,
ts.alertLevel alertLevel,
ts.code alertLevelCode,
u.name userName,
c.salesPersonFk,
z.hour zoneLanding,
HOUR(z.hour) zoneHour,
MINUTE(z.hour) zoneMinute,
z.name zoneName,
z.id zoneFk,
CAST(z.hour AS CHAR) hour,
a.nickname addressNickname
FROM ticket t
LEFT JOIN invoiceOut io ON t.refFk = io.ref
LEFT JOIN zone z ON z.id = t.zoneFk
LEFT JOIN address a ON a.id = t.addressFk
LEFT JOIN province p ON p.id = a.provinceFk
LEFT JOIN warehouse w ON w.id = t.warehouseFk
LEFT JOIN agencyMode am ON am.id = t.agencyModeFk
LEFT JOIN ticketState ts ON ts.ticketFk = t.id
LEFT JOIN state st ON st.id = ts.stateFk
LEFT JOIN client c ON c.id = t.clientFk
LEFT JOIN worker wk ON wk.id = c.salesPersonFk
LEFT JOIN account.user u ON u.id = wk.id
LEFT JOIN route r ON r.id = t.routeFk
t.shipped,
CAST(DATE(t.shipped) AS CHAR) shippedDate,
HOUR(t.shipped) shippedHour,
t.nickname,
t.refFk,
t.routeFk,
t.warehouseFk,
t.clientFk,
t.totalWithoutVat,
t.totalWithVat,
io.id invoiceOutId,
a.provinceFk,
p.name province,
w.name warehouse,
am.name agencyMode,
am.id agencyModeFk,
st.name state,
st.classColor,
wk.lastName salesPerson,
ts.stateFk stateFk,
ts.alertLevel alertLevel,
ts.code alertLevelCode,
u.name userName,
c.salesPersonFk,
z.hour zoneLanding,
HOUR(z.hour) zoneHour,
MINUTE(z.hour) zoneMinute,
z.name zoneName,
z.id zoneFk,
CAST(z.hour AS CHAR) hour,
a.nickname addressNickname,
(SELECT GROUP_CONCAT(DISTINCT i2.itemPackingTypeFk ORDER BY i2.itemPackingTypeFk SEPARATOR ',')
FROM sale s2
JOIN item i2 ON i2.id = s2.itemFk
WHERE s2.ticketFk = t.id
) AS packing
FROM ticket t
LEFT JOIN invoiceOut io ON t.refFk = io.ref
LEFT JOIN zone z ON z.id = t.zoneFk
LEFT JOIN address a ON a.id = t.addressFk
LEFT JOIN province p ON p.id = a.provinceFk
LEFT JOIN warehouse w ON w.id = t.warehouseFk
LEFT JOIN agencyMode am ON am.id = t.agencyModeFk
LEFT JOIN ticketState ts ON ts.ticketFk = t.id
LEFT JOIN state st ON st.id = ts.stateFk
LEFT JOIN client c ON c.id = t.clientFk
LEFT JOIN worker wk ON wk.id = c.salesPersonFk
LEFT JOIN account.user u ON u.id = wk.id
LEFT JOIN route r ON r.id = t.routeFk
`);
if (args.orderFk) {
@ -292,6 +297,7 @@ module.exports = Self => {
}
stmt.merge(conn.makeWhere(filter.where));
stmts.push(stmt);
stmt = new ParameterizedSQL(`

View File

@ -50,6 +50,11 @@ module.exports = Self => {
type: 'boolean',
description: 'True when lines and stock of origin are equal'
},
{
arg: 'departmentFk',
type: 'number',
description: 'Department identifier'
},
{
arg: 'filter',
type: 'object',
@ -96,6 +101,8 @@ module.exports = Self => {
};
case 'isFullMovable':
return {'f.isFullMovable': value};
case 'departmentFk':
return {'f.departmentFk': value};
}
});

View File

@ -49,9 +49,12 @@ module.exports = Self => {
where: {originalTicketFk: id}
}, myOptions);
const hasRefund = !!ticketRefunds?.length;
const allDeleted = ticketRefunds.every(refund => refund.refundTicket().isDeleted);
if (ticketRefunds?.length && !allDeleted) {
if (!hasRefund) await models.TicketRefund.destroyAll({refundTicketFk: id}, myOptions);
if (hasRefund && !allDeleted) {
const notDeleted = [];
for (const refund of ticketRefunds)
if (!refund.refundTicket().isDeleted) notDeleted.push(refund.refundTicket().id);

View File

@ -0,0 +1,54 @@
const models = require('vn-loopback/server/server').models;
const LoopBackContext = require('loopback-context');
describe('Ticket Closure - closeAll function', () => {
let ctx = {
req: {
getLocale: () => 'es',
accessToken: {userId: 1106},
headers: {origin: 'http://localhost'},
__: value => value,
},
args: {}
};
let options;
let tx;
let originalVnNew;
beforeEach(async() => {
spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({active: ctx.req});
tx = await models.Ticket.beginTransaction({});
options = {transaction: tx};
originalVnNew = Date.vnNew;
spyOn(Date, 'vnNew').and.callFake(() => {
const mockDate = originalVnNew();
mockDate.setDate(mockDate.getDate() + 1);
return mockDate;
});
});
afterEach(async() => {
if (tx)
await tx.rollback();
});
it('should set routeFk to NULL when conditions are met', async() => {
const ticketsBefore = await models.Ticket.find({
where: {
routeFk: {neq: null}
}
}, options);
await models.Ticket.closeAll(ctx, options);
const ticketsAfter = await models.Ticket.find({
where: {
id: {inq: ticketsBefore.map(ticket => ticket.id)},
routeFk: {neq: null}
}
}, options);
expect(ticketsBefore.length).toBeGreaterThan(ticketsAfter.length);
});
});

View File

@ -6,6 +6,9 @@ describe('TicketFuture getTicketsAdvance()', () => {
today.setHours(0, 0, 0, 0);
let tomorrow = Date.vnNew();
tomorrow.setDate(today.getDate() + 1);
const salesDeptId = 43;
const spain1DeptId = 95;
beforeAll.mockLoopBackContext();
it('should return the tickets passing the required data', async() => {
const tx = await models.Ticket.beginTransaction({});
@ -129,4 +132,39 @@ describe('TicketFuture getTicketsAdvance()', () => {
throw e;
}
});
it('should return the tickets matching the right department', async() => {
const tx = await models.Ticket.beginTransaction({});
try {
const options = {transaction: tx};
ctx.args = {
dateFuture: tomorrow,
dateToAdvance: today,
warehouseFk: 1,
};
await models.Ticket.updateAll({id: {inq: [12, 31]}}, {clientFk: 1}, options);
const client = await models.Client.findById(1, null, options);
await client.updateAttribute('salesPersonFk', 1, options);
const business = await models.Business.findById(1, null, options);
await business.updateAttributes({departmentFk: spain1DeptId}, options);
const saleTickets = await models.Ticket.getTicketsAdvance(ctx, options);
const filteredSaleTickets = await models.Ticket.getTicketsAdvance(
{args: {...ctx.args, departmentFk: spain1DeptId}},
options);
expect(saleTickets.length).toBeGreaterThan(filteredSaleTickets.length);
expect(saleTickets.some(ticket => ticket.departmentFk === salesDeptId)).toBeTrue();
expect(saleTickets.some(ticket => ticket.departmentFk === spain1DeptId)).toBeTrue();
expect(filteredSaleTickets.some(ticket => ticket.departmentFk === salesDeptId)).toBeFalse();
expect(filteredSaleTickets.some(ticket => ticket.departmentFk === spain1DeptId)).toBeTrue();
await tx.rollback();
} catch (e) {
await tx.rollback();
throw e;
}
});
});

View File

@ -113,5 +113,27 @@ describe('ticket setDeleted()', () => {
expect(error.message).not.toContain('Tickets with associated refunds');
});
it('should delete the refund - original ticket relation', async() => {
const tx = await models.Ticket.beginTransaction({});
try {
const options = {transaction: tx};
const ticketId = 24;
const refundTicket = await models.TicketRefund.findOne({where: {refundTicketFk: ticketId}}, options);
expect(refundTicket).toBeTruthy();
await models.Ticket.setDeleted(ctx, ticketId, options);
const removedRefundTicket = await models.TicketRefund.findOne({
where: {refundTicketFk: ticketId}},
options);
expect(removedRefundTicket).toBeNull();
await tx.rollback();
} catch (e) {
await tx.rollback();
}
});
});
});

View File

@ -1,63 +1,66 @@
{
"name": "Expedition",
"base": "VnModel",
"mixins": {
"Loggable": true
"name": "Expedition",
"base": "VnModel",
"mixins": {
"Loggable": true
},
"options": {
"mysql": {
"table": "expedition"
}
},
"properties": {
"id": {
"id": true,
"type": "number",
"description": "Identifier"
},
"options": {
"mysql": {
"table": "expedition"
}
"freightItemFk": {
"type": "number"
},
"properties": {
"id": {
"id": true,
"type": "number",
"description": "Identifier"
},
"freightItemFk": {
"type": "number"
},
"created": {
"type": "date"
},
"counter": {
"type": "number"
},
"externalId": {
"type": "string"
}
"created": {
"type": "date"
},
"relations": {
"ticket": {
"type": "belongsTo",
"model": "Ticket",
"foreignKey": "ticketFk"
},
"agencyMode": {
"type": "belongsTo",
"model": "AgencyMode",
"foreignKey": "agencyModeFk"
},
"worker": {
"type": "belongsTo",
"model": "Worker",
"foreignKey": "workerFk"
},
"packages": {
"type": "hasMany",
"model": "TicketPackaging",
"foreignKey": "ticketFk"
},
"freightItem": {
"type": "belongsTo",
"model": "Item",
"foreignKey": "freightItemFk"
},
"packaging": {
"type": "belongsTo",
"model": "Package",
"foreignKey": "packagingFk"
}
"counter": {
"type": "number"
},
"externalId": {
"type": "string"
},
"stateTypeFk": {
"type": "number"
}
},
"relations": {
"ticket": {
"type": "belongsTo",
"model": "Ticket",
"foreignKey": "ticketFk"
},
"agencyMode": {
"type": "belongsTo",
"model": "AgencyMode",
"foreignKey": "agencyModeFk"
},
"worker": {
"type": "belongsTo",
"model": "Worker",
"foreignKey": "workerFk"
},
"packages": {
"type": "hasMany",
"model": "TicketPackaging",
"foreignKey": "ticketFk"
},
"freightItem": {
"type": "belongsTo",
"model": "Item",
"foreignKey": "freightItemFk"
},
"packaging": {
"type": "belongsTo",
"model": "Package",
"foreignKey": "packagingFk"
}
}
}

View File

@ -24,13 +24,28 @@
"warehouseFk": {
"type": "number"
},
"sectorFk": {
"type": "number"
},
"labelerFk": {
"type": "number"
},
"isOnReservationMode": {
"type": "boolean",
"required": true
}
},
"machineFk": {
"type": "number"
},
"linesLimit": {
"type": "number"
},
"volumeLimit": {
"type": "number"
},
"sizeLimit": {
"type": "number"
}
},
"relations": {
"sector": {
@ -53,6 +68,11 @@
"model": "ItemPackingType",
"foreignKey": "itemPackingTypeFk",
"primaryKey": "code"
}
},
"machine": {
"type": "belongsTo",
"model": "Machine",
"foreignKey": "machineFk"
}
}
}
}

View File

@ -1,3 +1,4 @@
const UserError = require('vn-loopback/util/user-error');
module.exports = Self => {
Self.remoteMethodCtx('deleteZone', {
description: 'Delete a zone',
@ -49,26 +50,12 @@ module.exports = Self => {
}
}
};
const promises = [];
const ticketList = await models.Ticket.find(filter, myOptions);
const fixingState = await models.State.findOne({where: {code: 'FIXING'}}, myOptions);
const worker = await models.Worker.findOne({
where: {id: userId}
}, myOptions);
await models.Ticket.rawSql('UPDATE ticket SET zoneFk = NULL WHERE zoneFk = ?', [id], myOptions);
if (ticketList.length > 0)
throw new UserError('There are tickets for this area, delete them first');
for (ticket of ticketList) {
if (ticket.ticketState().alertLevel == 0) {
promises.push(models.Ticket.state(ctx, {
ticketFk: ticket.id,
stateFk: fixingState.id,
userFk: worker.id
}, myOptions));
}
}
await Promise.all(promises);
await models.Zone.destroyById(id, myOptions);
if (tx) await tx.commit();

View File

@ -8,9 +8,9 @@ describe('zone deletezone()', () => {
__: value => value
};
const ctx = {req: activeCtx};
const zoneId = 9;
const zoneId = 4;
const zoneId2 = 3;
let ticketIDs;
let originalTicketStates;
beforeAll(async() => {
spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({
@ -35,18 +35,8 @@ describe('zone deletezone()', () => {
await models.Zone.deleteZone(ctx, zoneId, options);
const updatedZone = await models.Zone.findById(zoneId, null, options);
const anUpdatedTicket = await models.Ticket.findById(ticketIDs[0], null, options);
const updatedTicketStates = await models.TicketState.find({
where: {
ticketFk: {inq: ticketIDs},
code: 'FIXING'
}
}, options);
expect(updatedZone).toBeNull();
expect(anUpdatedTicket.zoneFk).toBeNull();
expect(updatedTicketStates.length).toBeGreaterThan(originalTicketStates.length);
await tx.rollback();
} catch (e) {
@ -54,4 +44,20 @@ describe('zone deletezone()', () => {
throw e;
}
});
it('should not delete the zone if it has tickets', async() => {
const tx = await models.Zone.beginTransaction({});
let error;
try {
const options = {transaction: tx};
await models.Zone.deleteZone(ctx, zoneId2, options);
await tx.rollback();
} catch (e) {
error = e.message;
await tx.rollback();
}
expect(error).toEqual('There are tickets for this area, delete them first');
});
});

View File

@ -58,6 +58,7 @@
<th width="5%">{{$t('reference')}}</th>
<th class="number">{{$t('quantity')}}</th>
<th width="50%">{{$t('concept')}}</th>
<th width="50%">{{$t('producer')}}</th>
<th class="number" v-if="showPrices">{{$t('price')}}</th>
<th class="centered" width="5%" v-if="showPrices">{{$t('discount')}}</th>
<th class="centered" v-if="showPrices">{{$t('vat')}}</th>
@ -69,6 +70,7 @@
<td width="5%">{{sale.itemFk}}</td>
<td class="number">{{sale.quantity}}</td>
<td width="50%">{{sale.concept}}</td>
<td width="5%" class="font light-gray" v-if="sale.subName">{{sale.subName}}</td>
<td class="number" v-if="showPrices">{{sale.price | currency('EUR', $i18n.locale)}}</td>
<td class="centered" width="5%" v-if="showPrices">{{(sale.discount / 100) | percentage}}</td>
<td class="centered" v-if="showPrices">{{sale.vatType}}</td>
@ -81,7 +83,6 @@
<span v-if="sale.value5"> <strong>{{sale.tag5}}</strong> {{sale.value5}} </span>
<span v-if="sale.value6"> <strong>{{sale.tag6}}</strong> {{sale.value6}} </span>
<span v-if="sale.value7"> <strong>{{sale.tag7}}</strong> {{sale.value7}} </span>
<span v-if="sale.subName"> <strong>{{$t('producer')}}</strong> {{ sale.subName }}</span>
</td>
</tr>
</tbody>

View File

@ -0,0 +1,84 @@
html {
font-family: "Roboto", "Helvetica", "Arial", sans-serif;
margin-top: -9px;
margin-left: -6px;
}
table {
width: 100%;
font-size: 14px;
}
td {
border: 6px solid white;
}
.center {
text-align: center;
}
.right {
text-align: right;
}
.cursive {
font-style: italic;
}
.bold {
font-weight: bold;
}
.black-bg {
background-color: black;
color: white;
}
.xs-txt {
font-size: 18px;
}
.md-txt {
font-size: 26px;
}
.xl-txt {
font-size: 50px;
}
.cell {
border: 2px solid black;
box-sizing: content-box;
width: 100%;
height: 30px;
display: flex;
justify-content: center;
align-items: center;
}
.padding {
padding: 7px;
}
.xs-height {
height: 50px;
max-height: 50px;
}
.md-height {
height: 75px;
max-height: 75px;
}
.sm-width {
width: 60px;
max-width: 60px;
}
.md-width {
width: 125px;
max-width: 125px;
}
.lg-width {
width: 380px;
max-width: 380px;
}
.overflow-multiline {
max-height: inherit;
display: -webkit-box;
overflow: hidden;
word-wrap: break-word;
line-clamp: 2;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
}
.overflow-line {
width: inherit;
max-width: inherit;
overflow: hidden;
white-space: nowrap;
}

View File

@ -0,0 +1,91 @@
<!DOCTYPE html>
<html>
<body table v-for="item in items" style="break-before: page">
<table>
<tr>
<td class="md-txt bold center black-bg lg-width md-height">
<div class="overflow-multiline">
{{item.item}}
</div>
</td>
<td colspan="2" class="xl-txt bold center black-bg md-height md-width">
<div class="overflow-line">
{{item.size}}
</div>
</td>
</tr>
<tr>
<td class="right lg-width">
<div class="overflow-line">
{{
(item.longName && item.size && item.subName)
? `${item.longName} ${item.size} ${item.subName}`
: item.comment
}}
</div>
</td>
<td class="center sm-width">
<div class="overflow-line">
{{item.producerName || item.producerFk}}
</div>
</td>
<td class="center sm-width">
<div class="overflow-line">
{{item.inkFk}}
</div>
</td>
</tr>
<tr>
<td class="md-txt xl-width bold center">
<div class="overflow-line">
{{item.itemFk}}
</div>
</td>
<td colspan="2" class="md-txt md-width center">
<div class="overflow-line">
{{`${(packing || item.packing)} x ${item.stems || ''}`}}
</div>
</td>
</tr>
<tr>
<td rowspan="2" class="center">
<div v-html="getBarcode(item.buyFk)"></div>
</td>
<td colspan="2" class="center md-width xs-height xs-txt">
<div class="overflow-line">
{{item.entryFk}}
</div>
</td>
</tr>
<tr>
<td class="center xs-txt sm-width">
<div class="overflow-line">
{{item.buyerName}}
</div>
</td>
<td class="center xs-txt sm-width">
<div class="overflow-line">
{{item.origin}}
</div>
</td>
</tr>
<tr>
<td class="center xl-width">
<div class="overflow-line">
{{item.buyFk}}
</div>
</td>
<td class="xs-txt sm-width center">
<div class="overflow-line">
{{date}}
</div>
</td>
<td class="xs-txt sm-width cursive center bold">
<div class="overflow-line">
{{`${item.labelNum}/${item.quantity / (packing || item.packing)}`}}
</div>
</td>
</tr>
</table>
</body>
</html>

View File

@ -0,0 +1,58 @@
const UserError = require('vn-loopback/util/user-error');
const {DOMImplementation, XMLSerializer} = require('xmldom');
const moment = require('moment');
const jsbarcode = require('jsbarcode');
module.exports = {
name: 'item-label-barcode',
async serverPrefetch() {
this.company = await this.findOneFromDef('company', [this.warehouseId]);
if (!this.company)
throw new UserError(`There is no company associated with that warehouse`);
this.date = Date.vnNew();
this.lastBuy = await this.findOneFromDef('lastBuy', [
this.id,
this.warehouseId,
this.date
]);
this.items = await this.rawSqlFromDef('item', [this.copies || 1, this.lastBuy.id]);
if (!this.items.length) throw new UserError(`Empty data source`);
this.date = moment(this.date).format('WW/E');
},
methods: {
getBarcode(data) {
const document = new DOMImplementation().createDocument('http://www.w3.org/1999/xhtml', 'html', null);
const svgNode = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
jsbarcode(svgNode, data, {
xmlDocument: document,
format: 'code128',
displayValue: false,
width: 3.8,
height: 85,
margin: 0
});
return new XMLSerializer().serializeToString(svgNode);
}
},
props: {
id: {
type: Number,
required: true,
description: 'The item id'
},
warehouseId: {
type: Number
},
packing: {
type: Number
},
copies: {
type: Number
},
userId: {
type: Number
}
}
};

View File

@ -0,0 +1 @@
reportName: Etiqueta de artículo barcode

View File

@ -0,0 +1,11 @@
{
"width": "10.4cm",
"height": "4.9cm",
"margin": {
"top": "0.17cm",
"right": "0.745cm",
"bottom": "0cm",
"left": "0cm"
},
"printBackground": true
}

View File

@ -0,0 +1,5 @@
SELECT co.code
FROM warehouse w
JOIN address a ON a.id = w.addressFk
JOIN company co ON co.clientFk = a.clientFk
WHERE w.id = ?

View File

@ -0,0 +1,34 @@
WITH RECURSIVE numbers AS (
SELECT 1 n
UNION ALL
SELECT n + 1
FROM numbers
WHERE n < ?
)
SELECT ROW_NUMBER() OVER() labelNum,
b.itemFk,
i.name item,
b.id buyFk,
b.quantity,
b.packing,
b.entryFk,
o.code origin,
p.`name` producerName,
p.id producerFk,
i.`size`,
i.category,
i.stems,
i.inkFk,
ig.longName,
ig.subName,
i.comment,
w.code buyerName
FROM vn.buy b
JOIN vn.item i ON i.id = b.itemFk
LEFT JOIN vn.item ig ON ig.id = b.itemOriginalFk
JOIN vn.origin o ON o.id = i.originFk
LEFT JOIN vn.producer p ON p.id = i.producerFk
JOIN vn.itemType it ON it.id = i.typeFk
JOIN vn.worker w ON w.id = it.workerFk
JOIN numbers num
WHERE b.id = ?

View File

@ -0,0 +1 @@
SELECT buy_getUltimate(?, ?, ?) id

Some files were not shown because too many files have changed in this diff Show More