Skip to content

Commit

Permalink
Merge branch 'feature/legacy-support' into feature/dictionary-multi-t…
Browse files Browse the repository at this point in the history
…enants
  • Loading branch information
EdwinBetanc0urt committed Jul 25, 2024
2 parents 3e27886 + 09d297f commit b756b5d
Show file tree
Hide file tree
Showing 89 changed files with 1,080 additions and 1,881 deletions.
31 changes: 1 addition & 30 deletions src/api/ADempiere/business-data/entities.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* ADempiere-Vue (Frontend) for ADempiere ERP & CRM Smart Business Solution
* Copyright (C) 201-Present E.R.P. Consultores y Asociados, C.A. www.erpya.com
* Copyright (C) 2018-Present E.R.P. Consultores y Asociados, C.A. www.erpya.com
* Contributor(s): Edwin Betancourt [email protected] https://github.com/EdwinBetanc0urt
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -139,32 +139,3 @@ export function requestDeleteEntities({
return response
})
}

// /**
// * Rollback entity (Create, Update, Delete)
// * @param {string} tableName
// * @param {number} recordId
// * @param {string} eventType
// */
// export function rollbackEntity({
// tableName,
// recordId,
// recordUuid,
// eventType
// }) {
// return request({
// url: '/common/api/rollback-entity',
// method: 'post',
// data: {
// table_name: tableName,
// id: recordId,
// uuid: recordUuid,
// event_type: eventType
// }
// })
// .then(entityResponse => {
// const { convertEntity } = require('@/utils/ADempiere/apiConverts/persistence.js')

// return convertEntity(entityResponse)
// })
// }
173 changes: 0 additions & 173 deletions src/api/ADempiere/common/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,10 @@ import { request } from '@/utils/ADempiere/request'

// Constants
import { ROWS_OF_RECORDS_BY_PAGE } from '@/utils/ADempiere/tableUtils'
import { RECORD_ROWS_BY_LIST } from '@/utils/ADempiere/dictionary/field/lookups'

// Utils and Helper Methods
import { camelizeObjectKeys } from '@/utils/ADempiere/transformObject.js'

/**
* Conversion Rate
*/
export function requestGetConversionRate() {
return request({
url: '/common/conversion-rates',
method: 'get'
})
.then(response => {
return camelizeObjectKeys(response)
})
}

/**
* Get System Info
*/
Expand Down Expand Up @@ -82,58 +68,6 @@ export function requestGetCountryDefinition({
})
}

/**
* Get Organization list from role
* @param param0
* @returns
*/
export function requestOrganizationsList({
roleId,
pageToken,
pageSize = RECORD_ROWS_BY_LIST
}) {
return request({
url: '/security/organizations',
method: 'get',
params: {
role_id: roleId,
page_token: pageToken,
page_size: pageSize
}
})
.then(organizationsListResponse => {
return {
nextPageToken: organizationsListResponse.next_page_token,
recordCount: organizationsListResponse.record_count,
organizationsList: organizationsListResponse.organizations.map(organization => {
return camelizeObjectKeys(organization)
})
}
})
}

/**
* Get Warehouses of Organization
* @param organizationId
* @returns
*/
export function requestWarehousesList({
organizationId,
pageToken,
pageSize = RECORD_ROWS_BY_LIST
}) {
return request({
url: '/security/warehouses',
method: 'get',
params: {
organization_id: organizationId,
// Page Data
page_token: pageToken,
page_size: pageSize
}
})
}

/**
* GET Business Partners
*/
Expand Down Expand Up @@ -169,110 +103,3 @@ export function requestListBusinessPartner({
}
})
}

/**
* GET Product Conversions
*/
export function productConversions({
id
}) {
return request({
url: `/common/product-conversions/${id}`,
method: 'get'
})
.then(responseProductConversions => {
return {
nextPageToken: responseProductConversions.next_page_token,
recordCount: responseProductConversions.record_count,
businessPartnersList: responseProductConversions.product_conversion.map(list => {
return camelizeObjectKeys(list)
})
}
})
}

/**
* GET Business Partne
*/
export function businessPartner({
searchValue
}) {
return request({
url: `/core-functionality/business-partners`,
method: 'get',
params: {
search_value: searchValue
}
})
.then(businessPartnerResponse => {
return {
nextPageToken: businessPartnerResponse.next_page_token,
recordCount: businessPartnerResponse.record_count,
businessPartnersList: businessPartnerResponse.business_partners.map(list => {
return camelizeObjectKeys(list)
})
}
})
}

/**
* POST Business Partner
*/
export function requestCreateBusinessPartner({
value,
taxId,
duns,
naics,
name,
name2,
description,
contactName,
eMail,
phone,
businessPartnerGroupUuid,
// Location
address1,
address2,
address3,
address4,
cityUuid,
cityName,
postalCode,
regionUuid,
regionName,
countryUuid,
posUuid
}) {
return request({
url: '/core-functionality/create-business-partner',
method: 'post',
data: {
value,
tax_id: taxId,
duns,
naics,
name,
last_name: name2,
description,
contact_name: contactName,
e_mail: eMail,
phone,
business_partner_group_uid: businessPartnerGroupUuid,
// Location
address1,
address2,
address3,
address4,
city_uuid: cityUuid,
city_name: cityName,
postal_code: postalCode,
region_uuid: regionUuid,
region_name: regionName,
country_uuid: countryUuid,
pos_uuid: posUuid
}
})
.then(businessPartnerResponse => {
return camelizeObjectKeys(businessPartnerResponse)
})
}
6 changes: 3 additions & 3 deletions src/api/ADempiere/dictionary/field.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,6 @@ export function requestFieldMetadata({
case !isEmptyValue(id):
url = `/dictionary/fields/${id}`
break
case (!isEmptyValue(tableName) && isEmptyValue(columnName)):
url = `/dictionary/fields/${tableName}/${columnName}`
break
case !isEmptyValue(columnId):
url = `/dictionary/fields/column/${columnId}`
break
Expand All @@ -47,6 +44,9 @@ export function requestFieldMetadata({
case !isEmptyValue(elementColumnName):
url = `/dictionary/fields/element/column/${elementColumnName}`
break
case (!isEmptyValue(tableName) && !isEmptyValue(columnName)):
url = `/dictionary/fields/${tableName}/${columnName}`
break
}
return request({
url,
Expand Down
12 changes: 1 addition & 11 deletions src/api/ADempiere/field/search/business-partner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import { ROWS_OF_RECORDS_BY_PAGE } from '@/utils/ADempiere/tableUtils'
import { isEmptyValue } from '@/utils/ADempiere/valueUtils.js'

export function requestListBusinessPartner({
contextAttributesList,
contextAttributes,
filters = [],
fieldId,
processParameterId,
Expand Down Expand Up @@ -60,16 +60,6 @@ export function requestListBusinessPartner({
// }
// })

let contextAttributes = []
if (!isEmptyValue(contextAttributesList)) {
contextAttributes = contextAttributesList.map(attribute => {
return {
key: attribute.columnName,
value: attribute.value
}
})
}

let url
switch (true) {
case !isEmptyValue(fieldId):
Expand Down
18 changes: 1 addition & 17 deletions src/api/ADempiere/field/search/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,9 @@ import { isEmptyValue } from '@/utils/ADempiere/valueUtils'

// Constants
import { ROWS_OF_RECORDS_BY_PAGE } from '@/utils/ADempiere/tableUtils'
import { convertArrayKeyValueToObject } from '@/utils/ADempiere/formatValue/iterableFormat'

export function requestGridGeneralInfo({
contextAttributesList,
contextAttributes,
filters = [],
fieldId,
processParameterId,
Expand All @@ -52,21 +51,6 @@ export function requestGridGeneralInfo({
// }
// })

let contextAttributes = []
if (!isEmptyValue(contextAttributesList)) {
// contextAttributes = contextAttributesList.map(attribute => {
// return {
// key: attribute.columnName,
// value: attribute.value
// }
// })
contextAttributes = JSON.stringify(
convertArrayKeyValueToObject({
array: contextAttributesList
})
)
}

let url = 'user-interface/search-records'
switch (true) {
case !isEmptyValue(fieldId):
Expand Down
4 changes: 3 additions & 1 deletion src/api/ADempiere/field/search/invoice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,8 @@ export function requestListInvoicesInfo({
grandTotalTo,
isWithoutValidation
}) {
let url = '/field/invoices'
// TODO: Search for a more optimal way to compare and build the route.
let url
switch (true) {
case !isEmptyValue(fieldId):
url = `/field/invoices/field/${fieldId}`
Expand Down Expand Up @@ -147,6 +148,7 @@ export function requestListInvoicesInfo({
browse_field_id: browseFieldId,
reference_id: referenceId,
column_id: columnId,
table_name: tableName,
column_name: columnName,
// Custom Filter
document_no: documentNo,
Expand Down
11 changes: 5 additions & 6 deletions src/api/ADempiere/field/search/order.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ export function requestListOrderInfo({
orderId,
isWithoutValidation
}) {
let url = '/field/orders'
// TODO: Search for a more optimal way to compare and build the route.
let url
switch (true) {
case !isEmptyValue(fieldId):
url = `/field/orders/field/${fieldId}`
Expand All @@ -93,14 +94,11 @@ export function requestListOrderInfo({
case !isEmptyValue(browseFieldId):
url = `/field/orders/query-criteria/${browseFieldId}`
break
case (!isEmptyValue(tableName) && !isEmptyValue(columnName)):
url = `/field/orders/table/${tableName}/${columnName}`
break
case !isEmptyValue(columnId):
url = `/field/orders/column/${columnId}`
break
default:
url = `/field/orders`
case (!isEmptyValue(tableName) && !isEmptyValue(columnName)):
url = `/field/orders/table/${tableName}/${columnName}`
break
}

Expand All @@ -120,6 +118,7 @@ export function requestListOrderInfo({
browse_field_id: browseFieldId,
reference_id: referenceId,
column_id: columnId,
table_name: tableName,
column_name: columnName,
// Custom Filter
document_no: documentNo,
Expand Down
12 changes: 1 addition & 11 deletions src/api/ADempiere/field/search/product.ts
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ export function requestListVendors({
}

export function requestListProducts({
contextAttributesList,
contextAttributes,
filters = [],
fieldId,
processParameterId,
Expand Down Expand Up @@ -300,16 +300,6 @@ export function requestListProducts({
// }
// })

let contextAttributes = []
if (!isEmptyValue(contextAttributesList)) {
contextAttributes = contextAttributesList.map(attribute => {
return {
key: attribute.columnName,
value: attribute.value
}
})
}

let url = '/field/products'
switch (true) {
case !isEmptyValue(fieldId):
Expand Down
Loading

0 comments on commit b756b5d

Please sign in to comment.