Compare commits

..

106 Commits

Author SHA1 Message Date
Guillermo Bonet d7a25b06bf Merge branch 'test' into dev
gitea/salix/pipeline/head This commit looks good Details
2025-02-07 15:05:41 +01:00
Guillermo Bonet 8261b35559 Merge branch 'master' into test
gitea/salix/pipeline/head This commit looks good Details
2025-02-07 15:05:20 +01:00
Guillermo Bonet b56468d3aa fix: refs #7024 Test
gitea/salix/pipeline/head This commit looks good Details
2025-02-07 15:05:04 +01:00
Guillermo Bonet ec3210a5c0 Merge branch 'test' into dev
gitea/salix/pipeline/head This commit looks good Details
2025-02-07 14:28:28 +01:00
Guillermo Bonet b1d2441d2e Merge branch 'master' into test
gitea/salix/pipeline/head This commit looks good Details
2025-02-07 14:27:56 +01:00
Guillermo Bonet 95d2823666 fix: refs #7024 Deleted dated check
gitea/salix/pipeline/head This commit looks good Details
2025-02-07 14:27:27 +01:00
Jon Elias f04933a9c1 Merge pull request 'Fix[ItemFixedPrice]: Fixed item name filter' (!3427) from Hotfix-FixedPriceNameFilter into dev
gitea/salix/pipeline/head This commit looks good Details
Reviewed-on: #3427
Reviewed-by: Alex Moreno <alexm@verdnatura.es>
2025-02-07 12:44:42 +00:00
Jon Elias 516f409ae5 Merge branch 'dev' into Hotfix-FixedPriceNameFilter
gitea/salix/pipeline/pr-dev This commit looks good Details
2025-02-07 12:42:20 +00:00
Jon Elias d76db10e67 fix: fixed item name filter
gitea/salix/pipeline/pr-dev This commit looks good Details
2025-02-07 13:39:53 +01:00
Carlos Andrés f851a0b73b Merge pull request 'HOTFIX: before save checkAccessAcl' (!3426) from hotfix_client_beforeSave_ACL into master
gitea/salix/pipeline/head This commit looks good Details
Reviewed-on: #3426
Reviewed-by: Alex Moreno <alexm@verdnatura.es>
2025-02-07 10:18:43 +00:00
Javier Segarra 23134deab5 fix: before save checkAccessAcl
gitea/salix/pipeline/pr-master This commit looks good Details
2025-02-07 11:11:22 +01:00
Guillermo Bonet 21d9369250 fix: refs #8172 Version fix
gitea/salix/pipeline/head This commit looks good Details
2025-02-07 11:04:10 +01:00
Guillermo Bonet 1a274648a7 Merge pull request 'refactor: refs #8172 Created table parkingCoordinates' (!3320) from 8172-parkingCoordinates into dev
gitea/salix/pipeline/head This commit looks good Details
Reviewed-on: #3320
Reviewed-by: Carlos Andrés <carlosap@verdnatura.es>
2025-02-07 09:38:55 +00:00
Guillermo Bonet 6fd1c35819 Merge branch 'dev' into 8172-parkingCoordinates
gitea/salix/pipeline/pr-dev This commit looks good Details
2025-02-07 10:36:35 +01:00
Javier Segarra ef4d639499 Merge pull request '#7601 - Different agency fot future tickets' (!3420) from 7601_futureAgency into dev
gitea/salix/pipeline/head This commit looks good Details
Reviewed-on: #3420
Reviewed-by: Javi Gallego <jgallego@verdnatura.es>
2025-02-07 08:32:47 +00:00
Jon Elias 18fe468623 Merge pull request 'Hotfix[InvoiceOutList]: Fixed company filter' (!3424) from Hotfix-InvoiceOutCompanyFilter into master
gitea/salix/pipeline/head This commit looks good Details
Reviewed-on: #3424
Reviewed-by: Alex Moreno <alexm@verdnatura.es>
2025-02-07 07:12:33 +00:00
Javier Segarra 47c3878a74 Merge branch 'dev' into 7601_futureAgency
gitea/salix/pipeline/pr-dev This commit looks good Details
2025-02-07 07:06:54 +00:00
Jon Elias a6de493271 Merge branch 'master' into Hotfix-InvoiceOutCompanyFilter
gitea/salix/pipeline/pr-master This commit looks good Details
2025-02-07 06:56:49 +00:00
Jon Elias 200f159c6b fix: style
gitea/salix/pipeline/pr-master This commit looks good Details
2025-02-07 07:55:08 +01:00
Jon Elias ec01c6b0c2 fix: fixed company filter
gitea/salix/pipeline/pr-master This commit looks good Details
2025-02-07 07:51:18 +01:00
Robert Ferrús 860d86d19e Merge pull request '6702-missageSaleCloned' (!3404) from 6702-missageSaleCloned into dev
gitea/salix/pipeline/head This commit looks good Details
Reviewed-on: #3404
Reviewed-by: Javi Gallego <jgallego@verdnatura.es>
2025-02-07 06:51:05 +00:00
Jorge Penadés fa098661b6 Merge pull request 'fix: add await' (!3422) from hotfix-addAwait into master
gitea/salix/pipeline/head This commit looks good Details
Reviewed-on: #3422
Reviewed-by: Carlos Andrés <carlosap@verdnatura.es>
2025-02-06 16:53:52 +00:00
Jorge Penadés 6a83cec33f fix: add await
gitea/salix/pipeline/pr-master This commit looks good Details
2025-02-06 17:43:58 +01:00
Javier Segarra 35bf9abcf4 Merge branch 'dev' into 7601_futureAgency
gitea/salix/pipeline/pr-dev This commit looks good Details
2025-02-06 16:15:27 +00:00
Robert Ferrús aa44d0e727 Merge branch 'dev' of https: refs #6702//gitea.verdnatura.es/verdnatura/salix into 6702-missageSaleCloned
gitea/salix/pipeline/pr-dev This commit looks good Details
2025-02-06 14:31:37 +01:00
Guillermo Bonet 9f302fac24 Merge branch 'test' into dev
gitea/salix/pipeline/head There was a failure building this commit Details
2025-02-06 13:47:36 +01:00
Guillermo Bonet 92ca3a2582 Merge branch 'master' into test
gitea/salix/pipeline/head This commit looks good Details
2025-02-06 13:47:17 +01:00
Carlos Andrés 2e8e2329ec fix: refs #8535 deploy
gitea/salix/pipeline/head This commit looks good Details
2025-02-06 13:44:22 +01:00
Robert Ferrús 73a7a4cbd3 Merge pull request 'feat: refs #8487 delete appointment from travel view' (!3421) from 8487-modifyTravelView into test
gitea/salix/pipeline/head This commit looks good Details
Reviewed-on: #3421
Reviewed-by: Robert Ferrús <robert@verdnatura.es>
2025-02-06 12:32:12 +00:00
Javier Segarra ab0667f85c feat: retrive requested fields
gitea/salix/pipeline/pr-dev Build queued... Details
2025-02-06 12:31:46 +00:00
Ivan Mas f12a690bef feat: refs #8487 delete appointment from travel view
gitea/salix/pipeline/pr-test This commit looks good Details
2025-02-06 13:28:44 +01:00
Guillermo Bonet beed658f61 fix: refs #8535 deploy
gitea/salix/pipeline/head This commit looks good Details
2025-02-06 13:21:32 +01:00
Guillermo Bonet 110a5212c0 fix: refs #8535 deploy
gitea/salix/pipeline/head This commit looks good Details
2025-02-06 12:55:01 +01:00
Guillermo Bonet e9e3a5f128 Merge pull request 'feat: refs #8535 sistema de warnings' (!3418) from 8535-log-mandate into master
gitea/salix/pipeline/head There was a failure building this commit Details
Reviewed-on: #3418
Reviewed-by: Guillermo Bonet <guillermo@verdnatura.es>
2025-02-06 11:18:57 +00:00
Carlos Andrés fa5888f931 Merge branch 'master' of https: refs #8535//gitea.verdnatura.es/verdnatura/salix into 8535-log-mandate
gitea/salix/pipeline/pr-master This commit looks good Details
2025-02-06 11:53:57 +01:00
Carlos Andrés 9b2c0f1c48 feat: refs #8535 log table mandate
gitea/salix/pipeline/pr-master This commit looks good Details
2025-02-06 11:46:39 +01:00
Jorge Penadés 97be16b344 Merge pull request 'feat: refs #7119 add VehicleState model with data source configuration' (!3328) from 7119-createVehicle into dev
gitea/salix/pipeline/head There was a failure building this commit Details
gitea/salix/pipeline/pr-dev This commit looks good Details
Reviewed-on: #3328
Reviewed-by: Javi Gallego <jgallego@verdnatura.es>
2025-02-06 09:24:09 +00:00
Jorge Penadés 9ba517b648 Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 7119-createVehicle
gitea/salix/pipeline/pr-dev This commit looks good Details
2025-02-06 10:20:22 +01:00
Juanjo Breso b0dd1d4fff Merge pull request 'feat: refs #269518 isFragile item and itemType' (!3419) from 269518-ticket_getWarnings_isFragile into master
gitea/salix/pipeline/head This commit looks good Details
Reviewed-on: #3419
Reviewed-by: Javi Gallego <jgallego@verdnatura.es>
2025-02-06 08:18:27 +00:00
Juanjo Breso 8df36f296a feat: refs #269518 isFragile item and itemType
gitea/salix/pipeline/pr-master This commit looks good Details
2025-02-06 09:11:48 +01:00
Carlos Andrés 37b735b988 feat: refs #8535 sistema de warnings
gitea/salix/pipeline/pr-master This commit looks good Details
2025-02-05 17:21:36 +01:00
Jose Antonio Tubau abf73f5705 Merge pull request 'feat: refs #8304 add ACL entry for WorkerDms with high privileges' (!3353) from 8304-workerChangesAndFixes into dev
gitea/salix/pipeline/head This commit looks good Details
Reviewed-on: #3353
Reviewed-by: Javi Gallego <jgallego@verdnatura.es>
2025-02-05 12:23:04 +00:00
Jose Antonio Tubau 0a25595ed5 Merge branch 'dev' into 8304-workerChangesAndFixes
gitea/salix/pipeline/pr-test This commit looks good Details
gitea/salix/pipeline/pr-dev This commit looks good Details
2025-02-05 13:00:44 +01:00
Alex Moreno 1ee5af96a5 Merge branch 'test' of https://gitea.verdnatura.es/verdnatura/salix into dev
gitea/salix/pipeline/head This commit looks good Details
2025-02-05 11:16:32 +01:00
Alex Moreno e89c12f753 fix: refs #7943 better "relation": "business",
gitea/salix/pipeline/head This commit looks good Details
2025-02-05 10:52:20 +01:00
Alex Moreno f216166806 fix: refs #7943 better "relation": "business",
gitea/salix/pipeline/head This commit looks good Details
2025-02-05 10:16:14 +01:00
Robert Ferrús 14a48bf4c6 Merge branch 'dev' into 6702-missageSaleCloned
gitea/salix/pipeline/pr-dev This commit looks good Details
2025-02-03 12:37:12 +00:00
Robert Ferrús d79c19d92a feat: refs #6702 delete line
gitea/salix/pipeline/pr-dev This commit looks good Details
2025-02-03 12:42:38 +01:00
Robert Ferrús 0646d2e817 feat: refs #6702 changes request
gitea/salix/pipeline/pr-dev This commit looks good Details
2025-02-03 12:41:51 +01:00
Robert Ferrús d98476b777 Merge branch 'dev' into 6702-missageSaleCloned
gitea/salix/pipeline/pr-dev This commit looks good Details
2025-02-03 06:11:47 +00:00
Robert Ferrús 1a8ce32833 Merge branch 'dev' into 6702-missageSaleCloned
gitea/salix/pipeline/pr-dev This commit looks good Details
2025-01-31 12:17:08 +00:00
Robert Ferrús 9d3a4257b7 feat: refs #6702 translations
gitea/salix/pipeline/pr-dev This commit looks good Details
2025-01-31 12:53:48 +01:00
Robert Ferrús f484c3e653 Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 6702-missageSaleCloned 2025-01-31 11:59:00 +01:00
Robert Ferrús 948bdbd2c6 feat: refs #6702 refs #6701 changes
gitea/salix/pipeline/pr-dev This commit looks good Details
2025-01-31 08:19:39 +01:00
Robert Ferrús ce447b7de6 Merge branch 'dev' of https: refs #6702//gitea.verdnatura.es/verdnatura/salix into 6702-missageSaleCloned
gitea/salix/pipeline/pr-dev This commit looks good Details
2025-01-31 07:14:10 +01:00
Robert Ferrús 1e18e48f8c feat: refs #6702 es.json delete changes
gitea/salix/pipeline/pr-dev There was a failure building this commit Details
2025-01-31 07:09:42 +01:00
Jorge Penadés 77623b489b feat: refs #7119 add new vehicle
gitea/salix/pipeline/pr-dev This commit looks good Details
2025-01-30 10:55:36 +01:00
Jorge Penadés a0dc8f8104 Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 7119-createVehicle
gitea/salix/pipeline/pr-dev This commit looks good Details
2025-01-30 10:26:40 +01:00
Jorge Penadés 2f364ebc76 Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 7119-createVehicle
gitea/salix/pipeline/pr-dev This commit looks good Details
2025-01-29 16:40:37 +01:00
Jorge Penadés a463a8f4d8 Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 7119-createVehicle
gitea/salix/pipeline/pr-dev There was a failure building this commit Details
2025-01-29 14:49:07 +01:00
Jorge Penadés 2b443266b2 Merge branch 'dev' of https: refs #7119//gitea.verdnatura.es/verdnatura/salix into 7119-createVehicle
gitea/salix/pipeline/pr-dev There was a failure building this commit Details
2025-01-29 11:51:21 +01:00
Jorge Penadés 051c6ffcbc refactor(vehicle filter): refs #7119 simplify search condition to use logical OR for ID and number plate
gitea/salix/pipeline/pr-dev This commit looks good Details
2025-01-28 12:23:24 +01:00
Jorge Penadés 2eabfaaa8f Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 7119-createVehicle
gitea/salix/pipeline/pr-dev This commit looks good Details
2025-01-28 11:44:59 +01:00
Jorge Penadés fb653c1eca fix: refs #7119 rollback
gitea/salix/pipeline/pr-dev This commit looks good Details
2025-01-24 16:42:10 +01:00
Jorge Penadés ec7bbd13b1 refactor: refs #7119 update vehicle filter logic and improve test cases
gitea/salix/pipeline/pr-dev This commit looks good Details
2025-01-24 16:37:35 +01:00
Jorge Penadés 2346205072 Merge branch 'dev' of https: refs #7119//gitea.verdnatura.es/verdnatura/salix into 7119-createVehicle
gitea/salix/pipeline/pr-dev There was a failure building this commit Details
2025-01-24 16:14:09 +01:00
Jorge Penadés 3fba81b41e feat: refs #7119 add 'id' filter option and enhance bank policy model with dmsFk field
gitea/salix/pipeline/pr-dev This commit looks good Details
2025-01-24 10:46:35 +01:00
Jorge Penadés f8e4561a59 Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 7119-createVehicle
gitea/salix/pipeline/pr-dev This commit looks good Details
2025-01-24 09:37:10 +01:00
Jorge Penadés 3a449896cd feat: refs #7119 update vehicle permissions and enhance vehicle model with new fields
gitea/salix/pipeline/pr-dev This commit looks good Details
2025-01-23 18:02:53 +01:00
Jose Antonio Tubau e22a472e97 Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 8304-workerChangesAndFixes
gitea/salix/pipeline/pr-test There was a failure building this commit Details
gitea/salix/pipeline/pr-dev There was a failure building this commit Details
2025-01-23 15:06:03 +01:00
Jorge Penadés 3ea67675da feat: refs #7119 add VehicleType model and update vehicle permissions for delivery roles
gitea/salix/pipeline/pr-dev This commit looks good Details
2025-01-23 10:53:53 +01:00
Jorge Penadés 0440582e2b Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 7119-createVehicle
gitea/salix/pipeline/pr-dev This commit looks good Details
2025-01-23 10:09:47 +01:00
Jose Antonio Tubau d3b22ce6c9 Merge branch '8304-workerChangesAndFixes' of https://gitea.verdnatura.es/verdnatura/salix into 8304-workerChangesAndFixes
gitea/salix/pipeline/pr-dev This commit looks good Details
2025-01-22 16:17:38 +01:00
Jose Antonio Tubau e05f740c3d Merge branch 'dev' into 8304-workerChangesAndFixes 2025-01-22 16:17:35 +01:00
Jose Antonio Tubau 171296f2db Merge branch 'dev' into 8304-workerChangesAndFixes
gitea/salix/pipeline/pr-dev This commit looks good Details
2025-01-22 11:43:14 +00:00
Jorge Penadés 49e08fbf45 Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 7119-createVehicle 2025-01-22 12:42:25 +01:00
Jorge Penadés 2ae0097fa8 feat: refs #7119 add vehicle type management and delivery role permissions
gitea/salix/pipeline/pr-dev This commit looks good Details
2025-01-21 15:48:20 +01:00
Jose Antonio Tubau 7f5224ebca feat: refs #8304 add ACL entries for Business and Worker models and update worker model relationships
gitea/salix/pipeline/pr-dev There was a failure building this commit Details
2025-01-21 14:45:13 +01:00
Jose Antonio Tubau b20dee8382 feat: refs #8304 add notes field to business model
gitea/salix/pipeline/pr-dev This commit looks good Details
2025-01-21 12:28:34 +01:00
Jorge Penadés 55a0a5bc9a feat: refs #7119 add delivery role permissions
gitea/salix/pipeline/pr-dev This commit looks good Details
2025-01-21 11:52:09 +01:00
Jorge Penadés e343e457ee Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 7119-createVehicle
gitea/salix/pipeline/pr-dev This commit looks good Details
2025-01-21 10:48:08 +01:00
Jorge Penadés 3d2a7cfb66 feat: refs #7119 update ACLs for vehicle management and refine vehicle filter logic
gitea/salix/pipeline/pr-dev This commit looks good Details
2025-01-20 18:05:33 +01:00
Jorge Penadés 946d08e543 feat: refs #7119 update ACLs and remove unused models for vehicle management
gitea/salix/pipeline/pr-dev This commit looks good Details
2025-01-20 17:29:18 +01:00
Jorge Penadés ecedc84164 Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 7119-createVehicle
gitea/salix/pipeline/pr-dev There was a failure building this commit Details
2025-01-20 14:28:30 +01:00
Jose Antonio Tubau 0e8d9137ed feat: refs #8304 add privilege check for WorkerDms filter method
gitea/salix/pipeline/pr-dev This commit looks good Details
2025-01-10 13:48:03 +01:00
Jose Antonio Tubau a167e7fada feat: refs #8304 add ACL entry for WorkerDms with high privileges
gitea/salix/pipeline/pr-dev There was a failure building this commit Details
2025-01-10 13:42:29 +01:00
Robert Ferrús eca2ff84ef feat: refs #6702 changes
gitea/salix/pipeline/pr-dev There was a failure building this commit Details
2025-01-02 07:49:49 +01:00
Jorge Penadés bc495ed51e feat: refs #7119 add VehicleNotes model and update vehicle filter SQL query
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-12-30 17:55:27 +01:00
Jorge Penadés 68e42206c8 feat: refs #7119 enhance vehicle filter method with additional parameters and improve SQL query structure
gitea/salix/pipeline/pr-dev There was a failure building this commit Details
2024-12-30 17:31:56 +01:00
Jorge Penadés e9b0b1b7a3 Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 7119-createVehicle
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-12-30 15:56:57 +01:00
Jorge Penadés 8a6482ada5 Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 7119-createVehicle
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-12-30 09:31:19 +01:00
Jorge Penadés 921edb238c feat: refs #7119 add Ppe model and establish relationships in Vehicle model
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-12-27 16:55:59 +01:00
Jorge Penadés 0de4ce9b3c feat: refs #7119 add BankPolicy and FuelType models
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-12-27 15:36:19 +01:00
Jorge Penadés 9731d13a9a feat: refs #7119 add updateAttributes ACL
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-12-27 12:21:46 +01:00
Jorge Penadés 4d7387af18 feat: refs #7119 add deleteById permission for deliveryBoss role in ACL for Vehicle model
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-12-26 17:52:36 +01:00
Jorge Penadés b01e4894c9 feat: refs #7119 remove vehicleStateFk argument from filter method and simplify search logic
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-12-26 17:02:37 +01:00
Jorge Penadés f8c1e2aacf feat: refs #7119 add search and filter capabilities to Vehicle model and update related SQL fixtures
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-12-26 16:36:50 +01:00
Jorge Penadés fffd095ab3 Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 7119-createVehicle
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-12-26 09:43:39 +01:00
Jorge Penadés 9aa790ecfd feat: refs #7119 add isKmTruckRate field to Vehicle model and filter
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-12-24 13:27:32 +01:00
Jorge Penadés 39fc196464 feat: refs #7119 add VehicleEvent and VehicleState models with associated methods and SQL fixtures
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-12-24 13:01:23 +01:00
Jorge Penadés 086b7aed4b feat: refs #7119 add VehicleState model with data source configuration
gitea/salix/pipeline/pr-dev This commit looks good Details
2024-12-24 10:40:17 +01:00
Robert Ferrús 9b2fb7a430 feat: refs #6702 sale fix Self.ticketWeekly 2024-12-19 11:32:15 +01:00
Robert Ferrús 0652d11112 feat: refs #6702 updatePrice message 2024-12-19 10:29:50 +01:00
Guillermo Bonet a8cf01ca19 refactor: refs #8172 Removed column and row columns
gitea/salix/pipeline/pr-dev There was a failure building this commit Details
2024-12-18 14:36:59 +01:00
Guillermo Bonet 6300795e52 refactor: refs #8172 Created table parkingCoordinates
gitea/salix/pipeline/pr-dev There was a failure building this commit Details
2024-12-18 13:17:47 +01:00
Robert Ferrús 46c4f4786a feat: refs #6702 saleCloned 2024-12-18 12:03:48 +01:00
56 changed files with 3020 additions and 3000 deletions

View File

@ -13,6 +13,7 @@ RUN apt-get update \
graphicsmagick \
&& curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
&& apt-get install -y --no-install-recommends nodejs \
&& npm install -g corepack@0.31.0 \
&& corepack enable pnpm
# Puppeteer

View File

@ -168,7 +168,6 @@
"emailVerified",
"twoFactor"
]
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -30,11 +30,16 @@ BEGIN
st.code stateCode,
sub2.code futureStateCode,
st.classColor,
sub2.classColor futureClassColor
sub2.classColor futureClassColor,
am.id agencyFk,
am.name agency,
sub2.agencyModeFk futureAgencyFk,
sub2.agencyMode futureAgency
FROM vn.saleVolume sv
JOIN vn.sale s ON s.id = sv.saleFk
JOIN vn.item i ON i.id = s.itemFk
JOIN vn.ticket t ON t.id = sv.ticketFk
JOIN vn.agencyMode am ON am.id = t.agencyModeFk
JOIN vn.address a ON a.id = t.addressFk
JOIN vn.province p ON p.id = a.provinceFk
JOIN vn.country c ON c.id = p.countryFk
@ -54,16 +59,19 @@ BEGIN
st.name state,
st.code,
st.classColor,
am.id agencyModeFk,
am.name agencyMode,
GROUP_CONCAT(DISTINCT i.itemPackingTypeFk ORDER BY i.itemPackingTypeFk) iptd
FROM vn.ticket t
JOIN vn.ticketState ts ON ts.ticketFk = t.id
JOIN vn.state st ON st.id = ts.stateFk
JOIN vn.sale s ON s.ticketFk = t.id
JOIN vn.item i ON i.id = s.itemFk
WHERE t.shipped BETWEEN vFutureDated
AND util.dayend(vFutureDated)
AND t.warehouseFk = vWarehouseFk
GROUP BY t.id
FROM vn.ticket t
JOIN vn.agencyMode am ON am.id = t.agencyModeFk
JOIN vn.ticketState ts ON ts.ticketFk = t.id
JOIN vn.state st ON st.id = ts.stateFk
JOIN vn.sale s ON s.ticketFk = t.id
JOIN vn.item i ON i.id = s.itemFk
WHERE t.shipped BETWEEN vFutureDated
AND util.dayend(vFutureDated)
AND t.warehouseFk = vWarehouseFk
GROUP BY t.id
) sub
GROUP BY sub.addressFk
) sub2 ON sub2.addressFk = t.addressFk AND t.id != sub2.id

View File

@ -25,7 +25,7 @@ BEGIN
LEFT JOIN agencyMode am ON am.id = tt.agencyModeFk
LEFT JOIN deliveryMethod dm ON dm.id = am.deliveryMethodFk
WHERE dm.code IN ('AGENCY')
AND it.isFragile;
AND (it.isFragile OR i.isFragile);
CREATE OR REPLACE TEMPORARY TABLE tmp.ticket_warnings
(PRIMARY KEY (ticketFk))

View File

@ -10,7 +10,6 @@ BEGIN
IF NEW.isBooked = OLD.isBooked AND (
NOT (NEW.supplierFk <=> OLD.supplierFk) OR
NOT (NEW.dated <=> OLD.dated) OR
NOT (NEW.travelFk <=> OLD.travelFk) OR
NOT (NEW.companyFk <=> OLD.companyFk) OR
NOT (NEW.invoiceInFk <=> OLD.invoiceInFk) OR

View File

@ -0,0 +1,12 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`mandate_afterDelete`
AFTER DELETE ON `mandate`
FOR EACH ROW
BEGIN
INSERT INTO mandateLog
SET `action` = 'delete',
`changedModel` = 'mandate',
`changedModelId` = OLD.id,
`userFk` = account.myUser_getId();
END$$
DELIMITER ;

View File

@ -3,10 +3,12 @@ CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`mandate_beforeInsert`
BEFORE INSERT ON `mandate`
FOR EACH ROW
BEGIN
SET NEW.editorFk = account.myUser_getId();
IF (NEW.code IS NULL) THEN
SET NEW.code=CONCAT(NEW.clientFk,'-',(SELECT AUTO_INCREMENT
FROM information_schema.TABLES
WHERE TABLE_SCHEMA='vn' and TABLE_NAME='mandate'));
END IF;
SET NEW.code=CONCAT(NEW.clientFk,'-',(SELECT AUTO_INCREMENT
FROM information_schema.TABLES
WHERE TABLE_SCHEMA='vn' and TABLE_NAME='mandate'));
END IF;
END$$
DELIMITER ;

View File

@ -0,0 +1,8 @@
DELIMITER $$
CREATE OR REPLACE DEFINER=`vn`@`localhost` TRIGGER `vn`.`mandate_beforeUpdate`
BEFORE INSERT ON `mandate`
FOR EACH ROW
BEGIN
SET NEW.editorFk = account.myUser_getId();
END$$
DELIMITER ;

View File

@ -16,7 +16,6 @@ AS SELECT `t`.`id` AS `id`,
`t`.`kg` AS `kg`,
`t`.`cargoSupplierFk` AS `cargoSupplierFk`,
`t`.`totalEntries` AS `totalEntries`,
`t`.`appointment` AS `appointment`,
`t`.`awbFk` AS `awbFk`,
`t`.`isRaid` AS `isRaid`,
`t`.`daysInForward` AS `daysInForward`

View File

@ -0,0 +1,23 @@
CREATE TABLE vn.parkingCoordinates (
parkingFk int(11) NOT NULL,
x varchar(5) NOT NULL,
y varchar(5) NOT NULL,
z varchar(5) NOT NULL,
CONSTRAINT parkingCoordinates_pk PRIMARY KEY (parkingFk),
CONSTRAINT parkingCoordinates_parking_FK FOREIGN KEY (parkingFk) REFERENCES vn.parking(id) ON DELETE CASCADE ON UPDATE CASCADE
)
ENGINE=InnoDB
DEFAULT CHARSET=utf8mb3
COLLATE=utf8mb3_unicode_ci;
INSERT INTO vn.parkingCoordinates (parkingFk, x, y, z)
SELECT id, `column`, `row`, `floor`
FROM vn.parking
WHERE `column` IS NOT NULL
OR `row` IS NOT NULL
OR `floor` IS NOT NULL;
ALTER TABLE vn.parking
DROP COLUMN `column`,
DROP COLUMN `row`,
DROP COLUMN `floor`;

View File

@ -0,0 +1,41 @@
USE vn;
INSERT INTO salix.ACL (model, property, accessType, permission, principalType, principalId)
VALUES ('Vehicle', 'filter', 'READ', 'ALLOW', 'ROLE', 'administrative'),
('Vehicle', 'filter', 'READ', 'ALLOW', 'ROLE', 'deliveryAssistant'),
('Vehicle', 'find', 'READ', 'ALLOW', 'ROLE', 'administrative'),
('Vehicle', 'find', 'READ', 'ALLOW', 'ROLE', 'deliveryAssistant'),
('Vehicle', 'findById', 'READ', 'ALLOW', 'ROLE', 'administrative'),
('Vehicle', 'findById', 'READ', 'ALLOW', 'ROLE', 'deliveryAssistant'),
('Vehicle', '__get__active', 'READ', 'ALLOW', 'ROLE', 'employee'),
('Vehicle', 'updateAttributes', 'WRITE', 'ALLOW', 'ROLE', 'administrative'),
('Vehicle', 'updateAttributes', 'WRITE', 'ALLOW', 'ROLE', 'deliveryAssistant'),
('Vehicle', 'deleteById', 'WRITE', 'ALLOW', 'ROLE', 'administrative'),
('Vehicle', 'deleteById', 'WRITE', 'ALLOW', 'ROLE', 'deliveryAssistant'),
('Vehicle', 'create', 'WRITE', 'ALLOW', 'ROLE', 'administrative'),
('Vehicle', 'create', 'WRITE', 'ALLOW', 'ROLE', 'deliveryAssistant'),
('BankPolicy', 'find', 'READ', 'ALLOW', 'ROLE', 'administrative'),
('BankPolicy', 'find', 'READ', 'ALLOW', 'ROLE', 'deliveryAssistant'),
('VehicleState', 'find', 'READ', 'ALLOW', 'ROLE', 'administrative'),
('VehicleState', 'find', 'READ', 'ALLOW', 'ROLE', 'deliveryAssistant'),
('Ppe', 'find', 'READ', 'ALLOW', 'ROLE', 'administrative' ),
('Ppe', 'find', 'READ', 'ALLOW', 'ROLE', 'deliveryAssistant' ),
('VehicleType', 'find', 'READ', 'ALLOW', 'ROLE', 'employee'),
('DeliveryPoint', 'find', 'READ', 'ALLOW', 'ROLE', 'deliveryAssistant'),
('DeliveryPoint', 'find', 'READ', 'ALLOW', 'ROLE', 'administrative');
CREATE TABLE IF NOT EXISTS vehicleType (
id INT(11) PRIMARY KEY AUTO_INCREMENT,
name VARCHAR(45) NOT NULL
);
INSERT IGNORE INTO vehicleType (id, name)
VALUES (1,'vehículo empresa'),
(2, 'furgoneta'),
(3, 'cabeza tractora'),
(4, 'remolque');
ALTER TABLE vehicle ADD COLUMN importCooler decimal(10,2) DEFAULT NULL;
ALTER TABLE vehicle ADD COLUMN vehicleTypeFk INT(11) DEFAULT 1;
ALTER TABLE vehicle ADD CONSTRAINT fk_vehicle_vehicleType FOREIGN KEY (vehicleTypeFk) REFERENCES vehicleType(id);

View File

@ -1,14 +0,0 @@
INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId)
VALUES ('Entry','getBuyList','READ','ALLOW','ROLE','buyer'),
('Entry','getBuyUltimate','READ','ALLOW','ROLE','buyer'),
('Entry','create','WRITE','ALLOW','ROLE','buyer'),
('Entry','cloneEntry','WRITE','ALLOW','ROLE','buyer'),
('Entry','deleteEntry','WRITE','ALLOW','ROLE','buyer'),
('Entry','recalcEntryPrices','WRITE','ALLOW','ROLE','buyer'),
('EntryType','find','READ','ALLOW','ROLE','buyer'),
('EntryConfig','findOne','READ','ALLOW','ROLE','buyer');
ALTER TABLE vn.ink ADD IF NOT EXISTS hexJson TEXT NOT NULL;
UPDATE vn.ink
SET hexJson = CONCAT('{"value": ["',hex,'"]}')

View File

@ -0,0 +1,6 @@
INSERT INTO salix.ACL (model, property, accessType, permission, principalType, principalId)
VALUES
('WorkerDms', 'hasHighPrivs', 'READ', 'ALLOW', 'ROLE', 'hr'),
('Business', 'updateAttributes', 'WRITE', 'ALLOW', 'ROLE', 'hr'),
('Worker', '__get__business', 'READ', 'ALLOW', 'ROLE', 'hr')
;

View File

@ -0,0 +1,23 @@
CREATE OR REPLACE TABLE vn.mandateLog (
`id` int(11) NOT NULL AUTO_INCREMENT,
`originFk` int(11) DEFAULT NULL,
`userFk` int(10) unsigned DEFAULT NULL,
`action` set('insert','update','delete','select') NOT NULL,
`creationDate` timestamp NULL DEFAULT current_timestamp(),
`description` text CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL,
`changedModel` enum('client') NOT NULL DEFAULT 'client',
`oldInstance` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`oldInstance`)),
`newInstance` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL CHECK (json_valid(`newInstance`)),
`changedModelId` int(11) NOT NULL,
`changedModelValue` varchar(45) DEFAULT NULL,
`summaryId` varchar(30) DEFAULT NULL,
`reason` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `logMandate_userFk` (`userFk`),
KEY `mandateLog_changedModel` (`changedModel`,`changedModelId`,`creationDate`),
KEY `mandateLog_originFk` (`originFk`,`creationDate`),
KEY `mandateLog_creationDate_IDX` (`creationDate` DESC) USING BTREE,
CONSTRAINT `mandateUserFk` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
ALTER TABLE vn.mandate ADD editorFk INT UNSIGNED DEFAULT NULL NULL;

View File

@ -0,0 +1 @@
ALTER TABLE vn.recovery DROP FOREIGN KEY cliente333;

View File

@ -58,10 +58,10 @@
"Swift / BIC can't be empty": "Swift / BIC can't be empty",
"Deleted sales from ticket": "I have deleted the following lines from the ticket [{{ticketId}}]({{{ticketUrl}}}): {{{deletions}}}",
"Added sale to ticket": "I have added the following line to the ticket [{{ticketId}}]({{{ticketUrl}}}): {{{addition}}}",
"Changed sale discount": "I have changed the following lines discounts from the ticket [{{ticketId}}]({{{ticketUrl}}}): {{{changes}}}",
"Changed sale discount": "I have changed the following lines discounts from the ticket [{{ticketId}}]({{{ticketUrl}}}): {{{changes}}} {{ticketWeekly}}",
"Created claim": "I have created the claim [{{claimId}}]({{{claimUrl}}}) for the following lines from the ticket [{{ticketId}}]({{{ticketUrl}}}): {{{changes}}}",
"Changed sale price": "I have changed the price of [{{itemId}} {{concept}}]({{{itemUrl}}}) ({{quantity}}) from {{oldPrice}}€ ➔ *{{newPrice}}€* of the ticket [{{ticketId}}]({{{ticketUrl}}})",
"Changed sale quantity": "I have changed {{changes}} of the ticket [{{ticketId}}]({{{ticketUrl}}})",
"Changed sale price": "I have changed the price of [{{itemId}} {{concept}}]({{{itemUrl}}}) ({{quantity}}) from {{oldPrice}}€ ➔ *{{newPrice}}€* of the ticket [{{ticketId}}]({{{ticketUrl}}}) {{ticketWeekly}}",
"Changed sale quantity": "I have changed {{changes}} of the ticket [{{ticketId}}]({{{ticketUrl}}}) {{ticketWeekly}}",
"Changes in sales": "the quantity of [{{itemId}} {{concept}}]({{{itemUrl}}}) from {{oldQuantity}} ➔ *{{newQuantity}}*",
"Changed sale reserved state": "I have changed the following lines reserved state from the ticket [{{ticketId}}]({{{ticketUrl}}}): {{{changes}}}",
"Bought units from buy request": "Bought {{quantity}} units of [{{itemId}} {{concept}}]({{{urlItem}}}) for the ticket id [{{ticketId}}]({{{url}}})",
@ -253,5 +253,6 @@
"Sales already moved": "Sales already moved",
"Holidays to past days not available": "Holidays to past days not available",
"Incorrect delivery order alert on route": "Incorrect delivery order alert on route: {{ route }} zone: {{ zone }}",
"Ticket has been delivered out of order": "The ticket {{ticket}} of route {{{fullUrl}}} has been delivered out of order."
}
"Ticket has been delivered out of order": "The ticket {{ticket}} of route {{{fullUrl}}} has been delivered out of order.",
"clonedFromTicketWeekly": ", that is a cloned sale from ticket {{ ticketWeekly }}"
}

View File

@ -121,10 +121,10 @@
"Incoterms is required for a non UEE member": "El incoterms es requerido para los clientes extracomunitarios",
"Deleted sales from ticket": "He eliminado las siguientes lineas del ticket [{{ticketId}}]({{{ticketUrl}}}): {{{deletions}}}",
"Added sale to ticket": "He añadido la siguiente linea al ticket [{{ticketId}}]({{{ticketUrl}}}): {{{addition}}}",
"Changed sale discount": "He cambiado el descuento de las siguientes lineas al ticket [{{ticketId}}]({{{ticketUrl}}}): {{{changes}}}",
"Changed sale discount": "He cambiado el descuento de las siguientes lineas al ticket [{{ticketId}}]({{{ticketUrl}}}): {{{changes}}} {{ticketWeekly}}",
"Created claim": "He creado la reclamación [{{claimId}}]({{{claimUrl}}}) de las siguientes lineas del ticket [{{ticketId}}]({{{ticketUrl}}}): {{{changes}}}",
"Changed sale price": "He cambiado el precio de [{{itemId}} {{concept}}]({{{itemUrl}}}) ({{quantity}}) de {{oldPrice}}€ ➔ *{{newPrice}}€* del ticket [{{ticketId}}]({{{ticketUrl}}})",
"Changed sale quantity": "He cambiado {{changes}} del ticket [{{ticketId}}]({{{ticketUrl}}})",
"Changed sale price": "He cambiado el precio de [{{itemId}} {{concept}}]({{{itemUrl}}}) ({{quantity}}) de {{oldPrice}}€ ➔ *{{newPrice}}€* del ticket [{{ticketId}}]({{{ticketUrl}}}) {{ticketWeekly}} ",
"Changed sale quantity": "He cambiado {{changes}} del ticket [{{ticketId}}]({{{ticketUrl}}}) {{ticketWeekly}}",
"Changes in sales": "la cantidad de [{{itemId}} {{concept}}]({{{itemUrl}}}) de {{oldQuantity}} ➔ *{{newQuantity}}*",
"State": "Estado",
"regular": "normal",
@ -396,6 +396,6 @@
"There are tickets to be invoiced": "La zona tiene tickets por facturar",
"Incorrect delivery order alert on route": "Alerta de orden de entrega incorrecta en ruta: {{ route }} zona: {{ zone }}",
"Ticket has been delivered out of order": "El ticket {{ticket}} {{{fullUrl}}} no ha sido entregado en su orden.",
"Price cannot be blank": "El precio no puede estar en blanco"
"Price cannot be blank": "El precio no puede estar en blanco",
"clonedFromTicketWeekly": ", que es una linea clonada del ticket {{ticketWeekly}}"
}

View File

@ -1,4 +1,4 @@
name: muestra
name: plantilla
columns:
id: id
created: creado

View File

@ -0,0 +1,10 @@
name: mandate
columns:
id: id
clientFk: client
companyFk: company
code: code
created: created
finished: finished
mandateTypeFk: mandate type
editorFk: editor

View File

@ -0,0 +1,10 @@
name: mandate
columns:
id: id
clientFk: cliente
companyFk: empresa
code: código
created: creado
finished: finalizado
mandateTypeFk: tipo de mandato
editorFk: editor

View File

@ -248,9 +248,10 @@ module.exports = Self => {
const models = Self.app.models;
const loopBackContext = LoopBackContext.getCurrentContext();
const accessToken = {req: loopBackContext.active.accessToken};
const editVerifiedDataWithoutTaxDataChecked = models.ACL.checkAccessAcl(
const accessToken = {req: {accessToken: loopBackContext.active.accessToken}};
const editVerifiedDataWithoutTaxDataChecked = await models.ACL.checkAccessAcl(
accessToken,
'Client',
'editVerifiedDataWithoutTaxDataCheck',

View File

@ -1,6 +1,9 @@
{
"name": "Mandate",
"base": "VnModel",
"mixins": {
"Loggable": true
},
"options": {
"mysql": {
"table": "mandate"
@ -39,4 +42,4 @@
"foreignKey": "mandateTypeFk"
}
}
}
}

View File

@ -1,303 +0,0 @@
const ParameterizedSQL = require('loopback-connector').ParameterizedSQL;
const buildFilter = require('vn-loopback/util/filter').buildFilter;
const mergeFilters = require('vn-loopback/util/filter').mergeFilters;
module.exports = Self => {
Self.remoteMethodCtx('getBuyList', {
description: 'Returns buys for editing of one entry',
accessType: 'READ',
accepts: [{
arg: 'entryFk',
type: 'number',
required: true,
description: 'The entry id',
http: {source: 'path'}
},
{
arg: 'filter',
type: 'object',
description: 'Filter defining where, order, offset, and limit - must be a JSON-encoded string'
},
{
arg: 'isIgnored',
type: 'boolean',
description: 'check if the buy is ignored',
http: {source: 'query'}
},
{
arg: 'itemFk',
type: 'number',
description: 'item id',
http: {source: 'query'}
},
{
arg: 'name',
type: 'string',
description: 'item name',
http: {source: 'query'}
},
{
arg: 'size',
type: 'number',
description: 'item size',
http: {source: 'query'}
},
{
arg: 'stickers',
type: 'number',
description: 'sticker quantity',
http: {source: 'query'}
},
{
arg: 'packagingFk',
type: 'number',
description: 'packaging id',
http: {source: 'query'}
},
{
arg: 'weight',
type: 'number',
description: 'weight',
http: {source: 'query'}
},
{
arg: 'packing',
type: 'number',
description: 'packing quantity',
http: {source: 'query'}
},
{
arg: 'grouping',
type: 'number',
description: 'grouping quantity',
http: {source: 'query'}
},
{
arg: 'quantity',
type: 'number',
http: {source: 'query'}
},
{
arg: 'buyingValue',
type: 'number',
http: {source: 'query'}
},
{
arg: 'amount',
type: 'number',
description: 'buying value * quantity',
http: {source: 'query'}
},
{
arg: 'price2',
type: 'number',
description: 'price for the package',
http: {source: 'query'}
},
{
arg: 'price3',
type: 'number',
description: 'price for the box',
http: {source: 'query'}
},
{
arg: 'minPrice',
type: 'number',
description: 'item minimum price',
http: {source: 'query'}
},
{
arg: 'packingOut',
type: 'number',
description: 'quantity of package on a vn box',
http: {source: 'query'}
},
{
arg: 'comment',
type: 'string',
description: 'item comment',
http: {source: 'query'}
},
{
arg: 'subName',
type: 'string',
description: 'supplier name',
http: {source: 'query'}
},
{
arg: 'subName',
type: 'string',
description: 'supplier name',
http: {source: 'query'}
},
{
arg: 'company_name',
type: 'string',
description: 'company name',
http: {source: 'query'}
},
{
arg: 'workerFk',
type: 'number',
description: 'buyer id',
http: {source: 'query'}
},
{
arg: 'itemTypeFk',
type: 'number',
description: 'item family id',
http: {source: 'query'}
},
{
arg: 'groupingMode',
type: 'string',
description: 'grouping mode',
http: {source: 'query'}
},
{
arg: 'hasMinPrice',
type: 'boolean',
description: 'grouping mode',
http: {source: 'query'}
},
{
arg: 'groupBy',
type: 'string',
description: 'group by',
http: {source: 'query'}
},
],
returns: {
type: ['object'],
root: true
},
http: {
path: `/:entryFk/getBuyList`,
verb: 'GET'
}
});
Self.getBuyList = async(ctx, entryFk, filter, options) => {
const myOptions = {};
if (typeof options == 'object')
Object.assign(myOptions, options);
let conn = Self.dataSource.connector;
let where = buildFilter(ctx.args, (param, value) => {
switch (param) {
case 'name':
case 'subName':
case 'company_name':
case 'comment':
return {[param]: {like: `%${value}%`}};
case 'size':
case 'isIgnored':
case 'itemFk':
case 'stickers':
case 'packagingFk':
case 'weight':
case 'packing':
case 'grouping':
case 'quantity':
case 'buyingValue':
case 'amount':
case 'price2':
case 'price3':
case 'packingOut':
case 'minPrice':
case 'workerFk':
case 'itemTypeFk':
case 'groupingMode':
case 'hasMinPrice':
return {[param]: value};
}
});
filter = mergeFilters(filter, {where});
let stmts = [];
let stmt;
const selectFields = `b.id,
b.isIgnored,
b.itemFk,
b.printedStickers,
b.stickers,
b.packagingFk,
b.weight,
b.packing,
b.groupingMode,
b.grouping,
b.quantity,
b.buyingValue,
ROUND(b.buyingValue * b.quantity, 2) amount,
b.isChecked,
b.price2,
b.price3,
i.name,
i.size,
i.minPrice,
i.hasMinPrice,
i.packingOut,
i.comment,
i.subName,
i.tag5,
i.value5,
i.tag6,
i.value6,
i.tag7,
i.value7,
i.tag8,
i.value8,
i.tag9,
i.value9,
i.tag10,
i.value10,
s.company_name,
ik.hexJson,
it.workerFk,
it.id itemTypeFk
`;
const groupByFields = `SUM(b.printedStickers) printedStickers,
SUM(b.packing) packing,
SUM(b.stickers) stickers,
SUM(b.weight) weight,
SUM(b.quantity) quantity,
SUM(ROUND(b.buyingValue * b.quantity, 2)) amount
`;
const groupBy = ctx.args.groupBy;
stmt = new ParameterizedSQL(
`SELECT *
FROM(
SELECT
${ groupBy ? groupByFields : selectFields}
FROM item i
LEFT JOIN ink ik ON ik.id = i.inkFk
LEFT JOIN buy b ON b.itemFk = i.id
LEFT JOIN edi.ekt e ON e.id = b.ektFk
LEFT JOIN edi.supplier s ON e.pro = s.supplier_id
LEFT JOIN itemType it ON it.id = i.typeFk
WHERE b.entryFk = ?
${groupBy ?? ''}
) sub`,
[entryFk]
);
stmt.merge(conn.makeSuffix(filter));
let itemsIndex = stmts.push(stmt) - 1;
let sql = ParameterizedSQL.join(stmts, ';');
let result = await conn.executeStmt(sql, myOptions);
if (groupBy && result.length) {
const buys = await Self.app.models.Buy.find({where: {entryFk}}, myOptions);
const buysChecked = buys.filter(buy => buy?.isChecked);
result[0].isChecked = buysChecked.length === buys.length;
}
return itemsIndex === 0 ? result : result[itemsIndex];
};
};

View File

@ -1,46 +0,0 @@
module.exports = Self => {
Self.remoteMethodCtx('getBuyUltimate', {
description: 'Returns the last buy of the item',
accessType: 'READ',
accepts: [
{
arg: 'itemFk',
type: 'number',
required: true
}, {
arg: 'warehouseFk',
type: 'number',
required: true
}, {
arg: 'date',
type: 'date',
required: true
}
],
returns: {
type: 'object',
root: true
},
http: {
path: `/getBuyUltimate`,
verb: 'GET'
}
});
Self.getBuyUltimate = async(ctx, itemFk, warehouseFk, date, options) => {
const myOptions = {};
if (typeof options == 'object')
Object.assign(myOptions, options);
await Self.rawSql('CALL vn.buy_getUltimate(?, ?, ?)', [itemFk, warehouseFk, date], myOptions);
return Self.rawSql(
`SELECT b.*
FROM cache.last_buy lb
JOIN buy b ON b.id = lb.buy_id
WHERE lb.item_id = ?
ORDER BY (lb.warehouse_id = ?) desc
LIMIT 1`,
[itemFk, warehouseFk], myOptions
);
};
};

View File

@ -1,46 +0,0 @@
module.exports = Self => {
Self.remoteMethodCtx('cloneEntry', {
description: 'Clones an entry',
accessType: 'WRITE',
accepts: [{
arg: 'id',
type: 'number',
required: true,
description: 'The entry id',
http: {source: 'path'}
}],
returns: {
type: 'object',
root: true
},
http: {
path: `/:id/cloneEntry`,
verb: 'POST'
}
});
Self.cloneEntry = async(ctx, id, options) => {
const userId = ctx.req.accessToken.userId;
const myOptions = {userId};
let tx;
let result;
if (typeof options == 'object')
Object.assign(myOptions, options);
if (!myOptions.transaction) {
tx = await Self.beginTransaction({});
myOptions.transaction = tx;
}
try {
result = await Self.rawSql('CALL entry_clone(?)', [id], myOptions);
if (tx) await tx.commit();
return result[0];
} catch (e) {
if (tx) await tx.rollback();
throw e;
}
};
};

View File

@ -1,48 +0,0 @@
module.exports = Self => {
Self.remoteMethodCtx('deleteEntry', {
description: 'Clones an entry',
accessType: 'WRITE',
accepts: [{
arg: 'id',
type: 'number',
required: true,
description: 'The entry id',
http: {source: 'path'}
}],
http: {
path: `/:id/deleteEntry`,
verb: 'POST'
}
});
Self.deleteEntry = async(ctx, id, options) => {
const userId = ctx.req.accessToken.userId;
const myOptions = {userId};
let tx;
if (typeof options == 'object')
Object.assign(myOptions, options);
if (!myOptions.transaction) {
tx = await Self.beginTransaction({});
myOptions.transaction = tx;
}
try {
const entry = await Self.findById(id, null, myOptions);
await entry.updateAttribute('travelFk', null, myOptions);
await Self.rawSql('DELETE FROM vn.duaEntry WHERE entryFk = ?;', [id], myOptions);
await Self.rawSql(`
DELETE i.*
FROM vn.invoiceIn i
JOIN vn.entry e ON e.invoiceInFk = i.id
WHERE e.id = ?`, [id], myOptions
);
if (tx) await tx.commit();
} catch (e) {
if (tx) await tx.rollback();
throw e;
}
};
};

View File

@ -129,68 +129,7 @@ module.exports = Self => {
arg: 'finalTemperature',
type: 'number',
description: 'Final temperature value'
},
{
arg: 'isExcludedFromAvailable',
type: 'boolean',
description: `landing date`
},
{
arg: 'isReceived',
type: 'boolean',
description: `travel received`
},
{
arg: 'isRaid',
type: 'boolean',
description: `travel isRaid`
},
{
arg: 'landed',
type: 'date',
description: `landing date`
},
{
arg: 'invoiceNumber',
type: 'string',
description: `entry invoice`
},
{
arg: 'reference',
type: 'string',
description: `entry reference`
},
{
arg: 'awbCode',
type: 'string',
description: `awb code`
},
{
arg: 'agencyModeId',
type: 'number',
description: `agency mode id`
},
{
arg: 'evaNotes',
type: 'string',
description: `observation`
},
{
arg: 'warehouseInFk',
type: 'number',
description: `warehouse in id`
},
{
arg: 'warehouseOutFk',
type: 'number',
description: `warehouse out id`
},
{
arg: 'entryTypeCode',
type: 'string',
description: 'entry type code'
},
}
],
returns: {
type: ['object'],
@ -217,12 +156,19 @@ module.exports = Self => {
{'s.name': {like: `%${value}%`}},
{'s.nickname': {like: `%${value}%`}}
]};
case 'invoiceNumber':
case 'reference':
case 'ref':
case 'evaNotes':
param = `e.${param}`;
return {[param]: {like: `%${value}%`}};
case 'created':
return {'e.created': {gte: value}};
case 'from':
return {'t.landed': {gte: value}};
case 'fromShipped':
return {'t.shipped': {gte: value}};
case 'to':
return {'t.landed': {lte: value}};
case 'toShipped':
return {'t.shipped': {lte: value}};
case 'id':
case 'isBooked':
case 'isConfirmed':
@ -232,20 +178,8 @@ module.exports = Self => {
case 'currencyFk':
case 'supplierFk':
case 'invoiceInFk':
case 'isExcludedFromAvailable':
return {[`e.${param}`]: value};
case 'isReceived':
case 'landed':
case 'isRaid':
case 'warehouseInFk':
case 'warehouseOutFk':
return {[`t.${param}`]: value};
case 'awbCode':
return {'a.code': {like: `%${value}%`}};
case 'agencyModeId':
return {[`am.id`]: value};
case 'entryTypeCode':
return {[`et.code`]: value};
param = `e.${param}`;
return {[param]: value};
case 'initialTemperature':
return {'e.initialTemperature': {lte: value}};
case 'finalTemperature':
@ -263,14 +197,15 @@ module.exports = Self => {
const stmts = [];
let stmt;
stmt = new ParameterizedSQL(
`SELECT e.id,
`SELECT
e.id,
e.supplierFk,
e.dated,
e.reference,
e.invoiceNumber,
e.isBooked,
e.isExcludedFromAvailable,
e.evaNotes,
e.evaNotes observation,
e.isConfirmed,
e.isOrdered,
t.isRaid,
@ -292,27 +227,15 @@ module.exports = Self => {
cu.code currencyCode,
t.shipped,
t.landed,
t.ref travelRef,
t.ref AS travelRef,
t.warehouseInFk,
w.name warehouseInName,
t.warehouseOutFk,
w2.name warehouseOutName,
a.code awbCode,
am.id agencyModeId,
am.name agencyModeName,
et.code entryTypeCode,
et.description entryTypeDescription,
t.isReceived
w.name warehouseInName
FROM vn.entry e
JOIN vn.supplier s ON s.id = e.supplierFk
LEFT JOIN vn.travel t ON t.id = e.travelFk
LEFT JOIN vn.warehouse w ON w.id = t.warehouseInFk
LEFT JOIN vn.warehouse w2 ON w2.id = t.warehouseOutFk
LEFT JOIN vn.company co ON co.id = e.companyFk
LEFT JOIN vn.currency cu ON cu.id = e.currencyFk
LEFT JOIN vn.awb a ON a.id = t.awbFk
LEFT JOIN vn.agencyMode am ON am.id = t.agencyModeFk
LEFT JOIN vn.entryType et ON et.code = e.typeFk`
JOIN vn.travel t ON t.id = e.travelFk
JOIN vn.warehouse w ON w.id = t.warehouseInFk
JOIN vn.company co ON co.id = e.companyFk
JOIN vn.currency cu ON cu.id = e.currencyFk`
);
stmt.merge(conn.makeWhere(filter.where));

View File

@ -1,50 +0,0 @@
module.exports = Self => {
Self.remoteMethodCtx('recalcEntryPrices', {
description: 'Clones an entry',
accessType: 'WRITE',
accepts: [{
arg: 'entryFk',
type: 'number',
required: true,
description: 'The entry id',
http: {source: 'path'}
}],
returns: {
type: 'object',
root: true
},
http: {
path: `/:entryFk/recalcEntryPrices`,
verb: 'POST'
}
});
Self.recalcEntryPrices = async(ctx, entryFk, options) => {
const userId = ctx.req.accessToken.userId;
const myOptions = {userId};
let tx;
let result;
if (typeof options == 'object')
Object.assign(myOptions, options);
if (!myOptions.transaction) {
tx = await Self.beginTransaction({});
myOptions.transaction = tx;
}
const entry = await Self.findById(entryFk, myOptions);
const entryConfig = await Self.app.models.EntryConfig.findOne(myOptions);
if (entry.supplierFk === entryConfig.inventorySupplierFk) return;
try {
result = await Self.rawSql('CALL vn.buy_recalcPricesByEntry(?)', [entryFk], myOptions);
if (tx) await tx.commit();
return result[0];
} catch (e) {
if (tx) await tx.rollback();
throw e;
}
};
};

View File

@ -31,8 +31,5 @@
},
"InventoryConfig": {
"dataSource": "vn"
},
"EntryConfig": {
"dataSource": "vn"
}
}

View File

@ -1,30 +0,0 @@
{
"name": "EntryConfig",
"base": "VnModel",
"mixins": {
"Loggable": true
},
"options": {
"mysql": {
"table": "entryConfig"
}
},
"properties": {
"defaultEntry": {
"type": "number",
"id": true
},
"mailToNotify": {
"type": "string"
},
"inventorySupplierFk": {
"type": "number"
},
"maxLockTime": {
"type": "number"
},
"defaultSupplierFk": {
"type": "number"
}
}
}

View File

@ -15,13 +15,8 @@ module.exports = Self => {
require('../methods/entry/transfer')(Self);
require('../methods/entry/labelSupplier')(Self);
require('../methods/entry/buyLabelSupplier')(Self);
require('../methods/entry-buys/getBuyList')(Self);
require('../methods/entry-buys/getBuyUltimate')(Self);
require('../methods/entry/cloneEntry')(Self);
require('../methods/entry/deleteEntry')(Self);
require('../methods/entry/recalcEntryPrices')(Self);
Self.observe('before save', async(ctx, options) => {
Self.observe('before save', async function(ctx, options) {
if (ctx.isNewInstance) return;
const changes = ctx.data || ctx.instance;

View File

@ -56,7 +56,8 @@
"required": true
},
"travelFk": {
"type": "number"
"type": "number",
"required": true
},
"companyFk": {
"type": "number",
@ -73,12 +74,6 @@
},
"finalTemperature": {
"type": "number"
},
"lockerUserFk":{
"type": "number"
},
"locked":{
"type": "date"
}
},
"relations": {
@ -112,16 +107,6 @@
"type": "belongsTo",
"model": "EntryType",
"foreignKey": "typeFk"
},
"invoiceIn": {
"type": "belongsTo",
"model": "InvoiceIn",
"foreignKey": "invoiceInFk"
},
"user": {
"type": "belongsTo",
"model": "VnUser",
"foreignKey": "lockerUserFk"
}
}
}
}

View File

@ -29,9 +29,9 @@ describe('entry_isEditable trigger', () => {
});
async function prepareEntry(isBooked, typeFk) {
let newCreated = Date.vnNew();
const companyFk = 69;
await entry.updateAttributes({isBooked, typeFk}, options);
await entry.updateAttributes({dated: newCreated}, options);
await entry.updateAttributes({companyFk}, options);
}
it('should throw an error when entry is booked and typeFk is null', async() => {

View File

@ -32,6 +32,12 @@ module.exports = Self => {
description: 'The client id',
http: {source: 'query'}
},
{
arg: 'companyFk',
type: 'integer',
description: 'The company id',
http: {source: 'query'}
},
{
arg: 'fi',
type: 'string',
@ -148,6 +154,7 @@ module.exports = Self => {
i.hasPdf,
i.customsAgentFk,
c.socialName AS clientSocialName,
i.companyFk,
co.code AS companyCode,
ca.fiscalName AS customsAgentName
FROM invoiceOut i

View File

@ -22,6 +22,11 @@ module.exports = Self => {
type: 'integer',
description: 'The item id',
},
{
arg: 'name',
type: 'string',
description: 'The item name',
},
{
arg: 'typeFk',
type: 'integer',
@ -112,6 +117,8 @@ module.exports = Self => {
: {'it.code': {like: `%${value}%`}};
case 'categoryFk':
return {'it.categoryFk': value};
case 'name':
return {'i.name': {like: `%${value}%`}};
case 'buyerFk':
return {'it.workerFk': value};
case 'warehouseFk':

View File

@ -89,7 +89,7 @@ describe('item filter()', () => {
const ctx = {args: {filter: filter, workerFk: 16}, req: {accessToken: {userId: 1}}};
const result = await models.Item.filter(ctx, filter, options);
expect(result.length).toEqual(3);
expect(result.length).toEqual(2);
expect(result[0].id).toEqual(16);
expect(result[1].id).toEqual(71);

View File

@ -26,7 +26,7 @@ describe('tag filterValue()', () => {
const filter = {where: {value: 'Blue'}, limit: 5};
const result = await models.Tag.filterValue(colorTagId, filter, options);
expect(result.length).toEqual(3);
expect(result.length).toEqual(2);
expect(result[0].value).toEqual('Blue');
expect(result[1].value).toEqual('Blue/Silver');

View File

@ -17,9 +17,6 @@
},
"showOrder": {
"type": "number"
},
"hexJson": {
"type": "string"
}
},
"acls": [

View File

@ -0,0 +1,128 @@
const {ParameterizedSQL} = require('loopback-connector');
const {buildFilter, mergeFilters} = require('vn-loopback/util/filter');
module.exports = Self => {
Self.remoteMethodCtx('filter', {
description: 'Find all instances of the model matched by filter from the data source.',
accessType: 'READ',
accepts: [{
arg: 'filter',
type: 'object',
description: 'Filter defining where, order, skip and limit - must be a JSON-encoded string',
http: {source: 'query'}
}, {
arg: 'search',
type: 'string',
description: 'Searchs the vehicle by id or numberPlate',
http: {source: 'query'}
}, {
arg: 'id',
type: 'number'
}, {
arg: 'description',
type: 'string'
}, {
arg: 'companyFk',
type: 'number'
}, {
arg: 'tradeMark',
type: 'string'
}, {
arg: 'numberPlate',
type: 'string'
}, {
arg: 'warehouseFk',
type: 'number'
}, {
arg: 'chassis',
type: 'string'
}, {
arg: 'leasing',
type: 'string'
}, {
arg: 'countryCodeFk',
type: 'string'
}, {
arg: 'vehicleTypeFk',
type: 'number'
}, {
arg: 'vehicleStateFk',
type: 'number'
}],
returns: {
type: ['object'],
root: true
},
http: {
path: `/filter`,
verb: `GET`
}
});
Self.filter = async(ctx, filter, options) => {
const conn = Self.dataSource.connector;
const myOptions = {};
if (typeof options == 'object') Object.assign(myOptions, options);
const where = buildFilter(ctx.args, (param, value) => {
switch (param) {
case 'search':
return {or: [{'v.id': value}, {numberPlate: {like: `%${value}%`}}]};
case 'id':
return {'v.id': value};
case 'description':
case 'tradeMark':
case 'numberPlate':
case 'chassis':
case 'leasing':
return {[param]: {like: `%${value}%`}};
case 'companyFk':
case 'warehouseFk':
case 'countryCodeFk':
case 'vehicleStateFk':
case 'vehicleTypeFk':
return {[param]: value};
}
});
filter = mergeFilters(filter, {where});
const stmt = new ParameterizedSQL(`
SELECT v.id,
v.numberPlate,
v.tradeMark,
v.model,
v.m3,
v.description,
v.isActive,
v.countryCodeFk,
v.chassis,
v.leasing,
vt.name type,
w.name warehouse,
c.code company,
sub.state
FROM vehicle v
JOIN vehicleType vt ON vt.id = v.vehicleTypeFk
LEFT JOIN warehouse w ON w.id = v.warehouseFk
LEFT JOIN company c ON c.id = v.companyFk
LEFT JOIN (
SELECT e.vehicleFk,
e.vehicleStateFk,
s.state,
ROW_NUMBER() OVER (PARTITION BY e.vehicleFk ORDER BY e.started DESC) rn
FROM vehicleEvent e
LEFT JOIN vehicleState s ON e.vehicleStateFk = s.id
) sub ON sub.vehicleFk = v.id AND sub.rn = 1
`);
const sqlWhere = conn.makeWhere(filter.where);
stmt.merge(sqlWhere);
stmt.merge(conn.makePagination(filter));
const sql = ParameterizedSQL.join([stmt], ';');
return conn.executeStmt(sql, myOptions);
};
};

View File

@ -0,0 +1,127 @@
const {models} = require('vn-loopback/server/server');
describe('Vehicle filter()', () => {
const deliveryAssiId = 123;
const ctx = beforeAll.getCtx(deliveryAssiId);
let options;
let tx;
beforeEach(async() => {
ctx.args = {};
options = {};
tx = await models.Sale.beginTransaction({});
options.transaction = tx;
});
afterEach(async() => {
await tx.rollback();
});
it('should return the vehicles matching "search"', async() => {
const {id} = await models.Vehicle.findById(1, null, options);
const {numberPlate} = await models.Vehicle.findById(2, null, options);
ctx.args = {search: id};
const [searchResult] = await models.Vehicle.filter(ctx);
ctx.args = {search: numberPlate};
const [searchResult2] = await models.Vehicle.filter(ctx);
expect(searchResult.id).toEqual(id);
expect(searchResult2.numberPlate).toEqual(numberPlate);
});
it('should return the vehicles matching "companyFk"', async() => {
const company = await models.Company.findOne({where: {code: 'VNL'}}, options);
ctx.args = {companyFk: company.id};
const searchResult = await models.Vehicle.filter(ctx, null, options);
searchResult.forEach(record => {
expect(record.company).toEqual(company.code);
});
});
it('should return the vehicles matching "tradeMark"', async() => {
const tradeMark = 'WAYNE INDUSTRIES';
ctx.args = {tradeMark};
const searchResult = await models.Vehicle.filter(ctx);
searchResult.forEach(record => {
expect(record.tradeMark).toEqual(tradeMark);
});
});
it('should return the vehicles matching "numberPlate"', async() => {
const {numberPlate} = await models.Vehicle.findById(1, null, options);
ctx.args = {numberPlate};
const searchResult = await models.Vehicle.filter(ctx);
searchResult.forEach(record => {
expect(record.numberPlate).toEqual(numberPlate);
});
});
it('should return the vehicles matching "warehouseFk"', async() => {
const warehouse = await models.Warehouse.findById(1, null, options);
ctx.args = {warehouseFk: warehouse.id};
const searchResult = await models.Vehicle.filter(ctx);
searchResult.forEach(record => {
expect(record.warehouse).toEqual(warehouse.name);
});
});
it('should return the vehicles matching "chassis"', async() => {
const {chassis} = await models.Vehicle.findById(1, null, options);
ctx.args = {chassis};
const [searchResult] = await models.Vehicle.filter(ctx);
expect(searchResult.chassis).toEqual(chassis);
});
it('should return the vehicles matching "leasing"', async() => {
const leasing = 'Wayne leasing';
ctx.args = {leasing};
const searchResult = await models.Vehicle.filter(ctx);
searchResult.forEach(record => {
expect(record.leasing).toEqual(leasing);
});
});
it('should return the vehicles matching "countryCodeFk"', async() => {
const countryCodeFk = 'ES';
ctx.args = {countryCodeFk};
const searchResult = await models.Vehicle.filter(ctx);
searchResult.forEach(record => {
expect(record.countryCodeFk).toEqual(countryCodeFk);
});
});
it('should return the vehicles matching "vehicleTypeFk"', async() => {
const {name, id} = await models.VehicleType.findById(1, null, options);
ctx.args = {vehicleTypeFk: id};
const searchResult = await models.Vehicle.filter(ctx);
searchResult.forEach(record => {
expect(record.type).toEqual(name);
});
});
it('should return the vehicles matching "vehicleStateFk"', async() => {
const {state, id} = await models.VehicleState.findById(3);
ctx.args = {vehicleStateFk: id};
const searchResult = await models.Vehicle.filter(ctx);
searchResult.forEach(record => {
expect(record.state).toEqual(state);
});
});
it('should return the vehicles matching "description"', async() => {
const {description} = await models.Vehicle.findById(2);
ctx.args = {description};
const searchResult = await models.Vehicle.filter(ctx);
searchResult.forEach(record => {
expect(record.description).toEqual(description);
});
});
});

View File

@ -5,12 +5,21 @@
"AgencyTermConfig": {
"dataSource": "vn"
},
"BankPolicy": {
"dataSource": "vn"
},
"Cmr": {
"dataSource": "vn"
},
"DeliveryPoint": {
"dataSource": "vn"
},
"FuelType": {
"dataSource": "vn"
},
"Ppe": {
"dataSource": "vn"
},
"RoadmapAddress": {
"dataSource": "vn"
},
@ -35,6 +44,12 @@
"Vehicle": {
"dataSource": "vn"
},
"VehicleState": {
"dataSource": "vn"
},
"VehicleType": {
"dataSource": "vn"
},
"RoutesMonitor": {
"dataSource": "vn"
}

View File

@ -0,0 +1,21 @@
{
"name": "BankPolicy",
"base": "VnModel",
"options": {
"mysql": {
"table": "bankPolicy"
}
},
"properties": {
"id": {
"type": "number",
"id": true
},
"ref": {
"type": "string"
},
"dmsFk": {
"type": "number"
}
}
}

View File

@ -0,0 +1,30 @@
{
"name": "FuelType",
"base": "VnModel",
"options": {
"mysql": {
"table": "fuelType"
}
},
"properties": {
"id": {
"type": "number",
"id": true,
"description": "Identifier"
},
"name": {
"type": "string"
},
"code": {
"type": "string"
}
},
"acls": [
{
"accessType": "READ",
"principalType": "ROLE",
"principalId": "$everyone",
"permission": "ALLOW"
}
]
}

View File

@ -0,0 +1,15 @@
{
"name": "Ppe",
"base": "VnModel",
"options": {
"mysql": {
"table": "ppe"
}
},
"properties": {
"id": {
"type": "number",
"id": true
}
}
}

View File

@ -0,0 +1,21 @@
{
"name": "VehicleState",
"base": "VnModel",
"options": {
"mysql": {
"table": "vehicleState"
}
},
"properties": {
"id": {
"type": "number",
"id": true
},
"state": {
"type": "string"
},
"hasToNotify": {
"type": "number"
}
}
}

View File

@ -0,0 +1,19 @@
{
"name": "VehicleType",
"base": "VnModel",
"options": {
"mysql": {
"table": "vehicleType"
}
},
"properties": {
"id": {
"type": "number",
"id": true,
"description": "Identifier"
},
"name": {
"type": "string"
}
}
}

View File

@ -1,3 +1,4 @@
module.exports = Self => {
require('../methods/vehicle/sorted')(Self);
require('../methods/vehicle/filter')(Self);
};

View File

@ -3,7 +3,7 @@
"base": "VnModel",
"options": {
"mysql": {
"table": "vehicle"
"table": "vehicle"
}
},
"properties": {
@ -29,6 +29,39 @@
},
"isActive": {
"type": "number"
},
"countryCodeFk": {
"type": "string"
},
"chassis": {
"type": "string"
},
"leasing": {
"type": "string"
},
"isKmTruckRate": {
"type": "number"
},
"fuelTypeFk": {
"type": "number"
},
"import": {
"type": "number"
},
"importCooler": {
"type": "number"
},
"vin": {
"type": "string"
},
"ppeFk": {
"type": "number"
},
"vehicleTypeFk": {
"type": "number"
},
"deliveryPointFk": {
"type": "number"
}
},
"relations": {
@ -46,21 +79,57 @@
"type": "belongsTo",
"model": "DeliveryPoint",
"foreignKey": "deliveryPointFk"
},
"event": {
"type": "hasMany",
"model": "VehicleEvent",
"foreignKey": "vehicleFk",
"property": "id"
},
"supplier": {
"type": "belongsTo",
"model": "Supplier",
"foreignKey": "supplierFk"
},
"supplierCooler": {
"type": "belongsTo",
"model": "Supplier",
"foreignKey": "supplierCoolerFk"
},
"bankPolicy": {
"type": "belongsTo",
"model": "BankPolicy",
"foreignKey": "bankPolicyFk"
},
"fuelType": {
"type": "belongsTo",
"model": "FuelType",
"foreignKey": "fuelTypeFk"
},
"ppe": {
"type": "hasOne",
"model": "Ppe",
"foreignKey": "id",
"property": "ppeFk"
},
"type": {
"type": "hasOne",
"model": "VehicleType",
"foreignKey": "id",
"property": "vehicleTypeFk"
}
},
"scope": {
"where": {
"isActive": {
"scopes": {
"active": {
"fields": [
"id",
"numberPlate"
],
"where": {
"isActive": {
"neq": false
}
}
},
"acls": [
{
"accessType": "READ",
"principalType": "ROLE",
"principalId": "$everyone",
"permission": "ALLOW"
}
]
}
}
}

View File

@ -12,14 +12,6 @@
"id": true,
"description": "Identifier"
},
"column": {
"type": "string",
"required": true
},
"row": {
"type": "string",
"required": true
},
"code": {
"type": "string"
},

View File

@ -7,6 +7,6 @@ describe('Supplier getItemsPackaging()', () => {
expect(item.id).toEqual(1);
expect(item.name).toEqual('Ranged weapon longbow 200cm');
expect(item.quantity).toEqual(5000);
expect(item.quantityTotal).toEqual(5200);
expect(item.quantityTotal).toEqual(5100);
});
});

View File

@ -113,6 +113,12 @@ module.exports = Self => {
const salesPerson = sale.ticket().client().salesPersonUser();
if (salesPerson) {
const url = await Self.app.models.Url.getUrl();
const saleCloned = await Self.app.models.SaleCloned.findById(sale.id, {
include: 'saleOriginal',
});
const ticketWeekly = saleCloned?.saleOriginal()?.ticketFk || null;
const message = $t('Changed sale price', {
ticketId: sale.ticket().id,
itemId: sale.itemFk,
@ -121,7 +127,8 @@ module.exports = Self => {
oldPrice: oldPrice,
newPrice: newPrice,
ticketUrl: `${url}ticket/${sale.ticket().id}/sale`,
itemUrl: `${url}item/${sale.itemFk}/summary`
itemUrl: `${url}item/${sale.itemFk}/summary`,
ticketWeekly: ticketWeekly ? $t('clonedFromTicketWeekly', {ticketWeekly}) : null
});
await models.Chat.sendCheckingPresence(ctx, salesPerson.id, message, myOptions);
}

View File

@ -72,6 +72,12 @@ module.exports = Self => {
const salesPerson = sale.ticket().client().salesPersonUser();
if (salesPerson) {
const url = await Self.app.models.Url.getUrl();
const saleCloned = await Self.app.models.SaleCloned.findById(sale.id, {
include: 'saleOriginal',
});
const ticketWeekly = saleCloned?.saleOriginal()?.ticketFk || null;
const change = $t('Changes in sales', {
itemId: sale.itemFk,
concept: sale.concept,
@ -84,6 +90,7 @@ module.exports = Self => {
ticketId: sale.ticket().id,
changes: JSON.stringify(change),
ticketUrl: `${url}ticket/${sale.ticket().id}/sale`,
ticketWeekly: ticketWeekly ? $t('clonedFromTicketWeekly', {ticketWeekly}) : null
});
await models.Chat.sendCheckingPresence(ctx, salesPerson.id, message, myOptions);

View File

@ -166,10 +166,18 @@ module.exports = Self => {
const salesPerson = ticket.client().salesPersonUser();
if (salesPerson) {
const url = await Self.app.models.Url.getUrl();
const saleId = sales[0].id;
const saleCloned = await Self.app.models.SaleCloned.findById(saleId, {
include: 'saleOriginal',
});
const ticketWeekly = saleCloned?.saleOriginal()?.ticketFk || null;
const message = $t('Changed sale discount', {
ticketId: id,
ticketUrl: `${url}ticket/${id}/sale`,
changes: changesMade
changes: changesMade,
ticketWeekly: ticketWeekly ? $t('clonedFromTicketWeekly', {ticketWeekly}) : null
});
await models.Chat.sendCheckingPresence(ctx, salesPerson.id, message, myOptions);
}

View File

@ -1,5 +1,6 @@
const ParameterizedSQL = require('loopback-connector').ParameterizedSQL;
const {mergeFilters, mergeWhere} = require('vn-loopback/util/filter');
const UserError = require('vn-loopback/util/user-error');
module.exports = Self => {
Self.remoteMethodCtx('filter', {
@ -33,7 +34,10 @@ module.exports = Self => {
const conn = Self.dataSource.connector;
const userId = ctx.req.accessToken.userId;
const models = Self.app.models;
const hasPrivs = await models.ACL.checkAccessAcl(ctx, 'WorkerDms', 'hasHighPrivs', '*');
if (!hasPrivs && userId !== id)
throw new UserError('You don\'t have enough privileges');
// Get ids alloweds
const account = await models.VnUser.findById(userId);

View File

@ -155,6 +155,11 @@
"type": "hasMany",
"model": "WorkerRelative",
"foreignKey": "workerFK"
},
"business": {
"type": "hasMany",
"model": "Business",
"foreignKey": "workerFk"
}
},
"acls": [
@ -272,7 +277,8 @@
"relation": "department",
"scope": {
"fields": [
"id"
"id",
"name"
]
}
}
@ -289,14 +295,23 @@
"departmentFk",
"workerBusinessProfessionalCategoryFk"
],
"include": [
"include":[
{
"relation": "department",
"scope": {
"fields": ["id", "name"]
}
},
{
"relation": "reasonEnd",
"scope": {
"fields": [
"id",
"reason"
]
"fields": ["id", "reason"]
}
},
{
"relation": "workerBusinessProfessionalCategory",
"scope": {
"fields": ["id", "description"]
}
}
]