Skip to content

Commit

Permalink
Use all entries to create transactions ACDM-1575 #resolve (#1439)
Browse files Browse the repository at this point in the history
  • Loading branch information
sergiofbsilva committed Jan 4, 2019
1 parent 270c4f0 commit 732cd43
Showing 1 changed file with 0 additions and 24 deletions.
Expand Up @@ -18,21 +18,12 @@
*/
package org.fenixedu.academic.domain.accounting.postingRules;

import java.util.Collection;
import java.util.Collections;
import java.util.Set;

import org.fenixedu.academic.domain.accounting.Account;
import org.fenixedu.academic.domain.accounting.AccountingTransaction;
import org.fenixedu.academic.domain.accounting.EntryType;
import org.fenixedu.academic.domain.accounting.Event;
import org.fenixedu.academic.domain.accounting.EventType;
import org.fenixedu.academic.domain.accounting.ServiceAgreementTemplate;
import org.fenixedu.academic.domain.exceptions.DomainException;
import org.fenixedu.academic.dto.accounting.AccountingTransactionDetailDTO;
import org.fenixedu.academic.dto.accounting.EntryDTO;
import org.fenixedu.academic.util.Money;
import org.fenixedu.bennu.core.domain.User;
import org.joda.time.DateTime;

public class FixedAmountPR extends FixedAmountPR_Base {
Expand Down Expand Up @@ -61,21 +52,6 @@ protected void init(EntryType entryType, EventType eventType, DateTime startDate
super.setFixedAmount(fixedAmount);
}

@Override
protected Set<AccountingTransaction> internalProcess(User user, Collection<EntryDTO> entryDTOs, Event event,
Account fromAccount, Account toAccount, AccountingTransactionDetailDTO transactionDetail) {

if (entryDTOs.size() != 1) {
throw new DomainException("error.accounting.postingRules.FixedAmountPR.invalid.number.of.entryDTOs");
}

final EntryDTO entryDTO = entryDTOs.iterator().next();

return Collections.singleton(makeAccountingTransaction(user, event, fromAccount, toAccount, entryDTO.getEntryType(),
entryDTO.getAmountToPay(), transactionDetail));

}

@Override
public void setFixedAmount(Money fixedAmount) {
throw new DomainException("error.accounting.postingRules.FixedAmountPR.cannot.modify.fixedAmount");
Expand Down

0 comments on commit 732cd43

Please sign in to comment.