"error.accounting.agreement.serviceAgreementTemplates.DegreeCurricularPlanServiceAgreementTemplate.cannot.modify.degreeCurricularPlan");
}
public GratuityPaymentPlan getGratuityPaymentPlanFor(final StudentCurricularPlan studentCurricularPlan,
final ExecutionYear executionYear) {
GratuityPaymentPlan result = null;
for (final PaymentPlan paymentPlan : getPaymentPlansSet()) {
if (paymentPlan instanceof GratuityPaymentPlan
&& ((GratuityPaymentPlan) paymentPlan).isAppliableFor(studentCurricularPlan, executionYear)) {
GratuityPaymentPlan gratuityPaymentPlan = (GratuityPaymentPlan) paymentPlan;
if (result == null) {
result = (GratuityPaymentPlan) paymentPlan;
} else {
if (gratuityPaymentPlan.hasPrecedenceOver(result.getClass())) {
result = gratuityPaymentPlan;
} else if (!result.hasPrecedenceOver(gratuityPaymentPlan.getClass())) {
// Incompatible payment plans
throw new DomainException(
"error.net.sourceforge.fenixedu.domain.accounting.serviceAgreementTemplates.DegreeCurricularPlanServiceAgreementTemplate.more.than.one.gratuity.payment.plan.is.appliable");
}
}