public static boolean isInvoiceType(GenericValue invoice,String inputTypeId) throws GenericEntityException {
  if (invoice == null) {
    return false;
  }
  GenericValue invoiceType=invoice.getRelatedOne("InvoiceType",true);
  if (invoiceType == null) {
    throw new GenericEntityException("Cannot find InvoiceType for invoiceId " + invoice.getString("invoiceId"));
  }
  String invoiceTypeId=invoiceType.getString("invoiceTypeId");
  if (inputTypeId.equals(invoiceTypeId)) {
    return true;
  }
  return isInvoiceTypeRecurse(invoiceType,inputTypeId);
}

public static boolean isInvoiceType ( GenericValue invoice , String inputTypeId ) throws GenericEntityException { if ( invoice == null ) { return false ; } GenericValue invoiceType = invoice . getRelatedOne ( "InvoiceType" , true ) ; if ( invoiceType == null ) { throw new GenericEntityException ( "Cannot find InvoiceType for invoiceId " + invoice . getString ( "invoiceId" ) ) ; } String invoiceTypeId = invoiceType . getString ( "invoiceTypeId" ) ; if ( inputTypeId . equals ( invoiceTypeId ) ) { return true ; } return isInvoiceTypeRecurse ( invoiceType , inputTypeId ) ; }
checks if a invoice is of a specified invoicetype . invoicetypeid . return false if invoice is null . it ' s better to use more specific calls like ispurchaseinvoice ( ) .
