Ejemplo n.º 1
0
 /**
  * Gets the List of currencies configured to use in Mifos, the first element will be the default
  * currency.
  *
  * @return List of currencies
  */
 public static LinkedList<MifosCurrency> getCurrencies() {
   if (currencies.size() == 0) {
     currencies.add(AccountingRules.getMifosCurrency(new ConfigurationPersistence()));
     ConfigurationPersistence configurationPersistence = new ConfigurationPersistence();
     for (String currencyCode : AccountingRules.getAdditionalCurrencyCodes()) {
       currencies.add(getMifosCurrency(currencyCode, configurationPersistence));
     }
   }
   return currencies;
 }
Ejemplo n.º 2
0
  public void testGetLastMeetingDateForCustomer() throws Exception {
    MeetingBO meeting =
        TestObjectFactory.createMeeting(
            TestObjectFactory.getNewMeetingForToday(WEEKLY, EVERY_WEEK, CUSTOMER_MEETING));
    center = TestObjectFactory.createWeeklyFeeCenter("Center_Active", meeting);
    setRequestPathInfo("/collectionsheetaction.do");
    addRequestParameter("method", "getLastMeetingDateForCustomer");
    addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
    addRequestParameter("officeId", "3");
    addRequestParameter("loanOfficerId", "1");
    addRequestParameter("customerId", String.valueOf(center.getCustomerId().intValue()));

    request.setAttribute(Constants.CURRENTFLOWKEY, flowKey);
    SessionUtils.setAttribute(
        CollectionSheetEntryConstants.COLLECTION_SHEET_ENTRY_FORM_DTO,
        createDefaultCollectionSheetDto(),
        request);

    actionPerform();
    verifyNoActionErrors();
    verifyNoActionMessages();
    verifyForward("load_success");

    if (AccountingRules.isBackDatedTxnAllowed()) {
      Assert.assertEquals(
          "The value for isBackDated Trxn Allowed",
          SessionUtils.getAttribute(CollectionSheetEntryConstants.ISBACKDATEDTRXNALLOWED, request),
          Constants.YES);
      Assert.assertEquals(
          new java.sql.Date(
                  DateUtils.getDateWithoutTimeStamp(getMeetingDates(meeting).getTime()).getTime())
              .toString(),
          SessionUtils.getAttribute("LastMeetingDate", request).toString());
      Assert.assertEquals(
          new java.util.Date(
              DateUtils.getDateWithoutTimeStamp(getMeetingDates(meeting).getTime()).getTime()),
          DateUtils.getDate(
              ((BulkEntryActionForm)
                      request
                          .getSession()
                          .getAttribute(CollectionSheetEntryConstants.BULKENTRYACTIONFORM))
                  .getTransactionDate()));
    } else {
      Assert.assertEquals(
          "The value for isBackDated Trxn Allowed",
          SessionUtils.getAttribute(CollectionSheetEntryConstants.ISBACKDATEDTRXNALLOWED, request),
          Constants.NO);
      Assert.assertEquals(
          new java.sql.Date(
                  DateUtils.getDateWithoutTimeStamp(getMeetingDates(meeting).getTime()).getTime())
              .toString(),
          SessionUtils.getAttribute("LastMeetingDate", request).toString());
      Assert.assertEquals(
          DateUtils.getUserLocaleDate(
              getUserLocale(request),
              new java.sql.Date(DateUtils.getCurrentDateWithoutTimeStamp().getTime()).toString()),
          ((BulkEntryActionForm)
                  request
                      .getSession()
                      .getAttribute(CollectionSheetEntryConstants.BULKENTRYACTIONFORM))
              .getTransactionDate());
    }
  }