@Override protected String initObject(Context context, boolean isUpdate) { String string = context.getString(); if (isUpdate) { if (string.isEmpty()) { addFirstMessage( context, getMessages().selectATransactionToUpdate(getMessages().creditCardCharge())); return "expensesList"; } creditCardCharge = getTransaction(string, AccounterCoreType.CREDITCARDCHARGE, context); if (creditCardCharge == null) { addFirstMessage( context, getMessages().selectATransactionToUpdate(getMessages().creditCardCharge())); return "expensesList " + string; } setValues(); } else { if (!string.isEmpty()) { get(NUMBER).setValue(string); } creditCardCharge = new ClientCreditCardCharge(); } setTransaction(creditCardCharge); return null; }
@Override protected String initObject(Context context, boolean isUpdate) { if (isUpdate) { String string = context.getString(); if (string.isEmpty()) { addFirstMessage(context, getMessages().selectATransactionToUpdate(getMessages().invoice())); return "employeeList"; } long numberFromString = getNumberFromString(string); employee = (ClientEmployee) CommandUtils.getClientObjectById( numberFromString, AccounterCoreType.EMPLOYEE, getCompanyId()); if (employee == null) { return "employeeList" + string; } setValues(); } else { employee = new ClientEmployee(); } return null; }