From 9925b146f74f7043c9243550e64d9fd6fa14288e Mon Sep 17 00:00:00 2001 From: EdwinBetanc0urt Date: Tue, 19 Nov 2024 14:23:20 -0400 Subject: [PATCH] fix default extension to export. --- src/lang/ADempiere/en/smartBrowser.js | 3 ++- src/lang/ADempiere/es/smartBrowser.js | 3 ++- src/utils/ADempiere/dictionary/browser/actionsMenu.js | 9 +++++++-- src/utils/ADempiere/exportUtil.js | 10 ++++++++-- 4 files changed, 19 insertions(+), 6 deletions(-) diff --git a/src/lang/ADempiere/en/smartBrowser.js b/src/lang/ADempiere/en/smartBrowser.js index 39b2d66f5c2..4351a6c2f97 100644 --- a/src/lang/ADempiere/en/smartBrowser.js +++ b/src/lang/ADempiere/en/smartBrowser.js @@ -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: { diff --git a/src/lang/ADempiere/es/smartBrowser.js b/src/lang/ADempiere/es/smartBrowser.js index 1021ed5b46f..f4f4ccab1f4 100644 --- a/src/lang/ADempiere/es/smartBrowser.js +++ b/src/lang/ADempiere/es/smartBrowser.js @@ -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: { diff --git a/src/utils/ADempiere/dictionary/browser/actionsMenu.js b/src/utils/ADempiere/dictionary/browser/actionsMenu.js index f45a1a9a60e..87d8b92d6e7 100644 --- a/src/utils/ADempiere/dictionary/browser/actionsMenu.js +++ b/src/utils/ADempiere/dictionary/browser/actionsMenu.js @@ -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' @@ -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 { diff --git a/src/utils/ADempiere/exportUtil.js b/src/utils/ADempiere/exportUtil.js index 84626754d6f..b85ad22c7b8 100644 --- a/src/utils/ADempiere/exportUtil.js +++ b/src/utils/ADempiere/exportUtil.js @@ -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'), @@ -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({