Skip to content

Commit

Permalink
fix default extension to export.
Browse files Browse the repository at this point in the history
  • Loading branch information
EdwinBetanc0urt committed Nov 19, 2024
1 parent 2399658 commit 9925b14
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 6 deletions.
3 changes: 2 additions & 1 deletion src/lang/ADempiere/en/smartBrowser.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ const smartBrowser = {
title: 'Export All Records',
description: 'Records matching the query criteria.',
successful: 'Successful export',
quantityExport: 'Quantity of exported records: '
quantityExport: 'Quantity of exported records: ',
withoutExtension: 'You must select the specific format/extension.'
},
// process
processAllRecords: {
Expand Down
3 changes: 2 additions & 1 deletion src/lang/ADempiere/es/smartBrowser.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ const smartBrowser = {
title: 'Exportar Todos Los Registros',
description: 'Registros que coincidan con el criterio de búsqueda.',
successful: 'Exportación exitosa',
quantityExport: 'Cantidad de registros exportados: '
quantityExport: 'Cantidad de registros exportados: ',
withoutExtension: 'Debe seleccionar el formato/extensión específico.'
},
// process
processAllRecords: {
Expand Down
9 changes: 7 additions & 2 deletions src/utils/ADempiere/dictionary/browser/actionsMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import { OPERATOR_IN } from '@/utils/ADempiere/dataUtils.js'
import { EXPORT_SUPPORTED_TYPES } from '@/utils/ADempiere/exportUtil.js'

// Utils and Helpers Methods
import { showNotification } from '@/utils/ADempiere/notification.js'
import { showMessage, showNotification } from '@/utils/ADempiere/notification.js'
import { zoomIn } from '@/utils/ADempiere/coreUtils.js'
import { isEmptyValue } from '@/utils/ADempiere/valueUtils.js'
import { exportFileFromJson } from '@/utils/ADempiere/exportUtil.js'
Expand Down Expand Up @@ -72,7 +72,12 @@ export const exportAllRecords = {
svg: false,
icon: 'el-icon-download',
actionName: 'exportAllRecords',
exportAllRecords: () => null,
exportAllRecords: () => {
showMessage({
type: 'info',
message: language.t('smartBrowser.exportAllRecords.withoutExtension')
})
},
// generate export formats
childs: Object.keys(EXPORT_SUPPORTED_TYPES).map(format => {
return {
Expand Down
10 changes: 8 additions & 2 deletions src/utils/ADempiere/exportUtil.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ import { export_txt_to_zip } from '@/vendor/Export2Zip'
import { isEmptyValue } from '@/utils/ADempiere/valueUtils'
import { formatField } from '@/utils/ADempiere/valueFormat'

/**
* Default extension/format to export records
*/
export const DEFAULT_EXPORT_TYPE = 'csv'

// export file with records
export const EXPORT_SUPPORTED_TYPES = {
csv: language.t('extensionFile.csv'),
Expand Down Expand Up @@ -167,9 +172,10 @@ export function exportZipFile({
* @param {string} containerUuid
* @param {object} containerManager
* @param {string} formatToExport
* @param {array} formatToExport
* @param {array} selection
* @param {object} currrentRecord
*/
export const exportRecords = ({ parentUuid, containerUuid, containerManager, formatToExport = 'json', selection = [], currrentRecord = { }}) => {
export const exportRecords = ({ parentUuid, containerUuid, containerManager, formatToExport = DEFAULT_EXPORT_TYPE, selection = [], currrentRecord = { }}) => {
let currentSelection = [currrentRecord]
if (isEmptyValue(currrentRecord)) {
currentSelection = containerManager.getSelection({
Expand Down

0 comments on commit 9925b14

Please sign in to comment.