added
new translation in i18n file
missing projectFields for charging station + logging
modified
all csv headers with translation
removed all csv template strings
MODIFY
src/assets/i18n/de.json
src/assets/i18n/de.json
"ocppProtocol": "OCPP Protocol",
"ocppVersion": "OCPP Version",
"powerLimitUnit": "Power Limit Unit",
+ "timezone" : "Charging station timezone",
"vendor": "Vendor"
},
"general": {
"date": "Date",
"endDate": "End Date",
"endTime": "End Time",
+ "invalidDate": "Invalid Date",
+ "invalidTime": "Invalid Time",
"latitude": "Latitude",
"longitude": "Longitude",
"month": "Month",
"name": "Name",
"price": "Price",
"priceUnit": "Price Unit",
+ "site": "Site",
"siteArea": "Site Area",
"startDate": "Start Date",
"startTime": "Start Time",
"time": "Time",
+ "value": "Value",
"year": "Year"
},
"loggings": {

MODIFY
src/assets/i18n/en.json
src/assets/i18n/en.json
"ocppProtocol": "OCPP Protocol",
"ocppVersion": "OCPP Version",
"powerLimitUnit": "Power Limit Unit",
+ "timezone" : "Charging station timezone",
"vendor": "Vendor"
},
"general": {
"date": "Date",
"endDate": "End Date",
"endTime": "End Time",
+ "invalidDate": "Invalid Date",
+ "invalidTime": "Invalid Time",
"latitude": "Latitude",
"longitude": "Longitude",
"month": "Month",
"name": "Name",
"price": "Price",
"priceUnit": "Price Unit",
+ "site": "Site",
"siteArea": "Site Area",
"startDate": "Start Date",
"startTime": "Start Time",
"time": "Time",
+ "value": "Value",
"year": "Year"
},
"loggings": {

MODIFY
src/assets/i18n/es.json
src/assets/i18n/es.json
"ocppProtocol": "OCPP Protocol",
"ocppVersion": "OCPP Version",
"powerLimitUnit": "Power Limit Unit",
+ "timezone" : "Charging station timezone",
"vendor": "Vendor"
},
"general": {
"date": "Date",
"endDate": "End Date",
"endTime": "End Time",
+ "invalidDate": "Invalid Date",
+ "invalidTime": "Invalid Time",
"latitude": "Latitude",
"longitude": "Longitude",
"month": "Month",
"name": "Name",
"price": "Price",
"priceUnit": "Price Unit",
+ "site": "Site",
"siteArea": "Site Area",
"startDate": "Start Date",
"startTime": "Start Time",
"time": "Time",
+ "value": "Value",
"year": "Year"
},
"loggings": {

MODIFY
src/assets/i18n/pt.json
src/assets/i18n/pt.json
"ocppProtocol": "OCPP Protocol",
"ocppVersion": "OCPP Version",
"powerLimitUnit": "Power Limit Unit",
+ "timezone" : "Charging station timezone",
"vendor": "Vendor"
},
"general": {
"date": "Date",
"endDate": "End Date",
"endTime": "End Time",
+ "invalidDate": "Invalid Date",
+ "invalidTime": "Invalid Time",
"latitude": "Latitude",
"longitude": "Longitude",
"month": "Month",
"name": "Name",
"price": "Price",
"priceUnit": "Price Unit",
+ "site": "Site",
"siteArea": "Site Area",
"startDate": "Start Date",
"startTime": "Start Time",
"time": "Time",
+ "value": "Value",
"year": "Year"
},
"loggings": {

MODIFY
src/server/rest/v1/service/ChargingStationService.ts
src/server/rest/v1/service/ChargingStationService.ts
@@ -1270,10 +1270,10 @@ export default class ChargingStationService {
// TODO: To remove the 'lastHeartBeat' when new version of Mobile App will be released (> V1.3.22)
'id', 'inactive', 'connectorsStatus', 'connectorsConsumption', 'public', 'firmwareVersion', 'chargePointVendor', 'chargePointModel',
'ocppVersion', 'ocppProtocol', 'lastSeen', 'lastHeartBeat', 'firmwareUpdateStatus', 'coordinates', 'issuer', 'voltage',
- 'siteAreaID', 'siteArea.id', 'siteArea.name', 'siteArea.siteID', 'siteArea.site.name', 'siteArea.address', 'maximumPower',
- 'connectors.connectorId', 'connectors.status', 'connectors.type', 'connectors.power', 'connectors.errorCode',
+ 'siteAreaID', 'siteArea.id', 'siteArea.name', 'siteArea.siteID', 'siteArea.site.name', 'siteArea.address', 'maximumPower', 'powerLimitUnit',
+ 'chargePointModel', 'chargePointSerialNumber', 'chargeBoxSerialNumber', 'connectors.connectorId', 'connectors.status', 'connectors.type', 'connectors.power', 'connectors.errorCode',
'connectors.currentTotalConsumptionWh', 'connectors.currentInstantWatts', 'connectors.currentStateOfCharge',
- 'connectors.currentTransactionID', 'connectors.currentTotalInactivitySecs', 'connectors.currentTagID', 'chargePoints',
+ 'connectors.currentTransactionID', 'connectors.currentTotalInactivitySecs', 'connectors.currentTagID', 'chargePoints', 'lastReboot', 'createdOn',
...userProject
];
} else {
@@ -1311,17 +1311,22 @@ export default class ChargingStationService {
private static convertOCPPParamsToCSV(ocppParams: OCPPParams, writeHeader = true): string {
let csv = '';
+ const i18nManager = new I18nManager('fr');
// Header
if (writeHeader) {
- csv = `Charging Station${Constants.CSV_SEPARATOR}Name${Constants.CSV_SEPARATOR}Value${Constants.CSV_SEPARATOR}Site Area${Constants.CSV_SEPARATOR}Site\r\n`;
+ csv = i18nManager.translate('chargers.chargingStation') + Constants.CSV_SEPARATOR;
+ csv += i18nManager.translate('general.name') + Constants.CSV_SEPARATOR;
+ csv += i18nManager.translate('general.value') + Constants.CSV_SEPARATOR;
+ csv += i18nManager.translate('general.siteArea') + Constants.CSV_SEPARATOR;
+ csv += i18nManager.translate('general.site') + Constants.CSV_SEPARATOR;
}
// Content
for (const param of ocppParams.params) {
- csv += `${ocppParams.chargingStationName}` + Constants.CSV_SEPARATOR;
- csv += `${param.key}` + Constants.CSV_SEPARATOR;
- csv += `${Utils.replaceSpecialCharsInCSVValueParam(param.value)}` + Constants.CSV_SEPARATOR;
- csv += `${ocppParams.siteAreaName}` + Constants.CSV_SEPARATOR;
- csv += `${ocppParams.siteName}\r\n`;
+ csv += ocppParams.chargingStationName + Constants.CSV_SEPARATOR;
+ csv += param.key + Constants.CSV_SEPARATOR;
+ csv += Utils.replaceSpecialCharsInCSVValueParam(param.value) + Constants.CSV_SEPARATOR;
+ csv += ocppParams.siteAreaName + Constants.CSV_SEPARATOR;
+ csv += ocppParams.siteName + '\r\n';
}
return csv;
}
@@ -1331,47 +1336,51 @@ export default class ChargingStationService {
const i18nManager = new I18nManager(req.user.locale);
// Header
if (writeHeader) {
- csv = `${i18nManager.translate('general.name')}${Constants.CSV_SEPARATOR}`;
- csv += `${i18nManager.translate('general.createdOn')}${Constants.CSV_SEPARATOR}`;
- csv += `${i18nManager.translate('chargers.numberOfConnectors')}${Constants.CSV_SEPARATOR}`;
- csv += `${i18nManager.translate('general.siteArea')}${Constants.CSV_SEPARATOR}`;
- csv += `${i18nManager.translate('general.latitude')}${Constants.CSV_SEPARATOR}`;
- csv += `${i18nManager.translate('general.longitude')}${Constants.CSV_SEPARATOR}`;
- csv += `${i18nManager.translate('chargers.chargePointSN')}${Constants.CSV_SEPARATOR}`;
- csv += `${i18nManager.translate('chargers.model')}${Constants.CSV_SEPARATOR}`;
- csv += `${i18nManager.translate('chargers.chargeBoxSN')}${Constants.CSV_SEPARATOR}`;
- csv += `${i18nManager.translate('chargers.vendor')}${Constants.CSV_SEPARATOR}`;
- csv += `${i18nManager.translate('chargers.firmwareVersion')}${Constants.CSV_SEPARATOR}`;
- csv += `${i18nManager.translate('chargers.ocppVersion')}${Constants.CSV_SEPARATOR}`;
- csv += `${i18nManager.translate('chargers.ocppProtocol')}${Constants.CSV_SEPARATOR}`;
- csv += `${i18nManager.translate('chargers.lastSeen')}${Constants.CSV_SEPARATOR}`;
- csv += `${i18nManager.translate('chargers.lastReboot')}${Constants.CSV_SEPARATOR}`;
- csv += `${i18nManager.translate('chargers.maxPower')}${Constants.CSV_SEPARATOR}`;
- csv += `${i18nManager.translate('chargers.powerLimitUnit')}\r\n`;
+ csv = i18nManager.translate('general.name') + Constants.CSV_SEPARATOR;
+ csv += i18nManager.translate('general.createdOn') + Constants.CSV_SEPARATOR;
+ csv += i18nManager.translate('chargers.numberOfConnectors') + Constants.CSV_SEPARATOR;
+ csv += i18nManager.translate('general.siteArea') + Constants.CSV_SEPARATOR;
+ csv += i18nManager.translate('general.latitude') + Constants.CSV_SEPARATOR;
+ csv += i18nManager.translate('general.longitude') + Constants.CSV_SEPARATOR;
+ csv += i18nManager.translate('chargers.chargePointSN') + Constants.CSV_SEPARATOR;
+ csv += i18nManager.translate('chargers.model') + Constants.CSV_SEPARATOR;
+ csv += i18nManager.translate('chargers.chargeBoxSN') + Constants.CSV_SEPARATOR;
+ csv += i18nManager.translate('chargers.vendor') + Constants.CSV_SEPARATOR;
+ csv += i18nManager.translate('chargers.firmwareVersion') + Constants.CSV_SEPARATOR;
+ csv += i18nManager.translate('chargers.ocppVersion') + Constants.CSV_SEPARATOR;
+ csv += i18nManager.translate('chargers.ocppProtocol') + Constants.CSV_SEPARATOR;
+ csv += i18nManager.translate('chargers.lastSeen') + Constants.CSV_SEPARATOR;
+ csv += i18nManager.translate('chargers.lastReboot') + Constants.CSV_SEPARATOR;
+ csv += i18nManager.translate('chargers.maxPower') + Constants.CSV_SEPARATOR;
+ csv += i18nManager.translate('chargers.powerLimitUnit') + '\r\n';
}
// Content
for (const chargingStation of chargingStations) {
- csv += `${chargingStation.id}` + Constants.CSV_SEPARATOR;
- csv += `${i18nManager.formatDateTime(chargingStation.createdOn, 'L')} ${i18nManager.formatDateTime(chargingStation.createdOn, 'LT')}` + Constants.CSV_SEPARATOR;
- csv += `${chargingStation.connectors ? chargingStation.connectors.length : '0'}` + Constants.CSV_SEPARATOR;
- csv += `${chargingStation?.siteArea?.name ? chargingStation.siteArea.name : ''}` + Constants.CSV_SEPARATOR;
+ csv += chargingStation.id + Constants.CSV_SEPARATOR;
+ if (chargingStation.createdOn) {
+ csv += i18nManager.formatDateTime(chargingStation.createdOn, 'L') + ' ' + i18nManager.formatDateTime(chargingStation.createdOn, 'LT') + Constants.CSV_SEPARATOR;
+ } else {
+ csv += i18nManager.translate('general.invalidDate') + ' ' + i18nManager.translate('general.invalidTime') + Constants.CSV_SEPARATOR;
+ }
+ csv += (chargingStation.connectors ? chargingStation.connectors.length : '0') + Constants.CSV_SEPARATOR;
+ csv += (chargingStation?.siteArea?.name ? chargingStation.siteArea.name : '') + Constants.CSV_SEPARATOR;
if (chargingStation.coordinates && chargingStation.coordinates.length === 2) {
- csv += `${chargingStation.coordinates[1]}` + Constants.CSV_SEPARATOR;
- csv += `${chargingStation.coordinates[0]}` + Constants.CSV_SEPARATOR;
+ csv += chargingStation.coordinates[1] + Constants.CSV_SEPARATOR;
+ csv += chargingStation.coordinates[0] + Constants.CSV_SEPARATOR;
} else {
- csv += `''${Constants.CSV_SEPARATOR}''`;
- }
- csv += `${chargingStation.chargePointSerialNumber}` + Constants.CSV_SEPARATOR;
- csv += `${chargingStation.chargePointModel}` + Constants.CSV_SEPARATOR;
- csv += `${chargingStation.chargeBoxSerialNumber}` + Constants.CSV_SEPARATOR;
- csv += `${chargingStation.chargePointVendor}` + Constants.CSV_SEPARATOR;
- csv += `${chargingStation.firmwareVersion}` + Constants.CSV_SEPARATOR;
- csv += `${chargingStation.ocppVersion}` + Constants.CSV_SEPARATOR;
- csv += `${chargingStation.ocppProtocol}` + Constants.CSV_SEPARATOR;
- csv += `${i18nManager.formatDateTime(chargingStation.lastSeen, 'L')} ${i18nManager.formatDateTime(chargingStation.lastSeen, 'LT')}` + Constants.CSV_SEPARATOR;
- csv += `${i18nManager.formatDateTime(chargingStation.lastReboot, 'L')} ${i18nManager.formatDateTime(chargingStation.lastReboot, 'LT')}` + Constants.CSV_SEPARATOR;
- csv += `${chargingStation.maximumPower}` + Constants.CSV_SEPARATOR;
- csv += `${chargingStation.powerLimitUnit}\r\n`;
+ csv += '' + Constants.CSV_SEPARATOR + '';
+ }
+ csv += chargingStation.chargePointSerialNumber + Constants.CSV_SEPARATOR;
+ csv += chargingStation.chargePointModel + Constants.CSV_SEPARATOR;
+ csv += chargingStation.chargeBoxSerialNumber + Constants.CSV_SEPARATOR;
+ csv += chargingStation.chargePointVendor + Constants.CSV_SEPARATOR;
+ csv += chargingStation.firmwareVersion + Constants.CSV_SEPARATOR;
+ csv += chargingStation.ocppVersion + Constants.CSV_SEPARATOR;
+ csv += chargingStation.ocppProtocol + Constants.CSV_SEPARATOR;
+ csv += i18nManager.formatDateTime(chargingStation.lastSeen, 'L') + ' ' + i18nManager.formatDateTime(chargingStation.lastSeen, 'LT') + Constants.CSV_SEPARATOR;
+ csv += i18nManager.formatDateTime(chargingStation.lastReboot, 'L') + ' ' + i18nManager.formatDateTime(chargingStation.lastReboot, 'LT') + Constants.CSV_SEPARATOR;
+ csv += chargingStation.maximumPower + Constants.CSV_SEPARATOR;
+ csv += chargingStation.powerLimitUnit + '\r\n';
}
return csv;
}

MODIFY
src/server/rest/v1/service/LoggingService.ts
src/server/rest/v1/service/LoggingService.ts
@@ -60,31 +60,31 @@ export default class LoggingService {
const i18nManager = new I18nManager(req.user.locale);
// Header
if (writeHeader) {
- csv = `${i18nManager.translate('general.date')}${Constants.CSV_SEPARATOR}`;
- csv += `${i18nManager.translate('general.time')}${Constants.CSV_SEPARATOR}`;
- csv += `${i18nManager.translate('loggings.level')}${Constants.CSV_SEPARATOR}`;
- csv += `${i18nManager.translate('loggings.type')}${Constants.CSV_SEPARATOR}`;
- csv += `${i18nManager.translate('loggings.action')}${Constants.CSV_SEPARATOR}`;
- csv += `${i18nManager.translate('loggings.message')}${Constants.CSV_SEPARATOR}`;
- csv += `${i18nManager.translate('loggings.method')}${Constants.CSV_SEPARATOR}`;
- csv += `${i18nManager.translate('loggings.module')}${Constants.CSV_SEPARATOR}`;
- csv += `${i18nManager.translate('loggings.source')}${Constants.CSV_SEPARATOR}`;
- csv += `${i18nManager.translate('loggings.host')}${Constants.CSV_SEPARATOR}`;
- csv += `${i18nManager.translate('loggings.process')}\r\n`;
+ csv = i18nManager.translate('general.date') + Constants.CSV_SEPARATOR;
+ csv += i18nManager.translate('general.time') + Constants.CSV_SEPARATOR;
+ csv += i18nManager.translate('loggings.level') + Constants.CSV_SEPARATOR;
+ csv += i18nManager.translate('loggings.type') + Constants.CSV_SEPARATOR;
+ csv += i18nManager.translate('loggings.action') + Constants.CSV_SEPARATOR;
+ csv += i18nManager.translate('loggings.message') + Constants.CSV_SEPARATOR;
+ csv += i18nManager.translate('loggings.method') + Constants.CSV_SEPARATOR;
+ csv += i18nManager.translate('loggings.module') + Constants.CSV_SEPARATOR;
+ csv += i18nManager.translate('loggings.source') + Constants.CSV_SEPARATOR;
+ csv += i18nManager.translate('loggings.host') + Constants.CSV_SEPARATOR;
+ csv += i18nManager.translate('loggings.process') + '\r\n';
}
// Content
for (const log of loggings) {
- csv += `${moment(log.timestamp).format('YYYY-MM-DD')}` + Constants.CSV_SEPARATOR;
- csv += `${moment(log.timestamp).format('HH:mm:ss')}` + Constants.CSV_SEPARATOR;
- csv += `${log.level}` + Constants.CSV_SEPARATOR;
- csv += `${log.type}` + Constants.CSV_SEPARATOR;
- csv += `${log.action}` + Constants.CSV_SEPARATOR;
- csv += `${log.message}` + Constants.CSV_SEPARATOR;
- csv += `${log.method}` + Constants.CSV_SEPARATOR;
- csv += `${log.module}` + Constants.CSV_SEPARATOR;
- csv += `${log.source}` + Constants.CSV_SEPARATOR;
- csv += `${log.host}` + Constants.CSV_SEPARATOR;
- csv += `${log.process}\r\n`;
+ csv += moment(log.timestamp).format('YYYY-MM-DD') + Constants.CSV_SEPARATOR;
+ csv += moment(log.timestamp).format('HH:mm:ss') + Constants.CSV_SEPARATOR;
+ csv += log.level + Constants.CSV_SEPARATOR;
+ csv += log.type + Constants.CSV_SEPARATOR;
+ csv += log.action + Constants.CSV_SEPARATOR;
+ csv += log.message + Constants.CSV_SEPARATOR;
+ csv += log.method + Constants.CSV_SEPARATOR;
+ csv += log.module + Constants.CSV_SEPARATOR;
+ csv += log.source + Constants.CSV_SEPARATOR;
+ csv += log.host + Constants.CSV_SEPARATOR;
+ csv += log.process + '\r\n';
}
return csv;
}
@@ -141,7 +141,7 @@ export default class LoggingService {
onlyRecordCount: filteredRequest.OnlyRecordCount
}, [
'id', 'level', 'timestamp', 'type', 'source', 'host', 'process', 'action', 'message',
- 'user.name', 'user.firstName', 'actionOnUser.name', 'actionOnUser.firstName', 'hasDetailedMessages'
+ 'user.name', 'user.firstName', 'actionOnUser.name', 'actionOnUser.firstName', 'hasDetailedMessages', 'method', 'module',
]);
return loggings;
}

MODIFY
src/server/rest/v1/service/StatisticService.ts
src/server/rest/v1/service/StatisticService.ts
@@ -480,32 +480,32 @@ export default class StatisticService {
}
let csv: string;
if (dataCategory === 'C') {
- csv = `${i18nManager.translate('chargers.chargingStation')}${Constants.CSV_SEPARATOR}`;
+ csv = i18nManager.translate('chargers.chargingStation') + Constants.CSV_SEPARATOR;
} else {
- csv = `${i18nManager.translate('users.user')}${Constants.CSV_SEPARATOR}`;
+ csv = i18nManager.translate('users.user') + Constants.CSV_SEPARATOR;
}
if (year && year !== '0') {
- csv += `${i18nManager.translate('general.year')}${Constants.CSV_SEPARATOR}`;
+ csv += i18nManager.translate('general.year') + Constants.CSV_SEPARATOR;
if (dataScope && dataScope === 'month') {
- csv += `${i18nManager.translate('general.month')}${Constants.CSV_SEPARATOR}`;
+ csv += i18nManager.translate('general.month') + Constants.CSV_SEPARATOR;
}
}
switch (dataType) {
case 'Consumption':
- csv += `${i18nManager.translate('statistics.consumption')}\r\n`;
+ csv += i18nManager.translate('statistics.consumption') + '\r\n';
break;
case 'Usage':
- csv += `${i18nManager.translate('statistics.usage')}\r\n`;
+ csv += i18nManager.translate('statistics.usage') + '\r\n';
break;
case 'Inactivity':
- csv += `${i18nManager.translate('statistics.inactivity')}\r\n`;
+ csv += i18nManager.translate('statistics.inactivity') + '\r\n';
break;
case 'Transactions':
- csv += `${i18nManager.translate('statistics.numberOfSessions')}\r\n`;
+ csv += i18nManager.translate('statistics.numberOfSessions') + '\r\n';
break;
case 'Pricing':
- csv += `${i18nManager.translate('general.price')}${Constants.CSV_SEPARATOR}`;
- csv += `${i18nManager.translate('general.priceUnit')}\r\n`;
+ csv += i18nManager.translate('general.price') + Constants.CSV_SEPARATOR;
+ csv += i18nManager.translate('general.priceUnit') + '\r\n';
break;
default:
return csv;
@@ -643,17 +643,16 @@ export default class StatisticService {
// Now build the export file
let number: number;
for (transaction of transactions) {
- csv += (dataCategory === 'C') ? `${transaction._id.chargeBox}` + Constants.CSV_SEPARATOR :
- `${Utils.buildUserFullName(transaction.user, false)}` + Constants.CSV_SEPARATOR;
- csv += (year && year !== '0') ? `${year}` + Constants.CSV_SEPARATOR : '';
- csv += (transaction._id.month > 0) ? `${transaction._id.month}` + Constants.CSV_SEPARATOR : '';
+ csv += (dataCategory === 'C') ? transaction._id.chargeBox + Constants.CSV_SEPARATOR : Utils.buildUserFullName(transaction.user, false) + Constants.CSV_SEPARATOR;
+ csv += (year && year !== '0') ? year + Constants.CSV_SEPARATOR : '';
+ csv += (transaction._id.month > 0) ? transaction._id.month + Constants.CSV_SEPARATOR : '';
number = Utils.truncTo(transaction.total, 2);
// Use raw numbers - it makes no sense to format numbers here,
// anyway only locale 'en-US' is supported here as could be seen by:
// const supportedLocales = Intl.NumberFormat.supportedLocalesOf(['fr-FR', 'en-US', 'de-DE']);
if (dataType === 'Pricing') {
if (transaction._id.unit) {
- csv += number.toString() + Constants.CSV_SEPARATOR + `${transaction._id.unit}` + '\r\n';
+ csv += number.toString() + Constants.CSV_SEPARATOR + transaction._id.unit + '\r\n';
} else {
csv += number.toString() + Constants.CSV_SEPARATOR + ' ' + '\r\n';
}

MODIFY
src/server/rest/v1/service/TransactionService.ts
src/server/rest/v1/service/TransactionService.ts
@@ -850,38 +850,39 @@ export default class TransactionService {
const i18nManager = new I18nManager(req.user.locale);
// Header
if (writeHeader) {
- csv = `${i18nManager.translate('users.id')}${Constants.CSV_SEPARATOR}`;
- csv += `${i18nManager.translate('chargers.chargingStation')}${Constants.CSV_SEPARATOR}`;
- csv += `${i18nManager.translate('chargers.connector')}${Constants.CSV_SEPARATOR}`;
- csv += `${i18nManager.translate('users.userID')}${Constants.CSV_SEPARATOR}`;
- csv += `${i18nManager.translate('users.user')}${Constants.CSV_SEPARATOR}`;
- csv += `${i18nManager.translate('general.startDate')}${Constants.CSV_SEPARATOR}`;
- csv += `${i18nManager.translate('general.startTime')}${Constants.CSV_SEPARATOR}`;
- csv += `${i18nManager.translate('general.endDate')}${Constants.CSV_SEPARATOR}`;
- csv += `${i18nManager.translate('general.endTime')}${Constants.CSV_SEPARATOR}`;
- csv += `${i18nManager.translate('transactions.totalConsumption')}${Constants.CSV_SEPARATOR}`;
- csv += `${i18nManager.translate('transactions.totalDuration')}${Constants.CSV_SEPARATOR}`;
- csv += `${i18nManager.translate('transactions.totalInactivity')}${Constants.CSV_SEPARATOR}`;
- csv += `${i18nManager.translate('general.price')}${Constants.CSV_SEPARATOR}`;
- csv += `${i18nManager.translate('general.priceUnit')}${Constants.CSV_SEPARATOR}`;
+ csv = i18nManager.translate('users.id') + Constants.CSV_SEPARATOR;
+ csv += i18nManager.translate('chargers.chargingStation') + Constants.CSV_SEPARATOR;
+ csv += i18nManager.translate('chargers.connector') + Constants.CSV_SEPARATOR;
+ csv += i18nManager.translate('users.userID') + Constants.CSV_SEPARATOR;
+ csv += i18nManager.translate('users.user') + Constants.CSV_SEPARATOR;
+ csv += i18nManager.translate('chargers.timezone') + Constants.CSV_SEPARATOR;
+ csv += i18nManager.translate('general.startDate') + Constants.CSV_SEPARATOR;
+ csv += i18nManager.translate('general.startTime') + Constants.CSV_SEPARATOR;
+ csv += i18nManager.translate('general.endDate') + Constants.CSV_SEPARATOR;
+ csv += i18nManager.translate('general.endTime') + Constants.CSV_SEPARATOR;
+ csv += i18nManager.translate('transactions.totalConsumption') + Constants.CSV_SEPARATOR;
+ csv += i18nManager.translate('transactions.totalDuration') + Constants.CSV_SEPARATOR;
+ csv += i18nManager.translate('transactions.totalInactivity') + Constants.CSV_SEPARATOR;
+ csv += i18nManager.translate('general.price') + Constants.CSV_SEPARATOR;
+ csv += i18nManager.translate('general.priceUnit') + '\r\n';
}
// Content
for (const transaction of transactions) {
- csv += `${transaction.id}` + Constants.CSV_SEPARATOR;
- csv += `${transaction.chargeBoxID}` + Constants.CSV_SEPARATOR;
- csv += `${transaction.connectorId}` + Constants.CSV_SEPARATOR;
- csv += `${transaction.user ? Cypher.hash(transaction.user.id) : ''}` + Constants.CSV_SEPARATOR;
- csv += `${transaction.user ? Utils.buildUserFullName(transaction.user, false) : ''}` + Constants.CSV_SEPARATOR;
- csv += `${transaction.timezone || 'N/A (UTC by default)'}` + Constants.CSV_SEPARATOR;
- csv += `${(transaction.timezone ? moment(transaction.timestamp).tz(transaction.timezone) : moment.utc(transaction.timestamp)).format('YYYY-MM-DD')}` + Constants.CSV_SEPARATOR;
- csv += `${(transaction.timezone ? moment(transaction.timestamp).tz(transaction.timezone) : moment.utc(transaction.timestamp)).format('HH:mm:ss')}` + Constants.CSV_SEPARATOR;
- csv += `${transaction.stop ? `${(transaction.timezone ? moment(transaction.stop.timestamp).tz(transaction.timezone) : moment.utc(transaction.stop.timestamp)).format('YYYY-MM-DD')}` : ''}` + Constants.CSV_SEPARATOR;
- csv += `${transaction.stop ? `${(transaction.timezone ? moment(transaction.stop.timestamp).tz(transaction.timezone) : moment.utc(transaction.stop.timestamp)).format('HH:mm:ss')}` : ''}` + Constants.CSV_SEPARATOR;
- csv += `${transaction.stop ? Math.round(transaction.stop.totalConsumptionWh ? transaction.stop.totalConsumptionWh / 1000 : 0) : ''}` + Constants.CSV_SEPARATOR;
- csv += `${transaction.stop ? Math.round(transaction.stop.totalDurationSecs ? transaction.stop.totalDurationSecs / 60 : 0) : ''}` + Constants.CSV_SEPARATOR;
- csv += `${transaction.stop ? Math.round(transaction.stop.totalInactivitySecs ? transaction.stop.totalInactivitySecs / 60 : 0) : ''}` + Constants.CSV_SEPARATOR;
- csv += `${transaction.stop ? Utils.truncTo(transaction.stop.price, 2) : ''}` + Constants.CSV_SEPARATOR;
- csv += `${transaction.stop ? transaction.stop.priceUnit : ''}\r\n`;
+ csv += transaction.id + Constants.CSV_SEPARATOR;
+ csv += transaction.chargeBoxID + Constants.CSV_SEPARATOR;
+ csv += transaction.connectorId + Constants.CSV_SEPARATOR;
+ csv += (transaction.user ? Cypher.hash(transaction.user.id) : '') + Constants.CSV_SEPARATOR;
+ csv += (transaction.user ? Utils.buildUserFullName(transaction.user, false) : '') + Constants.CSV_SEPARATOR;
+ csv += (transaction.timezone || 'N/A (UTC by default)') + Constants.CSV_SEPARATOR;
+ csv += (transaction.timezone ? moment(transaction.timestamp).tz(transaction.timezone) : moment.utc(transaction.timestamp)).format('YYYY-MM-DD') + Constants.CSV_SEPARATOR;
+ csv += (transaction.timezone ? moment(transaction.timestamp).tz(transaction.timezone) : moment.utc(transaction.timestamp)).format('HH:mm:ss') + Constants.CSV_SEPARATOR;
+ csv += (transaction.stop ? `${(transaction.timezone ? moment(transaction.stop.timestamp).tz(transaction.timezone) : moment.utc(transaction.stop.timestamp)).format('YYYY-MM-DD')}` : '') + Constants.CSV_SEPARATOR;
+ csv += (transaction.stop ? `${(transaction.timezone ? moment(transaction.stop.timestamp).tz(transaction.timezone) : moment.utc(transaction.stop.timestamp)).format('HH:mm:ss')}` : '') + Constants.CSV_SEPARATOR;
+ csv += (transaction.stop ? Math.round(transaction.stop.totalConsumptionWh ? transaction.stop.totalConsumptionWh / 1000 : 0) : '') + Constants.CSV_SEPARATOR;
+ csv += (transaction.stop ? Math.round(transaction.stop.totalDurationSecs ? transaction.stop.totalDurationSecs / 60 : 0) : '') + Constants.CSV_SEPARATOR;
+ csv += (transaction.stop ? Math.round(transaction.stop.totalInactivitySecs ? transaction.stop.totalInactivitySecs / 60 : 0) : '') + Constants.CSV_SEPARATOR;
+ csv += (transaction.stop ? Utils.truncTo(transaction.stop.price, 2) : '') + Constants.CSV_SEPARATOR;
+ csv += (transaction.stop ? transaction.stop.priceUnit : '') + '\r\n';
}
return csv;
}

MODIFY
src/server/rest/v1/service/UserService.ts
src/server/rest/v1/service/UserService.ts
@@ -1081,29 +1081,29 @@ export default class UserService {
const i18nManager = new I18nManager(req.user.locale);
// Header
if (writeHeader) {
- csv = `${i18nManager.translate('users.id')}${Constants.CSV_SEPARATOR}`;
- csv += `${i18nManager.translate('general.name')}${Constants.CSV_SEPARATOR}`;
- csv += `${i18nManager.translate('users.firstName')}${Constants.CSV_SEPARATOR}`;
- csv += `${i18nManager.translate('users.role')}${Constants.CSV_SEPARATOR}`;
- csv += `${i18nManager.translate('users.status')}${Constants.CSV_SEPARATOR}`;
- csv += `${i18nManager.translate('users.email')}${Constants.CSV_SEPARATOR}`;
- csv += `${i18nManager.translate('users.eulaAcceptedOn')}${Constants.CSV_SEPARATOR}`;
- csv += `${i18nManager.translate('general.createdOn')}${Constants.CSV_SEPARATOR}`;
- csv += `${i18nManager.translate('general.changedOn')}${Constants.CSV_SEPARATOR}`;
- csv += `${i18nManager.translate('general.changedBy')}\r\n`;
+ csv = i18nManager.translate('users.id') + Constants.CSV_SEPARATOR;
+ csv += i18nManager.translate('general.name') + Constants.CSV_SEPARATOR;
+ csv += i18nManager.translate('users.firstName') + Constants.CSV_SEPARATOR;
+ csv += i18nManager.translate('users.role') + Constants.CSV_SEPARATOR;
+ csv += i18nManager.translate('users.status') + Constants.CSV_SEPARATOR;
+ csv += i18nManager.translate('users.email') + Constants.CSV_SEPARATOR;
+ csv += i18nManager.translate('users.eulaAcceptedOn') + Constants.CSV_SEPARATOR;
+ csv += i18nManager.translate('general.createdOn') + Constants.CSV_SEPARATOR;
+ csv += i18nManager.translate('general.changedOn') + Constants.CSV_SEPARATOR;
+ csv += i18nManager.translate('general.changedBy') + '\r\n';
}
// Content
for (const user of users) {
- csv += `${Cypher.hash(user.id)}` + Constants.CSV_SEPARATOR;
- csv += `${user.name}` + Constants.CSV_SEPARATOR;
- csv += `${user.firstName}` + Constants.CSV_SEPARATOR;
- csv += `${user.role}` + Constants.CSV_SEPARATOR;
- csv += `${user.status}` + Constants.CSV_SEPARATOR;
- csv += `${user.email}` + Constants.CSV_SEPARATOR;
- csv += `${moment(user.eulaAcceptedOn).format('YYYY-MM-DD')}` + Constants.CSV_SEPARATOR;
- csv += `${moment(user.createdOn).format('YYYY-MM-DD')}` + Constants.CSV_SEPARATOR;
- csv += `${moment(user.lastChangedOn).format('YYYY-MM-DD')}` + Constants.CSV_SEPARATOR;
- csv += `${user.lastChangedBy ? Utils.buildUserFullName(user.lastChangedBy as User, false) : ''}\r\n`;
+ csv += Cypher.hash(user.id) + Constants.CSV_SEPARATOR;
+ csv += user.name + Constants.CSV_SEPARATOR;
+ csv += user.firstName + Constants.CSV_SEPARATOR;
+ csv += user.role + Constants.CSV_SEPARATOR;
+ csv += user.status + Constants.CSV_SEPARATOR;
+ csv += user.email + Constants.CSV_SEPARATOR;
+ csv += moment(user.eulaAcceptedOn).format('YYYY-MM-DD') + Constants.CSV_SEPARATOR;
+ csv += moment(user.createdOn).format('YYYY-MM-DD') + Constants.CSV_SEPARATOR;
+ csv += moment(user.lastChangedOn).format('YYYY-MM-DD') + Constants.CSV_SEPARATOR;
+ csv += (user.lastChangedBy ? Utils.buildUserFullName(user.lastChangedBy as User, false) : '') + '\r\n';
}
return csv;
}

added
- new translation in i18n file
- missing projectFields for charging station + logging
modified
- all csv headers with translation
- removed all csv template strings