OpenConcerto

Dépôt officiel du code source de l'ERP OpenConcerto
sonarqube

svn://code.openconcerto.org/openconcerto

Compare Revisions

Regard whitespace Rev 155 → Rev 156

/trunk/OpenConcerto/src/org/openconcerto/erp/core/finance/payment/element/SDDMessageSQLElement.java
85,7 → 85,7
import org.jdom2.Namespace;
 
public final class SDDMessageSQLElement extends ComptaSQLConfElement {
static final String TABLE_NAME = "SEPA_DIRECT_DEBIT_MESSAGE";
static public final String TABLE_NAME = "SEPA_DIRECT_DEBIT_MESSAGE";
static public final String XML_LOCATION_PREF_KEY = "SDD.XML.location";
public static final String SERIAL_MD = "SDD_MESSAGE_SERIAL";
 
172,7 → 172,7
// TODO rename createCodeFromPackage() to createCodeOfPackage() and change createCode()
// implementation to use a new createCodeFromPackage() which uses the class name (w/o
// SQLElement suffix)
return this.createCodeFromPackage() + ".SDDMessage";
return this.createCodeOfPackage() + ".SDDMessage";
}
 
public final void exportXML(final Component comp, final List<? extends SQLRowAccessor> messages) {
238,6 → 238,7
static private final class InvoicesByPaymentInfo {
private final Date lowerBound, upperBound;
 
// { collection date -> { sequence type -> invoice } }
private final NavigableMap<Date, ListMap<String, InvoiceElem>> map = new TreeMap<>();
private final Set<Number> lockedInvoicesIDs = new HashSet<>();
private BigDecimal sum = BigDecimal.ZERO;
278,6 → 279,7
if (!mandate.getBoolean("ACTIVE"))
throw new IllegalStateException("Inactive mandate for " + invoice);
// needed otherwise would have to update seqType while generating
// MAYBE sum all invoices for a single mandate, but which date to choose ?
if (!this.invoiceMandates.add(mandate.getString("MandateIdentification")))
return IgnoreReason.DUPLICATE_MANDATE;
 
405,7 → 407,7
final SQLRowValues invoiceVals = new SQLRowValues(invoiceT);
invoiceVals.putRowValues("ID_CLIENT").putNulls("NOM", "BIC", "IBAN");
invoiceVals.putRowValues("ID_MODE_REGLEMENT").putNulls("AJOURS", "LENJOUR").putRowValues("ID_SEPA_MANDATE").setAllToNull();
invoiceVals.putNulls("NET_A_PAYER", "DATE", "NUMERO");
invoiceVals.putNulls("NET_A_PAYER", "DATE", "NUMERO", "NOM");
final SQLRowValuesListFetcher fetcher = SQLRowValuesListFetcher.create(invoiceVals);
fetcher.setReturnedRowsUnmodifiable(true);
// required for locking rows and to make sure that there's a SEPA Mandate
622,7 → 624,9
 
res.addContent(new Element("Purp", painNS).addContent(new Element("Cd", painNS).setText("OTHR")));
 
// TODO <RmtInf><Ustrd>ligne de facture avec n° d'abonnement et indice de paiement.
final String info = (invoice.getString("NUMERO") + ' ' + invoice.getString("NOM")).trim();
if (!info.isEmpty())
res.addContent(new Element("RmtInf", painNS).addContent(elemCreator.create("Ustrd").setText(elemCreator.shortenText(info, 140))));
 
return res;
}
642,6 → 646,8
}
 
static private final class ElementCreator {
static private final String TRUNCATED_SUFFIX = "...";
static private final int TRUNCATED_SUFFIX_LENGTH = TRUNCATED_SUFFIX.length();
private final Namespace painNS;
private final SQLFieldTranslator fieldTrans;
 
668,6 → 674,12
throw new MissingInfoException(label == null ? elemName : label);
return create(elemName).setText(text);
}
 
protected String shortenText(final String text, final int maxLength) {
if (maxLength <= TRUNCATED_SUFFIX_LENGTH || text.length() <= maxLength)
return text;
return text.substring(0, maxLength - TRUNCATED_SUFFIX_LENGTH) + TRUNCATED_SUFFIX;
}
}
 
}