Example #1
0
int EBC_Provider_UpdateJob(AB_PROVIDER *pro, AB_JOB *j) {
  EBC_PROVIDER *dp;
  AB_ACCOUNT *a;
  AB_USER *u;

  assert(pro);
  dp=GWEN_INHERIT_GETDATA(AB_PROVIDER, EBC_PROVIDER, pro);
  assert(dp);

  a=AB_Job_GetAccount(j);
  assert(a);

  u=AB_Account_GetFirstUser(a);
  if (u==NULL) {
    DBG_ERROR(AQEBICS_LOGDOMAIN, "No user assigned to this account.");
    GWEN_Gui_ProgressLog(0,
			 GWEN_LoggerLevel_Error,
			 I18N("No user assigned to this account."));
    GWEN_Gui_ShowError(I18N("Setup Error"),
		       I18N("No user assigned to this account. Please assign one in the online banking setup dialog "
			    "for this account.\n"));
    return GWEN_ERROR_INTERNAL;
  }

  switch(AB_Job_GetType(j)) {
  case AB_Job_TypeTransfer: {
    AB_TRANSACTION_LIMITS *lim;

    lim=AB_TransactionLimits_new();
    AB_TransactionLimits_SetMaxLenPurpose(lim, 27);
    AB_TransactionLimits_SetMaxLenRemoteName(lim, 27);
    AB_TransactionLimits_SetMaxLinesRemoteName(lim, 1);
    AB_TransactionLimits_SetMaxLinesPurpose(lim, 2);

    AB_TransactionLimits_AddValuesTextKey(lim, "51", 0);
    AB_Job_SetFieldLimits(j, lim);
    AB_TransactionLimits_free(lim);

    break;
  }

  case AB_Job_TypeDebitNote: {
    AB_TRANSACTION_LIMITS *lim;

    lim=AB_TransactionLimits_new();
    AB_TransactionLimits_SetMaxLenPurpose(lim, 27);
    AB_TransactionLimits_SetMaxLenRemoteName(lim, 27);
    AB_TransactionLimits_SetMaxLinesRemoteName(lim, 1);
    AB_TransactionLimits_SetMaxLinesPurpose(lim, 2);

    AB_TransactionLimits_AddValuesTextKey(lim, "05", 0);
    AB_Job_SetFieldLimits(j, lim);
    AB_TransactionLimits_free(lim);

    break;
  }

  case AB_Job_TypeGetTransactions:
    break;

  case AB_Job_TypeGetBalance:
  default:
    DBG_INFO(AQEBICS_LOGDOMAIN,
	     "Job not yet supported (%d)",
	     AB_Job_GetType(j));
    return GWEN_ERROR_NOT_SUPPORTED;
  } /* switch */
  return 0;
}
Example #2
0
int EBC_Provider_AddJob(AB_PROVIDER *pro, AB_JOB *j) {
  EBC_PROVIDER *dp;
  AB_ACCOUNT *a;
  AB_USER *u;
  EBC_USERQUEUE *uq;
  int doAdd=1;
  GWEN_DB_NODE *dbJob;

  assert(pro);
  dp=GWEN_INHERIT_GETDATA(AB_PROVIDER, EBC_PROVIDER, pro);
  assert(dp);

  a=AB_Job_GetAccount(j);
  assert(a);

  u=AB_Account_GetFirstUser(a);
  if (u==NULL) {
    DBG_ERROR(AQEBICS_LOGDOMAIN, "No user assigned to account.");
    GWEN_Gui_ProgressLog(0,
			 GWEN_LoggerLevel_Error,
			 I18N("No user assigned to account."));
    GWEN_Gui_ShowError(I18N("Setup Error"),
		       I18N("No user assigned to this account. Please assign one in the online banking setup dialog "
			    "for this account.\n"));
    return GWEN_ERROR_INTERNAL;
  }

  dbJob=AB_Job_GetProviderData(j, pro);
  assert(dbJob);

  switch(AB_Job_GetType(j)) {
  case AB_Job_TypeGetTransactions:
  case AB_Job_TypeTransfer:
  case AB_Job_TypeDebitNote:
    break;
  case AB_Job_TypeGetBalance:
  default:
    DBG_INFO(AQEBICS_LOGDOMAIN,
	     "Job not yet supported (%d)",
	     AB_Job_GetType(j));
    return GWEN_ERROR_NOT_SUPPORTED;
  } /* switch */

  uq=EBC_Queue_GetUserQueue(dp->queue, u);
  assert(uq);

  if (AB_Job_GetType(j)==AB_Job_TypeGetTransactions) {
    AB_JOB *firstJob;

    firstJob=EBC_Queue_FindFirstJobLikeThis(dp->queue, u, j);
    if (firstJob) {
      GWEN_DB_NODE *dbCurrJob;

      /* this job is just a copy of the firstJob, reference it */
      dbCurrJob=AB_Job_GetProviderData(j, pro);
      assert(dbCurrJob);

      GWEN_DB_SetIntValue(dbCurrJob,
			  GWEN_DB_FLAGS_OVERWRITE_VARS,
			  "refJob",
			  AB_Job_GetJobId(firstJob));
      /* don't add to queues */
      doAdd=0;
    }
  }

  if (doAdd) {
    /* only add to queue if needed */
    EBC_UserQueue_AddJob(uq, j);
  }

  /* always add to linear list */
  AB_Job_List2_PushBack(dp->bankingJobs, j);
  return 0;
}
Example #3
0
void KBJobListViewItem::_populate()
{
  QString tmp;
  int i;
  AB_ACCOUNT *a;
  const char *p;

  assert(_job);

  i = 0;

  a = AB_Job_GetAccount(_job);
  assert(a);

  // job id
  setText(i++, QString::number(AB_Job_GetJobId(_job)));

  // job type
  switch (AB_Job_GetType(_job)) {
    case AB_Job_TypeGetBalance:
      tmp = i18n("Get Balance");
      break;
    case AB_Job_TypeGetTransactions:
      tmp = i18n("Get Transactions");
      break;
    case AB_Job_TypeTransfer:
      tmp = i18n("Transfer");
      break;
    case AB_Job_TypeDebitNote:
      tmp = i18n("Debit Note");
      break;
    default:
      tmp = i18nc("Unknown job type", "(unknown)");
      break;
  }
  setText(i++, tmp);

  // bank name
  tmp = AB_Account_GetBankName(a);
  if (tmp.isEmpty())
    tmp = AB_Account_GetBankCode(a);
  if (tmp.isEmpty())
    tmp = i18nc("Unknown bank code", "(unknown)");
  setText(i++, tmp);

  // account name
  tmp = AB_Account_GetAccountName(a);
  if (tmp.isEmpty())
    tmp = AB_Account_GetAccountNumber(a);
  if (tmp.isEmpty())
    tmp = i18nc("Unknown account number", "(unknown)");
  setText(i++, tmp);

  // status
  switch (AB_Job_GetStatus(_job)) {
    case AB_Job_StatusNew:
      tmp = i18nc("Status of the job", "new");
      break;
    case AB_Job_StatusUpdated:
      tmp = i18nc("Status of the job", "updated");
      break;
    case AB_Job_StatusEnqueued:
      tmp = i18nc("Status of the job", "enqueued");
      break;
    case AB_Job_StatusSent:
      tmp = i18nc("Status of the job", "sent");
      break;
    case AB_Job_StatusPending:
      tmp = i18nc("Status of the job", "pending");
      break;
    case AB_Job_StatusFinished:
      tmp = i18nc("Status of the job", "finished");
      break;
    case AB_Job_StatusError:
      tmp = i18nc("Status of the job", "error");
      break;
    default:
      tmp = i18nc("Status of the job", "(unknown)");
      break;
  }
  setText(i++, tmp);

  p = AB_Provider_GetName(AB_Account_GetProvider(a));
  if (!p)
    tmp = i18nc("Unknown account provider", "(unknown)");
  else
    tmp = p;
  setText(i++, tmp);

  p = AB_Job_GetCreatedBy(_job);
  if (!p)
    tmp = i18nc("Unknown creator of the job", "(unknown)");
  else
    tmp = p;
  setText(i++, tmp);
}