Project

General

Profile

Revision f4a16f5b src/libs/plugins/imexporters/swift/swift.c

View differences:

src/libs/plugins/imexporters/swift/swift.c
227 227
    }
228 228
    else if (strcasecmp(GWEN_DB_GroupName(dbT), "endSaldo")==0) {
229 229
      GWEN_DB_NODE *dbX;
230
      GWEN_TIME *ti=0;
230
      GWEN_DATE *dt=0;
231
      const char *s;
231 232
      const char *bankCode;
232 233
      const char *accountNumber;
233 234
      const char *iban;
......
236 237
      accountNumber=GWEN_DB_GetCharValue(dbT, "localAccountNumber", 0, 0);
237 238
      iban=GWEN_DB_GetCharValue(dbT, "localIban", 0, 0);
238 239

  
239
      dbX=GWEN_DB_GetGroup(dbT, GWEN_PATH_FLAGS_NAMEMUSTEXIST, "date");
240
      if (dbX)
241
        ti=GWEN_Time_fromDb(dbX);
240
      /* read date */
241
      s=GWEN_DB_GetCharValue(dbT, "date", 0, NULL);
242
      if (s && *s) {
243
        dt=GWEN_Date_fromString(s);
244
        if (dt==NULL) {
245
          DBG_ERROR(AQBANKING_LOGDOMAIN, "Bad date in saldo");
246
        }
247
      }
248

  
242 249
      dbX=GWEN_DB_GetGroup(dbT, GWEN_PATH_FLAGS_NAMEMUSTEXIST, "value");
243 250
      if (dbX) {
244 251
        AB_VALUE *v;
......
247 254
        if (v) {
248 255
          AB_BALANCE *bal;
249 256
          AB_IMEXPORTER_ACCOUNTINFO *iea;
250
          AB_ACCOUNT_STATUS *as;
251 257

  
252 258
          bal=AB_Balance_new();
253
          AB_Balance_SetTime(bal, ti);
259
          AB_Balance_SetDate(bal, dt);
254 260
          AB_Balance_SetValue(bal, v);
255 261
          AB_Value_free(v);
256
          as=AB_AccountStatus_new();
257
          if (ti)
258
            AB_AccountStatus_SetTime(as, ti);
259
          AB_AccountStatus_SetNotedBalance(as, bal);
260
          AB_Balance_free(bal);
262
          AB_Balance_SetType(bal, AB_Balance_TypeNoted); /* TODO: maybe use "booked" here? */
261 263

  
262 264
          iea=AB_ImExporterContext_GetOrAddAccountInfo(ctx, 0, iban, bankCode, accountNumber, 0);
263
          AB_ImExporterAccountInfo_AddAccountStatus(iea, as);
265
          AB_ImExporterAccountInfo_AddBalance(iea, bal);
264 266
        }
265 267
      }
266
      GWEN_Time_free(ti);
268
      GWEN_Date_free(dt);
267 269
    }
268 270
    else {
269 271
      int rv;

Also available in: Unified diff