save car in transaction only in remote start
MODIFY
src/assets/server/rest/v1/schemas/chargingstation/chargingstation-action-transaction-start.json
src/assets/server/rest/v1/schemas/chargingstation/chargingstation-action-transaction-start.json
"carID": {
"$ref": "common#/definitions/id"
},
+ "remoteStart": {
+ "type": "boolean"
+ },
"userID": {
"$ref": "common#/definitions/id"
},

MODIFY
src/server/rest/v1/service/ChargingStationService.ts
src/server/rest/v1/service/ChargingStationService.ts
@@ -1774,10 +1774,10 @@ export default class ChargingStationService {
Authorizations.isChargingStationValidInOrganization(action, req.tenant, chargingStation);
// Save Car selection
if (Utils.isComponentActiveFromToken(req.user, TenantComponents.CAR)) {
- if (filteredRequest.carID && filteredRequest.carID !== user.lastSelectedCarID) {
+ if (filteredRequest.remoteStart && filteredRequest.carID && filteredRequest.carID !== user.lastSelectedCarID) {
await UserStorage.saveLastSelectedCarID(req.tenant, user.id, filteredRequest.carID, true);
} else {
- await UserStorage.clearLastSelectedCarID(req.tenant, user.id);
+ await UserStorage.clearLastSelectedCarID(req.tenant, user.id, filteredRequest.remoteStart);
}
}
// Execute it

MODIFY
src/storage/mongodb/UserStorage.ts
src/storage/mongodb/UserStorage.ts
@@ -371,8 +371,8 @@ export default class UserStorage {
await Logging.traceDatabaseRequestEnd(tenant, MODULE_NAME, 'saveUserLastSelectedCarID', startTime, { lastSelectedCarID });
}
- public static async clearLastSelectedCarID(tenant: Tenant, userID: string): Promise<void> {
- return UserStorage.saveLastSelectedCarID(tenant, userID, null, false);
+ public static async clearLastSelectedCarID(tenant: Tenant, userID: string, lastSelectedCar: boolean): Promise<void> {
+ return UserStorage.saveLastSelectedCarID(tenant, userID, null, lastSelectedCar);
}
public static async saveUserMobileToken(tenant: Tenant, userID: string,

MODIFY
src/types/requests/HttpChargingStationRequest.ts
src/types/requests/HttpChargingStationRequest.ts
@@ -148,6 +148,7 @@ export interface HttpChargingStationReservationCancelRequest {
export interface HttpChargingStationStartTransactionRequest extends HttpChargingStationCommandRequest {
carID?: string,
userID?: string,
+ remoteStart?: boolean,
args: {
tagID?: string,
visualTagID?: string,

save car in transaction only in remote start