Dépôt officiel du code source de l'ERP OpenConcerto
/trunk/OpenConcerto/Configuration/Template/Labels/50x50.zpl |
---|
New file |
0,0 → 1,24 |
^XA |
^CI28 |
^FX Designation |
^CF0,24 |
^FO20,50^FB 380,3,0,L,0^FD${product.name}^FS |
^FX Traitement |
^CF0,22 |
^FO20,140^FDTraitement : ${product.treatment}^FS |
^FX Origine |
^CF0,22 |
^FO20,170^FDOrigine : ${product.origin}^FS |
^FX Numero de lot |
^CF0,22 |
^FO20,200^FDN° de lot : ${product.batch}^FS |
^FX EAN |
^BY3,2,90 |
^FO60,250^BEN,80,Y,N^FD${product.ean13}^FS |
^XZ |
/trunk/OpenConcerto/Configuration/Template/Labels/57x32.zpl |
---|
New file |
0,0 → 1,36 |
^XA |
^CI28 |
^FX HT |
^CF0,24 |
^FO490,20,1^FD${product.price}^FS |
^CF0,20 |
^FO490,45,1^FD€ HT^FS |
^FX TTC |
^CF0,24 |
^FO490,70,1^FD${product.pricewithtax}^FS |
^CF0,20 |
^FO490,95,1^FD€ TTC^FS |
^FX Code |
^CF0,28 |
^FO20,126^FB 380,3,0,L,0^FD${product.code}^FS |
^FX Designation |
^CF0,24 |
^FO20,155^FB480,1,0,L,0^FD${product.name}^FS |
^FX Couleur |
^CF0,18 |
^FO20,185^FDCouleur : ${product.color}^FS |
^FX Taille |
^CF0,18 |
^FO310,185^FDTaille : ${product.size}^FS |
^FX EAN |
^BY3,2,75 |
^FO54,15^BEN,75,Y,N^FD${product.ean13}^FS |
^XZ |
/trunk/OpenConcerto/Configuration/Template/Default/LivrePaye.ods |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/Configuration/Template/Default/RepartitionAnalytique.odsp |
---|
1,9 → 1,7 |
<odsp> |
<spliteveryrow> |
<sheet number="0">68</sheet> |
<sheet number="0">69</sheet> |
</spliteveryrow> |
<offset x="40" y ="20"/> |
<resize percent="85"/> |
<offset x="0" y ="0"/> |
<resize percent="100"/> |
</odsp> |
/trunk/OpenConcerto/Configuration/Template/Default/LivrePaye.odsp |
---|
2,8 → 2,8 |
<spliteveryrow> |
<sheet number="0">67</sheet> |
</spliteveryrow> |
<offset x="40" y ="20"/> |
<resize percent="85"/> |
<offset x="0" y ="0"/> |
<resize percent="100"/> |
</odsp> |
/trunk/OpenConcerto/Configuration/Template/Default/EtatStockInventaire.xml |
---|
3,7 → 3,7 |
<!-- <element location="A3" type="Value" ValueName="DATE"> |
</element> |
--> |
<table firstLine="2" endLine="17000" endPageLine="25000" lastColumn="E" table="SAISIE_VENTE_FACTURE"> |
<table firstLine="2" endLine="-1" endPageLine="25000" lastColumn="E" table="SAISIE_VENTE_FACTURE"> |
<element location="A" type="fill"> |
<field name="FAMILLE" /> |
29,5 → 29,9 |
<field name="QTE" /> |
</element> |
<element location="H" type="fill"> |
<field name="DEPOT" /> |
</element> |
</table> |
</contentDocument> |
/trunk/OpenConcerto/Configuration/Template/Default/FichePayeSimplifiee.xml |
---|
13,11 → 13,11 |
</field> |
</element> |
<element location="D7" type="fill"> |
<element location="C7" type="fill"> |
<field base="Common" table="SOCIETE_COMMON" name="NUMERO_URSSAF" /> |
</element> |
<element location="G7" type="fill"> |
<element location="F7" type="fill"> |
<field base="Common" table="SOCIETE_COMMON" name="NUM_SIRET" /> |
</element> |
114,10 → 114,10 |
<field name="DETAILS_CONGES" /> |
</element> |
<element location="H52" type="fill"> |
<element location="G52" type="fill"> |
<field name="COT_SAL" /> |
</element> |
<element location="I52" type="fill"> |
<element location="H52" type="fill"> |
<field name="COT_PAT" /> |
</element> |
/trunk/OpenConcerto/Configuration/Template/Default/EtatRapprochement.ods |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/Configuration/Template/Default/EtatRapprochement.ods |
---|
New file |
Property changes: |
Added: svn:mime-type |
+application/octet-stream |
\ No newline at end of property |
/trunk/OpenConcerto/Configuration/Template/Default/RepartitionAnalytique.ods |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/Configuration/Template/Default/EtatChargesPaye.odsp |
---|
New file |
0,0 → 1,9 |
<odsp> |
<spliteveryrow> |
<sheet number="0">68</sheet> |
</spliteveryrow> |
<offset x="0" y ="0"/> |
<resize percent="100"/> |
</odsp> |
/trunk/OpenConcerto/Configuration/Template/Default/EtatVentes.ods |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/Configuration/Template/Default/EtatRapprochement.xml |
---|
New file |
0,0 → 1,45 |
<?xml version="1.0" encoding="UTF-8" ?> |
<contentDocument> |
<element0 location="A1" type="Value" ValueName="SOCIETE"> |
</element0> |
<element0 location="F1" type="Value" ValueName="DATE_EDITION"> |
</element0> |
<element0 location="A3" type="Value" ValueName="TITRE"> |
</element0> |
<table0 firstLine="6" endLine="60" endPageLine="60" lastColumn="G" base="Societe" table="ECRITURE" pageRef="F3"> |
<element location="A" type="fill" > |
<field base="Societe" name="DATE"/> |
</element> |
<element location="B" type="fill" > |
<field base="Societe" name="CODE_JOURNAL"/> |
</element> |
<element location="C" type="fill" > |
<field base="Societe" name="PIECE"/> |
</element> |
<element location="D" type="fill" maxChar="60" > |
<field base="Societe" name="NOM"/> |
</element> |
<element location="E" type="fill"> |
<field base="Societe" name="DEBIT"/> |
</element> |
<element location="F" type="fill"> |
<field base="Societe" name="CREDIT"/> |
</element> |
<element location="G" type="fill"> |
<field base="Societe" name="SOLDE"/> |
</element> |
</table0> |
</contentDocument> |
/trunk/OpenConcerto/Configuration/Template/Default/EtatStockInventaire.ods |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/Configuration/Template/Default/FichePayeSimplifiee.ods |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/trunk/OpenConcerto/Configuration/Template/Default/RepartitionAnalytique.xml |
---|
28,7 → 28,11 |
<field name="POSTE_NOM" /> |
</element> |
<element location="D" type="fill"> |
<field name="CLASSE" /> |
</element> |
<element location="E" type="fill"> |
<field name="DEBIT" /> |
</element> |
/trunk/OpenConcerto/Configuration/Template/Default/EtatRapprochement.odsp |
---|
New file |
0,0 → 1,9 |
<odsp> |
<spliteveryrow> |
<sheet number="0">60</sheet> |
</spliteveryrow> |
<offset x="0" y ="0"/> |
<resize percent="100"/> |
</odsp> |
/trunk/OpenConcerto/src/META-INF/services/javax.script.ScriptEngineFactory |
---|
New file |
0,0 → 1,0 |
ilm.ognl.OGNLScriptEngineFactory |
/trunk/OpenConcerto/src/org/jopendocument/link/Component.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/jopendocument/link/OOConnexion.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
27,6 → 27,7 |
import java.net.URLClassLoader; |
import java.security.CodeSource; |
import java.security.PermissionCollection; |
import java.util.Collections; |
import java.util.List; |
import java.util.Map; |
import java.util.PropertyPermission; |
54,7 → 55,8 |
} |
static private final URL[] getURLs(final OOInstallation ooInstall) { |
final List<URL> res = ooInstall.getURLs(CollectionUtils.createSet("ridl.jar", "jurt.jar", "juh.jar", "unoil.jar")); |
final List<URL> from_v7 = ooInstall.getURLs(Collections.singleton("libreoffice.jar")); |
final List<URL> res = from_v7.isEmpty() ? ooInstall.getURLs(CollectionUtils.createSet("ridl.jar", "jurt.jar", "juh.jar", "unoil.jar")) : from_v7; |
return res.toArray(new URL[res.size()]); |
} |
/trunk/OpenConcerto/src/org/jopendocument/link/OOInstallation.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/ognl/OGNLScriptEngineFactory.java |
---|
New file |
0,0 → 1,137 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
* copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific |
* language governing permissions and limitations under the License. |
* |
* When distributing the software, include this License Header Notice in each file. |
*/ |
package org.openconcerto.ognl; |
import org.openconcerto.utils.StringUtils; |
import java.util.Arrays; |
import java.util.Collections; |
import java.util.List; |
import javax.script.ScriptEngine; |
import javax.script.ScriptEngineFactory; |
public class OGNLScriptEngineFactory implements ScriptEngineFactory { |
@Override |
public String getEngineName() { |
return (String) getParameter(ScriptEngine.ENGINE); |
} |
@Override |
public String getEngineVersion() { |
return (String) getParameter(ScriptEngine.ENGINE_VERSION); |
} |
@Override |
public List<String> getExtensions() { |
return Collections.unmodifiableList(extensions); |
} |
@Override |
public String getLanguageName() { |
return (String) getParameter(ScriptEngine.LANGUAGE); |
} |
@Override |
public String getLanguageVersion() { |
return (String) getParameter(ScriptEngine.LANGUAGE_VERSION); |
} |
@Override |
public List<String> getMimeTypes() { |
return Collections.unmodifiableList(mimeTypes); |
} |
@Override |
public List<String> getNames() { |
return Collections.unmodifiableList(names); |
} |
@Override |
public Object getParameter(final String key) { |
switch (key) { |
case ScriptEngine.NAME: |
return "OGNL"; |
case ScriptEngine.ENGINE: |
return "ILM OGNL"; |
case ScriptEngine.ENGINE_VERSION: |
return "1.0"; |
case ScriptEngine.LANGUAGE: |
return "OGNL"; |
case ScriptEngine.LANGUAGE_VERSION: |
return "OGNL 3.3"; |
case "THREADING": |
// The engine implementation is not thread-safe. Can't be |
// used to execute scripts concurrently on multiple threads. |
return null; |
default: |
return null; |
} |
} |
@Override |
public String getMethodCallSyntax(final String obj, final String method, final String... args) { |
final StringBuilder sb = new StringBuilder().append(obj).append('.').append(method).append('('); |
final int len = args.length; |
if (len > 0) { |
sb.append(args[0]); |
} |
for (int i = 1; i < len; i++) { |
sb.append(',').append(args[i]); |
} |
sb.append(')'); |
return sb.toString(); |
} |
@Override |
public String getOutputStatement(String toDisplay) { |
return "@System@out.println(" + StringUtils.doubleQuote(toDisplay) + ")"; |
} |
@Override |
public String getProgram(final String... statements) { |
final StringBuilder sb = new StringBuilder(); |
for (final String statement : statements) { |
sb.append(statement).append(','); |
} |
return sb.toString(); |
} |
@Override |
public ScriptEngine getScriptEngine() { |
return new OGNLScriptEngine(this); |
} |
private static final List<String> names; |
private static final List<String> mimeTypes; |
private static final List<String> extensions; |
static { |
names = immutableList("OGNL", "ILM-OGNL"); |
mimeTypes = immutableList("application/ognl", "text/ognl"); |
extensions = Collections.singletonList("ognl"); |
} |
private static List<String> immutableList(final String... elements) { |
return Collections.unmodifiableList(Arrays.asList(elements)); |
} |
} |
/trunk/OpenConcerto/src/org/openconcerto/ognl/OGNLScriptEngine.java |
---|
New file |
0,0 → 1,72 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
* copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific |
* language governing permissions and limitations under the License. |
* |
* When distributing the software, include this License Header Notice in each file. |
*/ |
package org.openconcerto.ognl; |
import java.io.Reader; |
import javax.script.AbstractScriptEngine; |
import javax.script.Bindings; |
import javax.script.ScriptContext; |
import javax.script.ScriptEngineFactory; |
import javax.script.ScriptException; |
import javax.script.SimpleBindings; |
import ognl.Ognl; |
import ognl.OgnlParser; |
public class OGNLScriptEngine extends AbstractScriptEngine { |
// the factory that created this engine |
private final OGNLScriptEngineFactory factory; |
OGNLScriptEngine(final OGNLScriptEngineFactory factory) { |
super(new SimpleBindings()); |
this.factory = factory; |
} |
@Override |
public Object eval(String script, ScriptContext context) throws ScriptException { |
try { |
final Bindings bindings = getBindings(context); |
return Ognl.getValue(script, bindings, Ognl.getRoot(bindings)); |
} catch (Exception e) { |
throw new ScriptException(e); |
} |
} |
// TODO also use ScriptContext.getWriter() & co. |
private Bindings getBindings(ScriptContext context) { |
return context.getBindings(ScriptContext.ENGINE_SCOPE); |
} |
@Override |
public Object eval(Reader reader, ScriptContext context) throws ScriptException { |
try { |
final Bindings bindings = getBindings(context); |
return Ognl.getValue(new OgnlParser(reader).topLevelExpression(), bindings, Ognl.getRoot(bindings)); |
} catch (Exception e) { |
throw new ScriptException(e); |
} |
} |
@Override |
public Bindings createBindings() { |
return new SimpleBindings(); |
} |
@Override |
public ScriptEngineFactory getFactory() { |
return this.factory; |
} |
} |
/trunk/OpenConcerto/src/org/openconcerto/sql/sqlobject/ITextWithCompletionPopUp.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/sql/sqlobject/ITextWithCompletion.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
418,11 → 418,23 |
private void showPopup() { |
assert SwingUtilities.isEventDispatchThread(); |
if (this.model.getSize() > 0) { |
if (this.popupInvoker.isShowing()) |
if (this.popupInvoker.isShowing()) { |
String max = ""; |
for (IComboSelectionItem item : this.model.getList()) { |
if (max.length() < item.getLabel().length()) { |
max = item.getLabel(); |
} |
} |
final int stringWidth = this.text.getGraphics().getFontMetrics().stringWidth(max); |
this.popup.setMinWith(Math.max(450, stringWidth + 20)); |
this.popup.show(this.popupInvoker, 0, this.text.getBounds().height); |
} |
} |
} |
public void changedUpdate(DocumentEvent e) { |
updateAutoCompletion(false); |
/trunk/OpenConcerto/src/org/openconcerto/sql/utils/GenerationUtils.java |
---|
File deleted |
/trunk/OpenConcerto/src/org/openconcerto/sql/model/SQLInjector.java |
---|
22,6 → 22,7 |
import org.openconcerto.sql.utils.ChangeTable; |
import org.openconcerto.sql.utils.SQLCreateTable; |
import org.openconcerto.sql.view.list.SQLTableModelSourceOnline; |
import org.openconcerto.utils.GestionDevise; |
import org.openconcerto.utils.StringUtils; |
import org.openconcerto.utils.cc.ITransformer; |
193,20 → 194,34 |
String label = rowVals.getString(to); |
SQLPreferences prefs = SQLPreferences.getMemCached(srcRow.getTable().getDBRoot()); |
final String ref = srcRow.getString(from); |
if (ref != null && ref.trim().length() > 0) { |
if (prefs.getBoolean("TransfertRef", true) || !to.equals("NOM")) { |
if (label != null && label.trim().length() > 0) { |
rowVals.put(to, cleanRef(label + ", " + srcRow.getString(from))); |
rowVals.put(to, cleanRef(label + ", " + ref)); |
} else { |
rowVals.put(to, srcRow.getString(from)); |
rowVals.put(to, ref); |
} |
} else if (prefs.getBoolean("TransfertMultiRef", false)) { |
SQLRowValues rowValsHeader = new SQLRowValues(UndefinedRowValuesCache.getInstance().getDefaultRowValues(tableElementDestination)); |
// TODO taxe may be undefined set it to default |
rowValsHeader.put("NOM", srcRow.getString(from)); |
rowValsHeader.put("NOM", ref); |
rowValsHeader.put(refField, rowVals); |
} |
// On reprend les références dans la facture |
if (rowValsHeader.getTable().getName().equalsIgnoreCase("SAISIE_VENTE_FACTURE_ELEMENT")) { |
SQLRowValues rowValsHeaderRef = new SQLRowValues(UndefinedRowValuesCache.getInstance().getDefaultRowValues(tableElementDestination)); |
rowValsHeaderRef.put("ID_STYLE", 3); |
if (srcRow.getTable().getName().equalsIgnoreCase("DEVIS")) { |
rowValsHeaderRef.put("NOM", srcRow.getString("OBJET")); |
} else { |
rowValsHeaderRef.put("NOM", srcRow.getString("NOM")); |
} |
rowValsHeaderRef.put(refField, rowVals); |
} |
} |
} |
} |
DateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy"); |
213,6 → 228,7 |
protected void transfertNumberReference(SQLRowAccessor srcRow, SQLRowValues rowVals, final SQLTable tableElementDestination, String refField) { |
SQLPreferences prefs = SQLPreferences.getMemCached(srcRow.getTable().getDBRoot()); |
if (!prefs.getBoolean("TransfertNoRef", false)) { |
if (prefs.getBoolean("TransfertRef", true)) { |
String label = rowVals.getString("NOM"); |
if (label != null && label.trim().length() > 0) { |
221,7 → 237,8 |
} else { |
rowVals.put("NOM", srcRow.getString("NUMERO")); |
} |
} else if (prefs.getBoolean("TransfertMultiRef", false)) { |
} |
if (prefs.getBoolean("TransfertMultiRef", false)) { |
SQLRowValues rowValsHeader = new SQLRowValues(UndefinedRowValuesCache.getInstance().getDefaultRowValues(tableElementDestination)); |
// FIXME Style forcé en titre 1 via l'ID |
rowValsHeader.put("ID_STYLE", 3); |
236,6 → 253,7 |
rowValsHeader.put(refField, rowVals); |
} |
} |
} |
public synchronized SQLRow insertFrom(final SQLRowAccessor srcRow) throws SQLException { |
return createRowValuesFrom(Arrays.asList(srcRow)).insert(); |
/trunk/OpenConcerto/src/org/openconcerto/sql/model/SQLRowValues.java |
---|
1105,8 → 1105,17 |
// TODO support java.time.LocalDateTime in Java 8 |
public static <T, U> U convert(final Class<T> source, final Object value, final Class<U> dest) { |
final ValueConvertor<T, U> conv = ValueConvertorFactory.find(source, dest); |
if (conv == null) |
if (conv == null) { |
// FIXME erreur dans passer une commande depuis le calcul des besoin, code à retirer |
if (SQLRowAccessor.class.isAssignableFrom(source) && Integer.class.isAssignableFrom(dest)) { |
System.err.println("Conversion d'une row en integer " + ((SQLRowAccessor) source.cast(value)).toString()); |
Thread.dumpStack(); |
return dest.cast(((SQLRowAccessor) source.cast(value)).getID()); |
} else { |
throw new IllegalArgumentException("No convertor to " + dest + " from " + source); |
} |
} |
return conv.convert(source.cast(value)); |
} |
/trunk/OpenConcerto/src/org/openconcerto/sql/view/list/RowValuesTableControlPanel.java |
---|
28,6 → 28,7 |
import javax.swing.ImageIcon; |
import javax.swing.JButton; |
import javax.swing.JOptionPane; |
import javax.swing.JPanel; |
import javax.swing.event.ListSelectionEvent; |
import javax.swing.event.ListSelectionListener; |
133,6 → 134,7 |
} |
SQLField validationField = RowValuesTableControlPanel.this.model.getValidationField(); |
if (validationField != null) { |
if (validationField.getTable().getName().equals(RowValuesTableControlPanel.this.model.getSQLElement().getTable().getName())) { |
boolean canDelete = true; |
for (int i : table.getSelectedRows()) { |
SQLRowValues rowVals = RowValuesTableControlPanel.this.model.getRowValuesAt(i); |
140,7 → 142,23 |
} |
if (canDelete) { |
RowValuesTableControlPanel.this.model.removeRowsAt(table.getSelectedRows()); |
} else { |
JOptionPane.showMessageDialog(buttonSuppr, "Impossible de supprimer une ligne validée"); |
} |
} else { |
boolean canDelete = true; |
for (int i : table.getSelectedRows()) { |
SQLRowValues rowVals = RowValuesTableControlPanel.this.model.getRowValuesAt(i); |
if (rowVals.hasID()) { |
canDelete &= rowVals.asRow().getReferentRows(validationField).isEmpty(); |
} |
} |
if (canDelete) { |
RowValuesTableControlPanel.this.model.removeRowsAt(table.getSelectedRows()); |
} else { |
JOptionPane.showMessageDialog(buttonSuppr, "Impossible de supprimer une ligne référencée"); |
} |
} |
// MAYBE show popup if can't delete |
} else { |
RowValuesTableControlPanel.this.model.removeRowsAt(table.getSelectedRows()); |
/trunk/OpenConcerto/src/org/openconcerto/sql/view/list/KeyTableCellRenderer.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
15,6 → 15,7 |
import org.openconcerto.sql.Configuration; |
import org.openconcerto.sql.element.SQLElement; |
import org.openconcerto.sql.model.SQLRowAccessor; |
import org.openconcerto.sql.model.SQLRowValues; |
import org.openconcerto.sql.model.SQLTable.ListenerAndConfig; |
import org.openconcerto.sql.model.SQLTableEvent; |
61,7 → 62,7 |
return super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); |
} |
public void setValue(Object value) { |
protected void setValue(Object value) { |
if (this.isLoading) { |
this.toSelect = value; |
76,11 → 77,17 |
} |
try { |
if (value instanceof SQLRowValues) { |
newValue = ((SQLRowValues) value).getString("CODE"); |
// if (value instanceof SQLRowValues) { |
// newValue = ((SQLRowValues) value).getID();// getString("CODE"); |
// } else { |
final int id; |
if (value instanceof SQLRowAccessor) { |
id = ((SQLRowAccessor) value).getID();// getString("CODE"); |
} else { |
final int id = Integer.parseInt(value.toString()); |
id = Integer.parseInt(value.toString()); |
} |
Number undefID = this.el.getTable().getUndefinedIDNumber(); |
if (undefID == null || id > undefID.intValue()) { |
IComboSelectionItem item = cacheMap.get(this.el).get(id); |
98,7 → 105,7 |
} else { |
newValue = SQLTableElement.UNDEFINED_STRING; |
} |
} |
// } |
} catch (NumberFormatException e) { |
e.printStackTrace(); |
/trunk/OpenConcerto/src/org/openconcerto/sql/view/list/IListe.java |
---|
49,6 → 49,7 |
import org.openconcerto.ui.MenuUtils; |
import org.openconcerto.ui.PopupMouseListener; |
import org.openconcerto.ui.SwingThreadUtils; |
import org.openconcerto.ui.WrapLayout; |
import org.openconcerto.ui.list.selection.BaseListStateModel; |
import org.openconcerto.ui.list.selection.ListSelection; |
import org.openconcerto.ui.list.selection.ListSelectionState; |
602,7 → 603,7 |
// car les updates du ITableModel se font de manière synchrone dans la EDT |
// donc on ne peut faire aucune action pendant les maj |
this.btnPanel = new JPanel(new FlowLayout(FlowLayout.LEADING)); |
this.btnPanel = new JPanel(new WrapLayout()); |
this.addListenerOnModel(new PropertyChangeListener() { |
@Override |
public void propertyChange(PropertyChangeEvent evt) { |
/trunk/OpenConcerto/src/org/openconcerto/sql/view/list/AutoCompletionManager.java |
---|
61,11 → 61,21 |
this(fromTableElement, fillFrom, table, tableModel, ITextWithCompletion.MODE_CONTAINS, false); |
} |
// FIXME Le validstatechecker est à passer au SQLTableElement |
public AutoCompletionManager(SQLTableElement fromTableElement, SQLField fillFrom, RowValuesTable table, RowValuesTableModel tableModel, ComboSQLRequest req) { |
this(fromTableElement, fillFrom, table, tableModel, ITextWithCompletion.MODE_CONTAINS, false, false, new ValidStateChecker(), req); |
} |
public AutoCompletionManager(SQLTableElement fromTableElement, SQLField fillFrom, RowValuesTable table, RowValuesTableModel tableModel, int modeCompletion, boolean expandWithShowAs, |
boolean foreign, ValidStateChecker checker) { |
this(fromTableElement, fillFrom, table, tableModel, modeCompletion, expandWithShowAs, foreign, checker, null); |
} |
// FIXME Le validstatechecker est à passer au SQLTableElement |
public AutoCompletionManager(SQLTableElement fromTableElement, SQLField fillFrom, RowValuesTable table, RowValuesTableModel tableModel, int modeCompletion, boolean expandWithShowAs, |
boolean foreign, ValidStateChecker checker, ComboSQLRequest req) { |
this.foreign = foreign; |
if (req == null) { |
List<String> l = new Vector<String>(); |
if (expandWithShowAs) { |
75,8 → 85,13 |
} |
} else { |
l.add(fillFrom.getName()); |
// FIXME à mettre en parametre |
if (fillFrom.getName().equals("NOM") && fillFrom.getTable().contains("CODE")) { |
l.add("CODE"); |
} |
ComboSQLRequest req = new ComboSQLRequest(fillFrom.getTable(), l); |
} |
req = new ComboSQLRequest(fillFrom.getTable(), l); |
} |
init(fromTableElement, fillFrom, table, tableModel, modeCompletion, req, foreign, checker); |
} |
/trunk/OpenConcerto/src/org/openconcerto/sql/view/list/SQLTextComboTableCellEditor.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
15,6 → 15,7 |
import org.openconcerto.sql.element.SQLElement; |
import org.openconcerto.sql.model.SQLField; |
import org.openconcerto.sql.model.SQLRowAccessor; |
import org.openconcerto.sql.model.SQLRowValues; |
import org.openconcerto.sql.model.SQLSelect; |
import org.openconcerto.sql.model.Where; |
135,8 → 136,13 |
} |
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) { |
if (value instanceof Integer) { |
this.val = (Integer) value; |
} else if (value instanceof SQLRowAccessor) { |
this.val = ((SQLRowAccessor) value).getID(); |
} else if (value != null) { |
throw new IllegalArgumentException("value type error for : " + value); |
} |
this.comboBox.setValue(this.val); |
this.comboBox.grabFocus(); |
/trunk/OpenConcerto/src/org/openconcerto/sql/view/list/RowValuesTableModel.java |
---|
31,7 → 31,6 |
import org.openconcerto.sql.model.Where; |
import org.openconcerto.sql.utils.AlterTable; |
import org.openconcerto.utils.CompareUtils; |
import org.openconcerto.utils.ExceptionHandler; |
import org.openconcerto.utils.ListMap; |
import org.openconcerto.utils.OrderedSet; |
58,6 → 57,8 |
// synchronized is used to protect list access |
private List<SQLRowValues> rowValues = new ArrayList<SQLRowValues>(); |
private final boolean debug = false; |
private OrderedSet<TableModelListener> tableModelListeners = new OrderedSet<TableModelListener>(); |
protected SQLElement element; |
78,6 → 79,8 |
private Where fillWhere; |
private boolean gestionReferentActive = false; |
public RowValuesTableModel() { |
} |
152,6 → 155,10 |
return this.defautRow; |
} |
public void setGestionReferentActive(boolean gestionReferent) { |
this.gestionReferentActive = gestionReferent; |
} |
public synchronized void addColumn(SQLTableElement e) { |
this.nbColumn++; |
this.list.add(e); |
177,7 → 184,7 |
SQLTableElement elt = this.list.get(columnIndex); |
boolean validate = false; |
boolean fieldValidate = false; |
if (this.validationField != null) { |
if (this.validationField != null && this.validationField.getTable().getName().equals(getSQLElement().getTable().getName())) { |
fieldValidate = elt.getField().getName().equalsIgnoreCase(this.validationField.getName()); |
validate = this.getRowValuesAt(rowIndex).getBoolean(this.validationField.getName()); |
} |
205,7 → 212,14 |
SQLTableElement sqlTableElem = this.list.get(columnIndex); |
Object storedObject = val.getObject(sqlTableElem.getRowField()); |
result = sqlTableElem.getValueFrom(val); |
if (sqlTableElem.getElementClass() != null && Number.class.isAssignableFrom(sqlTableElem.getElementClass()) && !CompareUtils.equals(result, storedObject)) { |
final Object resultToCheck; |
if (sqlTableElem.getElementClass() != null && Number.class.isAssignableFrom(sqlTableElem.getElementClass()) && result != null && SQLRowAccessor.class.isAssignableFrom(result.getClass()) |
&& storedObject != null && Number.class.isAssignableFrom(storedObject.getClass())) { |
resultToCheck = ((SQLRowAccessor) result).getIDNumber(); |
} else { |
resultToCheck = result; |
} |
if (sqlTableElem.getElementClass() != null && Number.class.isAssignableFrom(sqlTableElem.getElementClass()) && !CompareUtils.equals(resultToCheck, storedObject)) { |
fireTableDataChanged(); |
} |
224,6 → 238,11 |
} |
public void putValue(Object value, int rowIndex, String fieldName, boolean forcedFire) { |
if (debug) { |
System.err.println("putValue(row:" + rowIndex + "]) :" + value + "(" + value.getClass() + " fieldName : " + fieldName + ")"); |
Thread.dumpStack(); |
} |
checkEDT(); |
final SQLRowValues rowVal = this.rowValues.get(rowIndex); |
Object oldValue = rowVal.getObject(fieldName); |
259,6 → 278,7 |
if (oldValue != null && oldValue.equals(aValue)) { |
return; |
} |
try { |
SQLTableElement sqlTableElem = this.list.get(columnIndex); |
267,10 → 287,6 |
if (realVal == null || realVal.getClass() == this.getColumnClass(columnIndex)) { |
sqlTableElem.setValueFrom(rowVal, realVal); |
fireTableChanged(new TableModelEvent(this, rowIndex, rowIndex, columnIndex)); |
} else { |
System.err.println("RowValuesTableModel:setValueAt:" + realVal + "(" + realVal.getClass() + ") at (row:" + rowIndex + "/col:" + columnIndex + ") column class : " |
+ this.getColumnClass(columnIndex)); |
Thread.dumpStack(); |
} |
} catch (Exception e) { |
// can append when stop editing occur while removing a line |
295,8 → 311,10 |
/** |
* Valider les modifications dans la base |
* |
* @throws SQLException |
*/ |
public void commitData() { |
public void commitData() throws SQLException { |
commitData(false); |
} |
303,11 → 321,11 |
/** |
* Valider les modifications dans la base |
*/ |
public void commitData(boolean useMultipleInsertUpdate) { |
public void commitData(boolean useMultipleInsertUpdate) throws SQLException { |
checkEDT(); |
final List<SQLRowValues> rowsToCommmit = new ArrayList<SQLRowValues>(); |
rowsToCommmit.addAll(this.rowValues); |
try { |
final SQLTable table = getDefaultRowValues().getTable(); |
// Remove constraint on ORDRE for private |
final Constraint constraint = table.getConstraint(ConstraintType.UNIQUE, Arrays.asList(table.getOrderField().getName())); |
359,6 → 377,38 |
if (!updates.isEmpty()) { |
SQLUpdate.executeMultipleWithBatch(table.getDBSystemRoot(), updates); |
} |
if (this.gestionReferentActive) { |
// Traitement des référents |
List<SQLInsert> insertsRefs = new ArrayList<>(); |
List<SQLUpdate> updatesRefs = new ArrayList<>(); |
for (SQLRowValues rowVals : rowsToCommmit) { |
final Collection<SQLRowValues> referentRows = rowVals.getReferentRows(); |
System.err.println(referentRows.size() + " ref Rows pour RowValues " + rowVals); |
for (SQLRowValues refRow : referentRows) { |
System.err.println("\t" + refRow); |
if (refRow.hasID()) { |
SQLUpdate update = new SQLUpdate(new Where(refRow.getTable().getKey(), "=", refRow.getID())); |
update.importValuesFrom(refRow); |
updatesRefs.add(update); |
} else { |
SQLInsert insert = new SQLInsert(); |
insert.importValuesFrom(refRow); |
System.err.println("\t\t" + insert.asString()); |
insertsRefs.add(insert); |
} |
} |
} |
if (!insertsRefs.isEmpty()) { |
SQLInsert.executeMultiple(table.getDBSystemRoot(), insertsRefs); |
} |
if (!updatesRefs.isEmpty()) { |
SQLUpdate.executeMultipleWithBatch(table.getDBSystemRoot(), updatesRefs); |
} |
} |
table.fireTableModified(-1); |
} else { |
for (int i = 0; i < size; i++) { |
368,11 → 418,7 |
final SQLRow row = store.getStoredRow(r); |
r.setID(row.getIDNumber()); |
} |
} |
} catch (SQLException e) { |
ExceptionHandler.handle("Unable to commit rows", e); |
} |
} |
542,7 → 588,7 |
return this.list; |
} |
public void updateField(String field, SQLRowValues rowVals, String fieldCondition) { |
public void updateField(String field, SQLRowValues rowVals, String fieldCondition) throws SQLException { |
checkEDT(); |
if (rowVals != null) { |
int stop = this.rowValues.size(); |
590,11 → 636,8 |
} |
} |
this.rowValuesDeleted.clear(); |
try { |
this.element.archive(toArchive); |
} catch (SQLException e) { |
throw new IllegalStateException("Unable to archive rows : " + toArchive, e); |
} |
if (id != SQLRow.NONEXISTANT_ID) { |
this.commitData(); |
602,15 → 645,15 |
} |
} |
public void updateField(String field, SQLRowValues rowVals) { |
public void updateField(String field, SQLRowValues rowVals) throws SQLException { |
updateField(field, rowVals, null); |
} |
public void updateField(String field, int id) { |
public void updateField(String field, int id) throws SQLException { |
updateField(field, id, null); |
} |
public void updateField(String field, int id, String fieldCondition) { |
public void updateField(String field, int id, String fieldCondition) throws SQLException { |
if (id > 0) { |
updateField(field, this.element.getTable().getForeignTable(field).getRow(id).createUpdateRow(), fieldCondition); |
} |
667,26 → 710,13 |
final List<SQLRowValues> newRows = new ArrayList<SQLRowValues>(); |
final SQLTable table = RowValuesTableModel.this.element.getTable(); |
if (rowVals.hasID() && !rowVals.isUndefined() && rowVals.getID() != SQLRow.NONEXISTANT_ID) { |
SQLRow row = rowVals.getTable().getRow(rowVals.getID()); |
List<SQLRow> rowSet; |
if (referentField == null) { |
rowSet = row.getReferentRows(RowValuesTableModel.this.element.getTable()); |
newRows.addAll(fetchDataFromDB(rowVals, referentField, fieldWhere, value)); |
} else { |
rowSet = row.getReferentRows(referentField); |
} |
for (SQLRow row2 : rowSet) { |
if (fieldWhere == null || CompareUtils.equals(row2.getObject(fieldWhere.getName()), value)) { |
SQLRowValues rowVals2 = new SQLRowValues(RowValuesTableModel.this.element.getTable()); |
rowVals2.loadAbsolutelyAll(row2); |
newRows.add(rowVals2); |
} |
} |
} else { |
final Collection<? extends SQLRowAccessor> colRows; |
if (referentField == null) { |
colRows = rowVals.getReferentRows(RowValuesTableModel.this.element.getTable()); |
colRows = rowVals.getReferentRows(table); |
} else { |
colRows = rowVals.getReferentRows(referentField); |
} |
704,6 → 734,27 |
} |
} |
public List<SQLRowValues> fetchDataFromDB(final SQLRowAccessor rowVals, final SQLField referentField, final SQLField fieldWhere, final Object value) { |
final List<SQLRowValues> newRows = new ArrayList<>(); |
final SQLTable table = getSQLElement().getTable(); |
SQLRow row = rowVals.getTable().getRow(rowVals.getID()); |
List<SQLRow> rowSet; |
if (referentField == null) { |
rowSet = row.getReferentRows(table); |
} else { |
rowSet = row.getReferentRows(referentField); |
} |
for (SQLRow row2 : rowSet) { |
if (fieldWhere == null || CompareUtils.equals(row2.getObject(fieldWhere.getName()), value)) { |
SQLRowValues rowVals2 = new SQLRowValues(table); |
rowVals2.loadAbsolutelyAll(row2); |
newRows.add(rowVals2); |
} |
} |
return newRows; |
} |
public void addRow(SQLRowValues row) { |
checkEDT(); |
addRow(row, true); |
/trunk/OpenConcerto/src/org/openconcerto/sql/view/list/SQLTableElement.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
347,7 → 347,8 |
if (this.getModifier() != null) { |
result = this.getModifier().getValueFrom(row, this); |
// Test pour corriger les incohérences de BD (ex: PRIX_METRIQUE_VT_1 = 30 et PV_HT=0) |
if (this.getElementClass() != null && Number.class.isAssignableFrom(this.getElementClass()) && !CompareUtils.equals(result, row.getObject(this.rowField))) { |
if (this.getElementClass() != null && Number.class.isAssignableFrom(this.getElementClass()) && !row.getTable().getField(this.rowField).isForeignKey() |
&& !CompareUtils.equals(result, row.getObject(this.rowField))) { |
row.put(this.rowField, result); |
fireModification(row); |
} |
/trunk/OpenConcerto/src/org/openconcerto/sql/view/list/RowValuesTable.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
27,6 → 27,7 |
import org.openconcerto.ui.state.JTableStateManager; |
import org.openconcerto.ui.table.AlternateTableCellRenderer; |
import org.openconcerto.ui.table.XTableColumnModel; |
import org.openconcerto.utils.checks.EmptyChangeSupport; |
import org.openconcerto.utils.checks.EmptyListener; |
import org.openconcerto.utils.checks.ValidListener; |
import org.openconcerto.utils.checks.ValidState; |
40,6 → 41,7 |
import java.beans.PropertyChangeListener; |
import java.io.File; |
import java.io.IOException; |
import java.sql.SQLException; |
import java.util.ArrayList; |
import java.util.Collections; |
import java.util.List; |
67,6 → 69,10 |
private boolean editorAndRendererDone; |
private List<String> clearElementList = new ArrayList<String>(); |
// supports |
private final List<ValidListener> validListeners; |
private final EmptyChangeSupport emptySupp; |
public RowValuesTable(RowValuesTableModel model, File f) { |
this(model, f, false); |
} |
95,6 → 101,9 |
public RowValuesTable(RowValuesTableModel model, File f, boolean tiny, XTableColumnModel colModel) { |
super(model, colModel); |
this.emptySupp = new EmptyChangeSupport(this); |
this.validListeners = new ArrayList<>(); |
this.setTableHeader(new RowValuesTableHeader(colModel)); |
if (f == null) { |
218,7 → 227,15 |
if (e.getType() == TableModelEvent.INSERT) { |
scrollRectToVisible(new Rectangle(getCellRect(e.getFirstRow(), 0, true))); |
} |
if (this.emptySupp != null) { |
this.emptySupp.fireEmptyChange(getRowCount() == 0); |
} |
if (this.validListeners != null) { |
for (ValidListener l : this.validListeners) { |
l.validChange(null, getValidState()); |
} |
} |
} |
public RowValuesTableModel getRowValuesTableModel() { |
return this.model; |
225,7 → 242,11 |
} |
public void updateField(String field, SQLRowValues rowVals) { |
try { |
this.model.updateField(field, rowVals); |
} catch (SQLException e) { |
throw new IllegalStateException(e); |
} |
// Clear pour fixer le probleme avec les editframe et ne pas fermer la fenetre |
// sinon les elements pointront sur la nouveau devis et l'ancien les perdra |
clear(); |
232,7 → 253,12 |
} |
public void updateField(String field, int id) { |
try { |
this.model.updateField(field, id); |
} catch (SQLException e) { |
throw new IllegalStateException(e); |
} |
// Clear pour fixer le probleme avec les editframe et ne pas fermer la fenetre |
// sinon les elements pointront sur la nouveau devis et l'ancien les perdra |
clear(); |
239,7 → 265,11 |
} |
public void updateField(String field, int id, String fieldCondition) { |
try { |
this.model.updateField(field, id, fieldCondition); |
} catch (SQLException e) { |
throw new IllegalStateException(e); |
} |
// Clear pour fixer le probleme avec les editframe et ne pas fermer la fenetre |
// sinon les elements pointront sur la nouveau devis et l'ancien les perdra |
clear(); |
246,7 → 276,12 |
} |
public void updateField(String field, SQLRowValues rowVals, String fieldCondition) { |
try { |
this.model.updateField(field, rowVals, fieldCondition); |
} catch (SQLException e) { |
throw new IllegalStateException(e); |
} |
// Clear pour fixer le probleme avec les editframe et ne pas fermer la fenetre |
// sinon les elements pointront sur la nouveau devis et l'ancien les perdra |
clear(); |
/trunk/OpenConcerto/src/org/openconcerto/sql/ui/light/LightRowValuesTableOnline.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
25,6 → 25,7 |
import org.openconcerto.ui.light.TableSearchParameterType; |
import org.openconcerto.ui.light.UserSearch; |
import org.openconcerto.ui.light.UserSearchItem; |
import org.openconcerto.utils.StringUtils; |
import org.openconcerto.utils.cc.ITransformer; |
import java.util.ArrayList; |
101,10 → 102,21 |
String searchType = item.getType(); |
TableSearchMatcher m = LightRowValuesTableOnline.this.getSearchMatcher(colId, searchType); |
if (m != null) { |
if (searchType.equals(UserSearchItem.TYPE_CONTAINS)) { |
List<String> textParts = StringUtils.fastSplitTrimmed(userText, ' '); |
for (String p : textParts) { |
final Where where = m.getWhere(sel, new TableSearchParameterType(searchType), p); |
if (where != null) { |
wheres.add(where); |
} |
} |
} else { |
final Where where = m.getWhere(sel, new TableSearchParameterType(searchType), userText); |
if (where != null) { |
wheres.add(where); |
} |
} |
} else { |
Log.get().warning("no TableSearchMatcher for " + item); |
} |
/trunk/OpenConcerto/src/org/openconcerto/sql/ui/ConnexionPanel.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
47,8 → 47,10 |
import java.awt.event.ActionListener; |
import java.beans.PropertyChangeEvent; |
import java.beans.PropertyChangeListener; |
import java.text.DateFormat; |
import java.util.ArrayList; |
import java.util.Arrays; |
import java.util.Date; |
import java.util.List; |
import java.util.Locale; |
import java.util.ResourceBundle; |
319,6 → 321,7 |
final JPopupMenu menu = new JPopupMenu(); |
final Locale locale = UserProps.getInstance().getLocale(); |
for (final Locale l : ConnexionPanel.this.localesToDisplay) { |
System.err.println("ConnexionPanel.ConnexionPanel(...).new ActionListener() {...}.actionPerformed()" + l); |
final JCheckBoxMenuItem menuItem = new JCheckBoxMenuItem(l.getDisplayName(l)); |
if (l.equals(locale)) { |
menuItem.setSelected(true); |
506,6 → 509,8 |
} |
protected void setUILanguage(Locale locale) { |
System.err.println("ConnexionPanel.setUILanguage()" + locale + " : " + locale.getDisplayName()); |
final ResourceBundle bundle = ResourceBundle.getBundle(this.localeBaseName, locale, TranslationManager.getControl()); |
this.adminLogin = bundle.getString("adminLogin"); |
this.loginLabel.setText(bundle.getString("loginLabel")); |
528,5 → 533,8 |
// throw RuntimeException like ResourceBundle.getBundle() at the beginning of this |
// method |
TranslationManager.createDefaultInstance(); |
DateFormat df = DateFormat.getDateInstance(); |
System.err.println("ConnexionPanel.setUILanguage() Date :" + Locale.getDefault() + " : " + new Date() + ": format: " + df.format(new Date())); |
System.err.println("ConnexionPanel.setUILanguage() Category :" + Locale.getDefault(Locale.Category.FORMAT)); |
} |
} |
/trunk/OpenConcerto/src/org/openconcerto/utils/SystemUtils.java |
---|
132,6 → 132,10 |
return Enum.valueOf(clazz, propName); |
} |
static public final int getIntProperty(final String propName, final int def) { |
return getProperty(propName, Integer::parseInt, def); |
} |
static public final <T> T getProperty(final String propName, final Function<String, T> func, final T def) { |
final String prop = System.getProperty(propName); |
if (prop == null) |
/trunk/OpenConcerto/src/org/openconcerto/utils/mime/MimeType.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/mime/FreeDesktopMimeDetector.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/mime/File.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/mime/FileMagicMimeDetector.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/Mozilla.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/NumberUtils.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/CoreEqualizer.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/ArrayListOfInt.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/Value.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/model/DefaultIListModel.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
13,6 → 13,8 |
package org.openconcerto.utils.model; |
import org.openconcerto.utils.cc.TruncatableList; |
import java.util.ArrayList; |
import java.util.Arrays; |
import java.util.Collection; |
22,7 → 24,7 |
import javax.swing.AbstractListModel; |
/** |
* Un comboBoxModel qui utilise une liste, et possède un addAll(). |
* The default implementation for {@link IListModel}. |
* |
* @author Sylvain CUAZ |
* @param <T> type of items |
30,6 → 32,7 |
public class DefaultIListModel<T> extends AbstractListModel<T> implements IListModel<T> { |
protected final List<T> objects; |
protected boolean truncated; |
/** |
* Constructs an empty DefaultComboBoxModel object. |
48,15 → 51,22 |
* @param v a Vector object ... |
*/ |
public DefaultIListModel(Collection<? extends T> v) { |
this(v, false); |
} |
public DefaultIListModel(Collection<? extends T> v, final boolean truncated) { |
this.objects = new ArrayList<T>(v); |
this.truncated = truncated; |
} |
// implements javax.swing.ListModel |
@Override |
public int getSize() { |
return this.objects.size(); |
} |
// implements javax.swing.ListModel |
@Override |
public T getElementAt(int index) { |
if (index >= 0 && index < this.objects.size()) |
return this.objects.get(index); |
64,8 → 74,16 |
return null; |
} |
@Override |
public List<T> getList() { |
return Collections.unmodifiableList(this.objects); |
} |
public final boolean isTruncated() { |
return this.truncated; |
} |
public final TruncatableList<T> copyTruncatableList() { |
return new TruncatableList<>(new ArrayList<>(this.objects), this.isTruncated()); |
} |
} |
/trunk/OpenConcerto/src/org/openconcerto/utils/model/Reloadable.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/model/IMutableListModel.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
13,11 → 13,15 |
package org.openconcerto.utils.model; |
import java.util.Collection; |
public interface IMutableListModel<T> extends IListModel<T> { |
// Adds an item at the end of the model. |
void addElement(T obj); |
void addAll(Collection<? extends T> items); |
// Adds an item at a specific index. |
void insertElementAt(T obj, int index); |
/trunk/OpenConcerto/src/org/openconcerto/utils/model/NewSelection.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/model/ISearchable.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/model/DefaultIMutableListModel.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
124,11 → 124,17 |
return this.objects.indexOf(this.getSelectedItem()); |
} |
public final void setTruncated(boolean truncated) { |
this.truncated = truncated; |
} |
// implements javax.swing.MutableComboBoxModel |
@Override |
public final void addElement(T anObject) { |
this.addAll(Collections.singleton(anObject)); |
} |
@Override |
public void addAll(Collection<? extends T> items) { |
this.addAll(-1, items); |
} |
154,6 → 160,7 |
} |
// implements javax.swing.MutableComboBoxModel |
@Override |
public void insertElementAt(T anObject, int index) { |
this.objects.add(index, anObject); |
fireIntervalAdded(this, index, index); |
160,6 → 167,7 |
} |
// implements javax.swing.MutableComboBoxModel |
@Override |
public void removeElementAt(int index) { |
this.removeElementsAt(index, index); |
} |
255,7 → 263,7 |
// needed to implement javax.swing.MutableComboBoxModel |
protected final void removeForJRE(final Object anObject) { |
int index = this.objects.indexOf(anObject); |
final int index = this.objects.indexOf(anObject); |
if (index != -1) { |
removeElementAt(index); |
} |
276,6 → 284,7 |
/** |
* Empties the list. |
*/ |
@Override |
public void removeAllElements() { |
final int size = this.objects.size(); |
if (size > 0) { |
296,7 → 305,7 |
} |
protected void fire(int type, int index0, int index1, CollectionChangeEventCreator c) { |
Object[] listeners = this.listenerList.getListenerList(); |
final Object[] listeners = this.listenerList.getListenerList(); |
ListDataEvent e = null; |
for (int i = listeners.length - 2; i >= 0; i -= 2) { |
/trunk/OpenConcerto/src/org/openconcerto/utils/model/IListModel.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
26,6 → 26,7 |
*/ |
public interface IListModel<T> extends ListModel<T> { |
@Override |
public T getElementAt(int index); |
/** |
/trunk/OpenConcerto/src/org/openconcerto/utils/model/ListComboBoxModel.java |
---|
27,8 → 27,6 |
*/ |
public class ListComboBoxModel<T> extends DefaultIMutableListModel<T> implements MutableComboBoxModel<T> { |
private boolean truncated; |
public ListComboBoxModel() { |
this(Collections.<T> emptyList()); |
} |
45,13 → 43,4 |
public void removeElement(Object obj) { |
this.removeForJRE(obj); |
} |
public void setTruncated(boolean truncated) { |
this.truncated = truncated; |
} |
public boolean isTruncated() { |
return this.truncated; |
} |
} |
/trunk/OpenConcerto/src/org/openconcerto/utils/model/SimpleListDataListener.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/doc/Documented.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/CopyUtils.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/convertor/JavaTimeSQLConvertors.java |
---|
New file |
0,0 → 1,52 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
* copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific |
* language governing permissions and limitations under the License. |
* |
* When distributing the software, include this License Header Notice in each file. |
*/ |
package org.openconcerto.utils.convertor; |
public class JavaTimeSQLConvertors { |
static public ValueConvertor<java.time.LocalTime, java.sql.Time> LOCAL_TIME = new NullIsNullConvertor<java.time.LocalTime, java.sql.Time>() { |
@Override |
protected java.sql.Time convertNonNull(java.time.LocalTime o) { |
return java.sql.Time.valueOf(o); |
} |
@Override |
protected java.time.LocalTime unconvertNonNull(java.sql.Time o) { |
return o.toLocalTime(); |
} |
}; |
static public ValueConvertor<java.time.LocalDate, java.sql.Date> LOCAL_DATE = new NullIsNullConvertor<java.time.LocalDate, java.sql.Date>() { |
@Override |
protected java.sql.Date convertNonNull(java.time.LocalDate o) { |
return java.sql.Date.valueOf(o); |
} |
@Override |
protected java.time.LocalDate unconvertNonNull(java.sql.Date o) { |
return o.toLocalDate(); |
} |
}; |
static public ValueConvertor<java.time.LocalDateTime, java.sql.Timestamp> LOCAL_DATETIME = new NullIsNullConvertor<java.time.LocalDateTime, java.sql.Timestamp>() { |
@Override |
protected java.sql.Timestamp convertNonNull(java.time.LocalDateTime o) { |
return java.sql.Timestamp.valueOf(o); |
} |
@Override |
protected java.time.LocalDateTime unconvertNonNull(java.sql.Timestamp o) { |
return o.toLocalDateTime(); |
} |
}; |
} |
/trunk/OpenConcerto/src/org/openconcerto/utils/convertor/DateTSConvertor.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/convertor/ValueConvertorFactory.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
14,10 → 14,15 |
package org.openconcerto.utils.convertor; |
import org.openconcerto.utils.ReflectUtils; |
import org.openconcerto.utils.Tuple2.List2; |
import org.openconcerto.utils.cache.LRUMap; |
import java.util.ArrayList; |
import java.util.List; |
import java.util.Map; |
import net.jcip.annotations.GuardedBy; |
public final class ValueConvertorFactory { |
@SuppressWarnings("rawtypes") |
32,39 → 37,102 |
return o; |
} |
}; |
private static final ValueConvertor<?, ?> MISSING_CONV = new ValueConvertor<Void, Void>() { |
@Override |
public Void convert(Void o) { |
return null; |
} |
@Override |
public Void unconvert(Void o) { |
return null; |
} |
}; |
@SuppressWarnings("unchecked") |
public static final <T> ValueConvertor<T, T> getIdentityConvertor() { |
return (ValueConvertor<T, T>) IdentityConvertor; |
return IdentityConvertor; |
} |
private static final List<ValueConvertor<?, ?>> convs; |
private static final List<ValueConvertor<?, ?>> STRICT_CONVERTORS; |
private static final List<ValueConvertor<?, ?>> LENIENT_CONVERTORS; |
@GuardedBy("self") |
private static Map<List2<Class<?>>, ValueConvertor<?, ?>> CACHE = new LRUMap<>(512, 32); |
@GuardedBy("self") |
private static Map<List2<Class<?>>, ValueConvertor<?, ?>> LENIENT_CACHE = new LRUMap<>(512, 32); |
static { |
convs = new ArrayList<ValueConvertor<?, ?>>(); |
convs.add(new DateTSConvertor()); |
convs.add(new DateToSQLConvertor()); |
convs.add(new DateToTimeConvertor()); |
convs.add(StringClobConvertor.INSTANCE); |
convs.add(NumberConvertor.INT_TO_LONG); |
convs.add(NumberConvertor.SHORT_TO_INT); |
// common |
LENIENT_CONVERTORS = new ArrayList<>(); |
STRICT_CONVERTORS = new ArrayList<>(); |
LENIENT_CONVERTORS.add(new DateTSConvertor()); |
LENIENT_CONVERTORS.add(new DateToSQLConvertor()); |
LENIENT_CONVERTORS.add(new DateToTimeConvertor()); |
LENIENT_CONVERTORS.add(NumberConvertor.INT_TO_LONG); |
LENIENT_CONVERTORS.add(NumberConvertor.SHORT_TO_INT); |
LENIENT_CONVERTORS.add(JavaTimeSQLConvertors.LOCAL_DATE); |
LENIENT_CONVERTORS.add(JavaTimeSQLConvertors.LOCAL_TIME); |
LENIENT_CONVERTORS.add(JavaTimeSQLConvertors.LOCAL_DATETIME); |
STRICT_CONVERTORS.addAll(LENIENT_CONVERTORS); |
STRICT_CONVERTORS.add(StringClobConvertor.INSTANCE); |
STRICT_CONVERTORS.add(NumberConvertor.INT_TO_BIGDECIMAL_EXACT); |
LENIENT_CONVERTORS.add(StringClobConvertor.INSTANCE_LENIENT); |
} |
public static final <T, U> U convert(final T o, final Class<U> c2, final boolean lenient) { |
if (c2.isInstance(o)) |
return c2.cast(o); |
@SuppressWarnings("unchecked") |
final ValueConvertor<T, U> conv = (ValueConvertor<T, U>) find(o.getClass(), c2, lenient); |
if (conv == null) |
throw new IllegalArgumentException("No convertor to " + c2 + " from " + o); |
return conv.convert(o); |
} |
public static final <T, U> ValueConvertor<T, U> find(Class<T> c1, Class<U> c2) { |
if (c1 == c2) |
return (ValueConvertor<T, U>) getIdentityConvertor(); |
for (final ValueConvertor<?, ?> vc : convs) { |
return find(c1, c2, false); |
} |
public static final <T, U> ValueConvertor<T, U> find(Class<T> c1, Class<U> c2, final boolean lenient) { |
final ValueConvertor<?, ?> res; |
if (c1 == c2) { |
res = getIdentityConvertor(); |
} else { |
final List2<Class<?>> key = new List2<>(c1, c2); |
final Map<List2<Class<?>>, ValueConvertor<?, ?>> c = lenient ? LENIENT_CACHE : CACHE; |
synchronized (c) { |
final ValueConvertor<?, ?> inCache = c.get(key); |
if (inCache == MISSING_CONV) { |
return null; |
} else if (inCache != null) { |
res = inCache; |
} else { |
res = create(c1, c2, lenient); |
c.put(key, res == null ? MISSING_CONV : res); |
} |
} |
} |
@SuppressWarnings("unchecked") |
final ValueConvertor<T, U> casted = (ValueConvertor<T, U>) res; |
return casted; |
} |
private static final ValueConvertor<?, ?> create(Class<?> c1, Class<?> c2, final boolean lenient) { |
assert c1 != c2; |
for (final ValueConvertor<?, ?> vc : (lenient ? LENIENT_CONVERTORS : STRICT_CONVERTORS)) { |
final List<Class<?>> args = ReflectUtils.getTypeArguments(vc, ValueConvertor.class); |
if (args.size() != 2) |
throw new IllegalStateException(vc + " don't specify type arguments"); |
if (args.get(0).equals(c1) && args.get(1).equals(c2)) { |
return (ValueConvertor<T, U>) vc; |
return vc; |
} else if (args.get(0).equals(c2) && args.get(1).equals(c1)) { |
return new ReverseConvertor<T, U>((ValueConvertor<U, T>) vc); |
return ReverseConvertor.create(vc); |
} |
} |
if (Number.class.isAssignableFrom(c1) && Number.class.isAssignableFrom(c2)) |
return (ValueConvertor<T, U>) NumberConvertor.create(c1.asSubclass(Number.class), c2.asSubclass(Number.class), true); |
return NumberConvertor.create(c1.asSubclass(Number.class), c2.asSubclass(Number.class), !lenient); |
return null; |
} |
/trunk/OpenConcerto/src/org/openconcerto/utils/convertor/StringClobConvertor.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/convertor/NumberConvertor.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
28,7 → 28,7 |
@Override |
public Integer unconvert(Long o) { |
return o.intValue(); |
return Math.toIntExact(o.longValue()); |
} |
}; |
40,10 → 40,25 |
@Override |
public Short unconvert(Integer o) { |
return o.shortValue(); |
final short res = o.shortValue(); |
if (res != o.intValue()) |
throw new OverflowException(o, Short.class); |
return res; |
} |
}; |
public static final NumberConvertor<Integer, BigDecimal> INT_TO_BIGDECIMAL_EXACT = new NumberConvertor<Integer, BigDecimal>() { |
@Override |
public BigDecimal convert(Integer o) { |
return BigDecimal.valueOf(o.longValue()); |
} |
@Override |
public Integer unconvert(BigDecimal o) { |
return o.intValueExact(); |
} |
}; |
public static final <N1 extends Number, N2 extends Number> NumberConvertor<N1, N2> create(final Class<N1> c1, final Class<N2> c2, final boolean exact) { |
return new NumberConvertor<N1, N2>() { |
@Override |
/trunk/OpenConcerto/src/org/openconcerto/utils/convertor/ReverseConvertor.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
15,6 → 15,11 |
public class ReverseConvertor<T, U> implements ValueConvertor<T, U> { |
// avoid illegal new ReverseConvertor<?,?>() |
public static final <T, U> ReverseConvertor<T, U> create(ValueConvertor<U, T> o) { |
return new ReverseConvertor<>(o); |
} |
private final ValueConvertor<U, T> delegate; |
public ReverseConvertor(ValueConvertor<U, T> delegate) { |
/trunk/OpenConcerto/src/org/openconcerto/utils/convertor/ValueConvertor.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/convertor/DateToTimeConvertor.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/convertor/DateToSQLConvertor.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/convertor/NullIsNullConvertor.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/text/CSVReader.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/text/DocumentFilterList.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/text/FixedWidthOuputer.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/text/LimitedSizeDocumentFilter.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/text/CSVWriter.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/text/CharsetHelper.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/text/SimpleDocumentFilter.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/text/SimpleDocumentListener.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/text/CSVParser.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/ThreadHandler.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/Unzip.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/TransformedComparator.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/ProcessStreams.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/ooxml/XLSXSheet.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
18,6 → 18,8 |
import java.awt.Point; |
import java.io.IOException; |
import java.math.BigDecimal; |
import java.math.RoundingMode; |
import java.nio.charset.StandardCharsets; |
import java.util.ArrayList; |
import java.util.Calendar; |
34,8 → 36,6 |
import org.w3c.dom.NodeList; |
import org.xml.sax.SAXException; |
import com.ibm.icu.math.BigDecimal; |
public class XLSXSheet { |
private int columnCount; |
private int startX; |
136,6 → 136,8 |
} |
} else if (type.equals("s")) { |
cellValue = document.getSharedString(Integer.parseInt(value)); |
} else if (type.equals("str")) { |
cellValue = value; |
} |
this.rows.get(p.y - this.startY).set(p.x - this.startX, cellValue); |
} |
232,7 → 234,11 |
public static Date stringToDate(Calendar c, String d) { |
c.clear(); |
c.set(1900, 0, 0); |
c.add(Calendar.DAY_OF_YEAR, Integer.parseInt(d) - 1); |
BigDecimal b = new BigDecimal(d); |
final BigDecimal days = b.setScale(0, RoundingMode.FLOOR); |
c.add(Calendar.DAY_OF_YEAR, days.intValue() - 1); |
final BigDecimal ms = b.subtract(b.setScale(0, RoundingMode.FLOOR)).multiply(new BigDecimal(24)).multiply(new BigDecimal(36)).movePointRight(5); |
c.add(Calendar.MILLISECOND, ms.setScale(0, RoundingMode.HALF_UP).intValue()); |
return c.getTime(); |
} |
/trunk/OpenConcerto/src/org/openconcerto/utils/checks/ValidState.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/checks/EmptyChangeSupport.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/checks/EmptyObjFromVO.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/checks/ValidChangeSupport.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/checks/ValueObject.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/checks/EmptyListener.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/checks/ValidListener.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/checks/ValidObjectCombiner.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/checks/ValidObject.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/checks/ChainValidListener.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/checks/EmptyObj.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/checks/EmptyObjHelper.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/checks/ChainPropertyListener.java |
---|
New file |
0,0 → 1,87 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
* copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific |
* language governing permissions and limitations under the License. |
* |
* When distributing the software, include this License Header Notice in each file. |
*/ |
package org.openconcerto.utils.checks; |
import java.beans.PropertyChangeEvent; |
import java.beans.PropertyChangeListener; |
import java.util.function.Consumer; |
/** |
* Allow to propagate an event for another object, but still appear as the source of changes. |
* |
* @author Sylvain |
*/ |
public final class ChainPropertyListener implements PropertyChangeListener { |
static public final PropertyChangeEvent copyEvent(final Object bean, final PropertyChangeEvent evt) { |
return copyEvent(bean, evt.getPropertyName(), evt); |
} |
static public final PropertyChangeEvent copyEvent(final Object bean, final String propName, final PropertyChangeEvent evt) { |
final PropertyChangeEvent res = new PropertyChangeEvent(bean, propName, evt.getOldValue(), evt.getNewValue()); |
res.setPropagationId(evt.getPropagationId()); |
return res; |
} |
private final Consumer<PropertyChangeEvent> delegate; |
private final Object target; |
private final String propName; |
public ChainPropertyListener(Object target, PropertyChangeListener delegate) { |
this(target, null, delegate::propertyChange); |
} |
public ChainPropertyListener(final Object target, final String propName, final Consumer<PropertyChangeEvent> delegate) { |
if (target == null || delegate == null) |
throw new NullPointerException(); |
this.target = target; |
this.propName = propName; |
this.delegate = delegate; |
} |
public final String getPropName() { |
return this.propName; |
} |
private final String getPropName(PropertyChangeEvent evt) { |
return this.propName != null ? this.propName : evt.getPropertyName(); |
} |
@Override |
public void propertyChange(PropertyChangeEvent evt) { |
this.delegate.accept(copyEvent(this.target, this.getPropName(evt), evt)); |
} |
@Override |
public int hashCode() { |
final int prime = 31; |
int result = 1; |
result = prime * result + this.delegate.hashCode(); |
result = prime * result + this.target.hashCode(); |
return result; |
} |
@Override |
public boolean equals(Object obj) { |
if (this == obj) |
return true; |
if (obj == null) |
return false; |
if (getClass() != obj.getClass()) |
return false; |
final ChainPropertyListener other = (ChainPropertyListener) obj; |
return this.delegate.equals(other.delegate) && this.target.equals(other.target); |
} |
} |
/trunk/OpenConcerto/src/org/openconcerto/utils/NoneSelectedButtonGroup.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/ExceptionHandler.java |
---|
153,10 → 153,12 |
return res; |
} |
@Deprecated |
static public Future<Boolean> handle(String msg, Throwable originalExn) { |
return handle(null, msg, originalExn); |
} |
@Deprecated |
static public Future<Boolean> handle(String msg) { |
return handle(msg, null); |
} |
/trunk/OpenConcerto/src/org/openconcerto/utils/ProductInfo.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/NetUtils.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/Messages.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/UnmodifiableCollectionMap.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/ntp/SNTPClient.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/ntp/Timestamp.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/ntp/Message.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/ScreenImage.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/ChainedThread.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/EmailClient.java |
---|
376,7 → 376,7 |
final int returnCode = process.waitFor(); |
if (returnCode != 0) |
throw new IllegalStateException("Non zero return code: " + returnCode); |
throw new IllegalStateException("Non zero return code: " + returnCode + "\nCommande : " + CollectionUtils.join(pb.command(), " ")); |
return true; |
} |
}; |
/trunk/OpenConcerto/src/org/openconcerto/utils/io/HTMLable.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/io/JSONAble.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/io/NewLineWriter.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/io/RandomAccessFileInputStream.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/io/MailAccount.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
110,6 → 110,10 |
return sb.toString(); |
} |
public static final MailAccount create(final String fromAddr, String smtpLogin, String smtpPassword) throws AddressException { |
return create(fromAddr, null, smtpLogin, smtpPassword); |
} |
public static final MailAccount create(final String fromAddr, String smtpServer, String smtpLogin, String smtpPassword) throws AddressException { |
Objects.requireNonNull(fromAddr, "Missing 'From:' address"); |
final InternetAddress fromInetAddr = new InternetAddress(fromAddr, true); |
145,8 → 149,8 |
public MailAccount(String name, String address, String smtpServer, int port) { |
super(); |
this.name = name; |
this.address = address; |
this.smtpServer = smtpServer; |
this.address = Objects.requireNonNull(address); |
this.smtpServer = Objects.requireNonNull(smtpServer); |
this.port = port; |
this.auth = null; |
} |
/trunk/OpenConcerto/src/org/openconcerto/utils/io/PercentEncoder.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/io/JSONConverter.java |
---|
22,6 → 22,7 |
import java.text.Format; |
import java.util.Calendar; |
import java.util.Date; |
import java.util.function.Function; |
import com.google.gson.Gson; |
import com.google.gson.JsonElement; |
68,6 → 69,8 |
result = ((HTMLable) param).getHTML(); |
} else if (param instanceof JSONAble) { |
result = ((JSONAble) param).toJSON(); |
} else if (param instanceof JSONNamed) { |
result = ((JSONNamed) param).getJSONName(); |
} else if (param instanceof Date) { |
result = format((Date) param); |
} else if (param instanceof Calendar) { |
93,6 → 96,8 |
result = "#" + hexString; |
} else if (param instanceof BigDecimal) { |
result = ((BigDecimal) param).doubleValue(); |
} else if (param instanceof Enum) { |
result = ((Enum<?>) param).name().toLowerCase(); |
} else { |
result = param; |
} |
134,6 → 139,16 |
} |
} else if (type.equals(Color.class)) { |
result = type.cast(Color.decode(o.toString())); |
} else if (JSONNamed.class.isAssignableFrom(type)) { |
for (final T enumConstant : type.getEnumConstants()) { |
if (((JSONNamed) enumConstant).getJSONName().equals(o)) |
return enumConstant; |
} |
throw new IllegalArgumentException("Unknown name '" + o + "' for " + type); |
} else if (Enum.class.isAssignableFrom(type)) { |
@SuppressWarnings("unchecked") |
final Enum<?> enumVal = Enum.valueOf(type.asSubclass(Enum.class), o.toString().toUpperCase()); |
result = type.cast(enumVal); |
} else { |
result = type.cast(o); |
} |
149,6 → 164,10 |
} |
public static <T> T getParameterFromJSON(final JSONObject json, final String key, final Class<T> type, T defaultValue) { |
return getParameterFromJSON(json, key, (o) -> getObjectFromJSON(o, type), defaultValue); |
} |
public static <T> T getParameterFromJSON(final JSONObject json, final String key, final Function<Object, T> ctor, T defaultValue) { |
if (json == null) { |
throw new IllegalArgumentException("null JSON"); |
} |
155,7 → 174,7 |
if (key == null) { |
throw new IllegalArgumentException("null key"); |
} |
return json.containsKey(key) ? getObjectFromJSON(json.get(key), type) : defaultValue; |
return json.containsKey(key) ? ctor.apply(json.get(key)) : defaultValue; |
} |
public static JSONObject convertStringToJsonObject(final String jsonString) { |
/trunk/OpenConcerto/src/org/openconcerto/utils/io/DataInputStream.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/io/Transferable.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/io/JSONParameter.java |
---|
New file |
0,0 → 1,92 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
* copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific |
* language governing permissions and limitations under the License. |
* |
* When distributing the software, include this License Header Notice in each file. |
*/ |
package org.openconcerto.utils.io; |
import java.util.Objects; |
import java.util.function.Function; |
import net.minidev.json.JSONObject; |
/** |
* Allow to omit default value from JSON. |
* |
* @author sylvain |
* @param <T> type of parameter |
*/ |
public final class JSONParameter<T> { |
private static final Function<Object, Object> DEFAULT_TO_JSON = JSONConverter::getJSON; |
public static <U> JSONParameter<U> createNoDefault(String name, Class<U> clazz) { |
return create(name, clazz, null); |
} |
public static <U> JSONParameter<U> create(String name, Class<U> clazz, U def) { |
return new JSONParameter<U>(name, clazz, DEFAULT_TO_JSON, (o) -> JSONConverter.getObjectFromJSON(o, clazz), def); |
} |
public static <U> JSONParameter<U> createWithFunction(String name, U def, Function<Object, U> fromJSON) { |
return createWithFunction(name, def, DEFAULT_TO_JSON, fromJSON); |
} |
public static <U> JSONParameter<U> createWithFunction(String name, U def, Function<? super U, ?> toJSON, Function<Object, U> fromJSON) { |
return new JSONParameter<U>(name, null, toJSON, fromJSON, def); |
} |
private final String name; |
private final T defaultVal; |
private final Class<T> clazz; |
private final Function<? super T, ?> toJSON; |
private final Function<Object, T> fromJSON; |
protected JSONParameter(String name, Class<T> clazz, Function<? super T, ?> toJSON, Function<Object, T> fromJSON, T defaultVal) { |
super(); |
this.name = Objects.requireNonNull(name); |
this.clazz = clazz; |
this.toJSON = Objects.requireNonNull(toJSON); |
this.fromJSON = Objects.requireNonNull(fromJSON); |
this.defaultVal = defaultVal; |
} |
public final String getName() { |
return this.name; |
} |
public final T getDefaultValue() { |
return this.defaultVal; |
} |
public final Class<T> getValueClass() { |
return this.clazz; |
} |
public final Function<? super T, ?> getToJSON() { |
return this.toJSON; |
} |
public final Function<Object, T> getFromJSON() { |
return this.fromJSON; |
} |
public final JSONObject put(final JSONObject json, T val) { |
if (!Objects.equals(this.getDefaultValue(), val)) { |
json.put(this.getName(), this.getToJSON().apply(val)); |
} |
return json; |
} |
public final T get(final JSONObject json) { |
return JSONConverter.getParameterFromJSON(json, this.getName(), this.getFromJSON(), this.getDefaultValue()); |
} |
} |
/trunk/OpenConcerto/src/org/openconcerto/utils/io/BOMSkipper.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/io/PrintStreamPrinter.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/io/JSONNamed.java |
---|
New file |
0,0 → 1,18 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
* copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific |
* language governing permissions and limitations under the License. |
* |
* When distributing the software, include this License Header Notice in each file. |
*/ |
package org.openconcerto.utils.io; |
public interface JSONNamed { |
public String getJSONName(); |
} |
/trunk/OpenConcerto/src/org/openconcerto/utils/io/Mail.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/io/Printer.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/FileUtils.java |
---|
91,6 → 91,7 |
private static void browse(URI uri, final File f) throws IOException { |
assert (uri == null) != (f == null); |
boolean handled = false; |
IOException exn = null; |
final Desktop.Action action = Desktop.Action.BROWSE; |
if (isDesktopDesirable(action) && Desktop.isDesktopSupported()) { |
final Desktop d = Desktop.getDesktop(); |
120,18 → 121,32 |
} |
} |
} |
try { |
d.browse(uri); |
handled = true; |
} catch (IOException e) { |
// On Ubuntu, we sometimes get spurious errors, so retry |
exn = e; |
} |
} |
} |
if (!handled) { |
try { |
// if the caller passed a file use it instead of our converted URI |
if (f != null) |
openNative(f); |
else |
openNative(uri); |
} catch (IOException | RuntimeException e) { |
if (exn != null) { |
exn.addSuppressed(e); |
throw exn; |
} else { |
throw e; |
} |
} |
} |
} |
public static boolean isDesktopDesirable(Desktop.Action action) { |
// apparently the JRE just checks if gnome libs are available (e.g. open Nautilus in XFCE) |
/trunk/OpenConcerto/src/org/openconcerto/utils/LinkedListMap.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/OrderedSet.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/Zip.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/XMLCalendarFormat.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/function/FirstNonNull.java |
---|
New file |
0,0 → 1,62 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
* copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific |
* language governing permissions and limitations under the License. |
* |
* When distributing the software, include this License Header Notice in each file. |
*/ |
package org.openconcerto.utils.function; |
import org.openconcerto.utils.CollectionUtils; |
import java.util.Collection; |
import java.util.List; |
import java.util.function.Function; |
public class FirstNonNull<T, R> implements Function<T, R> { |
@SuppressWarnings("rawtypes") |
static private final Function EMPTY = (v) -> null; |
@SuppressWarnings("unchecked") |
public static final <T, R> Function<T, R> empty() { |
return EMPTY; |
} |
static public final <T, R> Function<T, R> create(final Collection<? extends Function<? super T, ? extends R>> functions) { |
if (functions.isEmpty()) |
return empty(); |
return new FirstNonNull<>(CollectionUtils.toImmutableList(functions)); |
} |
@SafeVarargs |
static public final <T, R> Function<T, R> create(final Function<? super T, ? extends R>... functions) { |
if (functions.length == 0) |
return empty(); |
return new FirstNonNull<>(CollectionUtils.toImmutableList(functions)); |
} |
private final List<Function<? super T, ? extends R>> functions; |
private FirstNonNull(final List<Function<? super T, ? extends R>> functions) { |
this.functions = functions; |
if (this.functions.contains(null)) |
throw new IllegalArgumentException("Null function : " + this.functions); |
} |
@Override |
public R apply(T t) { |
for (final Function<? super T, ? extends R> f : this.functions) { |
final R res = f.apply(t); |
if (res != null) |
return res; |
} |
return null; |
} |
} |
/trunk/OpenConcerto/src/org/openconcerto/utils/net/HTTPClient.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
13,6 → 13,8 |
package org.openconcerto.utils.net; |
import org.openconcerto.utils.StreamUtils; |
import java.io.IOException; |
import java.io.InputStream; |
import java.io.OutputStream; |
34,12 → 36,20 |
private final int responseCode; |
private final boolean authenticateError; |
protected ServerException(int responseCode, boolean authenticateError) { |
super("Response code was " + responseCode); |
private ServerException(final String message, final int responseCode, final boolean authenticateError) { |
super(message); |
this.responseCode = responseCode; |
this.authenticateError = authenticateError; |
} |
protected ServerException(int responseCode, boolean authenticateError) { |
this("Response code was " + responseCode, responseCode, authenticateError); |
} |
protected ServerException(Response response, String errorBody, boolean authenticateError) { |
this(response.toString() + (errorBody == null ? "" : "\n" + errorBody), response.getCode(), authenticateError); |
} |
public final int getResponseCode() { |
return this.responseCode; |
} |
53,16 → 63,18 |
protected final static Response create(HttpsURLConnection con, final Set<Integer> okCodes) throws IOException { |
final boolean success = okCodes == null ? con.getResponseCode() == 200 : okCodes.contains(con.getResponseCode()); |
return new Response(success, con.getResponseCode(), con.getResponseMessage(), con.getContentEncoding(), con.getContentType()); |
return new Response(con.getURL().toExternalForm(), success, con.getResponseCode(), con.getResponseMessage(), con.getContentEncoding(), con.getContentType()); |
} |
private final String url; |
private final boolean success; |
private final int code; |
private final String message; |
private final String contentEncoding, contentType; |
protected Response(boolean success, int code, String message, String contentEncoding, String contentType) { |
protected Response(final String url, boolean success, int code, String message, String contentEncoding, String contentType) { |
super(); |
this.url = url; |
this.success = success; |
this.code = code; |
this.message = message; |
70,6 → 82,10 |
this.contentType = contentType; |
} |
public final String getURL() { |
return this.url; |
} |
public final int getCode() { |
return this.code; |
} |
89,7 → 105,12 |
public final String getContentType() { |
return this.contentType; |
} |
@Override |
public String toString() { |
return this.getClass().getSimpleName() + (this.isSuccess() ? " SUCCESS (" : " ERROR (") + this.getCode() + ") \"" + this.getMessage() + "\" to " + this.url; |
} |
} |
private final String url; |
private SSLSocketFactory socketFactory; |
100,6 → 121,10 |
this.url = url; |
} |
public final String getURL() { |
return this.url; |
} |
public final SSLSocketFactory getSocketFactory() { |
return this.socketFactory; |
} |
134,8 → 159,13 |
public final Response checkResponseCode(final HttpsURLConnection con, final Set<Integer> okCodes) throws IOException { |
final Response res = Response.create(con, okCodes); |
if (this.throwsException() && !res.isSuccess()) |
throw new ServerException(res.getCode(), con.getHeaderField("WWW-Authenticate") != null); |
if (this.throwsException() && !res.isSuccess()) { |
final String errorBody; |
try (final InputStream errorStream = con.getErrorStream()) { |
errorBody = errorStream == null ? null : new String(StreamUtils.read(errorStream), StandardCharsets.UTF_8); |
} |
throw new ServerException(res, errorBody, con.getHeaderField("WWW-Authenticate") != null); |
} |
return res; |
} |
/trunk/OpenConcerto/src/org/openconcerto/utils/JImageAsynchronous.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/EncryptedClassLoader.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/Base64.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/ThrowableHandler.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/MultipleOutputStream.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/sync/MoveOperationList.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/sync/FileProperty.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/sync/MoveOperation.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/sync/RangeList.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/sync/RecursionType.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/sync/Range.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/sync/StreamUtils.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/sync/RollingChecksum32.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/sync/HashWriter.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/i18n/I18nUtils.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/i18n/MessageArgs.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/i18n/NounClass.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/i18n/Grammar_en.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/i18n/GrammaticalBase.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/i18n/GrammaticalCase.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/i18n/Grammar_fr.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/i18n/Grammar_es.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/i18n/VariantKey.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/i18n/LocalizedInstances.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/i18n/translation/messages_en.properties |
---|
12,6 → 12,8 |
os=Operating system |
javaVersion=Version <b>{0}</b> of {1} |
javaHome=installation directory |
startTime=Start time |
vm.params=Virtual machine parameters |
no.laf=No look and feel |
properties.all=All properties |
env.all=Whole environment |
/trunk/OpenConcerto/src/org/openconcerto/utils/i18n/translation/messages_fr.properties |
---|
12,6 → 12,8 |
os=Système d''exploitation |
javaVersion=Version <b>{0}</b> de {1} |
javaHome=dossier d'installation |
startTime=Heure de lancement |
vm.params=Paramètre de la machine virtuelle |
no.laf=Aucun thème |
properties.all=Toutes les propriétés |
env.all=Tout l'environnement |
/trunk/OpenConcerto/src/org/openconcerto/utils/i18n/TM.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/i18n/Grammar_pl.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/i18n/DefaultVariantKey.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/i18n/DynamicMap.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/i18n/Phrase.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/i18n/Grammar.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/i18n/Translator.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/i18n/TranslationManager.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/i18n/GrammaticalNumber.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/i18n/TranslatorChain.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/PEMImporter.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
13,6 → 13,8 |
package org.openconcerto.utils; |
import static java.util.Base64.getMimeDecoder; |
import java.io.BufferedReader; |
import java.io.ByteArrayInputStream; |
import java.io.File; |
36,7 → 38,6 |
import javax.net.ssl.KeyManagerFactory; |
import javax.net.ssl.SSLContext; |
import javax.net.ssl.SSLServerSocketFactory; |
import javax.xml.bind.DatatypeConverter; |
public class PEMImporter { |
91,7 → 92,7 |
} |
r.close(); |
final String hexString = b.toString(); |
final byte[] bytes = DatatypeConverter.parseBase64Binary(hexString); |
final byte[] bytes = getMimeDecoder().decode(hexString); |
return generatePrivateKeyFromDER(bytes); |
} |
107,7 → 108,7 |
while (s != null) { |
if (s.contains("END CERTIFICATE")) { |
String hexString = b.toString(); |
final byte[] bytes = DatatypeConverter.parseBase64Binary(hexString); |
final byte[] bytes = getMimeDecoder().decode(hexString); |
X509Certificate cert = generateCertificateFromDER(bytes); |
result.add(cert); |
b = new StringBuilder(); |
/trunk/OpenConcerto/src/org/openconcerto/utils/MultiLock.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/MessageDigestUtils.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/cc/IExnClosure.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/cc/AbstractMapDecorator.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/cc/ClosureFuture.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/cc/Factory.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/cc/IPredicate.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/cc/ITransformer.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/cc/CopyOnWriteMap.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/cc/TransformedMap.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/cc/IClosure.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/cc/TruncatableList.java |
---|
New file |
0,0 → 1,87 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
* copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific |
* language governing permissions and limitations under the License. |
* |
* When distributing the software, include this License Header Notice in each file. |
*/ |
package org.openconcerto.utils.cc; |
import java.util.Collections; |
import java.util.List; |
import java.util.Objects; |
public final class TruncatableList<T> { |
@SuppressWarnings("rawtypes") |
private static final TruncatableList EMPTY_LIST = new TruncatableList<>(Collections.emptyList(), false); |
@SuppressWarnings("unchecked") |
public static final <T> TruncatableList<T> empty() { |
return EMPTY_LIST; |
} |
/** |
* Create an instance from the passed list. |
* |
* @param <T> type of items. |
* @param l the list to use. |
* @param maxCount the maximum item count desired, negative meaning no limit. |
* @return a new instance with a view (not a copy) of the passed list. |
*/ |
static public final <T> TruncatableList<T> create(final List<T> l, final int maxCount) { |
final boolean truncated = maxCount >= 0 && l.size() > maxCount; |
return new TruncatableList<T>(truncated ? l.subList(0, maxCount) : l, truncated); |
} |
private final List<T> list; |
private final boolean truncated; |
public TruncatableList(List<T> list, boolean truncated) { |
super(); |
this.list = Objects.requireNonNull(list); |
this.truncated = truncated; |
} |
public final List<T> getList() { |
return this.list; |
} |
public final boolean isTruncated() { |
return this.truncated; |
} |
public final TruncatableList<T> truncate(final int maxCount) { |
if (this.getList().size() <= maxCount) |
return this; |
return new TruncatableList<>(this.getList().subList(0, maxCount), true); |
} |
@Override |
public int hashCode() { |
return Objects.hash(this.list, this.truncated); |
} |
@Override |
public boolean equals(Object obj) { |
if (this == obj) |
return true; |
if (obj == null) |
return false; |
if (getClass() != obj.getClass()) |
return false; |
final TruncatableList<?> other = (TruncatableList<?>) obj; |
return Objects.equals(this.list, other.list) && this.truncated == other.truncated; |
} |
@Override |
public String toString() { |
return this.getClass().getSimpleName() + (this.isTruncated() ? " truncated : " : " not truncated : ") + this.getList(); |
} |
} |
/trunk/OpenConcerto/src/org/openconcerto/utils/cc/TransformedSet.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/cc/MatchedList.java |
---|
New file |
0,0 → 1,80 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
* copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific |
* language governing permissions and limitations under the License. |
* |
* When distributing the software, include this License Header Notice in each file. |
*/ |
package org.openconcerto.utils.cc; |
import org.openconcerto.utils.ExceptionUtils; |
import java.util.BitSet; |
import java.util.Collections; |
import java.util.List; |
import java.util.Objects; |
import java.util.function.Function; |
import net.jcip.annotations.Immutable; |
@Immutable |
public class MatchedList<T> { |
@SuppressWarnings("rawtypes") |
private static final MatchedList EMPTY_LIST = new MatchedList<>(TruncatableList.empty(), null, Collections.emptyList()); |
@SuppressWarnings("unchecked") |
public static final <T> MatchedList<T> empty() { |
return EMPTY_LIST; |
} |
public static final <T> MatchedList<T> createNotFiltered(TruncatableList<T> truncatableItems) { |
return new MatchedList<T>(truncatableItems, null, null); |
} |
public static final <T> MatchedList<T> createFiltered(TruncatableList<T> truncatableItems, Function<? super T, String> asString, List<BitSet> matchedIndexes) { |
return new MatchedList<T>(truncatableItems, Objects.requireNonNull(asString), Objects.requireNonNull(matchedIndexes)); |
} |
// ATTN none of the attributes are copied/immutable |
private final TruncatableList<T> items; |
private final Function<? super T, String> asString; |
private final List<BitSet> matchedIndexes; |
private MatchedList(TruncatableList<T> truncatableItems, Function<? super T, String> asString, List<BitSet> matchedIndexes) { |
this.items = Objects.requireNonNull(truncatableItems); |
this.asString = asString; |
this.matchedIndexes = matchedIndexes; |
if (matchedIndexes != null) |
ExceptionUtils.requireEquals(truncatableItems.getList().size(), matchedIndexes.size(), "Size mismatch"); |
} |
public final TruncatableList<T> getTruncatableList() { |
return this.items; |
} |
public final List<T> getList() { |
return this.getTruncatableList().getList(); |
} |
public final Function<? super T, String> getAsString() { |
return this.asString; |
} |
/** |
* For each item in {@link #getList() the list}, the indexes in the {@link #getAsString() string |
* representation} which matched. |
* |
* @return the matching indexes, can be <code>null</code>. |
*/ |
public final List<BitSet> getMatchedIndexes() { |
return this.matchedIndexes; |
} |
} |
/trunk/OpenConcerto/src/org/openconcerto/utils/cc/Transformer.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/cc/HashingStrategy.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/cc/IdentitySet.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/cc/ITransformerFuture.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/cc/Closure.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/cc/ExnTransformer.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/cc/IFactory.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/cc/IClosureFuture.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/cc/ConstantFactory.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/cc/CustomEquals.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/cc/ITransformerExn.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/cc/ExnClosure.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/cc/TransformerFuture.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/ReflectUtils.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/IFutureTask.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/SleepingQueue.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/RecursionType.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/StreamUtils.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/Tuple3.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/RunnableWithCookies.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/DecimalUtils.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/TimeUtils.java |
---|
18,6 → 18,7 |
import java.time.LocalDate; |
import java.time.LocalDateTime; |
import java.time.ZoneId; |
import java.time.ZonedDateTime; |
import java.util.Arrays; |
import java.util.Calendar; |
import java.util.Collection; |
428,6 → 429,16 |
return finerAmount == finer.convert(coarserAmount, coarser); |
} |
public static ZonedDateTime toZonedDateTime(Calendar cal) { |
if (cal == null) |
return null; |
if (cal instanceof GregorianCalendar) { |
return ((GregorianCalendar) cal).toZonedDateTime(); |
} else { |
return ZonedDateTime.ofInstant(cal.toInstant(), getTZ(cal)); |
} |
} |
public static LocalDateTime toLocalDateTime(Calendar calendar) { |
if (calendar == null) |
return null; |
440,11 → 451,22 |
} |
public static final Calendar toCalendar(final LocalDateTime dt) { |
final Calendar cal = Calendar.getInstance(); |
return setTime(Calendar.getInstance(), dt); |
} |
public static final Calendar setTime(final Calendar cal, final LocalDateTime dt) { |
cal.setTimeInMillis(dt.atZone(getTZ(cal)).toInstant().toEpochMilli()); |
return cal; |
} |
public static final GregorianCalendar toGregorianCalendar(final LocalDateTime dt) { |
return toGregorianCalendar(dt.atZone(ZoneId.systemDefault())); |
} |
public static final GregorianCalendar toGregorianCalendar(final ZonedDateTime dt) { |
return GregorianCalendar.from(dt); |
} |
public static LocalDate toLocalDate(Calendar calendar) { |
if (calendar == null) |
return null; |
/trunk/OpenConcerto/src/org/openconcerto/utils/TinyMap.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/OSFamily.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/SortDirection.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/RTInterruptedException.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/AbstractXMLDateFormat.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/JImage.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/ImageUtils.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/TableModelAdapter.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/CollectionMap2.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/PropertiesUtils.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/ZippedFilesProcessor.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/TableModelSelectionAdapter.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/protocol/jarjar/Handler.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/protocol/Helper.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/Nombre.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/prog/EncConv.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/prog/ModDate.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/prog/CorrectFNameEncoding.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/prog/RemoteDebugArgs.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/prog/VMLauncher.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/prog/CorrectPathEncoding.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/prog/SVNUtils.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/Pair.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/PrefType.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/LogUtils.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/ColorFactory.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/XMLDateFormat.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/CollectionMap2Itf.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/cache/ICache.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/cache/CacheWatcher.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/cache/CacheItem.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/cache/CacheResult.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/cache/Memoizer.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/cache/CacheWatcherFactory.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/cache/CacheTimeOut.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/EnumOrderedSet.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/ui/StringWithId.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/ImageInfo.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/ThreadFactory.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/FeatureMode.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/StringInputStream.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/Matrix.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/StringCodec.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/Backup.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/change/CollectionChangeEvent.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/change/CollectionChangeEventCreator.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/change/ConstructorCreator.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/change/IListDataEvent.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/change/AddAllCreator.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/change/ListChange.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/ArrayComparator.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/GestionDevise.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/ClassPathLoader.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/OSXAdapter.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/Tuple2.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/RunnableQueue.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/Screenshot.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/DropperQueue.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/ClipboardUtils.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/Log.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/html/HTMLLink.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/html/HTMLFile.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/html/RawContent.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/html/Site.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/html/HTMLTitle.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/html/HTMLDiv.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/html/HTMLParagraph.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/html/HTMLManipulatorFrame.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/html/Page.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/html/HTMLElement.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/html/HTMLContent.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/StringUtils.java |
---|
57,7 → 57,36 |
final protected static char[] hexArray = "0123456789ABCDEF".toCharArray(); |
static public final String describe(Object o) { |
return o + (o == null ? "" : "(" + o.getClass() + ")"); |
} |
/** |
* Remove invalid character for PDF Font (Helvetica ...) |
* |
* @param s string to clean |
* @return cleaned string |
*/ |
public static String cleanPDFString(String s) { |
final StringBuilder b = new StringBuilder(s.length()); |
for (char c : s.toCharArray()) { |
if (Character.isLetterOrDigit(c)) { |
b.append(c); |
} else if (c == 'é' || c == 'è' || c == 'ê' || c == 'â' || c == 'à' || c == 'î' || c == 'ù' || c == 'û' || c == 'ô' || c == 'ç') { |
b.append(c); |
} else if (c >= 32 && c < 127) { |
b.append(c); |
} else { |
b.append(' '); |
} |
} |
return b.toString(); |
} |
/** |
* Retourne la chaine avec la première lettre en majuscule et le reste en minuscule. |
* |
* @param s la chaîne à transformer. |
841,6 → 870,14 |
return null; |
} |
public static final String nullIfEmpty(final String s) { |
return nullIfEmpty(s, false); |
} |
public static final String nullIfEmpty(final String s, final boolean trim) { |
return isEmpty(s, trim) ? null : s; |
} |
public static String toAsciiString(String str) { |
if (str == null) { |
return null; |
1028,4 → 1065,26 |
static public final String normalizeForSearch(final String s) { |
return normalizeCase(removeDiacritical(normalizeBlanks(s))); |
} |
static public final String escapeHTML(String html) { |
final int length = html.length(); |
final StringBuilder b = new StringBuilder(length * 2); |
for (int i = 0; i < length; i++) { |
final char c = html.charAt(i); |
if (c == '&') { |
b.append("&"); |
} else if (c == '\"') { |
b.append("""); |
} else if (c == '<') { |
b.append("<"); |
} else if (c == '>') { |
b.append(">"); |
} |
b.append(c); |
} |
return b.toString(); |
} |
} |
/trunk/OpenConcerto/src/org/openconcerto/utils/IScheduledFutureTask.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/Windows.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/FillMode.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/ListAbstractMap.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/AutoLayouter.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/DragUtils.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
/trunk/OpenConcerto/src/org/openconcerto/utils/SystemInfo.java |
---|
20,10 → 20,17 |
import org.openconcerto.utils.i18n.TM; |
import java.io.File; |
import java.lang.management.ManagementFactory; |
import java.lang.management.RuntimeMXBean; |
import java.net.InterfaceAddress; |
import java.net.NetworkInterface; |
import java.net.URI; |
import java.net.URISyntaxException; |
import java.time.Instant; |
import java.time.ZoneId; |
import java.time.ZonedDateTime; |
import java.time.format.DateTimeFormatter; |
import java.time.format.FormatStyle; |
import java.util.ArrayList; |
import java.util.Enumeration; |
import java.util.Formatter; |
49,6 → 56,7 |
public static final String CLASS_PROTOCOL = "class"; |
public static final String PROPS_PROTOCOL = "props"; |
public static final String ENV_PROTOCOL = "env"; |
private static final DateTimeFormatter DATETIME_FMT = DateTimeFormatter.ofLocalizedDateTime(FormatStyle.LONG); |
static public NavigableMap<Info, String> get(final boolean html, final Locale locale) { |
final TM tm = TM.getInstance(locale); |
70,8 → 78,14 |
} |
final Runtime rt = Runtime.getRuntime(); |
final long totalMemory = rt.totalMemory(); |
final RuntimeMXBean rtBean = ManagementFactory.getRuntimeMXBean(); |
final Instant startTime = Instant.ofEpochMilli(rtBean.getStartTime()); |
final String startTimeDesc = DATETIME_FMT.withLocale(locale).format(ZonedDateTime.ofInstant(startTime, ZoneId.systemDefault())); |
final String rtDesc = "<i>" + tm.translate("startTime") + " :</i> " + startTimeDesc + lineBreak + "<i>" + tm.translate("vm.params") + " :</i> " + rtBean.getInputArguments(); |
final String stats = "<i>" + tm.translate("memory.used") + " :</i> " + formatBytes(tm, totalMemory - rt.freeMemory()) + " / " + formatBytes(tm, totalMemory) + " ; " |
+ tm.translate("processors", rt.availableProcessors()); |
+ tm.translate("processors", rt.availableProcessors()) + lineBreak + rtDesc; |
final String lafDesc = lookAndFeel == null ? tm.translate("no.laf") : getLink(lookAndFeel.getName(), lafURI, html) + ", " + lookAndFeel.getDescription(); |
URI propsURI = null; |
URI envURI = null; |
/trunk/OpenConcerto/src/org/openconcerto/erp/gs1/GS1Util.java |
---|
13,30 → 13,10 |
package org.openconcerto.erp.gs1; |
import org.openconcerto.erp.core.sales.pos.io.Barcode; |
public class GS1Util { |
// ISO/IEC 15424 symbology identifiers |
// ]E0 : EAN-13, UPC-A, or UPC-E : 13 digits |
// ]E1 : Two-digit add-on symbol : 2 digits |
// ]E2 : Five-digit add-on symbol : 5 digits |
// ]E3 : EAN-13, UPC-A, or UPC-E with add-on symbol : 15 or 18 digits |
// ]E4 : EAN-8 : 8 digits |
// ]I1 : ITF-14 : 14 digits |
// ]C1 : GS1-128 : Standard AI element strings |
private static final String GS1_128_SCANNER_PREFIX = "]C1"; |
// ]e0 : GS1 DataBar : Standard AI element strings |
private static final String GS1_DATABAR_SCANNER_PREFIX = "]e0"; |
// ]e1 : GS1 Composite : Data packet containing the data + an encoded symbol separator |
// character. |
// ]e2 : GS1 Composite : Data packet containing the data following an escape mechanism |
// character. |
// ]d2 : GS1 DataMatrix : Standard AI element strings |
private static final String GS1_DATAMATRIX_SCANNER_PREFIX = "]d2"; |
private static final String GS1_DATAMATRIX_SCANNER_PREFIX_2 = "]D2"; |
// ]Q3 : GS1 QR Code : Standard AI element strings |
private static final String GS1_QRCODE_SCANNER_PREFIX = "]Q3"; |
// ]J1 : GS1 DotCode : Standard AI element strings |
static final int ERROR_CODE_INVALID_GS1_SCAN = 0; |
static final int ERROR_CODE_UNKNOWN_AI = 1; |
static final int ERROR_CODE_INCOMPLETE_AI = 2; |
61,15 → 41,8 |
this.separator = separator; |
} |
public GS1AIElements parseFromScanner(String scan) throws GS1ParseException { |
if (scan.startsWith(GS1_DATAMATRIX_SCANNER_PREFIX) || scan.startsWith(GS1_DATAMATRIX_SCANNER_PREFIX_2) || scan.startsWith(GS1_128_SCANNER_PREFIX) || scan.startsWith(GS1_DATABAR_SCANNER_PREFIX) |
|| scan.startsWith(GS1_QRCODE_SCANNER_PREFIX)) { |
return parse(scan.substring(3)); |
} |
return parse(scan); |
} |
public GS1AIElements parse(String barcode) throws GS1ParseException { |
public GS1AIElements parse(Barcode code) throws GS1ParseException { |
String barcode = code.getData(); |
if (barcode.length() < 3) { |
throw new GS1ParseException("", ERROR_CODE_INVALID_GS1_SCAN, "code too short"); |
} |
86,7 → 59,7 |
if (aiLength < 4) |
ai.append(barcode.charAt(i)); |
else |
throw new GS1ParseException(ai.toString(), ERROR_CODE_UNKNOWN_AI, "Unknown AI"); |
throw new GS1ParseException(ai.toString(), ERROR_CODE_UNKNOWN_AI, "Unknown AI in " + barcode); |
} else { |
int decimalPoint = 0; |
if (aii.decimalPoint) { |
215,7 → 188,7 |
System.out.println("GS1Util.main()" + (char) p.separator); |
String barcode = "0104607018700852111806051718062910180605_211"; |
// barcode = "01088888931021461712031510W1040190"; |
GS1AIElements values = p.parse(barcode); |
GS1AIElements values = p.parse(new Barcode(barcode)); |
values.dump(System.out); |
values.put("391", "kookkk"); |
235,7 → 208,7 |
System.err.println("GS1Util.main() GS128 from barcode reader"); |
String gs1128 = "]C10207612345678900152012153745646578"; |
GS1Util p2 = new GS1Util(); |
values = p2.parseFromScanner(gs1128); |
values = p2.parse(new Barcode(gs1128)); |
values.dump(System.out); |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/panel/compta/ImportFEC.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
52,7 → 52,8 |
try (BufferedReader bReader = new BufferedReader(new InputStreamReader(new FileInputStream(file), Charset.forName("Cp1252")))) { |
String line = bReader.readLine(); |
final List<String> headers = StringUtils.fastSplit(line, ExportFEC.ZONE_SEPARATOR); |
for (int i = 0; i < headers.size(); i++) { |
for (int i = 0; i < headers.size() && i < ExportFEC.COLS.size(); i++) { |
String c1 = headers.get(i); |
String c2 = ExportFEC.COLS.get(i); |
// Typo chez les stars de Ciel : MontantDevise au lieu de Montantdevise |
66,17 → 67,19 |
final List<String> parts = fastSplit(line, ExportFEC.ZONE_SEPARATOR); |
final String journalCode = parts.get(0).trim(); |
final String journalLib = parts.get(1).trim(); |
// final String ecritureNum = parts.get(2).trim(); |
final String ecritureNum = parts.get(2).trim(); |
final Date ecritureDate = parseDate(parts.get(3).trim()); |
final String compteNum = parts.get(4).trim(); |
final String compteLib = parts.get(5).trim(); |
// final String compAuxNum = parts.get(6).trim(); |
// final String compAuxLib = parts.get(7).trim(); |
String mvtKey = ecritureNum + "-" + journalCode; |
String pieceRef = parts.get(8).trim(); |
// final String pieceDate = parts.get(9).trim(); |
final String ecritureLib = parts.get(10).trim(); |
final BigDecimal debit = new BigDecimal(parts.get(11).replace(',', '.')); |
final BigDecimal credit = new BigDecimal(parts.get(12).replace(',', '.')); |
final BigDecimal debit = new BigDecimal(parts.get(11).replace(" ", "").replace(',', '.')); |
final BigDecimal credit = new BigDecimal(parts.get(12).replace(" ", "").replace(',', '.')); |
final String ecritureLet = parts.get(13).trim(); |
final Date dateLet = parseDate(parts.get(14).trim()); |
final Date validDate = parseDate(parts.get(15).trim()); |
84,15 → 87,15 |
// final String idevise = parts.get(17).trim(); |
if (pieceRef.isEmpty()) { |
pieceRef = "Import"; |
pieceRef = mvtKey; |
} |
Piece p = this.mapPiece.get(pieceRef); |
Piece p = this.mapPiece.get(mvtKey); |
Mouvement mouvement; |
if (p == null) { |
p = new Piece(pieceRef); |
mouvement = new Mouvement(); |
p.add(mouvement); |
this.mapPiece.put(pieceRef, p); |
this.mapPiece.put(mvtKey, p); |
} else { |
mouvement = p.getMouvements().get(0); |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/model/MouseSheetXmlListeListener.java |
---|
15,6 → 15,7 |
import org.openconcerto.erp.config.ComptaPropsConfiguration; |
import org.openconcerto.erp.core.common.ui.PreviewFrame; |
import org.openconcerto.erp.core.customerrelationship.mail.EmailCreator; |
import org.openconcerto.erp.core.customerrelationship.mail.EmailTemplate; |
import org.openconcerto.erp.core.customerrelationship.mail.ValueListener; |
import org.openconcerto.erp.generationDoc.AbstractSheetXml; |
36,6 → 37,7 |
import org.openconcerto.utils.Action; |
import org.openconcerto.utils.ExceptionHandler; |
import org.openconcerto.utils.ListMap; |
import org.openconcerto.utils.Tuple2; |
import org.openconcerto.utils.i18n.Grammar; |
import org.openconcerto.utils.i18n.TranslationManager; |
142,7 → 144,7 |
final Thread t = new Thread() { |
@Override |
public void run() { |
ListMap<String, File> mailFilesMap = new ListMap<>(); |
ListMap<String, Tuple2<SQLRow, File>> mailFilesMap = new ListMap<>(); |
for (AbstractSheetXml sheet : sheets) { |
String mail = ""; |
final SQLRow row = sheet.getSQLRow(); |
231,9 → 233,9 |
} |
try { |
if (readOnly) { |
mailFilesMap.add(mail, sheet.getOrCreatePDFDocumentFile(true).getAbsoluteFile()); |
mailFilesMap.add(mail, Tuple2.create(row, sheet.getOrCreatePDFDocumentFile(true).getAbsoluteFile())); |
} else { |
mailFilesMap.add(mail, sheet.getOrCreateDocumentFile().getAbsoluteFile()); |
mailFilesMap.add(mail, Tuple2.create(row, sheet.getOrCreateDocumentFile().getAbsoluteFile())); |
} |
} catch (Exception e) { |
243,7 → 245,7 |
for (final String mailDest : mailFilesMap.keySet()) { |
final List<File> files = mailFilesMap.get(mailDest); |
final List<Tuple2<SQLRow, File>> tuples = mailFilesMap.get(mailDest); |
SwingUtilities.invokeLater(new Runnable() { |
255,11 → 257,13 |
subject = template.getTitle() + " " + sheets.get(0).getReference().trim(); |
} |
subject = subject.trim(); |
if (subject.isEmpty()) { |
final StringJoiner joiner = new StringJoiner(", "); |
for (File f : files) { |
joiner.add(f.getName()); |
List<File> files = new ArrayList<>(); |
for (Tuple2<SQLRow, File> f : tuples) { |
joiner.add(f.get1().getName()); |
files.add(f.get1()); |
} |
if (subject.isEmpty()) { |
subject = joiner.toString(); |
} |
String message = getMailObject(sheets.get(0).getSQLRow()); |
270,6 → 274,15 |
message += template.getText(); |
} |
} |
if (template != null) { |
List<SQLRow> rows = new ArrayList<>(); |
for (Tuple2<SQLRow, File> f : tuples) { |
rows.add(f.get0()); |
} |
EmailCreator creator = new EmailCreator(template, rows, joiner.toString()); |
subject = creator.getObject(); |
message = creator.getValue(); |
} |
EmailComposer.getInstance().compose(mailDest, subject, message, files.toArray(new File[files.size()])); |
} catch (Exception e) { |
ExceptionHandler.handle("Impossible d'envoyer le courriel!", e); |
328,7 → 341,7 |
@Override |
public void run(Object source) { |
EmailTemplate.askTemplate(IListe.get(ev), table.getDBRoot(), new ValueListener() { |
EmailTemplate.askTemplate(IListe.get(ev), table.getDBRoot(), table.getName(), new ValueListener() { |
@Override |
public void valueSelected(Object value) { |
610,7 → 623,7 |
rows.add(table.getRow(r.getID())); |
} |
EmailTemplate.askTemplate(IListe.get(ev), table.getDBRoot(), new ValueListener() { |
EmailTemplate.askTemplate(IListe.get(ev), table.getDBRoot(), table.getName(), new ValueListener() { |
@Override |
public void valueSelected(Object value) { |
/trunk/OpenConcerto/src/org/openconcerto/erp/model/FichePayeModel.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
902,6 → 902,9 |
if (rowSource.getBoolean("CSG_REDUIT")) { |
this.salBrutCSGReduite = this.salBrutCSGReduite.subtract(montant); |
} |
if (rowSource.getBoolean("PART_CSG_SANS_ABATTEMENT")) { |
this.csgSansAbattement = this.csgSansAbattement.subtract(montant); |
} |
} // Gain |
else { |
925,7 → 928,10 |
if (rowSource.getBoolean("CSG_REDUIT")) { |
this.salBrutCSGReduite = this.salBrutCSGReduite.add(montant); |
} |
if (rowSource.getBoolean("PART_CSG_SANS_ABATTEMENT")) { |
this.csgSansAbattement = this.csgSansAbattement.add(montant); |
} |
} |
// Mis a jour du salaire brut |
// updateValueFiche(); |
948,7 → 954,10 |
if (rowSource.getBoolean("CSG_REDUIT")) { |
this.salBrutCSGReduite = this.salBrutCSGReduite.subtract(ded); |
} |
if (rowSource.getBoolean("PART_CSG_SANS_ABATTEMENT")) { |
this.csgSansAbattement = this.csgSansAbattement.subtract(ded); |
} |
} |
BigDecimal add = rowVals.getBigDecimal("MONTANT_SAL_AJ"); |
if (add != null) { |
this.salBrut = this.salBrut.add(add); |
970,10 → 979,13 |
if (rowSource.getBoolean("CSG_REDUIT")) { |
this.salBrutCSGReduite = this.salBrutCSGReduite.add(add); |
} |
if (rowSource.getBoolean("PART_CSG_SANS_ABATTEMENT")) { |
this.csgSansAbattement = this.csgSansAbattement.add(add); |
} |
} |
} |
} |
} |
private void calculNet(SQLRow rowSource, SQLRowValues rowVals) { |
/trunk/OpenConcerto/src/org/openconcerto/erp/graph/MargeDataModel.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
43,12 → 43,12 |
final SQLElementDirectory directory = Configuration.getInstance().getDirectory(); |
SQLTable tableSaisieVenteF = directory.getElement("SAISIE_VENTE_FACTURE").getTable(); |
SQLTable tableSaisieVenteFElt = directory.getElement("SAISIE_VENTE_FACTURE_ELEMENT").getTable(); |
final SQLSelect sel = new SQLSelect(tableSaisieVenteF.getBase()); |
final SQLSelect sel = new SQLSelect(); |
sel.addSelect(tableSaisieVenteFElt.getField("T_PA_HT"), "SUM"); |
sel.addSelect(tableSaisieVenteFElt.getField("T_PV_HT"), "SUM"); |
final Where w = new Where(tableSaisieVenteF.getField("DATE"), d1, d2); |
final Where w2 = new Where(tableSaisieVenteFElt.getField("ID_SAISIE_VENTE_FACTURE"), "=", tableSaisieVenteF.getKey()); |
sel.setWhere(w.and(w2)); |
sel.setWhere(w.and(w2).and(new Where(tableSaisieVenteFElt.getField("NIVEAU"), "=", 1))); |
BigDecimal total = BigDecimal.ZERO; |
Object[] o = tableSaisieVenteF.getBase().getDataSource().executeA1(sel.asString()); |
61,11 → 61,11 |
} |
final long value = total.longValue(); |
if (value > chart.getHigherRange().longValue()) { |
final List<AxisLabel> labels = chart.getLeftAxis().getLabels(); |
if (value > this.chart.getHigherRange().longValue()) { |
final List<AxisLabel> labels = this.chart.getLeftAxis().getLabels(); |
labels.get(2).setLabel(total.setScale(0, RoundingMode.HALF_UP).toString() + " €"); |
labels.get(1).setLabel(total.divide(new BigDecimal(2), DecimalUtils.HIGH_PRECISION).setScale(0, RoundingMode.HALF_UP) + " €"); |
chart.setHigherRange(value); |
this.chart.setHigherRange(value); |
} |
return value; |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/importer/DataImporter.java |
---|
410,7 → 410,17 |
for (int i = 0; i < rowCount; i++) { |
// Recherche d'existant |
SQLRowValues existingRow = findMatchingRow(model, converters, i, cache); |
updateOrInsert(model, converters, i, existingRow); |
} |
} |
protected SQLRowValues findMatchingRow(ArrayTableModel model, final ValueConverter[] converters, int i, Map<SQLField, Map<Object, SQLRowValues>> cache) { |
SQLRowValues existingRow = null; |
if (existingRow == null) { |
for (SQLField field : this.uniqueField) { |
List<Integer> cols = this.fieldMap.get(field); |
Object objectToInsert = null; |
429,10 → 439,8 |
break; |
} |
} |
updateOrInsert(model, converters, i, existingRow); |
} |
return existingRow; |
} |
private void updateOrInsert(ArrayTableModel model, final ValueConverter[] converters, int i, SQLRowValues existingRow) { |
/trunk/OpenConcerto/src/org/openconcerto/erp/importer/RowValuesNavigatorPanel.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
14,6 → 14,7 |
package org.openconcerto.erp.importer; |
import org.openconcerto.sql.model.SQLRowValues; |
import org.openconcerto.sql.model.SQLRowValuesCluster.StoreMode; |
import org.openconcerto.ui.DefaultGridBagConstraints; |
import java.awt.Dimension; |
104,11 → 105,11 |
c = 0; |
try { |
for (SQLRowValues row : insertList) { |
row.insert(); |
row.getGraph().store(StoreMode.INSERT, false); |
updateBar(); |
} |
for (SQLRowValues row : updateList) { |
row.update(); |
row.getGraph().store(StoreMode.COMMIT, false); |
updateBar(); |
} |
doAfterImport(); |
/trunk/OpenConcerto/src/org/openconcerto/erp/preferences/UIPreferencePanel.java |
---|
79,11 → 79,21 |
c.gridy++; |
c.gridx = 0; |
this.add(new JLabel("High DPI"), c); |
this.comboDPI = new JComboBox(new String[] { "Désactivé", "x1.3", "x2", "x3", "x4" }); |
this.comboDPI = new JComboBox(new String[] { "Désactivé", "x1.15", "x1.3", "x2", "x3", "x4" }); |
String dpi = this.properties.getProperty(UI_DPI); |
if (dpi != null && !dpi.equals("1")) { |
comboDPI.setSelectedIndex(Float.valueOf(dpi).intValue()); |
if (dpi.equalsIgnoreCase("1.15")) { |
comboDPI.setSelectedIndex(1); |
} else if (dpi.equalsIgnoreCase("1.3")) { |
comboDPI.setSelectedIndex(2); |
} else if (dpi.equalsIgnoreCase("2")) { |
comboDPI.setSelectedIndex(3); |
} else if (dpi.equalsIgnoreCase("3")) { |
comboDPI.setSelectedIndex(4); |
} else if (dpi.equalsIgnoreCase("4")) { |
comboDPI.setSelectedIndex(5); |
} |
} |
c.gridx++; |
this.add(comboDPI, c); |
222,12 → 232,14 |
} |
if (this.comboDPI.getSelectedIndex() == 1) { |
properties.setProperty(UI_DPI, "1.15"); |
} else if (this.comboDPI.getSelectedIndex() == 2) { |
properties.setProperty(UI_DPI, "1.3"); |
} else if (this.comboDPI.getSelectedIndex() == 2) { |
} else if (this.comboDPI.getSelectedIndex() == 3) { |
properties.setProperty(UI_DPI, "2"); |
} else if (this.comboDPI.getSelectedIndex() == 3) { |
} else if (this.comboDPI.getSelectedIndex() == 4) { |
properties.setProperty(UI_DPI, "3"); |
} else if (this.comboDPI.getSelectedIndex() == 4) { |
} else if (this.comboDPI.getSelectedIndex() == 5) { |
properties.setProperty(UI_DPI, "4"); |
} else { |
properties.setProperty(UI_DPI, "1"); |
/trunk/OpenConcerto/src/org/openconcerto/erp/preferences/GestionPieceCommercialePanel.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
13,6 → 13,7 |
package org.openconcerto.erp.preferences; |
import org.openconcerto.erp.generationEcritures.GenerationMvtSaisieVenteFacture; |
import org.openconcerto.ui.DefaultGridBagConstraints; |
import org.openconcerto.ui.preferences.DefaultPreferencePanel; |
import org.openconcerto.ui.preferences.DefaultProps; |
25,7 → 26,7 |
public class GestionPieceCommercialePanel extends DefaultPreferencePanel { |
public static final String SHOW_MOUVEMENT_NUMBER = "ShowMouvementNumber"; |
private final JCheckBox checkMvtPieceShow; |
private final JCheckBox checkMvtPieceShow, checkAccountingInvoiceDisable; |
public GestionPieceCommercialePanel() { |
super(); |
36,9 → 37,10 |
c.weighty = 1; |
this.checkMvtPieceShow = new JCheckBox("Afficher le numéro de mouvement lors de la création d'une pièce commerciale"); |
this.checkAccountingInvoiceDisable = new JCheckBox("Désactiver la génération automatique d'écriture des factures"); |
this.add(this.checkMvtPieceShow, c); |
c.gridy++; |
this.add(this.checkAccountingInvoiceDisable, c); |
setValues(); |
} |
48,6 → 50,8 |
final DefaultProps props = DefaultNXProps.getInstance(); |
props.setProperty(SHOW_MOUVEMENT_NUMBER, String.valueOf(this.checkMvtPieceShow.isSelected())); |
props.setProperty(GenerationMvtSaisieVenteFacture.NOT_GEN_ECRITURE, String.valueOf(this.checkAccountingInvoiceDisable.isSelected())); |
props.store(); |
} |
54,6 → 58,7 |
@Override |
public void restoreToDefaults() { |
this.checkMvtPieceShow.setSelected(false); |
this.checkAccountingInvoiceDisable.setSelected(false); |
} |
@Override |
67,6 → 72,10 |
final String showMvt = props.getStringProperty(SHOW_MOUVEMENT_NUMBER); |
final Boolean bShowMvt = Boolean.valueOf(showMvt); |
this.checkMvtPieceShow.setSelected(bShowMvt == null || bShowMvt.booleanValue()); |
final String d = props.getStringProperty(GenerationMvtSaisieVenteFacture.NOT_GEN_ECRITURE); |
final Boolean bD = Boolean.valueOf(d); |
this.checkAccountingInvoiceDisable.setSelected(bD == null || bD.booleanValue()); |
} |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/preferences/TemplateNXProps.java |
---|
17,7 → 17,10 |
import org.openconcerto.erp.core.customerrelationship.customer.report.FicheClientXmlSheet; |
import org.openconcerto.erp.core.edm.AttachmentSQLElement; |
import org.openconcerto.erp.core.finance.accounting.report.BalanceSheet; |
import org.openconcerto.erp.core.finance.accounting.report.GrandLivreSheetXML; |
import org.openconcerto.erp.core.finance.accounting.report.JournauxSheetXML; |
import org.openconcerto.erp.core.finance.accounting.report.RepartitionAnalytiqueSheetXML; |
import org.openconcerto.erp.core.finance.accounting.report.VentilationAnalytiqueSheetXML; |
import org.openconcerto.erp.core.humanresources.payroll.report.EtatChargesPayeSheet; |
import org.openconcerto.erp.core.humanresources.payroll.report.FichePayeSheetXML; |
import org.openconcerto.erp.core.humanresources.payroll.report.LivrePayeSheet; |
151,6 → 154,9 |
register(ListeVenteXmlSheet.TEMPLATE_ID, ListeVenteXmlSheet.TEMPLATE_PROPERTY_NAME, null); |
register(BalanceSheet.TEMPLATE_ID, BalanceSheet.TEMPLATE_PROPERTY_NAME, BalanceSheet.TEMPLATE_ID); |
register(JournauxSheetXML.TEMPLATE_ID, JournauxSheetXML.TEMPLATE_PROPERTY_NAME, JournauxSheetXML.TEMPLATE_ID); |
register(GrandLivreSheetXML.TEMPLATE_ID, GrandLivreSheetXML.TEMPLATE_PROPERTY_NAME, GrandLivreSheetXML.TEMPLATE_ID); |
register(VentilationAnalytiqueSheetXML.TEMPLATE_ID, VentilationAnalytiqueSheetXML.TEMPLATE_PROPERTY_NAME, VentilationAnalytiqueSheetXML.TEMPLATE_ID); |
register(RepartitionAnalytiqueSheetXML.TEMPLATE_ID, RepartitionAnalytiqueSheetXML.TEMPLATE_PROPERTY_NAME, RepartitionAnalytiqueSheetXML.TEMPLATE_ID); |
register(EtatChargesPayeSheet.TEMPLATE_ID, EtatChargesPayeSheet.TEMPLATE_PROPERTY_NAME, "Etat des charges"); |
register(FichePayeSheetXML.TEMPLATE_ID, FichePayeSheetXML.TEMPLATE_PROPERTY_NAME, "Fiche paye"); |
register(LivrePayeSheet.TEMPLATE_ID, LivrePayeSheet.TEMPLATE_PROPERTY_NAME, "Livre paye"); |
/trunk/OpenConcerto/src/org/openconcerto/erp/preferences/GestionCommercialeGlobalPreferencePanel.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
24,7 → 24,9 |
import org.openconcerto.ui.preferences.PrefView; |
import org.openconcerto.utils.PrefType; |
import javax.swing.ButtonGroup; |
import java.awt.event.ItemEvent; |
import java.awt.event.ItemListener; |
import javax.swing.JCheckBox; |
public class GestionCommercialeGlobalPreferencePanel extends JavaPrefPreferencePanel { |
44,6 → 46,11 |
public static String IMPUT_ECART = "ImputEcart"; |
public static String FRAIS_DOCUMENT = "GestionFraisDocuments"; |
public static String COMPTE_CLIENT_AUTO = "CompteClientAuto"; |
public static String FACTURE_PREVISIONNELLE = "FacturePrevisionnelle"; |
public static String TRANSFERT_AUTOMATIQUE = "Tr_Automatique"; |
public static final String POURCENT_RG = "PourcentRG"; |
public static final String DEVIS_VALIDITE_JOURS = "DevisValiditeJours"; |
public static final String ECRITURE_FACTURE_REF_LIBELLE = "RefFactureEcritureLibelle"; |
public GestionCommercialeGlobalPreferencePanel() { |
super("Gestion des pièces commerciales", null); |
72,6 → 79,10 |
orderPackaging.setDefaultValue(Boolean.TRUE); |
this.addView(orderPackaging); |
PrefView<Boolean> orderPackagingTrAuto = new PrefView<Boolean>(PrefType.BOOLEAN_TYPE, "Activer les options de transferts automatique", TRANSFERT_AUTOMATIQUE); |
orderPackagingTrAuto.setDefaultValue(Boolean.FALSE); |
this.addView(orderPackagingTrAuto); |
PrefView<Boolean> orderQuoting = new PrefView<Boolean>(PrefType.BOOLEAN_TYPE, "Gérer le chiffrage détaillés des commandes clients", CHIFFRAGE_COMMANDE_CLIENT); |
orderQuoting.setDefaultValue(Boolean.FALSE); |
this.addView(orderQuoting); |
84,6 → 95,10 |
viewAcompteDevis.setDefaultValue(Boolean.FALSE); |
this.addView(viewAcompteDevis); |
PrefView<Boolean> viewPrev = new PrefView<Boolean>(PrefType.BOOLEAN_TYPE, "Activer la gestion des factures prévisionnelles", FACTURE_PREVISIONNELLE); |
viewPrev.setDefaultValue(Boolean.FALSE); |
this.addView(viewPrev); |
PrefView<Boolean> addressSpec = new PrefView<Boolean>(PrefType.BOOLEAN_TYPE, "Afficher les sélecteurs d'adresse spécifique", ADDRESS_SPEC); |
addressSpec.setDefaultValue(Boolean.TRUE); |
this.addView(addressSpec); |
124,10 → 139,51 |
createEcrImput.setDefaultValue(Boolean.TRUE); |
this.addView(createEcrImput); |
ButtonGroup group = new ButtonGroup(); |
group.add((JCheckBox) viewMultiTransfert.getVW().getComp()); |
group.add((JCheckBox) viewTransfert.getVW().getComp()); |
group.add((JCheckBox) viewNo.getVW().getComp()); |
final PrefView<Boolean> rg = new PrefView<>(PrefType.BOOLEAN_TYPE, "Activer la gestion des pourcentages de retenue de garantie", POURCENT_RG); |
rg.setDefaultValue(Boolean.FALSE); |
this.addView(rg); |
final PrefView<Integer> devisJours = new PrefView<>(PrefType.INT_TYPE, "Nombre de jours de validité des devis", DEVIS_VALIDITE_JOURS); |
devisJours.setDefaultValue(30); |
this.addView(devisJours); |
final PrefView<Boolean> refEcriture = new PrefView<>(PrefType.BOOLEAN_TYPE, "Inclure la référence des factures clients dans le libellé des écritures.", ECRITURE_FACTURE_REF_LIBELLE); |
refEcriture.setDefaultValue(Boolean.FALSE); |
this.addView(refEcriture); |
final JCheckBox boxMulti = (JCheckBox) viewMultiTransfert.getVW().getComp(); |
final JCheckBox boxTR = (JCheckBox) viewTransfert.getVW().getComp(); |
final JCheckBox boxNoTR = (JCheckBox) viewNo.getVW().getComp(); |
boxNoTR.addItemListener(new ItemListener() { |
@Override |
public void itemStateChanged(ItemEvent e) { |
if (boxNoTR.isSelected()) { |
boxMulti.setSelected(false); |
boxTR.setSelected(false); |
} |
} |
}); |
boxMulti.addItemListener(new ItemListener() { |
@Override |
public void itemStateChanged(ItemEvent e) { |
if (boxMulti.isSelected()) { |
boxNoTR.setSelected(false); |
} |
} |
}); |
boxTR.addItemListener(new ItemListener() { |
@Override |
public void itemStateChanged(ItemEvent e) { |
if (boxTR.isSelected()) { |
boxNoTR.setSelected(false); |
} |
} |
}); |
} |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/preferences/GenerationDocumentComptaPreferencePanel.java |
---|
14,7 → 14,10 |
package org.openconcerto.erp.preferences; |
import org.openconcerto.erp.core.finance.accounting.report.BalanceSheet; |
import org.openconcerto.erp.core.finance.accounting.report.GrandLivreSheetXML; |
import org.openconcerto.erp.core.finance.accounting.report.JournauxSheetXML; |
import org.openconcerto.erp.core.finance.accounting.report.RepartitionAnalytiqueSheetXML; |
import org.openconcerto.erp.core.finance.accounting.report.VentilationAnalytiqueSheetXML; |
import org.openconcerto.utils.Tuple2; |
public class GenerationDocumentComptaPreferencePanel extends AbstractGenerationDocumentPreferencePanel { |
21,8 → 24,11 |
public GenerationDocumentComptaPreferencePanel() { |
super(); |
this.mapKeyLabel.put(Tuple2.create(BalanceSheet.TEMPLATE_ID, BalanceSheet.TEMPLATE_PROPERTY_NAME), BalanceSheet.TEMPLATE_ID); |
this.mapKeyLabel.put(Tuple2.create(GrandLivreSheetXML.TEMPLATE_ID, GrandLivreSheetXML.TEMPLATE_PROPERTY_NAME), GrandLivreSheetXML.TEMPLATE_ID); |
this.mapKeyLabel.put(Tuple2.create(JournauxSheetXML.TEMPLATE_ID, JournauxSheetXML.TEMPLATE_PROPERTY_NAME), JournauxSheetXML.TEMPLATE_ID); |
this.mapKeyLabel.put(Tuple2.create(BalanceSheet.TEMPLATE_ID, BalanceSheet.TEMPLATE_PROPERTY_NAME), BalanceSheet.TEMPLATE_ID); |
this.mapKeyLabel.put(Tuple2.create(RepartitionAnalytiqueSheetXML.TEMPLATE_ID, RepartitionAnalytiqueSheetXML.TEMPLATE_PROPERTY_NAME), RepartitionAnalytiqueSheetXML.TEMPLATE_ID); |
this.mapKeyLabel.put(Tuple2.create(VentilationAnalytiqueSheetXML.TEMPLATE_ID, VentilationAnalytiqueSheetXML.TEMPLATE_PROPERTY_NAME), VentilationAnalytiqueSheetXML.TEMPLATE_ID); |
} |
public String getTitleName() { |
/trunk/OpenConcerto/src/org/openconcerto/erp/config/DSNInstallationUtils.java |
---|
103,6 → 103,16 |
root.getSchema().updateVersion(); |
} |
if (!tableRubCot.contains("NUMERO_COMPTE_PCE")) { |
final AlterTable alter = new AlterTable(tableRubCot); |
alter.addVarCharColumn("NUMERO_COMPTE_PCE", 128); |
alter.addVarCharColumn("NUMERO_COMPTE_PCE_CHARGES", 128); |
final String req = alter.asString(); |
root.getDBSystemRoot().getDataSource().execute(req); |
root.refetchTable(tableRubCot.getName()); |
root.getSchema().updateVersion(); |
} |
if (!tableRubCot.contains("TAXABLE_CM")) { |
AlterTable tableRub = new AlterTable(tableRubCot); |
tableRub.addBooleanColumn("TAXABLE_CM", Boolean.FALSE, false); |
529,10 → 539,17 |
v.add(Tuple2.create("04", "Signalement Arrêt de travail")); |
v.add(Tuple2.create("05", "Signalement Reprise suite à arrêt de travail")); |
v.add(Tuple2.create("06", "DSN reprise d'historique")); |
v.add(Tuple2.create("07", "Signalement Fin du contrat de travail unique")); |
insertValues(v, table); |
} catch (SQLException ex) { |
throw new IllegalStateException("Erreur lors de la création de la table " + "DSN_NATURE", ex); |
} |
} else { |
final SQLTable table = root.getTable("DSN_NATURE"); |
List<Tuple2<String, String>> v = new ArrayList<Tuple2<String, String>>(); |
// DSN 2023 |
v.add(Tuple2.create("07", "Signalement Fin du contrat de travail unique")); |
insertValues(v, table); |
} |
if (!root.contains("DSN_TYPE")) { |
/trunk/OpenConcerto/src/org/openconcerto/erp/config/ComptaPropsConfiguration.java |
---|
57,6 → 57,8 |
import org.openconcerto.erp.core.finance.accounting.element.NatureCompteSQLElement; |
import org.openconcerto.erp.core.finance.accounting.element.PieceSQLElement; |
import org.openconcerto.erp.core.finance.accounting.element.PosteAnalytiqueSQLElement; |
import org.openconcerto.erp.core.finance.accounting.element.ReleveBancaireElementSQLElement; |
import org.openconcerto.erp.core.finance.accounting.element.ReleveBancaireSQLElement; |
import org.openconcerto.erp.core.finance.accounting.element.RepartitionAnalytiqueSQLElement; |
import org.openconcerto.erp.core.finance.accounting.element.SaisieKmItemSQLElement; |
import org.openconcerto.erp.core.finance.accounting.element.SaisieKmSQLElement; |
189,6 → 191,8 |
import org.openconcerto.erp.core.sales.product.element.EcoContributionSQLElement; |
import org.openconcerto.erp.core.sales.product.element.FamilleArticleSQLElement; |
import org.openconcerto.erp.core.sales.product.element.FamilleEcoContributionSQLElement; |
import org.openconcerto.erp.core.sales.product.element.LotLivraisonSQLElement; |
import org.openconcerto.erp.core.sales.product.element.LotReceptionSQLElement; |
import org.openconcerto.erp.core.sales.product.element.LotSQLElement; |
import org.openconcerto.erp.core.sales.product.element.MetriqueSQLElement; |
import org.openconcerto.erp.core.sales.product.element.ModeVenteArticleSQLElement; |
244,6 → 248,7 |
import org.openconcerto.erp.generationDoc.provider.AdresseVilleNomClientValueProvider; |
import org.openconcerto.erp.generationDoc.provider.ArticleCodeClientProvider; |
import org.openconcerto.erp.generationDoc.provider.ArticleCodeFournisseurProvider; |
import org.openconcerto.erp.generationDoc.provider.BatchListProvider; |
import org.openconcerto.erp.generationDoc.provider.ConditionsReglementDetailsProvider; |
import org.openconcerto.erp.generationDoc.provider.DateBLProvider; |
import org.openconcerto.erp.generationDoc.provider.DateProvider; |
266,13 → 271,17 |
import org.openconcerto.erp.generationDoc.provider.QteTotalDocProvider; |
import org.openconcerto.erp.generationDoc.provider.QteTotalLineDocProvider; |
import org.openconcerto.erp.generationDoc.provider.QteTotalProvider; |
import org.openconcerto.erp.generationDoc.provider.RGProvider; |
import org.openconcerto.erp.generationDoc.provider.RecapFactureProvider; |
import org.openconcerto.erp.generationDoc.provider.RecapLigneFactureProvider; |
import org.openconcerto.erp.generationDoc.provider.RefClientValueProvider; |
import org.openconcerto.erp.generationDoc.provider.RemiseProvider; |
import org.openconcerto.erp.generationDoc.provider.RemiseTotalProvider; |
import org.openconcerto.erp.generationDoc.provider.RestantAReglerProvider; |
import org.openconcerto.erp.generationDoc.provider.ResteALivrerDocProvider; |
import org.openconcerto.erp.generationDoc.provider.SaledTotalNotDiscountedProvider; |
import org.openconcerto.erp.generationDoc.provider.StockLocationProvider; |
import org.openconcerto.erp.generationDoc.provider.TitleInvoiceProvider; |
import org.openconcerto.erp.generationDoc.provider.TotalAcompteProvider; |
import org.openconcerto.erp.generationDoc.provider.TotalCommandeClientProvider; |
import org.openconcerto.erp.generationDoc.provider.UserCreateInitialsValueProvider; |
623,6 → 632,7 |
} |
private void registerCellValueProvider() { |
RGProvider.register(); |
UserCreateInitialsValueProvider.register(); |
UserModifyInitialsValueProvider.register(); |
UserCurrentInitialsValueProvider.register(); |
635,6 → 645,7 |
FacturableValueProvider.register(); |
TotalCommandeClientProvider.register(); |
LabelAccountInvoiceProvider.register(); |
TitleInvoiceProvider.register(); |
DateBLProvider.register(); |
AdresseRueClientValueProvider.register(); |
AdresseVilleClientValueProvider.register(); |
647,6 → 658,7 |
QteTotalDocProvider.register(); |
StockLocationProvider.register(); |
RefClientValueProvider.register(); |
RecapLigneFactureProvider.register(); |
ModeDeReglementDetailsProvider.register(); |
FormatedGlobalQtyTotalProvider.register(); |
FichePayeHeureSupTotalProvider.register(); |
660,10 → 672,13 |
DateProvider.register(); |
RemiseTotalProvider.register(); |
RecapFactureProvider.register(); |
RecapLigneFactureProvider.register(); |
RestantAReglerProvider.register(); |
ResteALivrerDocProvider.register(); |
SaledTotalNotDiscountedProvider.register(); |
ArticleCodeFournisseurProvider.register(); |
IbanProvider.register(); |
BatchListProvider.register(); |
} |
@Override |
969,6 → 984,9 |
dir.addSQLElement(DemandePrixItemSQLElement.class); |
dir.addSQLElement(FabricantSQLElement.class); |
dir.addSQLElement(ChiffrageCommandeClientSQLElement.class); |
dir.addSQLElement(LotSQLElement.class); |
dir.addSQLElement(LotReceptionSQLElement.class); |
dir.addSQLElement(LotLivraisonSQLElement.class); |
dir.addSQLElement(new CommercialSQLElement()); |
1100,7 → 1118,10 |
dir.addSQLElement(EmailTemplateSQLElement.class); |
dir.addSQLElement(ArretChomageIntemperieSQLElement.class); |
if (this.isExperimental) { |
dir.addSQLElement(ReleveBancaireSQLElement.class, this.getRootSociete()); |
dir.addSQLElement(ReleveBancaireElementSQLElement.class, this.getRootSociete()); |
} |
if (getRootSociete().contains("FWK_LIST_PREFS")) { |
dir.addSQLElement(new FWKListPrefs(getRootSociete())); |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/config/mapping_fr.xml |
---|
214,6 → 214,7 |
<FIELD name="PART_CP" label="Participe aux congés payés" /> |
<FIELD name="CSG_NORMAL" label="Participe à la base CSG normale" /> |
<FIELD name="CSG_REDUIT" label="Participe à la base CSG réduite" /> |
<FIELD name="PART_CSG_SANS_ABATTEMENT" label="Part CSG CRDS sans abattement" /> |
</element> |
<element refid="humanresources.payroll.category.comment" nameClass="feminine" name="rubrique de commentaire" |
namePlural="rubriques de commentaire"> |
246,6 → 247,8 |
<FIELD name="PART_PAT_IMPOSABLE" label="Montant patronale imposable" /> |
<FIELD name="LIGNE_PAYE_SIMPLIFIEE" label="Ligne simplifiée associée" /> |
<FIELD name="ALLEGEMENT_COTISATION" label="Allégement de cotisation financé par l'Etat" /> |
<FIELD name="NUMERO_COMPTE_PCE" label="Numéro de compte tiers spécifique" /> |
<FIELD name="NUMERO_COMPTE_PCE_CHARGES" label="Numéro de compte de charge spécifique" /> |
</element> |
<element refid="common.SOCIETE_COMMON" nameClass="feminine" name="société"> |
<FIELD name="DATABASE_NAME" label="Nom" /> |
/trunk/OpenConcerto/src/org/openconcerto/erp/config/DefaultMenuConfiguration.java |
---|
58,6 → 58,7 |
import org.openconcerto.erp.core.finance.accounting.action.NouveauLettrageAction; |
import org.openconcerto.erp.core.finance.accounting.action.NouveauPointageAction; |
import org.openconcerto.erp.core.finance.accounting.action.NouvelleValidationAction; |
import org.openconcerto.erp.core.finance.accounting.action.RelevesBancairesAction; |
import org.openconcerto.erp.core.finance.accounting.action.ResultatAnalytiqueAction; |
import org.openconcerto.erp.core.finance.accounting.ui.SaisieJournalAction; |
import org.openconcerto.erp.core.finance.payment.action.ListeDesChequesAEncaisserAction; |
110,6 → 111,7 |
import org.openconcerto.erp.core.sales.invoice.action.ListeDebiteursAction; |
import org.openconcerto.erp.core.sales.invoice.action.ListeDesElementsFactureAction; |
import org.openconcerto.erp.core.sales.invoice.action.ListeDesFactureItemsAction; |
import org.openconcerto.erp.core.sales.invoice.action.ListeDesFacturesPrevisionnellesOCAction; |
import org.openconcerto.erp.core.sales.invoice.action.ListeDesVentesAction; |
import org.openconcerto.erp.core.sales.invoice.action.ListeEcheancePrelevementAction; |
import org.openconcerto.erp.core.sales.invoice.action.ListeSDDMessageAction; |
124,7 → 126,6 |
import org.openconcerto.erp.core.sales.order.action.ListeDesElementsACommanderClientAction; |
import org.openconcerto.erp.core.sales.order.action.ListeDesFacturationCommandesClientAction; |
import org.openconcerto.erp.core.sales.order.action.NouvelleCommandeClientAction; |
import org.openconcerto.erp.core.sales.order.element.CommandeClientSQLElement; |
import org.openconcerto.erp.core.sales.pos.action.ListeDesCaissesTicketAction; |
import org.openconcerto.erp.core.sales.product.action.FamilleArticleAction; |
import org.openconcerto.erp.core.sales.product.action.ListeDesArticlesAction; |
136,6 → 137,7 |
import org.openconcerto.erp.core.sales.quote.action.ListeDesElementsDevisAction; |
import org.openconcerto.erp.core.sales.quote.action.NouveauDevisAction; |
import org.openconcerto.erp.core.sales.shipment.action.ListeDesBonsDeLivraisonAction; |
import org.openconcerto.erp.core.sales.shipment.action.ListeDesElementsBLAction; |
import org.openconcerto.erp.core.sales.shipment.action.ListeDesReliquatsBonsLivraisonsAction; |
import org.openconcerto.erp.core.sales.shipment.action.NouveauBonLivraisonAction; |
import org.openconcerto.erp.core.supplychain.credit.action.ListeDesAvoirsFournisseurAction; |
167,6 → 169,7 |
import org.openconcerto.erp.preferences.DefaultNXProps; |
import org.openconcerto.erp.preferences.GestionArticleGlobalPreferencePanel; |
import org.openconcerto.erp.preferences.GestionClientPreferencePanel; |
import org.openconcerto.erp.preferences.GestionCommercialeGlobalPreferencePanel; |
import org.openconcerto.erp.rights.ComptaUserRight; |
import org.openconcerto.erp.rights.NXRights; |
import org.openconcerto.erp.utils.correct.CorrectMouvement; |
458,7 → 461,9 |
group.addItem("accounting.general.ledger"); |
group.addItem("accounting.entries.ledger"); |
group.addItem("accounting.entries.list"); |
if (this.configuration.isExperimental()) { |
group.addItem("accounting.bank.statement.list"); |
} |
final Group gIO = new Group("menu.accounting.io", LayoutHints.DEFAULT_NOLABEL_SEPARATED_GROUP_HINTS); |
gIO.addItem("accounting.import"); |
gIO.addItem("accounting.import.fec"); |
511,15 → 516,21 |
boolean useListDesVentesAction = bModeVenteComptoir; |
if (useListDesVentesAction) { |
gCustomer.addItem("sales.list"); |
if (prefs.getBoolean(GestionCommercialeGlobalPreferencePanel.FACTURE_PREVISIONNELLE, false)) { |
gCustomer.addItem("customer.invoice.future.list"); |
} |
} else { |
gCustomer.addItem("customer.invoice.list"); |
if (prefs.getBoolean(GestionCommercialeGlobalPreferencePanel.FACTURE_PREVISIONNELLE, false)) { |
gCustomer.addItem("customer.invoice.future.list"); |
} |
} |
gCustomer.addItem("customer.credit.list"); |
gCustomer.addItem("sales.quote.element.list"); |
gCustomer.addItem("customer.invoice.details.list"); |
gCustomer.addItem("customer.deliver.details.list"); |
final Group gSupplier = new Group("menu.list.supplier", LayoutHints.DEFAULT_NOLABEL_SEPARATED_GROUP_HINTS); |
gSupplier.addItem("supplier.list"); |
666,14 → 677,16 |
boolean useListDesVentesAction = bModeVenteComptoir; |
if (useListDesVentesAction) { |
mManager.putAction(new ListeDesVentesAction(conf), "sales.list"); |
mManager.putAction(new ListeDesFacturesPrevisionnellesOCAction(), "customer.invoice.future.list"); |
} else { |
mManager.putAction(new ListeSaisieVenteFactureAction(), "customer.invoice.list"); |
mManager.putAction(new ListeDesFacturesPrevisionnellesOCAction(), "customer.invoice.future.list"); |
} |
mManager.putAction(new ListeDesAvoirsClientsAction(conf), "customer.credit.list"); |
mManager.putAction(new ListeDesFactureItemsAction(conf), "customer.invoice.details.list"); |
mManager.putAction(new ListeDesElementsBLAction(conf), "customer.deliver.details.list"); |
mManager.putAction(new ListeDesElementsDevisAction(conf), "sales.quote.element.list"); |
mManager.putAction(new ListeDesFournisseursAction(), "supplier.list"); |
721,7 → 734,10 |
mManager.putAction(new ExportRelationExpertAction(), "accounting.export"); |
mManager.putAction(new ImportEcritureFECAction(), "accounting.import.fec"); |
mManager.putAction(new ImportEcritureRImportAction(), "accounting.import.rimport"); |
if (configuration.isExperimental()) { |
mManager.putAction(new RelevesBancairesAction(this.configuration.getDirectory()), "accounting.bank.statement.list"); |
} |
} |
public void registerStatsDocumentsActions(final MenuAndActions mManager) { |
// mManager.putAction("accounting.vat.report", new DeclarationTVAAction()); |
/trunk/OpenConcerto/src/org/openconcerto/erp/config/update/Updater_1_5.java |
---|
25,6 → 25,7 |
import org.openconcerto.erp.core.sales.pos.element.TicketCaisseSQLElement; |
import org.openconcerto.erp.core.sales.product.element.ReferenceArticleSQLElement; |
import org.openconcerto.erp.core.sales.quote.element.DevisLogMailSQLElement; |
import org.openconcerto.erp.core.supplychain.order.ui.EtatCommandeFournisseur; |
import org.openconcerto.erp.core.supplychain.stock.element.ComposedItemStockUpdater; |
import org.openconcerto.erp.core.supplychain.stock.element.DepotStockSQLElement; |
import org.openconcerto.erp.core.supplychain.stock.element.StockItem; |
56,6 → 57,7 |
import java.math.BigDecimal; |
import java.sql.Clob; |
import java.sql.SQLException; |
import java.sql.Timestamp; |
import java.sql.Types; |
import java.util.ArrayList; |
import java.util.Arrays; |
969,6 → 971,7 |
tableFournisseur.getSchema().updateVersion(); |
tableFournisseur.fetchFields(); |
} |
if (!tableFournisseur.contains("CONDITIONS_PORT")) { |
final AlterTable alter = new AlterTable(tableFournisseur); |
alter.addVarCharColumn("CONDITIONS_PORT", 128); |
1101,12 → 1104,21 |
SQLTable tableEncaisse = root.getTable("ENCAISSER_MONTANT"); |
final AlterTable alterC = new AlterTable(tableEncaisse); |
alterC.addForeignColumn("ID_COMMANDE_CLIENT", tableDevisAcompte); |
alterC.addForeignColumn("ID_COMMANDE_CLIENT", tableCommandeAcompte); |
root.getBase().getDataSource().execute(alterC.asString()); |
root.refetchTable("ENCAISSER_MONTANT"); |
root.getSchema().updateVersion(); |
} |
SQLTable tableBlAcompte = root.getTable("BON_DE_LIVRAISON"); |
if (!tableBlAcompte.contains("T_ACOMPTE")) { |
final AlterTable alterB = new AlterTable(tableBlAcompte); |
alterB.addLongColumn("T_ACOMPTE", 0L, false); |
root.getBase().getDataSource().execute(alterB.asString()); |
root.refetchTable("BON_DE_LIVRAISON"); |
root.getSchema().updateVersion(); |
} |
if (!tableDevisAcompte.contains("DATE_LIVRAISON")) { |
final AlterTable alterB = new AlterTable(tableDevisAcompte); |
alterB.addColumn("DATE_LIVRAISON", "date"); |
1276,6 → 1288,15 |
table.fetchFields(); |
} |
if (!table.getFieldsName().contains("ID_COMPTE_PCE_PORT_SOUMIS_ACHAT")) { |
AlterTable t = new AlterTable(table); |
t.addForeignColumn("ID_COMPTE_PCE_PORT_SOUMIS_ACHAT", root.getTable("COMPTE_PCE")); |
t.addForeignColumn("ID_COMPTE_PCE_PORT_NON_SOUMIS_ACHAT", root.getTable("COMPTE_PCE")); |
table.getBase().getDataSource().execute(t.asString()); |
table.getSchema().updateVersion(); |
table.fetchFields(); |
} |
if (!table.getFieldsName().contains("AUTO_LETTRAGE")) { |
AlterTable t = new AlterTable(table); |
t.addBooleanColumn("AUTO_LETTRAGE", Boolean.FALSE, false); |
2017,7 → 2038,6 |
// for (SQLRow sqlRow : badStock) { |
// initStock(sqlRow); |
// } |
} |
// Tarification client par quantite |
2096,6 → 2116,7 |
final SQLCreateTable createTable = new SQLCreateTable(root, EmailTemplateSQLElement.TABLE_NAME); |
createTable.addVarCharColumn("NOM", 80); |
createTable.addVarCharColumn("TITRE", 80); |
createTable.addVarCharColumn("TABLE_NAME", 256); |
createTable.addVarCharColumn("TEXTE", 4096); |
createTable.addVarCharColumn("FORMAT_DATE", 20); |
createTable.addBooleanColumn("PAR_DEFAUT", Boolean.FALSE, false); |
2107,6 → 2128,16 |
} catch (SQLException ex) { |
throw new IllegalStateException("Erreur lors de la création de la table " + EmailTemplateSQLElement.TABLE_NAME, ex); |
} |
} else if (!root.getTable(EmailTemplateSQLElement.TABLE_NAME).contains("TABLE_NAME")) { |
AlterTable alter = new AlterTable(root.getTable(EmailTemplateSQLElement.TABLE_NAME)); |
alter.addVarCharColumn("TABLE_NAME", 256); |
root.getBase().getDataSource().execute(alter.asString()); |
root.refetchTable(EmailTemplateSQLElement.TABLE_NAME); |
root.getSchema().updateVersion(); |
UpdateBuilder up = new UpdateBuilder(root.getTable(EmailTemplateSQLElement.TABLE_NAME)); |
up.setObject("TABLE_NAME", "ECHEANCE_CLIENT"); |
root.getBase().getDataSource().execute(up.asString()); |
} |
// Force undefined policy to inDb |
root.setMetadata(SQLTable.UNDEFINED_ID_POLICY, "inDB"); |
2402,23 → 2433,6 |
throw new IllegalStateException("Erreur lors de la création de la table AGENCE", ex); |
} |
} |
// Tarification client par famille article |
if (root.getTable("TARIF_FAMILLE_ARTICLE_CLIENT") == null) { |
final SQLCreateTable createTableQtyTarif = new SQLCreateTable(root, "TARIF_FAMILLE_ARTICLE_CLIENT"); |
createTableQtyTarif.addForeignColumn("ID_FAMILLE_ARTICLE", root.getTable("FAMILLE_ARTICLE")); |
createTableQtyTarif.addForeignColumn("ID_CLIENT", root.getTable("CLIENT")); |
createTableQtyTarif.addDecimalColumn("QUANTITE", 16, 3, BigDecimal.ONE, false); |
createTableQtyTarif.addDecimalColumn("POURCENT_REMISE", 16, 3, null, true); |
// createTableQtyTarif.addDecimalColumn("PRIX_METRIQUE_VT_1", 16, 6, null, true); |
try { |
root.getBase().getDataSource().execute(createTableQtyTarif.asString()); |
InstallationPanel.insertUndef(createTableQtyTarif); |
root.refetchTable("TARIF_FAMILLE_ARTICLE_CLIENT"); |
root.getSchema().updateVersion(); |
} catch (SQLException ex) { |
throw new IllegalStateException("Erreur lors de la création de la table " + "TARIF_FAMILLE_ARTICLE_CLIENT", ex); |
} |
} |
// Tarification client par famille article |
if (root.getTable("TARIF_FAMILLE_ARTICLE_CLIENT") == null) { |
2619,42 → 2633,6 |
} |
} |
if (!root.contains("LOT_RECEPTION")) { |
SQLCreateTable createLotReception = new SQLCreateTable(root, "LOT_RECEPTION"); |
createLotReception.addDateAndTimeColumn("DATE_RECEPTION"); |
createLotReception.addVarCharColumn("FOURNISSEUR", 256); |
createLotReception.addVarCharColumn("ARTICLE", 256); |
createLotReception.addForeignColumn("ID_ARTICLE", root.findTable("ARTICLE", true)); |
createLotReception.addForeignColumn("ID_DEPOT_STOCK", root.findTable("DEPOT_STOCK", true)); |
createLotReception.addDecimalColumn("QUANTITE", 16, 6, BigDecimal.ONE, false); |
createLotReception.addVarCharColumn("NUMERO_LOT", 256); |
createLotReception.addVarCharColumn("NUMERO_SERIE", 256); |
createLotReception.addDateAndTimeColumn("DLC"); |
createLotReception.addDateAndTimeColumn("DLUO"); |
createLotReception.addForeignColumn("ID_BON_RECEPTION_ELEMENT", root.findTable("BON_RECEPTION_ELEMENT", true)); |
root.getBase().getDataSource().execute(createLotReception.asString()); |
InstallationPanel.insertUndef(createLotReception); |
SQLCreateTable createLotLivraison = new SQLCreateTable(root, "LOT_LIVRAISON"); |
createLotLivraison.addDateAndTimeColumn("DATE_LIVRAISON"); |
createLotLivraison.addVarCharColumn("CLIENT", 256); |
createLotLivraison.addVarCharColumn("ARTICLE", 256); |
createLotLivraison.addForeignColumn("ID_ARTICLE", root.findTable("ARTICLE", true)); |
createLotLivraison.addForeignColumn("ID_DEPOT_STOCK", root.findTable("DEPOT_STOCK", true)); |
createLotLivraison.addDecimalColumn("QUANTITE", 16, 6, BigDecimal.ONE, false); |
createLotLivraison.addVarCharColumn("NUMERO_LOT", 256); |
createLotLivraison.addVarCharColumn("NUMERO_SERIE", 256); |
createLotLivraison.addDateAndTimeColumn("DLC"); |
createLotLivraison.addDateAndTimeColumn("DLUO"); |
createLotLivraison.addForeignColumn("ID_BON_DE_LIVRAISON_ELEMENT", root.findTable("BON_DE_LIVRAISON_ELEMENT", true)); |
root.getBase().getDataSource().execute(createLotLivraison.asString()); |
InstallationPanel.insertUndef(createLotLivraison); |
} |
if (!root.contains("LOT")) { |
SQLCreateTable createLot = new SQLCreateTable(root, "LOT"); |
createLot.addForeignColumn("ID_STOCK", root.findTable("STOCK", true)); |
2661,8 → 2639,8 |
createLot.addDecimalColumn("QUANTITE", 16, 6, BigDecimal.ONE, false); |
createLot.addVarCharColumn("NUMERO_LOT", 256); |
createLot.addVarCharColumn("NUMERO_SERIE", 256); |
createLot.addDateAndTimeColumn("DLC"); |
createLot.addDateAndTimeColumn("DLUO"); |
createLot.addColumn("DLC", "date"); |
createLot.addColumn("DLUO", "date"); |
root.getBase().getDataSource().execute(createLot.asString()); |
InstallationPanel.insertUndef(createLot); |
2698,7 → 2676,98 |
tableArticle.getSchema().updateVersion(); |
root.refetch(); |
} |
if (!root.getTable("LOT").contains("NUMERO_LOT")) { |
final AlterTable alterLot = new AlterTable(root.getTable("LOT")); |
alterLot.addVarCharColumn("NUMERO_LOT", 256); |
alterLot.addVarCharColumn("NUMERO_SERIE", 256); |
alterLot.addColumn("DLC", "date"); |
alterLot.addColumn("DLUO", "date"); |
alterLot.dropColumn("ID_BON_RECEPTION_ELEMENT"); |
tableArticle.getBase().getDataSource().execute(alterLot.asString()); |
tableArticle.getSchema().updateVersion(); |
root.refetch(); |
} |
if (!root.contains("LOT_RECEPTION")) { |
SQLCreateTable createLotReception = new SQLCreateTable(root, "LOT_RECEPTION"); |
createLotReception.addDateAndTimeColumn("DATE_RECEPTION"); |
createLotReception.addVarCharColumn("FOURNISSEUR", 256); |
createLotReception.addVarCharColumn("ARTICLE", 256); |
createLotReception.addForeignColumn("ID_ARTICLE", root.findTable("ARTICLE", true)); |
createLotReception.addForeignColumn("ID_LOT", root.findTable("LOT", true)); |
createLotReception.addForeignColumn("ID_DEPOT_STOCK", root.findTable("DEPOT_STOCK", true)); |
createLotReception.addDecimalColumn("QUANTITE", 16, 6, BigDecimal.ONE, false); |
createLotReception.addVarCharColumn("NUMERO_LOT", 256); |
createLotReception.addVarCharColumn("NUMERO_SERIE", 256); |
createLotReception.addColumn("DLC", "date"); |
createLotReception.addColumn("DLUO", "date"); |
createLotReception.addForeignColumn("ID_BON_RECEPTION_ELEMENT", root.findTable("BON_RECEPTION_ELEMENT", true)); |
root.getBase().getDataSource().execute(createLotReception.asString()); |
InstallationPanel.insertUndef(createLotReception); |
SQLCreateTable createLotLivraison = new SQLCreateTable(root, "LOT_LIVRAISON"); |
createLotLivraison.addDateAndTimeColumn("DATE_LIVRAISON"); |
createLotLivraison.addVarCharColumn("CLIENT", 256); |
createLotLivraison.addVarCharColumn("ARTICLE", 256); |
createLotLivraison.addForeignColumn("ID_ARTICLE", root.findTable("ARTICLE", true)); |
createLotLivraison.addForeignColumn("ID_LOT", root.findTable("LOT", true)); |
createLotLivraison.addForeignColumn("ID_DEPOT_STOCK", root.findTable("DEPOT_STOCK", true)); |
createLotLivraison.addDecimalColumn("QUANTITE", 16, 6, BigDecimal.ONE, false); |
createLotLivraison.addVarCharColumn("NUMERO_LOT", 256); |
createLotLivraison.addVarCharColumn("NUMERO_SERIE", 256); |
createLotLivraison.addColumn("DLC", "date"); |
createLotLivraison.addColumn("DLUO", "date"); |
createLotLivraison.addForeignColumn("ID_BON_DE_LIVRAISON_ELEMENT", root.findTable("BON_DE_LIVRAISON_ELEMENT", true)); |
root.getBase().getDataSource().execute(createLotLivraison.asString()); |
InstallationPanel.insertUndef(createLotLivraison); |
root.getSchema().updateVersion(); |
root.refetch(); |
} |
if (root.getTable("LOT_RECEPTION").getField("DLC").getType().getJavaType().equals(Timestamp.class)) { |
AlterTable alterLotR = new AlterTable(root.getTable("LOT_RECEPTION")); |
alterLotR.alterColumn("DLC", EnumSet.allOf(Properties.class), "date", null, true); |
alterLotR.alterColumn("DLUO", EnumSet.allOf(Properties.class), "date", null, true); |
tableArticle.getBase().getDataSource().execute(alterLotR.asString()); |
tableArticle.getSchema().updateVersion(); |
root.refetchTable("LOT_RECEPTION"); |
} |
if (root.getTable("LOT_LIVRAISON").getField("DLC").getType().getJavaType().equals(Timestamp.class)) { |
AlterTable alterLotL = new AlterTable(root.getTable("LOT_LIVRAISON")); |
alterLotL.alterColumn("DLC", EnumSet.allOf(Properties.class), "date", null, true); |
alterLotL.alterColumn("DLUO", EnumSet.allOf(Properties.class), "date", null, true); |
tableArticle.getBase().getDataSource().execute(alterLotL.asString()); |
tableArticle.getSchema().updateVersion(); |
root.refetchTable("LOT_LIVRAISON"); |
} |
if (root.getTable("LOT").getField("DLC").getType().getJavaType().equals(Timestamp.class)) { |
AlterTable alterLot = new AlterTable(root.getTable("LOT")); |
alterLot.alterColumn("DLC", EnumSet.allOf(Properties.class), "date", null, true); |
alterLot.alterColumn("DLUO", EnumSet.allOf(Properties.class), "date", null, true); |
tableArticle.getBase().getDataSource().execute(alterLot.asString()); |
tableArticle.getSchema().updateVersion(); |
root.refetchTable("LOT"); |
} |
if (!root.getTable("LOT_RECEPTION").contains("ID_LOT")) { |
final AlterTable alterLot = new AlterTable(root.getTable("LOT_RECEPTION")); |
alterLot.addForeignColumn("ID_LOT", root.getTable("LOT")); |
tableArticle.getBase().getDataSource().execute(alterLot.asString()); |
tableArticle.getSchema().updateVersion(); |
root.refetchTable("LOT_RECEPTION"); |
} |
if (!root.getTable("LOT_LIVRAISON").contains("ID_LOT")) { |
final AlterTable alterLot = new AlterTable(root.getTable("LOT_LIVRAISON")); |
alterLot.addForeignColumn("ID_LOT", root.getTable("LOT")); |
tableArticle.getBase().getDataSource().execute(alterLot.asString()); |
tableArticle.getSchema().updateVersion(); |
root.refetchTable("LOT_LIVRAISON"); |
} |
SQLTable tableBR = root.getTable("BON_RECEPTION"); |
SQLTable tableModele = root.getTable("MODELE"); |
if (!tableBR.contains("ID_MODELE")) { |
2721,6 → 2790,65 |
rowVals.put("DEFAULT_MODELE", "BonReception"); |
rowVals.commit(); |
} |
// Pourcent RG |
if (!tableVF.contains("POURCENT_RG")) { |
final AlterTable alter = new AlterTable(tableVF); |
alter.addDecimalColumn("POURCENT_RG", 6, 2, BigDecimal.ZERO, true); |
tableVF.getBase().getDataSource().execute(alter.asString()); |
tableVF.getSchema().updateVersion(); |
tableVF.fetchFields(); |
} |
SQLTable tableCmdCli = root.getTable("COMMANDE_CLIENT"); |
if (!tableCmdCli.contains("POURCENT_RG")) { |
final AlterTable alter = new AlterTable(tableCmdCli); |
alter.addDecimalColumn("POURCENT_RG", 6, 2, BigDecimal.ZERO, true); |
tableCmdCli.getBase().getDataSource().execute(alter.asString()); |
tableCmdCli.getSchema().updateVersion(); |
tableCmdCli.fetchFields(); |
} |
SQLTable tableEchCli = root.getTable("ECHEANCE_CLIENT"); |
if (!tableEchCli.contains("RG")) { |
final AlterTable alter = new AlterTable(tableEchCli); |
alter.addBooleanColumn("RG", Boolean.FALSE, false); |
tableEchCli.getBase().getDataSource().execute(alter.asString()); |
tableEchCli.getSchema().updateVersion(); |
tableEchCli.fetchFields(); |
} |
SQLTable tableMode = root.getTable("MODE_REGLEMENT"); |
if (!tableMode.contains("RG")) { |
final AlterTable alter = new AlterTable(tableMode); |
alter.addBooleanColumn("RG", Boolean.FALSE, false); |
tableMode.getBase().getDataSource().execute(alter.asString()); |
tableMode.getSchema().updateVersion(); |
tableMode.fetchFields(); |
} |
SQLTable tableCmdF = root.getTable("COMMANDE"); |
if (!tableCmdF.contains("ETAT_COMMANDE")) { |
final AlterTable alter = new AlterTable(tableCmdF); |
alter.addIntegerColumn("ETAT_COMMANDE", EtatCommandeFournisseur.EN_ATTENTE.getId()); |
tableCmdF.getBase().getDataSource().execute(alter.asString()); |
tableCmdF.getSchema().updateVersion(); |
tableCmdF.fetchFields(); |
SQLTable tableCmdElement = root.getTable("COMMANDE_ELEMENT"); |
String reqPartiel = "UPDATE " + tableCmdF.getSQLName().quote() + " c SET \"ETAT_COMMANDE\"=" + EtatCommandeFournisseur.RECEPTION_PARTIEL.getId() + " WHERE " + " (\"ETAT_COMMANDE\"=" |
+ EtatCommandeFournisseur.BROUILLON.getId() + " or \"ETAT_COMMANDE\"=" + EtatCommandeFournisseur.EN_ATTENTE.getId() + ") " + "and (select SUM(i.\"QTE_RECUE\") from " |
+ tableCmdElement.getSQLName().quote() + " i" + " where i.\"ID_COMMANDE\"=c.\"ID\" and i.\"ARCHIVE\"=0)>0"; |
tableCmdF.getDBSystemRoot().getDataSource().execute(reqPartiel); |
String req = "UPDATE " + tableCmdF.getSQLName().quote() + " c SET \"ETAT_COMMANDE\"=" + EtatCommandeFournisseur.RECEPTIONNEE.getId() + " WHERE " + " (\"ETAT_COMMANDE\"=" |
+ EtatCommandeFournisseur.BROUILLON.getId() + " or \"ETAT_COMMANDE\"=" + EtatCommandeFournisseur.EN_ATTENTE.getId() + " or c.\"ETAT_COMMANDE\"=" |
+ EtatCommandeFournisseur.EN_RECEPTION.getId() + " or c.\"ETAT_COMMANDE\"=" + EtatCommandeFournisseur.RECEPTION_PARTIEL.getId() + ") " |
+ "and (select SUM((i.\"QTE\"*i.\"QTE_UNITAIRE\")-i.\"QTE_RECUE\") from " + tableCmdElement.getSQLName().quote() + " i" |
+ " where i.\"ID_COMMANDE\"=c.\"ID\" and i.\"ARCHIVE\"=0)<=0"; |
tableCmdF.getDBSystemRoot().getDataSource().execute(req); |
} |
// Fix undefined |
new SetFKDefault(root.getDBSystemRoot()).changeAll(root); |
List<SQLUpdate> ups = new ArrayList<>(); |
/trunk/OpenConcerto/src/org/openconcerto/erp/config/InstallationPanel.java |
---|
14,6 → 14,7 |
package org.openconcerto.erp.config; |
import org.openconcerto.erp.config.update.Updater_1_5; |
import org.openconcerto.erp.core.common.element.ComptaSQLConfElement; |
import org.openconcerto.erp.core.humanresources.payroll.report.LignePayeSimplifiee; |
import org.openconcerto.erp.core.sales.order.ui.EtatCommandeClient; |
import org.openconcerto.erp.core.sales.quote.element.EtatDevisSQLElement; |
100,6 → 101,8 |
public class InstallationPanel extends JPanel { |
private static final boolean DEBUG_FK = false; |
public static final String METADATA_VERSION = "OpenConcerto_Version"; |
public static void insertUndef(final SQLCreateTable ct) throws SQLException { |
// check that we can use insertReturnFirstField() |
if (ct.getPrimaryKey().size() != 1) |
864,6 → 867,26 |
alters.add(alter); |
} |
{ |
List<String> tables = Arrays.asList("FACTURE_FOURNISSEUR_ELEMENT", "DEVIS_ELEMENT", "COMMANDE_ELEMENT", "BON_RECEPTION_ELEMENT", "COMMANDE_CLIENT_ELEMENT", "BON_DE_LIVRAISON_ELEMENT", |
"SAISIE_VENTE_FACTURE_ELEMENT", "AVOIR_CLIENT_ELEMENT", "DEMANDE_PRIX_ELEMENT" |
); |
for (String string : tables) { |
final String fName = "T_POIDS_COLIS_NET"; |
if (root.getTable(string).contains(fName)) { |
SQLField fieldRepFacture = root.getTable(string).getField(fName); |
if (fieldRepFacture.getType().getSize() > 500) { |
final AlterTable alter = new AlterTable(root.getTable(string)); |
alter.alterColumn(fName, EnumSet.allOf(Properties.class), "numeric(16,8)", "1", false); |
alter.alterColumn("POIDS_COLIS_NET", EnumSet.allOf(Properties.class), "numeric(16,8)", "1", false); |
alters.add(alter); |
} |
} |
} |
} |
if (alters.size() > 0) { |
final SQLDataSource ds = root.getDBSystemRoot().getDataSource(); |
3869,8 → 3892,21 |
rowValsUserRight.commit(); |
} |
if (!codes.contains(ComptaSQLConfElement.NON_RESTREINT_PAR_COMMERCIAL_RIGHT)) { |
SQLRowValues rowVals = new SQLRowValues(table); |
rowVals.put("CODE", ComptaSQLConfElement.NON_RESTREINT_PAR_COMMERCIAL_RIGHT); |
rowVals.put("NOM", "Non restreint aux éléments liés au commercial de l'utilisateur"); |
String desc = "Liste non restreinte aux éléments liés au commercial de l'utilisateur"; |
rowVals.put("DESCRIPTION", desc); |
SQLRow row = rowVals.commit(); |
SQLRowValues rowValsUserRight = new SQLRowValues(table.getTable("USER_RIGHT")); |
rowValsUserRight.put("ID_RIGHT", row.getID()); |
rowValsUserRight.put("HAVE_RIGHT", Boolean.TRUE); |
rowValsUserRight.commit(); |
} |
} |
private void findBadForeignKey(DBRoot root) { |
Set<SQLTable> tables = root.getTables(); |
for (SQLTable table : tables) { |
4111,6 → 4147,20 |
rowVals.commit(); |
} |
if (!prefs.contains("PortAchatSoumisTVA")) { |
SQLRowValues rowVals = new SQLRowValues(table); |
rowVals.put("NOM", "PortAchatSoumisTVA"); |
rowVals.put("NUMERO_DEFAULT", "608510"); |
rowVals.commit(); |
} |
if (!prefs.contains("PortAchatNonSoumisTVA")) { |
SQLRowValues rowVals = new SQLRowValues(table); |
rowVals.put("NOM", "PortAchatNonSoumisTVA"); |
rowVals.put("NUMERO_DEFAULT", "608520"); |
rowVals.commit(); |
} |
if (!prefs.contains("AvanceClients")) { |
SQLRowValues rowVals = new SQLRowValues(table); |
rowVals.put("NOM", "AvanceClients"); |
4187,6 → 4237,7 |
req += ", \"CODE_POSTAL\"=substring(\"VILLE\" from (position('(' in \"VILLE\")+1) for length(\"VILLE\")-position('(' in \"VILLE\")-1) WHERE \"VILLE\" LIKE '% (%)'"; |
tableAdresse.getDBRoot().getDBSystemRoot().getDataSource().execute(req); |
} |
} |
private void updateVariablePaye(SQLTable table, String var, double value) throws SQLException { |
4346,6 → 4397,15 |
} |
final SQLTable tableRB = conf.getRoot().getTable("RUBRIQUE_BRUT"); |
if (!tableRB.contains("PART_CSG_SANS_ABATTEMENT")) { |
final AlterTable alter = new AlterTable(tableRB); |
alter.addBooleanColumn("PART_CSG_SANS_ABATTEMENT", Boolean.FALSE, false); |
final String req = alter.asString(); |
conf.getRoot().getDBSystemRoot().getDataSource().execute(req); |
conf.getRoot().refetchTable(tableRB.getName()); |
conf.getRoot().getSchema().updateVersion(); |
} |
if (!tableRB.contains("AVANTAGE_NATURE")) { |
final AlterTable alter = new AlterTable(tableRB); |
alter.addBooleanColumn("AVANTAGE_NATURE", Boolean.FALSE, false); |
4591,7 → 4651,7 |
} |
} |
// final Set<String> childrenNames = conf.getSystemRoot().getChildrenNames(); |
conf.getRoot().setMetadata(METADATA_VERSION, ProductInfo.getInstance().getVersion()); |
SwingUtilities.invokeLater(new Runnable() { |
@Override |
4720,6 → 4780,7 |
// at the end to let Updater_1_5 change field types from varchar to text |
fixUnboundedVarchar(root); |
root.setMetadata(METADATA_VERSION, ProductInfo.getInstance().getVersion()); |
return null; |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/config/translation_fr.xml |
---|
212,6 → 212,7 |
<action id="sales.invoice.create.supplier.order" label="Transférer en commande" /> |
<action id="sales.invoice.cancel.credit" label="Annuler l'avoir affecté" /> |
<action id="sales.shipment.create.invoice" label="Transfert en facture" /> |
<action id="cancel.regulation.cheque" label="Annuler la régularisation" /> |
<!-- Document --> |
<action id="modify" label="Modifier" /> |
231,7 → 232,16 |
<action id="supplychain.order.valid" label="Marquer comme validée" /> |
<action id="supplychain.order.create.receipt" label="Transfert vers bon de réception" /> |
<action id="supplychain.invoice.clone" label="Créer à partir de" /> |
<item id="supplychain.order.state.waiting" label="Brouillon" /> |
<item id="supplychain.order.state.running" label="En attente de réception" /> |
<item id="supplychain.order.state.toReceipt" label="En cours de réception" /> |
<item id="supplychain.supplychain.state.receipt.partial" label="Réception partielle" /> |
<item id="supplychain.order.state.receipt" label="Réceptionnée" /> |
<item id="supplychain.order.state.block" label="Litige" /> |
<item id="supplychain.order.state.cancelled" label="Annulée" /> |
<!-- Customer order --> |
<action id="sales.order.create.deliverynote" label="Transfert vers bon de livraison" /> |
<action id="sales.order.create.invoice" label="Transfert vers facture" /> |
383,5 → 393,6 |
<item id="common.SOCIETE_COMMON.grp5" label="Plan comptable de l'entreprise" /> |
<item id="common.SOCIETE_COMMON.accounting.plan" label="Choix du plan comptable" /> |
<action id="batch.history.pdf.action" label="Générer la fiche de suivi" /> |
</translation> |
/trunk/OpenConcerto/src/org/openconcerto/erp/config/mappingCompta_fr.xml |
---|
19,9 → 19,12 |
<FIELD name="DATE_DEBUT_SUSPENSION" label="Début de suspension" /> |
<FIELD name="DATE_FIN_SUSPENSION" label="Fin de suspension" /> |
</element> |
<element refid="customerrelationship.customer.agency" nameClass="feminine" name="agence"> |
<FIELD name="ID_CLIENT" label="Client" /> |
<FIELD name="ID_ADRESSE" label="Adresse" /> |
<FIELD name="DESIGNATION" label="Désignation" /> |
</element> |
<element refid="customerrelationship.customer.category" nameClass="feminine" name="catégorie de client"> |
<FIELD name="name" label="Nom" /> |
</element> |
430,6 → 433,10 |
<FIELD name="DATE_FIN" label="Date de fin d'intervention" /> |
<FIELD name="POURCENT_SERVICE" label="Pourcentage service" /> |
<FIELD name="ID_TAXE_PORT" label="Taxe sur port" /> |
<FIELD name="NIVEAU" label="Niveau" /> |
<FIELD name="LARGEUR" label="Largeur" /> |
<FIELD name="LONGUEUR" label="Longueur" /> |
<FIELD name="HAUTEUR" label="Hauteur" /> |
</element> |
<element refid="supplychain.credit.note" nameClass="feminine" name="facture d'avoir fournisseur" |
namePlural="factures d'avoir fournisseur"> |
507,6 → 514,7 |
</element> |
<element refid="supplychain.receipt.item" nameClass="masculine" name="élément de bon" |
namePlural="éléments de bon"> |
<FIELD name="ID_COMMANDE_ELEMENT" label="élement de bon de réception" /> |
<FIELD name="ID_ARTICLE_DECLINAISON_TAILLE" label="Taille" /> |
<FIELD name="ID_ARTICLE_DECLINAISON_COULEUR" label="Couleur" /> |
<FIELD name="NB_COLIS" label="Nb Colis" /> |
555,6 → 563,10 |
<FIELD name="SERVICE" label="Service" /> |
<FIELD name="ID_MODE_VENTE_ARTICLE" label="Mode de vente" /> |
<FIELD name="ID_FAMILLE_ARTICLE" label="Famille" /> |
<FIELD name="NIVEAU" label="Niveau" /> |
<FIELD name="LARGEUR" label="Largeur" /> |
<FIELD name="LONGUEUR" label="Longueur" /> |
<FIELD name="HAUTEUR" label="Hauteur" /> |
</element> |
<element refid="sales.shipment.delivery.note" nameClass="masculine" name="bon de livraison" |
namePlural="bons de livraison"> |
578,17 → 590,19 |
<FIELD name="TOTAL_TTC" label="Total TTC" /> |
<FIELD name="NOM" label="Référence" /> |
<FIELD name="T_ECOTAXE" label="Dont ecotaxe" /> |
<FIELD name="T_DEVISE" label="Total Devise" /> |
<FIELD name="T_DEVISE" label="Total devise" /> |
<FIELD name="PORT_HT" label="Frais de port HT" /> |
<FIELD name="REMISE_HT" label="Remise HT" /> |
<FIELD name="ID_TAXE_PORT" label="TVA sur Port" /> |
<FIELD name="ID_MODELE" label="Modèle" /> |
<FIELD name="T_ECO_CONTRIBUTION" label="Dont Eco-Contrib." /> |
<FIELD name="TOTAL_SERVICE" label="Total service" /> |
<FIELD name="invoiceProgress" label="Avancement facturation" /> |
<FIELD name="ID_COMMERCIAL" label="Commercial" /> |
</element> |
<element refid="sales.shipment.item" nameClass="masculine" name="élément de bon de livraison" |
namePlural="éléments de bon de livraison"> |
<FIELD name="ID_BON_DE_LIVRAISON" label="Bon de livraison" /> |
<FIELD name="ID_ARTICLE_DECLINAISON_TAILLE" label="Taille" /> |
<FIELD name="ID_ARTICLE_DECLINAISON_COULEUR" label="Couleur" /> |
<FIELD name="ID_DEPOT_STOCK" label="Dépôt Stock" /> |
648,6 → 662,11 |
<FIELD name="T_PRIX_FINAL_TTC" label="Total prix client TTC" /> |
<FIELD name="PRIX_FINAL_TTC" label="Prix client TTC" /> |
<FIELD name="T_ECOTAXE" label="Total Ecotaxe" /> |
<FIELD name="ID_COMMANDE_CLIENT_ELEMENT" label="Commande client élément" /> |
<FIELD name="NIVEAU" label="Niveau" /> |
<FIELD name="LARGEUR" label="Largeur" /> |
<FIELD name="LONGUEUR" label="Longueur" /> |
<FIELD name="HAUTEUR" label="Hauteur" /> |
</element> |
<element refid="sales.pos.receipt" nameClass="feminine" name="caisse"> |
<FIELD name="NOM" label="Caisse" /> |
910,6 → 929,8 |
<FIELD name="BLOQUE_LIVRAISON" label="Bloquer les livraisons" /> |
<FIELD name="OBSOLETE" label="Obsolète" /> |
<FIELD name="ALERTE" label="Message d'alerte" /> |
<FIELD name="SOLDE_COMPTE" label="Solde"/> |
</element> |
<element refid="customerrelationship.customer.department" nameClass="masculine" name="service client" |
namePlural="services client"> |
1116,7 → 1137,7 |
<FIELD name="DATE_FIN_SUSPENSION" label="Fin de supension (S21.G00.65.003)" /> |
<FIELD name="DATE_DEBUT_SUSPENSION" label="Début de supension (S21.G00.65.002)" /> |
<FIELD name="NATURE" label="Nature de l'emploi (*)" titlelabel="Nature de l'emploi" /> |
<FIELD name="COMPLEMENT_PCS" label="Code complément PCS-ESE" /> |
<FIELD name="COMPLEMENT_PCS" label="Code complément PCS-ESE (S21.G00.40.005)" /> |
<FIELD name="ID_CODE_EMPLOI" label="Catégorie socioprofessionnelle " |
titlelabel="Code Catégorie socioprofessionnelle" /> |
<FIELD name="ID_CODE_CONTRAT_TRAVAIL" label="Contrat de travail" titlelabel="Code contrat" /> |
1145,6 → 1166,7 |
</element> |
<element refid="supplychain.order" nameClass="feminine" name="commande fournisseur" |
namePlural="commandes fournisseur"> |
<FIELD name="ETAT_COMMANDE" label="Etat" /> |
<FIELD name="DATE_RECEPTION_DEMANDEE" label="Date réception demandée" /> |
<FIELD name="DATE_RECEPTION_CONFIRMEE" label="Date réception confirmée" /> |
<FIELD name="INCOTERM" label="Incoterm" /> |
1162,8 → 1184,8 |
<FIELD name="SOURCE" label="Source" /> |
<FIELD name="T_HT" label="Total HT" /> |
<FIELD name="T_TVA" label="Total TVA" /> |
<FIELD name="T_SERVICE" label="Total service" /> |
<FIELD name="T_TTC" label="Total TTC" /> |
<FIELD name="T_TTC" label="Total TTC" /> |
<FIELD name="T_DEVISE" label="Total Devise" /> |
<FIELD name="T_POIDS" label="Poids total" /> |
<FIELD name="ID_POLE_PRODUIT" label="Pôle produit" /> |
1225,12 → 1247,17 |
<FIELD name="POURCENT_REMISE" label="% Remise" /> |
<FIELD name="T_POIDS" label="Poids total net" /> |
<FIELD name="ID_MODE_VENTE_ARTICLE" label="Mode de vente" /> |
<FIELD name="NIVEAU" label="Niveau" /> |
<FIELD name="LARGEUR" label="Largeur" /> |
<FIELD name="LONGUEUR" label="Longueur" /> |
<FIELD name="HAUTEUR" label="Hauteur" /> |
</element> |
<element refid="sales.order" nameClass="feminine" name="commande client" namePlural="commandes clients"> |
<FIELD name="FACTURATION_INTERNE" label="Facturation interne" /> |
<FIELD name="T_ACOMPTE" label="Acompte" /> |
<FIELD name="ID_COMMANDE_CLIENT_PRECEDENT" label="Commande précedente" /> |
<FIELD name="POURCENT_RG" label="Pourcentage RG" /> |
<FIELD name="ID_TAXE_FRAIS_DOCUMENT" label="TVA sur frais documents" /> |
<FIELD name="FRAIS_DOCUMENT_HT" label="Frais de document HT" /> |
<FIELD name="DATE_LIVRAISON_PREV" label="Livraison prévue le" /> |
1254,10 → 1281,11 |
<FIELD name="T_HT" label="Total HT" /> |
<FIELD name="T_TVA" label="Total TVA" /> |
<FIELD name="T_TTC" label="Total TTC" /> |
<FIELD name="T_DEVISE" label="Total Devise" /> |
<FIELD name="T_DEVISE" label="Total devise" /> |
<FIELD name="INFOS" label="Informations" /> |
<FIELD name="SOURCE" label="Source" /> |
<FIELD name="T_POIDS" label="Poids total" /> |
<FIELD name="T_SERVICE" label="Total service" /> |
<FIELD name="ID_COMMERCIAL" label="Commercial" /> |
<FIELD name="ID_POLE_PRODUIT" label="Pôle produit" /> |
<FIELD name="TYPE_EXPEDITION" label="Type d'envoi" /> |
1320,6 → 1348,11 |
<FIELD name="LIVRE" label="Livré" /> |
<FIELD name="QTE_LIVREE" label="Qté livrée" /> |
<FIELD name="LIVRE_FORCED" label="Livraison forcée" /> |
<FIELD name="NIVEAU" label="Niveau" /> |
<FIELD name="LARGEUR" label="Largeur" /> |
<FIELD name="LONGUEUR" label="Longueur" /> |
<FIELD name="HAUTEUR" label="Hauteur" /> |
</element> |
<element refid="humanresources.employe.salesman" nameClass="masculine" name="commercial"> |
<FIELD name="ID_POLE_PRODUIT" label="Pôle produit" /> |
1401,6 → 1434,11 |
</element> |
<element refid="supplychain.order.demande.achat" nameClass="feminine" name="demande d'achat" |
namePlural="demandes d'achat"> |
<FIELD name="ID_COMMANDE" label="Commande" /> |
<FIELD name="ID_BON_RECEPTION" label="Bon de réception" /> |
<FIELD name="IMPORT" label="Importé" /> |
<FIELD name="T_HT" label="Total HT" /> |
<FIELD name="P_HT" label="Prix HT" /> |
<FIELD name="NUMERO" label="Numéro" /> |
<FIELD name="ID_FOURNISSEUR" label="Fournisseur" /> |
<FIELD name="DATE" label="Date" /> |
1447,6 → 1485,7 |
</element> |
<element refid="supplychain.order.demande.item" nameClass="masculine" name="élement de demande de prix" |
namePlural="élements de demandes de prix"> |
<FIELD name="ID_ARTICLE_DECLINAISON_TAILLE" label="Taille" /> |
<FIELD name="ID_ARTICLE_DECLINAISON_COULEUR" label="Couleur" /> |
<FIELD name="ID_DEPOT_STOCK" label="Dépôt Stock" /> |
1495,6 → 1534,11 |
<FIELD name="T_PA_HT" label="Total achat HT" /> |
<FIELD name="T_POIDS" label="Poids total" /> |
<FIELD name="ID_MODE_VENTE_ARTICLE" label="Mode de vente" /> |
<FIELD name="NIVEAU" label="Niveau" /> |
<FIELD name="LARGEUR" label="Largeur" /> |
<FIELD name="LONGUEUR" label="Longueur" /> |
<FIELD name="HAUTEUR" label="Hauteur" /> |
</element> |
<element refid="supplychain.stock.depot" nameClass="masculine" name="dépôt"> |
<FIELD name="NOM" label="Nom" titlelabel="Dépôt" /> |
1669,6 → 1713,11 |
<FIELD name="DUREE_MISSION" label="Durée approx." /> |
<FIELD name="FONCTION_SIGN" label="Fonction signataire" /> |
<FIELD name="DATE_SIGN" label="Date de signature" /> |
<FIELD name="NIVEAU" label="Niveau" /> |
<FIELD name="LARGEUR" label="Largeur" /> |
<FIELD name="LONGUEUR" label="Longueur" /> |
<FIELD name="HAUTEUR" label="Hauteur" /> |
</element> |
<element refid="finance.accounting.DEVISE_HISTORIQUE"> |
<FIELD name="DATE" label="Date" /> |
1867,6 → 1916,8 |
<FIELD name="ID_CLIENT" label="Client" /> |
<FIELD name="ID_ADRESSE" label="Adresse de livraison spécifique" /> |
<FIELD name="T_ECO_CONTRIBUTION" label="Dont Eco-Contrib." /> |
<FIELD name="T_SERVICE" label="Service" /> |
<FIELD name="ID_MODE_REGLEMENT" label="Mode de règlement" /> |
</element> |
<element refid="supplychain.orderinvoice.purchase.item" nameClass="masculine" name="élément de facture" |
namePlural="éléments de facture"> |
1918,6 → 1969,10 |
<FIELD name="POURCENT_REMISE" label="% Remise" /> |
<FIELD name="T_POIDS" label="Poids total" /> |
<FIELD name="ID_MODE_VENTE_ARTICLE" label="Mode de vente" /> |
<FIELD name="NIVEAU" label="Niveau" /> |
<FIELD name="LARGEUR" label="Largeur" /> |
<FIELD name="LONGUEUR" label="Longueur" /> |
<FIELD name="HAUTEUR" label="Hauteur" /> |
</element> |
<element refid="sales.product.family" nameClass="feminine" name="famille d'article" |
namePlural="familles d'articles"> |
2035,6 → 2090,14 |
<FIELD name="NOTA" label="Nota" /> |
<FIELD name="VALID" label="Valider par le responsable" /> |
</element> |
<element refid="sales.product.batch.receipt" nameClass="feminin" name="réception de lot" |
namePlural="réceptions de lot"> |
<FIELD name="QUANTITE" label="Quantité" /> |
<FIELD name="NUMERO_LOT" label="N° Lot" /> |
<FIELD name="DLC" label="DLC" /> |
<FIELD name="DLUO" label="DLUO" /> |
<FIELD name="NUMERO_SERIE" label="N° Série" /> |
</element> |
<element refid="supplychain.supplier" nameClass="masculine" name="fournisseur"> |
<FIELD name="ALG_MATRICULE" label="Matricule" /> |
<FIELD name="ALG_ARTICLE" label="Article" /> |
2250,7 → 2313,18 |
<FIELD name="ID_ADRESSE_COMMON" label="Adresse" /> |
<FIELD name="FACTURE_ADRESSE" label="Facturer à cette adresse" /> |
<FIELD name="ID_POSTE_ANALYTIQUE" label="Poste analytique" /> |
<FIELD name="controle.product.pole.address.default" label="Adresse" /> |
<FIELD name="analytic.poste.id" label="Poste analytique" /> |
</element> |
<element refid="calendar-group" nameClass="feminine" name="section du planning" |
namePlural="sections du planning"> |
<FIELD name="CALENDAR_GROUP_ACCESS" label="Utilisateur ayant accès en modification" /> |
<FIELD name="CALENDAR_USER_GROUP" label="Utilisateur dans cette section" /> |
<FIELD name="CALENDAR_GROUP_NOTIFY" label="Utilisateur à notifier" /> |
<FIELD name="NAME" label="Libellé" /> |
</element> |
<element refid="finance.accounting.analytic.set" nameClass="masculine" name="poste analytique" |
namePlural="postes analytiques"> |
<FIELD name="NOM" label="Nom du Poste" /> |
2430,6 → 2504,8 |
<FIELD name="DATE" label="le" /> |
<FIELD name="NOM" label="Libellé" /> |
<FIELD name="MONTANT_TTC" label="Montant TTC" titlelabel="TTC" /> |
<FIELD name="MONTANT_HT" label="Montant HT" titlelabel="HT" /> |
<FIELD name="MONTANT_TVA" label="Montant TTVA" titlelabel="TVA" /> |
<FIELD name="ID_TAXE" label="Taxe" /> |
<FIELD name="ID_MODE_REGLEMENT" label="Mode de règlement" /> |
<FIELD name="ID_FOURNISSEUR" label="Fournisseur" /> |
2481,6 → 2557,7 |
<FIELD name="CREATION_AUTO" label="Article généré" titlelabel="généré" /> |
</element> |
<element refid="sales.invoice" nameClass="feminine" name="facture"> |
<FIELD name="POURCENT_RG" label="Pourcentage RG" /> |
<FIELD name="ID_TAXE_FRAIS_DOCUMENT" label="TVA sur frais documents" /> |
<FIELD name="FRAIS_DOCUMENT_HT" label="Frais de document HT" /> |
<FIELD name="ACOMPTE_COMMANDE" label="Acompte" /> |
2625,6 → 2702,10 |
<FIELD name="POURCENT_FACTURABLE" label="Facturable (€ ou %)" /> |
<FIELD name="POURCENT_CCIP" label="CCIP" /> |
<FIELD name="DATE_FIN" label="Date de fin d'intervention" /> |
<FIELD name="HAUTEUR" label="Hauteur" /> |
<FIELD name="LARGEUR" label="Largeur" /> |
<FIELD name="LONGUEUR" label="Longueur" /> |
<FIELD name="NIVEAU" label="Niveau" /> |
</element> |
<element refid="humanresources.payroll.employe" nameClass="masculine" name="salarié"> |
<FIELD name="NOM" label="Nom (*)" titlelabel="Nom" /> |
2727,6 → 2808,7 |
<FIELD name="TOTAL_HT" label="Total HT" /> |
<FIELD name="TOTAL_TTC" label="Total TTC" /> |
<FIELD name="NUMERO" label="Numéro" /> |
<FIELD name="ID_CAISSE" label="Caisse" /> |
</element> |
<element refid="civility" nameClass="masculine" name="titre personnel" namePlural="titres personnels"> |
<FIELD name="NOM" label="Libellé" /> |
2799,5 → 2881,6 |
<FIELD name="TEXTE" label="Texte" /> |
<FIELD name="FORMAT_DATE" label="Format de date" /> |
<FIELD name="PAR_DEFAUT" label="Par défaut" /> |
<FIELD name="TABLE_NAME" label="Table" /> |
</element> |
</ROOT> |
/trunk/OpenConcerto/src/org/openconcerto/erp/injector/CommandeFactureClientSQLInjector.java |
---|
35,6 → 35,10 |
if (tableCommande.contains("T_ACOMPTE")) { |
map(tableCommande.getField("T_ACOMPTE"), tableFacture.getField("T_ACOMPTE")); |
} |
if (tableCommande.contains("POURCENT_RG") && tableFacture.contains("POURCENT_RG")) { |
map(tableCommande.getField("POURCENT_RG"), tableFacture.getField("POURCENT_RG")); |
} |
if (tableCommande.contains("PORT_HT")) { |
map(tableCommande.getField("PORT_HT"), tableFacture.getField("PORT_HT")); |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/injector/CommandeBlSQLInjector.java |
---|
32,6 → 32,9 |
if (tableCmd.getTable().contains("ID_POLE_PRODUIT") && tableBl.contains("ID_POLE_PRODUIT")) { |
map(tableCmd.getField("ID_POLE_PRODUIT"), tableBl.getField("ID_POLE_PRODUIT")); |
} |
if (tableCmd.contains("T_ACOMPTE") && tableBl.contains("T_ACOMPTE")) { |
map(tableCmd.getField("T_ACOMPTE"), tableBl.getField("T_ACOMPTE")); |
} |
if (getSource().getTable().contains("ID_CONTACT")) { |
map(getSource().getField("ID_CONTACT"), getDestination().getField("ID_CONTACT")); |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/injector/CommandeBlEltSQLInjector.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
20,6 → 20,7 |
public CommandeBlEltSQLInjector(final DBRoot root) { |
super(root, "COMMANDE_CLIENT_ELEMENT", "BON_DE_LIVRAISON_ELEMENT", false); |
createDefaultMap(); |
remove(getSource().getField("QTE_LIVREE"), getDestination().getField("QTE_LIVREE")); |
mapDefaultValues(getDestination().getField("QTE_LIVREE"), Integer.valueOf(0)); |
if (getDestination().contains("ID_COMMANDE_CLIENT_ELEMENT")) { |
map(getSource().getKey(), getDestination().getField("ID_COMMANDE_CLIENT_ELEMENT")); |
/trunk/OpenConcerto/src/org/openconcerto/erp/injector/BonFactureSQLInjector.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
34,6 → 34,9 |
if (tableBon.getTable().contains("ID_POLE_PRODUIT")) { |
map(tableBon.getField("ID_POLE_PRODUIT"), tableFacture.getField("ID_POLE_PRODUIT")); |
} |
if (tableBon.contains("T_ACOMPTE") && tableFacture.contains("T_ACOMPTE")) { |
map(tableBon.getField("T_ACOMPTE"), tableFacture.getField("T_ACOMPTE")); |
} |
if (getSource().getTable().contains("ID_CONTACT")) { |
map(getSource().getField("ID_CONTACT"), getDestination().getField("ID_CONTACT")); |
} |
70,7 → 73,10 |
if (getSource().getTable().contains("ACOMPTE_COMMANDE")) { |
map(getSource().getField("ACOMPTE_COMMANDE"), getDestination().getField("ACOMPTE_COMMANDE")); |
} |
if (getSource().getTable().contains("ID_COMMERCIAL")) { |
map(getSource().getField("ID_COMMERCIAL"), getDestination().getField("ID_COMMERCIAL")); |
} |
} |
@Override |
protected void merge(SQLRowAccessor srcRow, SQLRowValues rowVals) { |
/trunk/OpenConcerto/src/org/openconcerto/erp/injector/FactureAvoirSQLInjector.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
18,6 → 18,7 |
import org.openconcerto.sql.model.DBRoot; |
import org.openconcerto.sql.model.SQLInjector; |
import org.openconcerto.sql.model.SQLRow; |
import org.openconcerto.sql.model.SQLRowAccessor; |
import org.openconcerto.sql.model.SQLRowValues; |
import org.openconcerto.sql.model.SQLTable; |
72,7 → 73,18 |
if (myListItem.size() != 0) { |
final SQLInjector injector = SQLInjector.getInjector(tableElementSource, tableElementDestination); |
for (SQLRowAccessor rowElt : myListItem) { |
final SQLRowValues createRowValuesFrom = injector.createRowValuesFrom(rowElt.asRow()); |
final SQLRow asRow = rowElt.asRow(); |
final SQLRowValues createRowValuesFrom = injector.createRowValuesFrom(asRow); |
if (asRow.getObject("MONTANT_FACTURABLE") != null) { |
createRowValuesFrom.put("PV_HT", asRow.getObject("MONTANT_FACTURABLE")); |
createRowValuesFrom.put("PRIX_METRIQUE_VT_1", asRow.getObject("MONTANT_FACTURABLE")); |
} else if (asRow.getObject("POURCENT_FACTURABLE") != null && asRow.getObject("PRIX_METRIQUE_VT_1") != null) { |
final BigDecimal pv = asRow.getBigDecimal("PRIX_METRIQUE_VT_1").multiply(asRow.getBigDecimal("POURCENT_FACTURABLE")).movePointLeft(2); |
createRowValuesFrom.put("PV_HT", pv); |
createRowValuesFrom.put("PRIX_METRIQUE_VT_1", pv); |
} |
if (createRowValuesFrom.getTable().getFieldsName().contains("POURCENT_ACOMPTE")) { |
if (createRowValuesFrom.getObject("POURCENT_ACOMPTE") == null) { |
createRowValuesFrom.put("POURCENT_ACOMPTE", new BigDecimal(100.0)); |
/trunk/OpenConcerto/src/org/openconcerto/erp/injector/ArticleCommandeEltSQLInjector.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
31,4 → 31,5 |
remove(tableArticle.getField("ID_DEVISE"), tableCommandeElement.getField("ID_DEVISE")); |
} |
} |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/generationDoc/OOXMLField.java |
---|
277,9 → 277,26 |
if (cellSize != null && cellSize.trim().length() != 0) { |
result = splitStringCell(cellSize, result); |
} |
String attributeValueMaxChar = this.elt.getAttributeValue("maxChar"); |
if (attributeValueMaxChar != null) { |
int maxChar = Integer.valueOf(attributeValueMaxChar); |
if (result != null && result.length() > maxChar) { |
result = result.substring(0, maxChar); |
} |
} |
return result; |
} else { |
if (display == null || !display.equalsIgnoreCase("false")) { |
String attributeValueMaxChar = this.elt.getAttributeValue("maxChar"); |
if (attributeValueMaxChar != null) { |
int maxChar = Integer.valueOf(attributeValueMaxChar); |
if (o != null && o.toString().length() > maxChar) { |
o = o.toString().substring(0, maxChar); |
} |
} |
if (cellSize != null && cellSize.trim().length() != 0 && o != null) { |
return splitStringCell(cellSize, o.toString()); |
} else { |
/trunk/OpenConcerto/src/org/openconcerto/erp/generationDoc/OOgenerationXML.java |
---|
208,7 → 208,7 |
} |
// Sauvegarde du fichier |
return saveSpreadSheet(spreadSheet, outputDirectory, expectedFileName, templateId, rowLanguage); |
return saveSpreadSheet(spreadSheet, outputDirectory, expectedFileName, templateId, rowLanguage, typeTemplate); |
} catch (final JDOMException e) { |
991,7 → 991,7 |
* @throws IOException |
*/ |
private static File saveSpreadSheet(SpreadSheet ssheet, File pathDest, String fileName, String templateId, SQLRow rowLanguage) throws IOException { |
private static File saveSpreadSheet(SpreadSheet ssheet, File pathDest, String fileName, String templateId, SQLRow rowLanguage, String type) throws IOException { |
final String langage = rowLanguage != null ? rowLanguage.getString("CHEMIN") : null; |
// Test des arguments |
if (ssheet == null || pathDest == null || fileName.trim().length() == 0) { |
1027,7 → 1027,7 |
// Copie de l'odsp |
File odspOut = new File(pathDest, fileName + ".odsp"); |
try (final InputStream odspIn = TemplateManager.getInstance().getTemplatePrintConfiguration(templateId, langage, null);) { |
try (final InputStream odspIn = TemplateManager.getInstance().getTemplatePrintConfiguration(templateId, langage, type);) { |
if (odspIn != null) { |
StreamUtils.copy(odspIn, odspOut); |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/generationDoc/SpreadSheetGenerator.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
29,6 → 29,7 |
import java.awt.Point; |
import java.io.File; |
import java.io.FileInputStream; |
import java.io.FileNotFoundException; |
import java.io.IOException; |
import java.io.InputStream; |
56,7 → 57,7 |
private String printer; |
private boolean exportPDF; |
private Map mapReplaceText; |
private String fODSP = null; |
private InputStream fODSP = null; |
protected static final String defaultLocationTemplate = "/Configuration/Template/Default/"; |
77,15 → 78,17 |
// on parcourt chaque ligne de la feuille pour recuperer les styles |
int columnCount = (colEnd == -1) ? sheet.getColumnCount() : (colEnd + 1); |
System.err.println("End column search : " + columnCount); |
int endColumnSearch = Math.min(100, columnCount); |
System.err.println("End column search : " + endColumnSearch); |
int rowCount = (rowEnd > 0) ? rowEnd : sheet.getRowCount(); |
for (int i = 0; i < rowCount; i++) { |
int endRowSearch = Math.min(100, rowCount); |
for (int i = 0; i < endRowSearch; i++) { |
int x = 0; |
Map<Integer, String> mapCellStyle = new HashMap<Integer, String>(); |
String style = ""; |
for (int j = 0; j < columnCount; j++) { |
for (int j = 0; j < endColumnSearch; j++) { |
if (sheet.isCellValid(j, i)) { |
183,11 → 186,14 |
} |
protected SpreadSheet loadTemplate() throws IOException { |
InputStream f = getStreamStatic(modelDir + File.separator + this.modele); |
fODSP = modelDir + File.separator + this.modele + "p"; |
InputStream f = TemplateManager.getInstance().getTemplate(modele.replaceAll(".ods", "")); |
if (f == null) { |
f = getStreamStatic(modelDir + File.separator + this.modele); |
fODSP = getStreamStatic(modelDir + File.separator + this.modele + "p"); |
if (f == null) { |
f = getStreamStatic(defaultLocationTemplate + File.separator + this.modele); |
fODSP = defaultLocationTemplate + File.separator + this.modele + "p"; |
fODSP = getStreamStatic(defaultLocationTemplate + File.separator + this.modele + "p"); |
if (f == null) { |
ExceptionHandler.handle("Modele " + this.modele + " introuvable. Impossible de générer le document."); |
System.err.println("Modele introuvable : " + (defaultLocationTemplate + File.separator + this.modele)); |
195,6 → 201,10 |
return null; |
} |
} |
} else { |
fODSP = TemplateManager.getInstance().getTemplatePrintConfiguration(modele.replaceAll(".ods", ""), null, null); |
} |
final SpreadSheet res = new ODPackage(f).getSpreadSheet(); |
f.close(); |
return res; |
217,13 → 227,12 |
fTmp.renameTo(fDest); |
fDest = new File(this.destDirOO, this.destFileName + ".ods"); |
try (final InputStream stream = getStreamStatic(fODSP)) { |
if (stream != null) { |
if (this.fODSP != null) { |
// Copie de l'odsp |
File odspOut = new File(this.destDirOO, this.destFileName + ".odsp"); |
StreamUtils.copy(stream, odspOut); |
StreamUtils.copy(this.fODSP, odspOut); |
} |
} |
try { |
ssheet.saveAs(fDest); |
} catch (FileNotFoundException e) { |
/trunk/OpenConcerto/src/org/openconcerto/erp/generationDoc/OOXMLElement.java |
---|
133,6 → 133,15 |
if (brk != null && brk.trim().length() > 0) { |
res = (res == null ? res : res.toString().replaceAll(brk, "\n")); |
} |
String attributeValueMaxChar = this.elt.getAttributeValue("maxChar"); |
if (attributeValueMaxChar != null) { |
int maxChar = Integer.valueOf(attributeValueMaxChar); |
if (res != null && res.toString().length() > maxChar) { |
res = res.toString().substring(0, maxChar); |
} |
} |
return res; |
} |
141,6 → 150,7 |
sel.addSelect(field, function); |
Where w = new Where(field.getTable().getField("ID_" + this.row.getTable().getName()), "=", this.row.getID()); |
sel.setWhere(w); |
return Configuration.getInstance().getBase().getDataSource().executeScalar(sel.asString()); |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/generationDoc/provider/FormatedGlobalQtyTotalProvider.java |
---|
43,10 → 43,13 |
this.pieceName = withPieceName; |
} |
private final BigDecimal cent = new BigDecimal(100); |
public Object getValue(SpreadSheetCellValueContext context) { |
final SQLRowAccessor row = context.getRow(); |
final BigDecimal pv = row.getBigDecimal("PV_HT"); |
if (!this.alwaysShowOnZeroQty && pv != null && pv.compareTo(BigDecimal.ZERO) == 0) { |
final BigDecimal pR = row.getBigDecimal("POURCENT_REMISE"); |
if (!this.alwaysShowOnZeroQty && pv != null && pv.compareTo(BigDecimal.ZERO) == 0 && (pR == null || pR.compareTo(cent) != 0)) { |
return null; |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/generationDoc/provider/TitleInvoiceProvider.java |
---|
New file |
0,0 → 1,42 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
* copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific |
* language governing permissions and limitations under the License. |
* |
* When distributing the software, include this License Header Notice in each file. |
*/ |
package org.openconcerto.erp.generationDoc.provider; |
import org.openconcerto.erp.generationDoc.SpreadSheetCellValueContext; |
import org.openconcerto.erp.generationDoc.SpreadSheetCellValueProvider; |
import org.openconcerto.erp.generationDoc.SpreadSheetCellValueProviderManager; |
import org.openconcerto.sql.model.SQLRowAccessor; |
public class TitleInvoiceProvider implements SpreadSheetCellValueProvider { |
public Object getValue(SpreadSheetCellValueContext context) { |
final SQLRowAccessor row = context.getRow(); |
String result; |
if (row.getBoolean("PARTIAL")) { |
result = "Facture de situation"; |
} else { |
result = "Facture de solde"; |
} |
if (row.getBoolean("PREVISIONNELLE")) { |
result += " Prévisionnelle"; |
} |
return result; |
} |
public static void register() { |
SpreadSheetCellValueProviderManager.put("sales.account.title", new TitleInvoiceProvider()); |
} |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/generationDoc/provider/RecapFactureProvider.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
19,6 → 19,7 |
import org.openconcerto.sql.model.SQLRowAccessor; |
import org.openconcerto.utils.GestionDevise; |
import java.text.SimpleDateFormat; |
import java.util.Calendar; |
import java.util.Collection; |
import java.util.HashSet; |
31,9 → 32,12 |
}; |
private final TypeRecapFactureProvider type; |
private final boolean withDate, withAvoir; |
public RecapFactureProvider(TypeRecapFactureProvider t) { |
public RecapFactureProvider(TypeRecapFactureProvider t, boolean withDate, boolean withAvoir) { |
this.type = t; |
this.withDate = withDate; |
this.withAvoir = withAvoir; |
} |
public Object getValue(SpreadSheetCellValueContext context) { |
55,8 → 59,14 |
} |
public static void register() { |
SpreadSheetCellValueProviderManager.put("sales.account.history", new RecapFactureProvider(TypeRecapFactureProvider.HT)); |
SpreadSheetCellValueProviderManager.put("sales.account.history.ttc", new RecapFactureProvider(TypeRecapFactureProvider.TTC)); |
SpreadSheetCellValueProviderManager.put("sales.account.history", new RecapFactureProvider(TypeRecapFactureProvider.HT, false, false)); |
SpreadSheetCellValueProviderManager.put("sales.account.history.ttc", new RecapFactureProvider(TypeRecapFactureProvider.TTC, false, false)); |
SpreadSheetCellValueProviderManager.put("sales.account.history.withdate", new RecapFactureProvider(TypeRecapFactureProvider.HT, true, false)); |
SpreadSheetCellValueProviderManager.put("sales.account.history.ttc.withdate", new RecapFactureProvider(TypeRecapFactureProvider.TTC, true, false)); |
SpreadSheetCellValueProviderManager.put("sales.account.history.with.credit", new RecapFactureProvider(TypeRecapFactureProvider.HT, false, true)); |
SpreadSheetCellValueProviderManager.put("sales.account.history.with.credit.ttc", new RecapFactureProvider(TypeRecapFactureProvider.TTC, false, true)); |
SpreadSheetCellValueProviderManager.put("sales.account.history.with.credit.withdate", new RecapFactureProvider(TypeRecapFactureProvider.HT, true, true)); |
SpreadSheetCellValueProviderManager.put("sales.account.history.with.credit.ttc.withdate", new RecapFactureProvider(TypeRecapFactureProvider.TTC, true, true)); |
} |
public String getPreviousAcompte(SQLRowAccessor sqlRowAccessor, Set<SQLRowAccessor> alreadyAdded, Calendar c) { |
65,15 → 75,25 |
} |
Collection<? extends SQLRowAccessor> rows = sqlRowAccessor.getReferentRows(sqlRowAccessor.getTable().getTable("TR_COMMANDE_CLIENT")); |
StringBuffer result = new StringBuffer(); |
SimpleDateFormat format = new SimpleDateFormat("dd/MM/yyyy"); |
for (SQLRowAccessor sqlRowAccessor2 : rows) { |
SQLRowAccessor rowFact = sqlRowAccessor2.getForeign("ID_SAISIE_VENTE_FACTURE"); |
if (rowFact != null && !rowFact.isUndefined() && !alreadyAdded.contains(rowFact) && rowFact.getDate("DATE").before(c)) { |
if (rowFact != null && !rowFact.isUndefined() && !alreadyAdded.contains(rowFact) && rowFact.getDate("DATE").before(c) |
&& (!this.withAvoir || (this.withAvoir && rowFact.isForeignEmpty("ID_AVOIR_CLIENT")))) { |
alreadyAdded.add(rowFact); |
final String fieldTotal = this.type == TypeRecapFactureProvider.HT ? "T_HT" : "T_TTC"; |
result.append(rowFact.getString("NUMERO") + " (" + GestionDevise.currencyToString(rowFact.getLong(fieldTotal)) + "€), "); |
result.append(rowFact.getString("NUMERO")); |
result.append(" ("); |
if (this.withDate) { |
result.append(format.format(rowFact.getDate("DATE").getTime()) + " "); |
} |
result.append(GestionDevise.currencyToString(rowFact.getLong(fieldTotal)) + "€), "); |
if (this.withDate) { |
result.append("\n"); |
} |
} |
} |
return result.toString(); |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/generationDoc/provider/RestantAReglerProvider.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
35,18 → 35,18 |
public RestantAReglerProvider(TypeRestantAReglerProvider t) { |
this.type = t; |
if (this.type == TypeRestantAReglerProvider.HT) { |
acompteProv = new TotalAcompteProvider(TypeTotalAcompteProvider.HT); |
cmdProvider = new TotalCommandeClientProvider(TypeTotalCommandeClientProvider.HT); |
this.acompteProv = new TotalAcompteProvider(TypeTotalAcompteProvider.HT, false); |
this.cmdProvider = new TotalCommandeClientProvider(TypeTotalCommandeClientProvider.HT); |
} else { |
acompteProv = new TotalAcompteProvider(TypeTotalAcompteProvider.TTC); |
cmdProvider = new TotalCommandeClientProvider(TypeTotalCommandeClientProvider.TTC); |
this.acompteProv = new TotalAcompteProvider(TypeTotalAcompteProvider.TTC, false); |
this.cmdProvider = new TotalCommandeClientProvider(TypeTotalCommandeClientProvider.TTC); |
} |
} |
public Object getValue(SpreadSheetCellValueContext context) { |
Object acompte = acompteProv.getValue(context); |
Object cmd = cmdProvider.getValue(context); |
Object acompte = this.acompteProv.getValue(context); |
Object cmd = this.cmdProvider.getValue(context); |
if (acompte != null && cmd != null) { |
return ((BigDecimal) cmd).subtract((BigDecimal) acompte); |
} else { |
/trunk/OpenConcerto/src/org/openconcerto/erp/generationDoc/provider/RecapLigneFactureProvider.java |
---|
New file |
0,0 → 1,108 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
* copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific |
* language governing permissions and limitations under the License. |
* |
* When distributing the software, include this License Header Notice in each file. |
*/ |
package org.openconcerto.erp.generationDoc.provider; |
import org.openconcerto.erp.generationDoc.SpreadSheetCellValueContext; |
import org.openconcerto.erp.generationDoc.SpreadSheetCellValueProvider; |
import org.openconcerto.erp.generationDoc.SpreadSheetCellValueProviderManager; |
import org.openconcerto.sql.model.SQLRowAccessor; |
import org.openconcerto.sql.model.SQLRowValues; |
import org.openconcerto.sql.model.SQLRowValuesListFetcher; |
import org.openconcerto.sql.model.Where; |
import org.openconcerto.utils.DecimalUtils; |
import java.math.BigDecimal; |
import java.math.RoundingMode; |
import java.util.Calendar; |
import java.util.List; |
public class RecapLigneFactureProvider implements SpreadSheetCellValueProvider { |
private enum TypeLineRecapFactureProvider { |
HT, TTC, PERCENT; |
}; |
private final TypeLineRecapFactureProvider type; |
private final boolean old, withAvoir; |
public RecapLigneFactureProvider(TypeLineRecapFactureProvider t, boolean old) { |
this(t, old, false); |
} |
public RecapLigneFactureProvider(TypeLineRecapFactureProvider t, boolean old, boolean withAvoir) { |
this.type = t; |
this.old = old; |
this.withAvoir = withAvoir; |
} |
public Object getValue(SpreadSheetCellValueContext context) { |
SQLRowAccessor row = context.getRow(); |
final SQLRowAccessor factureOrigin = row.getNonEmptyForeign("ID_SAISIE_VENTE_FACTURE"); |
final Calendar date = factureOrigin.getDate("DATE"); |
final SQLRowAccessor foreignCmdItem = row.getNonEmptyForeign("ID_COMMANDE_CLIENT_ELEMENT"); |
if (foreignCmdItem != null && foreignCmdItem.getBigDecimal("T_PV_HT").signum() != 0) { |
SQLRowValues rowValsFactItem2Fetch = new SQLRowValues(row.getTable()); |
rowValsFactItem2Fetch.putNulls("T_PV_HT", "T_PV_TTC"); |
rowValsFactItem2Fetch.putRowValues("ID_SAISIE_VENTE_FACTURE").putNulls("DATE", "ID_AVOIR_CLIENT"); |
final List<SQLRowValues> fetch = SQLRowValuesListFetcher.create(rowValsFactItem2Fetch).fetch(new Where(row.getTable().getField("ID_COMMANDE_CLIENT_ELEMENT"), "=", foreignCmdItem.getID())); |
BigDecimal total = BigDecimal.ZERO; |
BigDecimal totalTTC = BigDecimal.ZERO; |
for (SQLRowAccessor sqlRowAccessor : fetch) { |
final SQLRowAccessor nonEmptyForeign = sqlRowAccessor.getNonEmptyForeign("ID_SAISIE_VENTE_FACTURE"); |
if (nonEmptyForeign != null && (!withAvoir || (withAvoir && sqlRowAccessor.isForeignEmpty("ID_AVOIR_CLIENT")))) { |
final Calendar date2 = nonEmptyForeign.getDate("DATE"); |
final boolean same = old && factureOrigin.getID() == nonEmptyForeign.getID(); |
if (same || date2.before(date) || (date2.equals(date) && nonEmptyForeign.getID() < factureOrigin.getID())) { |
total = total.add(sqlRowAccessor.getBigDecimal("T_PV_HT")); |
totalTTC = totalTTC.add(sqlRowAccessor.getBigDecimal("T_PV_TTC")); |
} |
} |
} |
if (this.type == TypeLineRecapFactureProvider.HT) { |
return total; |
} else if (this.type == TypeLineRecapFactureProvider.TTC) { |
return totalTTC; |
} else { |
if (foreignCmdItem.getBigDecimal("T_PV_HT").signum() != 0) { |
return total.divide(foreignCmdItem.getBigDecimal("T_PV_HT"), DecimalUtils.HIGH_PRECISION).movePointRight(2).setScale(2, RoundingMode.HALF_UP) + "%"; |
} else { |
return ""; |
} |
} |
} else { |
return ""; |
} |
} |
public static void register() { |
SpreadSheetCellValueProviderManager.put("sales.account.line.history", new RecapLigneFactureProvider(TypeLineRecapFactureProvider.HT, false)); |
SpreadSheetCellValueProviderManager.put("sales.account.line.history.ttc", new RecapLigneFactureProvider(TypeLineRecapFactureProvider.TTC, false)); |
SpreadSheetCellValueProviderManager.put("sales.account.line.history.percent", new RecapLigneFactureProvider(TypeLineRecapFactureProvider.PERCENT, false)); |
SpreadSheetCellValueProviderManager.put("sales.account.line.history.total", new RecapLigneFactureProvider(TypeLineRecapFactureProvider.HT, true)); |
SpreadSheetCellValueProviderManager.put("sales.account.line.history.total.ttc", new RecapLigneFactureProvider(TypeLineRecapFactureProvider.TTC, true)); |
SpreadSheetCellValueProviderManager.put("sales.account.line.history.total.percent", new RecapLigneFactureProvider(TypeLineRecapFactureProvider.PERCENT, true)); |
SpreadSheetCellValueProviderManager.put("sales.account.line.history.with.credit", new RecapLigneFactureProvider(TypeLineRecapFactureProvider.HT, false, true)); |
SpreadSheetCellValueProviderManager.put("sales.account.line.history.with.credit.ttc", new RecapLigneFactureProvider(TypeLineRecapFactureProvider.TTC, false, true)); |
SpreadSheetCellValueProviderManager.put("sales.account.line.history.with.credit.percent", new RecapLigneFactureProvider(TypeLineRecapFactureProvider.PERCENT, false, true)); |
SpreadSheetCellValueProviderManager.put("sales.account.line.history.with.credit.total", new RecapLigneFactureProvider(TypeLineRecapFactureProvider.HT, true, true)); |
SpreadSheetCellValueProviderManager.put("sales.account.line.history.with.credit.total.ttc", new RecapLigneFactureProvider(TypeLineRecapFactureProvider.TTC, true, true)); |
SpreadSheetCellValueProviderManager.put("sales.account.line.history.with.credit.total.percent", new RecapLigneFactureProvider(TypeLineRecapFactureProvider.PERCENT, true, true)); |
} |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/generationDoc/provider/QteLineDocProvider.java |
---|
47,16 → 47,17 |
} |
final BigDecimal qteUV = sqlRowAccessor.getBigDecimal("QTE_UNITAIRE"); |
final BigDecimal qte = new BigDecimal(sqlRowAccessor.getInt("QTE")); |
final BigDecimal qte = sqlRowAccessor.getTable().getName().equalsIgnoreCase("BON_DE_LIVRAISON_ELEMENT") ? new BigDecimal(sqlRowAccessor.getInt("QTE_LIVREE")) |
: new BigDecimal(sqlRowAccessor.getInt("QTE")); |
final BigDecimal tare; |
if (sqlRowAccessor.getObject("TARE") != null) { |
tare = new BigDecimal(sqlRowAccessor.getInt("NB_COLIS")); |
tare = sqlRowAccessor.getBigDecimal("TARE"); |
} else { |
tare = BigDecimal.ZERO; |
} |
BigDecimal pdsNet = nbColis.multiply(qte).multiply(qteUV); |
BigDecimal pdsNet = new BigDecimal(sqlRowAccessor.getFloat("POIDS")).multiply(qte).multiply(qteUV); |
if (this.type == TypePoidsDocProvider.POIDS_NET) { |
return pdsNet; |
} else { |
/trunk/OpenConcerto/src/org/openconcerto/erp/generationDoc/provider/TotalAcompteProvider.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
31,9 → 31,11 |
}; |
private final TypeTotalAcompteProvider type; |
private boolean old; |
public TotalAcompteProvider(TypeTotalAcompteProvider t) { |
public TotalAcompteProvider(TypeTotalAcompteProvider t, boolean old) { |
this.type = t; |
this.old = old; |
} |
public Object getValue(SpreadSheetCellValueContext context) { |
43,7 → 45,7 |
Collection<? extends SQLRowAccessor> rows = row.getReferentRows(row.getTable().getTable("TR_COMMANDE_CLIENT")); |
long total = 0; |
Set<SQLRowAccessor> facture = new HashSet<SQLRowAccessor>(); |
facture.add(row); |
for (SQLRowAccessor sqlRowAccessor : rows) { |
total += getPreviousAcompte(sqlRowAccessor.getForeign("ID_COMMANDE_CLIENT"), facture, c, row); |
} |
52,8 → 54,10 |
} |
public static void register() { |
SpreadSheetCellValueProviderManager.put("sales.account.total", new TotalAcompteProvider(TypeTotalAcompteProvider.HT)); |
SpreadSheetCellValueProviderManager.put("sales.account.total.ttc", new TotalAcompteProvider(TypeTotalAcompteProvider.TTC)); |
SpreadSheetCellValueProviderManager.put("sales.account.total.cumul", new TotalAcompteProvider(TypeTotalAcompteProvider.HT, true)); |
SpreadSheetCellValueProviderManager.put("sales.account.total.cumul.ttc", new TotalAcompteProvider(TypeTotalAcompteProvider.TTC, true)); |
SpreadSheetCellValueProviderManager.put("sales.account.total", new TotalAcompteProvider(TypeTotalAcompteProvider.HT, false)); |
SpreadSheetCellValueProviderManager.put("sales.account.total.ttc", new TotalAcompteProvider(TypeTotalAcompteProvider.TTC, false)); |
} |
public long getPreviousAcompte(SQLRowAccessor sqlRowAccessor, Set<SQLRowAccessor> alreadyAdded, Calendar c, SQLRowAccessor origin) { |
65,8 → 69,9 |
for (SQLRowAccessor sqlRowAccessor2 : rows) { |
SQLRowAccessor rowFact = sqlRowAccessor2.getForeign("ID_SAISIE_VENTE_FACTURE"); |
if (rowFact != null && !rowFact.isUndefined() && !alreadyAdded.contains(rowFact) |
&& (rowFact.getDate("DATE").before(c) || (rowFact.getDate("DATE").equals(c) && rowFact.getID() < origin.getID()))) { |
final boolean sameFact = rowFact.getDate("DATE").equals(c) && rowFact.getID() < origin.getID(); |
final boolean oldFact = rowFact.getID() == origin.getID() && this.old; |
if (rowFact != null && !rowFact.isUndefined() && !alreadyAdded.contains(rowFact) && (rowFact.getDate("DATE").before(c) || sameFact || oldFact)) { |
alreadyAdded.add(rowFact); |
l += this.type == TypeTotalAcompteProvider.HT ? rowFact.getLong("T_HT") : rowFact.getLong("T_TTC"); |
} |
73,5 → 78,4 |
} |
return l; |
} |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/generationDoc/provider/ResteALivrerDocProvider.java |
---|
New file |
0,0 → 1,95 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
* copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific |
* language governing permissions and limitations under the License. |
* |
* When distributing the software, include this License Header Notice in each file. |
*/ |
package org.openconcerto.erp.generationDoc.provider; |
import org.openconcerto.erp.generationDoc.SpreadSheetCellValueContext; |
import org.openconcerto.erp.generationDoc.SpreadSheetCellValueProvider; |
import org.openconcerto.erp.generationDoc.SpreadSheetCellValueProviderManager; |
import org.openconcerto.sql.model.SQLRowAccessor; |
import java.math.BigDecimal; |
public class ResteALivrerDocProvider implements SpreadSheetCellValueProvider { |
protected enum ResteProvider { |
RESTE, LIVRE_TOTAL, RESTE_CMD, LIVRE_TOTAL_CMD |
}; |
protected final ResteProvider type; |
public ResteALivrerDocProvider(ResteProvider t) { |
this.type = t; |
} |
@Override |
public Object getValue(SpreadSheetCellValueContext context) { |
SQLRowAccessor sqlRowAccessor = context.getRow(); |
return geTotalFromRow(sqlRowAccessor); |
} |
protected BigDecimal geTotalFromRow(SQLRowAccessor sqlRowAccessor) { |
BigDecimal totalD; |
BigDecimal total = sqlRowAccessor.getBigDecimal("QTE_UNITAIRE"); |
total = total.multiply(new BigDecimal(sqlRowAccessor.getInt("QTE"))); |
if (this.type == ResteProvider.RESTE_CMD || this.type == ResteProvider.LIVRE_TOTAL_CMD) { |
totalD = new BigDecimal(sqlRowAccessor.getInt("QTE_LIVREE")); |
final BigDecimal returnedValue; |
if (this.type == ResteProvider.RESTE_CMD) { |
returnedValue = total.subtract(totalD); |
} else { |
returnedValue = totalD; |
} |
if (!sqlRowAccessor.isForeignEmpty("ID_ARTICLE") && returnedValue.signum() > 0) { |
return returnedValue; |
} else { |
return null; |
} |
} else { |
final SQLRowAccessor nonEmptyForeignCmdItem = sqlRowAccessor.getNonEmptyForeign("ID_COMMANDE_CLIENT_ELEMENT"); |
if (nonEmptyForeignCmdItem == null) { |
totalD = sqlRowAccessor.getBigDecimal("QTE_UNITAIRE"); |
totalD = totalD.multiply(new BigDecimal(sqlRowAccessor.getInt("QTE_LIVREE"))); |
return total.subtract(totalD); |
} else { |
totalD = nonEmptyForeignCmdItem.getBigDecimal("QTE_LIVREE"); |
} |
if (this.type == ResteProvider.LIVRE_TOTAL) { |
if (totalD.signum() > 0) { |
return totalD; |
} else { |
return null; |
} |
} else { |
BigDecimal r = total.subtract(totalD); |
if (r.signum() > 0) { |
return r; |
} else { |
return null; |
} |
} |
} |
} |
public static void register() { |
SpreadSheetCellValueProviderManager.put("sales.qty.delivred.total", new ResteALivrerDocProvider(ResteProvider.LIVRE_TOTAL)); |
SpreadSheetCellValueProviderManager.put("sales.qty.delivred.remained", new ResteALivrerDocProvider(ResteProvider.RESTE)); |
SpreadSheetCellValueProviderManager.put("sales.qty.cmd.delivred.total", new ResteALivrerDocProvider(ResteProvider.LIVRE_TOTAL_CMD)); |
SpreadSheetCellValueProviderManager.put("sales.qty.cmd.delivred.remained", new ResteALivrerDocProvider(ResteProvider.RESTE_CMD)); |
} |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/generationDoc/provider/RGProvider.java |
---|
New file |
0,0 → 1,76 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
* copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific |
* language governing permissions and limitations under the License. |
* |
* When distributing the software, include this License Header Notice in each file. |
*/ |
package org.openconcerto.erp.generationDoc.provider; |
import org.openconcerto.erp.generationDoc.SpreadSheetCellValueContext; |
import org.openconcerto.erp.generationDoc.SpreadSheetCellValueProvider; |
import org.openconcerto.erp.generationDoc.SpreadSheetCellValueProviderManager; |
import org.openconcerto.utils.DecimalUtils; |
import java.math.BigDecimal; |
import java.math.RoundingMode; |
public class RGProvider implements SpreadSheetCellValueProvider { |
private enum TypeRGProvider { |
HT_RESTANT(true, true), TTC_RESTANT(false, true), HT_RG(true, false), TTC_RG(false, false); |
private final boolean restant, ht; |
TypeRGProvider(boolean ht, boolean restant) { |
this.restant = restant; |
this.ht = ht; |
} |
public boolean isHt() { |
return this.ht; |
} |
public boolean isRestant() { |
return this.restant; |
} |
}; |
private final TypeRGProvider type; |
public RGProvider(TypeRGProvider t) { |
this.type = t; |
} |
public Object getValue(SpreadSheetCellValueContext context) { |
final BigDecimal total; |
if (this.type.isHt()) { |
total = new BigDecimal(context.getRow().getLong("T_HT")).movePointLeft(2); |
} else { |
total = new BigDecimal(context.getRow().getLong("T_TTC")).movePointLeft(2); |
} |
final BigDecimal pourcentRG = context.getRow().getBigDecimal("POURCENT_RG"); |
final BigDecimal totalRG = total.multiply(pourcentRG.movePointLeft(2), DecimalUtils.HIGH_PRECISION).setScale(2, RoundingMode.HALF_UP); |
if (this.type.isRestant()) { |
return total.subtract(totalRG); |
} else { |
return totalRG; |
} |
} |
public static void register() { |
SpreadSheetCellValueProviderManager.put("sales.rg.due", new RGProvider(TypeRGProvider.TTC_RG)); |
SpreadSheetCellValueProviderManager.put("sales.total.sub.rg", new RGProvider(TypeRGProvider.TTC_RESTANT)); |
SpreadSheetCellValueProviderManager.put("sales.rg.due.ht", new RGProvider(TypeRGProvider.HT_RG)); |
SpreadSheetCellValueProviderManager.put("sales.total.sub.rg.ht", new RGProvider(TypeRGProvider.HT_RESTANT)); |
} |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/generationDoc/provider/LabelAccountInvoiceProvider.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
22,12 → 22,18 |
public class LabelAccountInvoiceProvider implements SpreadSheetCellValueProvider { |
private final String label; |
public LabelAccountInvoiceProvider(String label) { |
this.label = label; |
} |
public Object getValue(SpreadSheetCellValueContext context) { |
final SQLRowAccessor row = context.getRow(); |
final Collection<? extends SQLRowAccessor> rows = row.getReferentRows(row.getTable().getTable("TR_COMMANDE_CLIENT")); |
String result; |
if (row.getBoolean("PARTIAL")) { |
result = "Facturation intermédiaire, commande N°"; |
result = this.label + ", commande N°"; |
} else { |
result = "Solde, commande N°"; |
} |
41,7 → 47,8 |
} |
public static void register() { |
SpreadSheetCellValueProviderManager.put("sales.account.label", new LabelAccountInvoiceProvider()); |
SpreadSheetCellValueProviderManager.put("sales.account.label", new LabelAccountInvoiceProvider("Facturation intermédiaire")); |
SpreadSheetCellValueProviderManager.put("sales.account.label.account", new LabelAccountInvoiceProvider("Facture d'acompte")); |
} |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/generationDoc/provider/BatchListProvider.java |
---|
New file |
0,0 → 1,80 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
* copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific |
* language governing permissions and limitations under the License. |
* |
* When distributing the software, include this License Header Notice in each file. |
*/ |
package org.openconcerto.erp.generationDoc.provider; |
import org.openconcerto.erp.generationDoc.SpreadSheetCellValueContext; |
import org.openconcerto.erp.generationDoc.SpreadSheetCellValueProviderManager; |
import org.openconcerto.sql.model.SQLRowAccessor; |
import java.text.DateFormat; |
import java.text.SimpleDateFormat; |
import java.util.Calendar; |
import java.util.Collection; |
public class BatchListProvider extends UserInitialsValueProvider { |
private final String refTable; |
public BatchListProvider(String refTable) { |
this.refTable = refTable; |
} |
@Override |
public Object getValue(SpreadSheetCellValueContext context) { |
final DateFormat format = new SimpleDateFormat("dd/MM/yyyy"); |
final SQLRowAccessor row = context.getRow(); |
final Collection<? extends SQLRowAccessor> cols = row.asRow().getReferentRows(row.getTable().getTable(this.refTable)); |
final StringBuilder res = new StringBuilder(); |
for (SQLRowAccessor sqlRowAccessor : cols) { |
final Calendar dluo = sqlRowAccessor.getDate("DLUO"); |
final Calendar dlc = sqlRowAccessor.getDate("DLC"); |
final String lot = sqlRowAccessor.getString("NUMERO_LOT"); |
final String serie = sqlRowAccessor.getString("NUMERO_SERIE"); |
if (res.length() > 0) { |
res.append("\n"); |
} |
if (serie != null && serie.trim().length() > 0) { |
res.append("N° Série : " + serie); |
} |
if (lot != null && lot.trim().length() > 0) { |
if (res.length() > 0) { |
res.append(", "); |
} |
res.append("N° Lot : " + lot); |
} |
if (dlc != null) { |
if (res.length() > 0) { |
res.append(", "); |
} |
res.append("DLC : " + format.format(dlc.getTime())); |
} |
if (dluo != null) { |
if (res.length() > 0) { |
res.append(", "); |
} |
res.append("DLUO : " + format.format(dluo.getTime())); |
} |
} |
return res.toString(); |
} |
public static void register() { |
SpreadSheetCellValueProviderManager.put("sales.batch.list", new BatchListProvider("LOT_LIVRAISON")); |
SpreadSheetCellValueProviderManager.put("purchase.batch.list", new BatchListProvider("LOT_RECEPTION")); |
} |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/generationDoc/OOgenerationListeXML.java |
---|
166,10 → 166,11 |
int nbPage = fillTable(tableau, liste, sheet, mapStyle, true, style); |
int firstLine = Integer.valueOf(tableau.getAttributeValue("firstLine")); |
int endLine = Integer.valueOf(tableau.getAttributeValue("endLine")); |
Object printRangeObj = sheet.getPrintRanges(); |
System.err.println("Nombre de page == " + nbPage); |
if (nbPage == 1) { |
if (nbPage == 1 || endLine == -1) { |
fillTable(tableau, liste, sheet, mapStyle, false, style); |
} else { |
233,6 → 234,8 |
int currentLine = Integer.valueOf(tableau.getAttributeValue("firstLine")); |
int endPageLine = Integer.valueOf(tableau.getAttributeValue("endPageLine")); |
int endLine = Integer.valueOf(tableau.getAttributeValue("endLine")); |
List listElts = tableau.getChildren("element"); |
Object o = null; |
241,8 → 244,15 |
Map<String, Double> mapSousTotal = new HashMap<String, Double>(); |
Map<String, Double> mapTotal = new HashMap<String, Double>(); |
// agrandissement selon le nombre de ligne à insérer |
if (endLine == -1) { |
sheet.setRowCount(currentLine + 1); |
sheet.setRowCount(currentLine + liste.size(), currentLine); |
// sheet.duplicateRows(currentLine+1, liste.size(), 1); |
endPageLine = currentLine + 1 + liste.size(); |
} |
// on remplit chaque ligne à partir des rows recuperées |
for (int i = 0; i < liste.size(); i++) { |
Map<String, Object> mValues = liste.get(i); |
// System.err.println(mValues); |
402,6 → 412,15 |
private static Object resizeValue(Element elt, Object res) { |
{ |
String digitSize = elt.getAttributeValue("digitsFormat"); |
if (digitSize != null) { |
int size = Integer.valueOf(digitSize); |
if (res != null && res.toString().length() > 0) { |
res = String.format("%-" + size + "s", res).replace(' ', '0'); |
} |
} |
} |
{ |
String attributeValueMaxChar = elt.getAttributeValue("maxChar"); |
if (attributeValueMaxChar != null) { |
int maxChar = Integer.valueOf(attributeValueMaxChar); |
439,7 → 458,6 |
private static Object getValueOfComposant(Element eltField, Map<String, Object> mValues) { |
String field = eltField.getAttributeValue("name"); |
return mValues.get(field); |
} |
606,7 → 624,8 |
System.err.println("End column search : " + columnCount); |
int rowCount = (rowEnd > 0) ? rowEnd : sheet.getRowCount(); |
// Limite pour éviter les breakrepeated |
rowCount = Math.min(100, rowCount); |
System.err.println("End row search : " + rowCount); |
for (int i = 0; i < rowCount && (mapStyleDef.keySet().size() - 2) > mapStyleFounded.keySet().size(); i++) { |
/trunk/OpenConcerto/src/org/openconcerto/erp/generationDoc/SheetXml.java |
---|
185,7 → 185,7 |
@Override |
public void run(Object source) { |
EmailTemplate.askTemplate(null, table.getDBRoot(), new ValueListener() { |
EmailTemplate.askTemplate(null, table.getDBRoot(), table.getName(), new ValueListener() { |
@Override |
public void valueSelected(Object value) { |
/trunk/OpenConcerto/src/org/openconcerto/erp/generationDoc/gestcomm/OptionDocProcessor.java |
---|
61,14 → 61,20 |
BigDecimal totalHT = sqlRowValues.getBigDecimal("T_PV_HT"); |
final BigDecimal remisePercent = sqlRowValues.getBigDecimal("POURCENT_REMISE"); |
if (remisePercent != null && remisePercent.signum() > 0) { |
if (remisePercent != null && remisePercent.signum() > 0 && remisePercent.movePointLeft(2).compareTo(BigDecimal.ONE) != 0) { |
if (BigDecimal.ONE.subtract(remisePercent.movePointLeft(2)).signum() != 0) { |
totalHT = totalHT.divide(BigDecimal.ONE.subtract(remisePercent.movePointLeft(2)), org.openconcerto.utils.DecimalUtils.HIGH_PRECISION); |
} |
} |
// On ne recalcule pas le prix unitaire si la remise est de 100% sinon le prix |
// unitaire est à 0 et les provider de quantité n'affiche plus rien |
if (remisePercent == null || remisePercent.movePointLeft(2).compareTo(BigDecimal.ONE) != 0) { |
BigDecimal unitPrice = totalHT.divide(qte, DecimalUtils.HIGH_PRECISION); |
sqlRowValues.put("PV_HT", unitPrice); |
sqlRowValues.put("PRIX_METRIQUE_VT_1", unitPrice); |
} |
} |
} |
result.add(sqlRowValues); |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/generationEcritures/MouvementGED.java |
---|
New file |
0,0 → 1,48 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
* copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific |
* language governing permissions and limitations under the License. |
* |
* When distributing the software, include this License Header Notice in each file. |
*/ |
package org.openconcerto.erp.generationEcritures; |
import org.openconcerto.erp.core.edm.Attachment; |
import org.openconcerto.sql.model.DBRoot; |
import org.openconcerto.sql.model.SQLInsert; |
import org.openconcerto.sql.model.SQLTable; |
import org.openconcerto.sql.users.User; |
public class MouvementGED { |
private String url; |
private Mouvement mvt; |
public MouvementGED(String url) { |
this.url = url; |
} |
public void setEcriture(Mouvement mvt) { |
this.mvt = mvt; |
} |
public SQLInsert createInsert(DBRoot root, User user) { |
final SQLInsert insert = new SQLInsert(); |
final SQLTable table = root.getTable("ATTACHMENT"); |
insert.add(table.getField("SOURCE_TABLE"), "MOUVEMENT"); |
insert.add(table.getField("SOURCE_ID"), this.mvt.getId().intValue()); |
insert.add(table.getField("NAME"), this.url); |
insert.add(table.getField("FILENAME"), this.url); |
insert.add(table.getField("MIMETYPE"), Attachment.MIMETYPE_URL); |
insert.add(table.getField("FILESIZE"), 0); |
insert.add(table.getField("STORAGE_PATH"), ""); |
insert.add(table.getField("STORAGE_FILENAME"), ""); |
return insert; |
} |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/generationEcritures/GenerationMvtFichePaye.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
57,7 → 57,7 |
private Map<String, SQLTable> mapTableSource = new HashMap<String, SQLTable>(); |
public GenerationMvtFichePaye(int[] idFichePaye, String mois, String annee) throws SQLException { |
public GenerationMvtFichePaye(int[] idFichePaye, String mois, String annee, Date d) throws SQLException { |
setRowAnalytiqueSource(null); |
SQLTable tableNet = Configuration.getInstance().getBase().getTable("RUBRIQUE_NET"); |
73,6 → 73,7 |
this.idFichePaye = idFichePaye; |
this.annee = annee; |
this.mois = mois; |
this.date = d; |
this.idMvt = getNewMouvement("", 1, 1, "Paye " + this.mois + " " + this.annee); |
new Thread(GenerationMvtFichePaye.this).start(); |
} |
98,7 → 99,7 |
// SQLRow rowFiche = |
// Configuration.getInstance().getBase().getTable("FICHE_PAYE").getRow(this.idFichePaye); |
// iniatilisation des valeurs de la map |
this.date = new Date(); |
// this.date = new Date(); |
// SQLRow rowMois = tableMois.getRow(rowFiche.getInt("ID_MOIS")); |
// SQLRow rowSal = tableSalarie.getRow(rowFiche.getInt("ID_SALARIE")); |
348,15 → 349,19 |
Tuple2<Integer, Integer> t = mapCaisse.get(idCaisse); |
// on recupere les comptes tiers et charge de la caisse associée |
int idCompteCharge = (t == null ? ComptePCESQLElement.getId("645") : t.get0()); |
// } |
int idCompteCharge; |
if (rowSource.getString("NUMERO_COMPTE_PCE_CHARGES") != null && rowSource.getString("NUMERO_COMPTE_PCE_CHARGES").trim().length() > 0) { |
idCompteCharge = ComptePCESQLElement.getId(rowSource.getString("NUMERO_COMPTE_PCE_CHARGES")); |
} else { |
idCompteCharge = (t == null ? ComptePCESQLElement.getId("645") : t.get0()); |
} |
int idCompteTiers; |
if (rowSource.getString("NUMERO_COMPTE_PCE") != null && rowSource.getString("NUMERO_COMPTE_PCE").trim().length() > 0) { |
idCompteTiers = ComptePCESQLElement.getId(rowSource.getString("NUMERO_COMPTE_PCE")); |
} else { |
idCompteTiers = (t == null ? ComptePCESQLElement.getId("437") : t.get1()); |
} |
// int idCompteTiers = rowCaisse.getInt("ID_COMPTE_PCE_TIERS"); |
// if (idCompteTiers <= 1) { |
int idCompteTiers = (t == null ? ComptePCESQLElement.getId("437") : t.get1()); |
// int idCompteTiers = ComptePCESQLElement.getId("437"); |
// } |
// Cotisations sal. |
if (row.getObject("MONTANT_SAL_DED") != null && row.getFloat("MONTANT_SAL_DED") != 0) { |
/trunk/OpenConcerto/src/org/openconcerto/erp/generationEcritures/GenerationMvtFactureFournisseur.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
22,14 → 22,14 |
import org.openconcerto.sql.model.SQLRowAccessor; |
import org.openconcerto.sql.model.SQLRowValues; |
import org.openconcerto.sql.model.SQLTable; |
import org.openconcerto.utils.ExceptionHandler; |
import java.math.BigDecimal; |
import java.math.RoundingMode; |
import java.sql.SQLException; |
import java.util.Date; |
import java.util.Map; |
public class GenerationMvtFactureFournisseur extends GenerationEcritures implements Runnable { |
public class GenerationMvtFactureFournisseur extends GenerationEcritures { |
public static final String ID = "accounting.records.supplychain.order"; |
42,18 → 42,18 |
private static final SQLTable tableMvt = base.getTable("MOUVEMENT"); |
private static final SQLRow rowPrefsCompte = tablePrefCompte.getRow(2); |
public GenerationMvtFactureFournisseur(SQLRow row, int idMvt) { |
public GenerationMvtFactureFournisseur(SQLRow row, int idMvt) throws SQLException { |
setRowAnalytiqueSource(row); |
this.idFacture = row.getID(); |
this.idMvt = idMvt; |
(new Thread(GenerationMvtFactureFournisseur.this)).start(); |
genereMouvement(); |
} |
public GenerationMvtFactureFournisseur(SQLRow row) { |
public GenerationMvtFactureFournisseur(SQLRow row) throws SQLException { |
this(row, 1); |
} |
public void genereMouvement() throws Exception { |
public void genereMouvement() throws SQLException { |
SQLRow saisieRow = getRowAnalytiqueSource(); |
// SQLRow taxeRow = base.getTable("TAXE").getRow(saisieRow.getInt("ID_TAXE")); |
203,11 → 203,4 |
} |
public void run() { |
try { |
genereMouvement(); |
} catch (Exception e) { |
ExceptionHandler.handle("Erreur pendant la générations des écritures comptables", e); |
} |
} |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/generationEcritures/GenerationMvtReglementFactureFournisseur.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
38,7 → 38,7 |
import java.util.Map; |
// FIXME mettre toute les generations dans des threads à part |
public final class GenerationMvtReglementFactureFournisseur extends GenerationEcritures implements Runnable { |
public final class GenerationMvtReglementFactureFournisseur extends GenerationEcritures { |
private int idfacture; |
50,13 → 50,13 |
private static final SQLRow rowPrefsCompte = tablePrefCompte.getRow(2); |
private int idPere = 1; // Id du mouvement pere |
public GenerationMvtReglementFactureFournisseur(int idFacture, int idMvt) { |
public GenerationMvtReglementFactureFournisseur(int idFacture, int idMvt) throws SQLException { |
this.idfacture = idFacture; |
this.idPere = idMvt; |
new Thread(GenerationMvtReglementFactureFournisseur.this).start(); |
genereReglement(); |
} |
private void genereReglement() throws Exception { |
private void genereReglement() throws SQLException { |
System.out.println("Génération des ecritures du reglement du mouvement " + this.idMvt); |
249,7 → 249,7 |
public void run() { |
try { |
genereReglement(); |
} catch (Exception e) { |
ExceptionHandler.handle("Erreur pendant la générations des écritures comptables", e); |
e.printStackTrace(); |
/trunk/OpenConcerto/src/org/openconcerto/erp/generationEcritures/GenerationMvtAvoirClient.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
19,6 → 19,7 |
import org.openconcerto.erp.core.finance.accounting.element.JournalSQLElement; |
import org.openconcerto.erp.generationEcritures.provider.AccountingRecordsProvider; |
import org.openconcerto.erp.generationEcritures.provider.AccountingRecordsProviderManager; |
import org.openconcerto.erp.preferences.DefaultNXProps; |
import org.openconcerto.sql.Configuration; |
import org.openconcerto.sql.model.SQLRow; |
import org.openconcerto.sql.model.SQLRowAccessor; |
52,6 → 53,7 |
} |
public int genereMouvement() throws Exception { |
boolean genEcrDisabled = DefaultNXProps.getInstance().getBooleanValue(GenerationMvtSaisieVenteFacture.NOT_GEN_ECRITURE, false); |
SQLTable avoirClientTable = base.getTable("AVOIR_CLIENT"); |
120,7 → 122,9 |
this.putValue("ID_COMPTE_PCE", rowCompl.getForeignID("ID_COMPTE_PCE")); |
this.putValue("CREDIT", Long.valueOf(0)); |
this.putValue("DEBIT", Long.valueOf(taxeC)); |
if (!genEcrDisabled) { |
ajoutEcriture(); |
} |
taxe += taxeC; |
// this.putValue("ID_COMPTE_PCE", |
// rowCompl.getForeignID("ID_COMPTE_PCE_PRODUITS")); |
134,10 → 138,12 |
this.putValue("ID_COMPTE_PCE", row.getID()); |
this.putValue("DEBIT", Long.valueOf(b - taxe)); |
this.putValue("CREDIT", Long.valueOf(0)); |
if (!genEcrDisabled) { |
SQLRow rowEcr = ajoutEcriture(); |
// addAssocAnalytiqueFromProvider(rowEcr, avoirRow); |
} |
} |
} |
// compte TVA |
Map<SQLRowAccessor, BigDecimal> tvaMap = calc.getMapHtTVA(); |
147,9 → 153,11 |
this.putValue("ID_COMPTE_PCE", rowAc.getID()); |
this.putValue("DEBIT", Long.valueOf(longValue)); |
this.putValue("CREDIT", Long.valueOf(0)); |
if (!genEcrDisabled) { |
ajoutEcriture(); |
} |
} |
} |
// compte Clients |
int idCompteClient = avoirRow.getForeignRow("ID_CLIENT").getInt("ID_COMPTE_PCE"); |
164,8 → 172,9 |
this.putValue("DEBIT", Long.valueOf(0)); |
long ttc = calc.getTotalTTC().movePointRight(2).longValue(); |
this.putValue("CREDIT", Long.valueOf(ttc)); |
if (!genEcrDisabled) { |
ajoutEcriture(); |
} |
// Mise à jour de mouvement associé à la facture d'avoir |
SQLRowValues valAvoir = new SQLRowValues(avoirClientTable); |
valAvoir.put("ID_MOUVEMENT", Integer.valueOf(this.idMvt)); |
179,8 → 188,9 |
this.putValue("ID_COMPTE_PCE", Integer.valueOf(idCompteClient)); |
this.putValue("DEBIT", Long.valueOf(ttc)); |
this.putValue("CREDIT", Long.valueOf(0)); |
if (!genEcrDisabled) { |
ajoutEcriture(); |
} |
// compte Factor |
int idComptefactor = rowPrefsCompte.getInt("ID_COMPTE_PCE_FACTOR"); |
if (idComptefactor <= 1) { |
197,8 → 207,10 |
this.putValue("ID_COMPTE_PCE", idComptefactor); |
this.putValue("DEBIT", Long.valueOf(0)); |
this.putValue("CREDIT", Long.valueOf(ttc)); |
if (!genEcrDisabled) { |
ajoutEcriture(); |
} |
} |
if (avoirRow.getInt("ID_MODE_REGLEMENT") > 1) { |
new GenerationMvtReglementAvoir(avoirRow, this.idMvt); |
/trunk/OpenConcerto/src/org/openconcerto/erp/generationEcritures/Ecriture.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
31,6 → 31,7 |
private BigDecimal credit; |
private Mouvement mouvement; |
private String nom; |
private String nomPieceCommerciale; |
private String compteNumero; |
private String compteNom; |
private Number compteID; |
50,6 → 51,7 |
this.date = date; |
this.debit = debit; |
this.credit = credit; |
this.nomPieceCommerciale = ""; |
} |
public SQLInsert createInsert(DBRoot root, User user) { |
79,7 → 81,7 |
insert.add(table.getField("ID_JOURNAL"), this.journalID); |
insert.add(table.getField("JOURNAL_NOM"), this.journalNom); |
insert.add(table.getField("JOURNAL_CODE"), this.journalCode); |
insert.add(table.getField("NOM_PIECE"), this.mouvement.getPiece().getNom()); |
insert.add(table.getField("NOM_PIECE"), this.nomPieceCommerciale); |
insert.add(table.getField("ID_USER_COMMON_CREATE"), user.getId()); |
insert.add(table.getField("ID_USER_COMMON_MODIFY"), user.getId()); |
insert.add(table.getField("CLOTURE"), this.cloture); |
104,6 → 106,14 |
this.dateLettrage = dateLettrage; |
} |
public void setNomPieceCommerciale(String nomPieceCommerciale) { |
this.nomPieceCommerciale = nomPieceCommerciale; |
} |
public String getNomPieceCommerciale() { |
return this.nomPieceCommerciale; |
} |
public void setLettrage(String lettrage) { |
this.lettrage = lettrage; |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/generationEcritures/GenerationReglementVenteNG.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
26,6 → 26,7 |
import org.openconcerto.erp.generationEcritures.provider.AccountingRecordsProvider; |
import org.openconcerto.erp.generationEcritures.provider.AccountingRecordsProviderManager; |
import org.openconcerto.erp.model.PrixTTC; |
import org.openconcerto.erp.preferences.DefaultNXProps; |
import org.openconcerto.erp.preferences.GestionCommercialeGlobalPreferencePanel; |
import org.openconcerto.sql.Configuration; |
import org.openconcerto.sql.element.SQLElement; |
161,6 → 162,12 |
// Cheque |
if (typeRegRow.getID() == TypeReglementSQLElement.CHEQUE) { |
final SQLRowAccessor nonEmptyForeign = modeReglement.getNonEmptyForeign("ID_BANQUE"); |
if (nonEmptyForeign != null && nonEmptyForeign.getTable().contains("TYPE_CAISSE") && nonEmptyForeign.getBoolean("TYPE_CAISSE")) { |
rowClient = null; |
cptTiers = nonEmptyForeign.getForeign("ID_COMPTE_PCE"); |
} |
Date dateTmp = this.date; |
if (modeReglement.getObject("DATE") != null) { |
dateTmp = modeReglement.getDate("DATE").getTime(); |
196,6 → 203,9 |
&& !this.rowPrefsCompte.isForeignEmpty("ID_JOURNAL_CB_ATTENTE")) { |
this.putValue("ID_JOURNAL", this.rowPrefsCompte.getForeignID("ID_JOURNAL_CB_ATTENTE")); |
} |
if (typeRegRow.contains("ID_COMPTE_PCE_CAISSE") && (rowClient == null || rowClient.isUndefined()) && !typeRegRow.isForeignEmpty("ID_COMPTE_PCE_CAISSE")) { |
this.putValue("ID_JOURNAL", JournalSQLElement.CAISSES); |
} |
int idCompteClient = cptTiers != null && !cptTiers.isUndefined() ? cptTiers.getID() : rowClient.getInt("ID_COMPTE_PCE"); |
if (avance) { |
214,11 → 224,23 |
} |
} |
} |
boolean genEcrDisabled = DefaultNXProps.getInstance().getBooleanValue(GenerationMvtSaisieVenteFacture.NOT_GEN_ECRITURE, false); |
if (typeRegRow.contains("ID_COMPTE_PCE_CAISSE") && (rowClient == null || rowClient.isUndefined()) && !typeRegRow.isForeignEmpty("ID_COMPTE_PCE_CAISSE")) { |
if (!modeReglement.isForeignEmpty("ID_BANQUE")) { |
rowClient = null; |
final SQLRow foreign = modeReglement.getForeign("ID_BANQUE"); |
if (foreign.getBoolean("TYPE_CAISSE")) { |
idCompteClient = foreign.getForeignID("ID_COMPTE_PCE"); |
} |
} |
} |
this.putValue("ID_COMPTE_PCE", idCompteClient); |
this.putValue("DEBIT", Long.valueOf(0)); |
this.putValue("CREDIT", Long.valueOf(ttc.getLongValue())); |
if (!genEcrDisabled) { |
this.ecrClient = ajoutEcriture(); |
} |
// compte de reglement, caisse, cheque, ... |
if (typeRegRow.getID() == TypeReglementSQLElement.ESPECE) { |
235,6 → 257,11 |
throw new SQLException(e); |
} |
} |
if (typeRegRow.contains("ID_COMPTE_PCE_CAISSE") && (rowClient == null || rowClient.isUndefined()) && !typeRegRow.isForeignEmpty("ID_COMPTE_PCE_CAISSE")) { |
this.putValue("ID_COMPTE_PCE", typeRegRow.getForeignID("ID_COMPTE_PCE_CAISSE")); |
} |
if (typeRegRow.getID() == TypeReglementSQLElement.CB && this.rowPrefsCompte.getTable().contains("ID_COMPTE_PCE_CB_ATTENTE") |
&& !this.rowPrefsCompte.isForeignEmpty("ID_COMPTE_PCE_CB_ATTENTE")) { |
243,8 → 270,9 |
this.putValue("DEBIT", Long.valueOf(ttc.getLongValue())); |
this.putValue("CREDIT", Long.valueOf(0)); |
if (!genEcrDisabled) { |
ajoutEcriture(); |
} |
// FIXME remove getConf |
SQLRow rowSoc = ComptaPropsConfiguration.getInstanceCompta().getRowSociete(); |
if (rowSoc.getTable().contains("TVA_ENCAISSEMENT") && rowSoc.getBoolean("TVA_ENCAISSEMENT")) { |
259,12 → 287,16 |
this.putValue("ID_COMPTE_PCE", rowCompteTvaCol.getID()); |
this.putValue("DEBIT", Long.valueOf(tva)); |
this.putValue("CREDIT", Long.valueOf(0)); |
if (!genEcrDisabled) { |
ajoutEcriture(); |
} |
this.putValue("ID_COMPTE_PCE", rowCompteTvaEnc.getID()); |
this.putValue("DEBIT", Long.valueOf(0)); |
this.putValue("CREDIT", Long.valueOf(tva)); |
if (!genEcrDisabled) { |
ajoutEcriture(); |
} |
} |
} |
294,10 → 326,11 |
this.idMvt = getNewMouvement("ECHEANCE_CLIENT", 1, mvtSource.getID(), mvtSource.getInt("ID_PIECE")); |
valEcheance.put("ID_MOUVEMENT", Integer.valueOf(this.idMvt)); |
valEcheance.put("DATE", dateEch); |
valEcheance.put("RG", modeReglement.getBoolean("RG")); |
valEcheance.put("MONTANT", Long.valueOf(ttc.getLongValue())); |
valEcheance.put("ID_CLIENT", rowClient == null ? null : rowClient.getID()); |
valEcheance.put("TIERS", tiers); |
valEcheance.put("ID_COMPTE_PCE_TIERS", cptTiers == null || !cptTiers.isUndefined() ? null : cptTiers.getID()); |
valEcheance.put("ID_COMPTE_PCE_TIERS", cptTiers == null || cptTiers.isUndefined() ? mvtSource.getTable().getTable("COMPTE_PCE").getUndefinedIDNumber() : cptTiers.getID()); |
if (source.getTable().equals(tableSaisieVenteFacture)) { |
valEcheance.put("ID_SAISIE_VENTE_FACTURE", source.getID()); |
} |
370,6 → 403,9 |
} |
public void doLettrageAuto(final SQLRowAccessor source, Date dateLettrage) { |
if (this.ecrClient != null) { |
// A. On lettre les critures client (facture ET reglement) |
// A1. Recherche criture client de facturation |
421,6 → 457,7 |
e.printStackTrace(); |
} |
} |
} |
private void paiementCheque(Date dateEch, SQLRow source, PrixTTC ttc, SQLRow rowClient, SQLRow modeRegl, SQLRow mvtSource, boolean avance, String tiers, SQLRowAccessor cptTiers) |
throws SQLException { |
477,6 → 514,21 |
if (rowPrefsCompte.getObject("ID_JOURNAL_VALEUR_ENCAISSEMENT") != null && !rowPrefsCompte.isForeignEmpty("ID_JOURNAL_VALEUR_ENCAISSEMENT")) { |
idJournal = rowPrefsCompte.getForeignID("ID_JOURNAL_VALEUR_ENCAISSEMENT"); |
} |
// compte de reglement, caisse, cheque, ... |
int idCompteRegl = rowPrefsCompte.getInt("ID_COMPTE_PCE_VALEUR_ENCAISSEMENT"); |
if (idCompteRegl <= 1) { |
idCompteRegl = ComptePCESQLElement.getIdComptePceDefault("ValeurEncaissement"); |
} |
if (modeRegl != null) { |
final SQLRowAccessor nonEmptyForeign = modeRegl.getNonEmptyForeign("ID_BANQUE"); |
if (nonEmptyForeign != null && nonEmptyForeign.getTable().contains("TYPE_CAISSE") && nonEmptyForeign.getBoolean("TYPE_CAISSE")) { |
final SQLRow rowTypeREgl = tableMouvement.getTable("TYPE_REGLEMENT").getRow(TypeReglementSQLElement.CHEQUE); |
if (rowTypeREgl.contains("ID_COMPTE_PCE_CAISSE") && (rowClient == null || rowClient.isUndefined()) && !rowTypeREgl.isForeignEmpty("ID_COMPTE_PCE_CAISSE")) { |
idCompteRegl = rowTypeREgl.getForeignID("ID_COMPTE_PCE_CAISSE"); |
idJournal = JournalSQLElement.CAISSES; |
} |
} |
} |
this.putValue("ID_JOURNAL", idJournal); |
this.putValue("ID_COMPTE_PCE", idCompteClient); |
483,13 → 535,10 |
this.putValue("DEBIT", Long.valueOf(0)); |
this.putValue("CREDIT", Long.valueOf(ttc.getLongValue())); |
boolean genEcrDisabled = DefaultNXProps.getInstance().getBooleanValue(GenerationMvtSaisieVenteFacture.NOT_GEN_ECRITURE, false); |
if (!genEcrDisabled) { |
this.ecrClient = ajoutEcriture(); |
// compte de reglement, caisse, cheque, ... |
int idCompteRegl = rowPrefsCompte.getInt("ID_COMPTE_PCE_VALEUR_ENCAISSEMENT"); |
if (idCompteRegl <= 1) { |
idCompteRegl = ComptePCESQLElement.getIdComptePceDefault("ValeurEncaissement"); |
} |
this.putValue("ID_COMPTE_PCE", Integer.valueOf(idCompteRegl)); |
this.putValue("DEBIT", Long.valueOf(ttc.getLongValue())); |
this.putValue("CREDIT", Long.valueOf(0)); |
496,6 → 545,7 |
ajoutEcriture(); |
} |
} |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/generationEcritures/GenerationMvtSaisieVenteFacture.java |
---|
16,15 → 16,20 |
import org.openconcerto.erp.core.common.ui.TotalCalculator; |
import org.openconcerto.erp.core.finance.accounting.element.ComptePCESQLElement; |
import org.openconcerto.erp.core.finance.accounting.element.JournalSQLElement; |
import org.openconcerto.erp.core.finance.payment.element.TypeReglementSQLElement; |
import org.openconcerto.erp.core.finance.tax.model.TaxeCache; |
import org.openconcerto.erp.generationDoc.SheetXml; |
import org.openconcerto.erp.core.finance.tax.model.TaxeCache; |
import org.openconcerto.erp.generationEcritures.provider.AccountingRecordsProvider; |
import org.openconcerto.erp.generationEcritures.provider.AccountingRecordsProviderManager; |
import org.openconcerto.erp.model.PrixTTC; |
import org.openconcerto.erp.preferences.DefaultNXProps; |
import org.openconcerto.erp.preferences.GestionCommercialeGlobalPreferencePanel; |
import org.openconcerto.sql.model.SQLRow; |
import org.openconcerto.sql.model.SQLRowAccessor; |
import org.openconcerto.sql.model.SQLRowValues; |
import org.openconcerto.sql.model.SQLTable; |
import org.openconcerto.sql.preferences.SQLPreferences; |
import org.openconcerto.utils.DecimalUtils; |
import org.openconcerto.utils.ExceptionHandler; |
import org.openconcerto.utils.StringUtils; |
42,6 → 47,7 |
public class GenerationMvtSaisieVenteFacture extends GenerationEcritures implements Runnable { |
public static final String ID = "accounting.records.invoice.sales"; |
public static final String NOT_GEN_ECRITURE = "accounting.invoice.generation.disable"; |
private static final String source = "SAISIE_VENTE_FACTURE"; |
public static final Integer journal = Integer.valueOf(JournalSQLElement.VENTES); |
private int idSaisieVenteFacture; |
99,13 → 105,10 |
SQLRow saisieRow = GenerationMvtSaisieVenteFacture.saisieVFTable.getRow(this.idSaisieVenteFacture); |
setRowAnalytiqueSource(saisieRow); |
boolean genEcrDisabled = DefaultNXProps.getInstance().getBooleanValue(GenerationMvtSaisieVenteFacture.NOT_GEN_ECRITURE, false); |
this.putValue("ID_JOURNAL", GenerationMvtSaisieVenteFacture.journal); |
SQLRow clientRow = saisieRow.getForeignRow("ID_CLIENT"); |
// Calcul des montants |
PrixTTC prixTTC = new PrixTTC(((Long) saisieRow.getObject("T_TTC")).longValue()); |
// Total des acomptes déjà versés sur la facture |
long montantAcompteTTC = 0; |
int idCompteClient = clientRow.getInt("ID_COMPTE_PCE"); |
Boolean acompte = saisieRow.getBoolean("ACOMPTE"); |
114,7 → 117,36 |
} else { |
this.nom = "Fact. vente " + saisieRow.getObject("NUMERO").toString(); |
} |
boolean typeCaisse = false; |
SQLRow modeRegl = saisieRow.getForeignRow("ID_MODE_REGLEMENT"); |
final SQLRow typeRegRow = modeRegl.getForeignRow("ID_TYPE_REGLEMENT"); |
final SQLRowAccessor nonEmptyForeign = modeRegl.getNonEmptyForeign("ID_BANQUE"); |
if (nonEmptyForeign != null && nonEmptyForeign.getTable().contains("TYPE_CAISSE") && nonEmptyForeign.getBoolean("TYPE_CAISSE")) { |
typeCaisse = true; |
idCompteClient = nonEmptyForeign.getForeignID("ID_COMPTE_PCE"); |
Number idJournal = nonEmptyForeign.getNonEmptyForeignIDNumber("ID_JOURNAL"); |
if (idJournal != null) { |
this.putValue("ID_JOURNAL", idJournal); |
} else { |
this.putValue("ID_JOURNAL", JournalSQLElement.CAISSES); |
} |
this.nom += " (" + typeRegRow.getString("NOM") + ") " + StringUtils.limitLength(clientRow.getString("NOM"), 20); |
} else { |
this.nom += " " + StringUtils.limitLength(clientRow.getString("NOM"), 20); |
} |
if (SQLPreferences.getMemCached(saisieRow.getTable().getDBRoot()).getBoolean(GestionCommercialeGlobalPreferencePanel.ECRITURE_FACTURE_REF_LIBELLE, false)) { |
if (saisieRow.getString("NOM") != null && saisieRow.getString("NOM").trim().length() > 0) |
this.nom += " " + StringUtils.limitLength(saisieRow.getString("NOM"), 30); |
} |
// Calcul des montants |
PrixTTC prixTTC = new PrixTTC(((Long) saisieRow.getObject("T_TTC")).longValue()); |
// Total des acomptes déjà versés sur la facture |
long montantAcompteTTC = 0; |
this.putValue("NOM", this.nom); |
// iniatilisation des valeurs de la map |
123,7 → 155,7 |
provider.putLabel(saisieRow, this.mEcritures); |
this.putValue("DATE", this.date); |
this.putValue("ID_JOURNAL", GenerationMvtSaisieVenteFacture.journal); |
this.putValue("ID_MOUVEMENT", Integer.valueOf(1)); |
// on calcule le nouveau numero de mouvement |
176,7 → 208,9 |
this.putValue("ID_COMPTE_PCE", rowCompl.getForeignID("ID_COMPTE_PCE")); |
this.putValue("DEBIT", Long.valueOf(0)); |
this.putValue("CREDIT", Long.valueOf(taxeC)); |
if (!genEcrDisabled) { |
ajoutEcriture(); |
} |
taxe += taxeC; |
// this.putValue("ID_COMPTE_PCE", |
// rowCompl.getForeignID("ID_COMPTE_PCE_PRODUITS")); |
197,9 → 231,11 |
this.putValue("ID_COMPTE_PCE", idComptePCE); |
this.putValue("DEBIT", Long.valueOf(0)); |
this.putValue("CREDIT", Long.valueOf(b - taxe)); |
if (!genEcrDisabled) { |
ajoutEcriture(); |
} |
} |
} |
Map<SQLRowAccessor, BigDecimal> tvaMap = calc.getMapHtTVA(); |
for (SQLRowAccessor rowAc : tvaMap.keySet()) { |
208,9 → 244,11 |
this.putValue("ID_COMPTE_PCE", rowAc.getID()); |
this.putValue("DEBIT", Long.valueOf(0)); |
this.putValue("CREDIT", longValue); |
if (!genEcrDisabled) { |
ajoutEcriture(); |
} |
} |
} |
// compte Clients |
226,7 → 264,9 |
} |
this.putValue("DEBIT", ttcLongValue); |
this.putValue("CREDIT", Long.valueOf(0)); |
if (!genEcrDisabled) { |
ajoutEcriture(); |
} |
// TODO Gestion des factures d'acomptes |
// Solde des acomptes |
303,9 → 343,8 |
if (genereReglement) { |
// Génération du reglement |
SQLRow modeRegl = saisieRow.getForeignRow("ID_MODE_REGLEMENT"); |
final SQLRow typeRegRow = modeRegl.getForeignRow("ID_TYPE_REGLEMENT"); |
String label = this.nom + " (" + typeRegRow.getString("NOM") + ") " + StringUtils.limitLength(clientRow.getString("NOM"), 20); |
String label = this.nom + " (" + typeRegRow.getString("NOM") + ") "; |
int idAvoir = saisieRow.getInt("ID_AVOIR_CLIENT"); |
if (idAvoir > 1) { |
// SQLRow avoirRow = base.getTable("AVOIR_CLIENT").getRow(idAvoir); |
312,11 → 351,46 |
long l = ((Number) saisieRow.getObject("T_AVOIR_TTC")).longValue(); |
prixTTC = new PrixTTC(((Long) saisieRow.getObject("T_TTC")).longValue() - l); |
} |
prixTTC = new PrixTTC(saisieRow.getLong("NET_A_PAYER")); |
final long totalNet = saisieRow.getLong("NET_A_PAYER"); |
final SQLRow rowClient; |
final SQLRow rowCptTiers; |
if (typeCaisse) { |
rowClient = null; |
rowCptTiers = modeRegl.getForeign("ID_BANQUE").getForeign("ID_COMPTE_PCE"); |
} else { |
rowClient = clientRow; |
rowCptTiers = null; |
} |
final String tiers = clientRow.getString("NOM"); |
if (saisieRow.contains("POURCENT_RG") && saisieRow.getBigDecimal("POURCENT_RG") != null && saisieRow.getBigDecimal("POURCENT_RG").signum() != 0) { |
long totalRG = new BigDecimal(totalNet).multiply(saisieRow.getBigDecimal("POURCENT_RG"), DecimalUtils.HIGH_PRECISION).movePointLeft(2).setScale(0, RoundingMode.HALF_UP) |
.longValue(); |
PrixTTC prixRG = new PrixTTC(totalRG); |
prixTTC = new PrixTTC(totalNet - totalRG); |
if (prixTTC.getLongValue() > 0) { |
new GenerationReglementVenteNG(label.trim(), clientRow, prixTTC, this.date, modeRegl, saisieRow, mvtTable.getRow(idMvt)); |
new GenerationReglementVenteNG(label.trim(), rowClient, prixTTC, this.date, modeRegl, saisieRow, mvtTable.getRow(idMvt), true, false, tiers, rowCptTiers); |
} |
if (prixRG.getLongValue() > 0) { |
SQLRowValues rowValsMdrRg = new SQLRowValues(modeRegl.getTable()); |
rowValsMdrRg.put("AJOURS", 365); |
rowValsMdrRg.put("LENJOUR", 0); |
rowValsMdrRg.put("COMPTANT", Boolean.FALSE); |
rowValsMdrRg.put("FIN_MOIS", Boolean.FALSE); |
rowValsMdrRg.put("DATE_FACTURE", Boolean.TRUE); |
rowValsMdrRg.put("RG", Boolean.TRUE); |
rowValsMdrRg.put("ID_TYPE_REGLEMENT", TypeReglementSQLElement.INDEFINI); |
final SQLRow rowMdrRG = rowValsMdrRg.commit(); |
new GenerationReglementVenteNG(label.trim(), rowClient, prixRG, this.date, rowMdrRG, saisieRow, mvtTable.getRow(idMvt), true, false, tiers, rowCptTiers); |
} |
} else { |
prixTTC = new PrixTTC(totalNet); |
if (prixTTC.getLongValue() > 0) { |
new GenerationReglementVenteNG(label.trim(), rowClient, prixTTC, this.date, modeRegl, saisieRow, mvtTable.getRow(idMvt), true, false, tiers, rowCptTiers); |
} |
} |
} |
// Mise à jour de mouvement associé à la facture |
SQLRowValues valSasieVF = new SQLRowValues(GenerationMvtSaisieVenteFacture.saisieVFTable); |
/trunk/OpenConcerto/src/org/openconcerto/erp/generationEcritures/GenerationMvtSaisieKm.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
61,7 → 61,7 |
getNewMouvement(GenerationMvtSaisieKm.source, this.idSaisieKm, 1, rowValsPiece); |
// gnération des ecritures |
SQLTable tableElt = Configuration.getInstance().getRoot().findTable("SAISIE_KM_ELEMENT"); |
SQLTable tableElt = table.getDBRoot().findTable("SAISIE_KM_ELEMENT"); |
List<SQLRow> set = saisieRow.getReferentRows(tableElt); |
SQLTable tableAssoc = Configuration.getInstance().getRoot().findTable("ASSOCIATION_ANALYTIQUE"); |
70,6 → 70,9 |
int idCpt = ComptePCESQLElement.getId(rowElement.getString("NUMERO"), rowElement.getString("NOM")); |
if (ecritureTable.contains("DATE_ECHEANCE") && table.getDBRoot().findTable("SAISIE_KM_ELEMENT").contains("DATE_ECHEANCE")) { |
this.putValue("DATE_ECHEANCE", rowElement.getObject("DATE_ECHEANCE")); |
} |
// Ajout de l'écriture |
this.putValue("ID_COMPTE_PCE", new Integer(idCpt)); |
this.putValue("NOM", rowElement.getString("NOM_ECRITURE")); |
/trunk/OpenConcerto/src/org/openconcerto/erp/generationEcritures/GenerationMvtDepotChequeClient.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
28,6 → 28,9 |
import org.openconcerto.erp.core.common.element.BanqueSQLElement; |
import org.openconcerto.erp.core.finance.accounting.element.ComptePCESQLElement; |
import org.openconcerto.erp.core.finance.accounting.element.JournalSQLElement; |
import org.openconcerto.erp.core.finance.payment.element.TypeReglementSQLElement; |
import org.openconcerto.erp.preferences.DefaultNXProps; |
import org.openconcerto.sql.model.SQLRow; |
import org.openconcerto.sql.model.SQLRowAccessor; |
import org.openconcerto.sql.model.SQLRowValues; |
90,7 → 93,21 |
int idJrnl = this.banque.getForeignID("ID_JOURNAL"); |
this.putValue("ID_JOURNAL", idJrnl); |
} |
if (!depot.isForeignEmpty("ID_" + BanqueSQLElement.TABLENAME)) { |
SQLRow rowBanque = depot.getForeignRow("ID_" + BanqueSQLElement.TABLENAME); |
if (rowBanque.getTable().contains("TYPE_CAISSE") && rowBanque.getBoolean("TYPE_CAISSE")) { |
final SQLRow row = rowBanque.getTable().getTable("TYPE_REGLEMENT").getRow(TypeReglementSQLElement.CHEQUE); |
if (row.getTable().contains("ID_COMPTE_PCE_CAISSE")) { |
Number n = row.getNonEmptyForeignIDNumber("ID_COMPTE_PCE_CAISSE"); |
if (n != null) { |
this.putValue("ID_JOURNAL", JournalSQLElement.CAISSES); |
} |
} |
} |
} |
boolean genEcrDisabled = DefaultNXProps.getInstance().getBooleanValue(GenerationMvtSaisieVenteFacture.NOT_GEN_ECRITURE, false); |
List<Integer> pieceIDs = new ArrayList<Integer>(); |
SQLRowValues rowValsDepotElt = new SQLRowValues(depot.getTable().getTable("DEPOT_CHEQUE_ELEMENT")); |
rowValsDepotElt.putNulls("MONTANT", "TIERS", "PIECE"); |
131,20 → 148,36 |
this.putValue("ID_COMPTE_PCE", new Integer(idCompteClient)); |
this.putValue("DEBIT", new Long(0)); |
this.putValue("CREDIT", new Long(sqlRowAccessor.getLong("MONTANT"))); |
if (!genEcrDisabled) { |
SQLRow insertedRow = ajoutEcriture(); |
sqlRowAccessor.createEmptyUpdateRow().put("ID_ECRITURE", insertedRow.getID()).getGraph().store(StoreMode.COMMIT, false); |
} |
sqlRowAccessor.getForeign("ID_CHEQUE_A_ENCAISSER").createEmptyUpdateRow().put("ENCAISSE", Boolean.TRUE).getGraph().store(StoreMode.COMMIT, false); |
} |
// compte de reglement cheque, ... |
fillCompteBanqueFromRow(depot, "VenteCheque", false); |
if (!depot.isForeignEmpty("ID_" + BanqueSQLElement.TABLENAME)) { |
SQLRow rowBanque = depot.getForeignRow("ID_" + BanqueSQLElement.TABLENAME); |
if (rowBanque.getTable().contains("TYPE_CAISSE") && rowBanque.getBoolean("TYPE_CAISSE")) { |
final SQLRow row = rowBanque.getTable().getTable("TYPE_REGLEMENT").getRow(TypeReglementSQLElement.CHEQUE); |
if (row.getTable().contains("ID_COMPTE_PCE_CAISSE")) { |
Number n = row.getNonEmptyForeignIDNumber("ID_COMPTE_PCE_CAISSE"); |
if (n != null) { |
this.putValue("ID_COMPTE_PCE", n); |
} |
} |
} |
} |
this.putValue("NOM", this.nom); |
this.putValue("DEBIT", new Long(this.montant)); |
this.putValue("CREDIT", new Long(0)); |
if (!genEcrDisabled) { |
SQLRow insertedRow = ajoutEcriture(); |
depot.createEmptyUpdateRow().put("ID_MOUVEMENT", idMvt).put("ID_ECRITURE", insertedRow.getID()).getGraph().store(StoreMode.COMMIT, false); |
} else { |
depot.createEmptyUpdateRow().put("ID_MOUVEMENT", idMvt).getGraph().store(StoreMode.COMMIT, false); |
} |
pieceIDs.add(mouvementTable.getRow(idMvt).getForeignID("ID_PIECE")); |
lettrageAuto(pieceIDs, this.date); |
/trunk/OpenConcerto/src/org/openconcerto/erp/generationEcritures/provider/SalesInvoiceAccountingRecordsProvider.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
15,9 → 15,11 |
import org.openconcerto.erp.config.ComptaPropsConfiguration; |
import org.openconcerto.erp.generationEcritures.GenerationMvtSaisieVenteFacture; |
import org.openconcerto.erp.preferences.GestionCommercialeGlobalPreferencePanel; |
import org.openconcerto.sql.Configuration; |
import org.openconcerto.sql.model.SQLRowAccessor; |
import org.openconcerto.sql.model.SQLRowValues; |
import org.openconcerto.sql.preferences.SQLPreferences; |
import org.openconcerto.utils.StringUtils; |
import java.util.Map; |
40,7 → 42,21 |
} else { |
nom = "Fact. vente " + rowSource.getObject("NUMERO").toString(); |
} |
SQLRowAccessor modeRegl = rowSource.getForeign("ID_MODE_REGLEMENT"); |
final SQLRowAccessor typeRegRow = modeRegl.getForeign("ID_TYPE_REGLEMENT"); |
final SQLRowAccessor nonEmptyForeign = modeRegl.getNonEmptyForeign("ID_BANQUE"); |
if (nonEmptyForeign != null && nonEmptyForeign.getTable().contains("TYPE_CAISSE") && nonEmptyForeign.getBoolean("TYPE_CAISSE")) { |
nom += " (" + typeRegRow.getString("NOM") + ") "; |
} |
nom += " " + StringUtils.limitLength(rowSource.getForeign("ID_CLIENT").getString("NOM"), 20); |
if (SQLPreferences.getMemCached(rowSource.getTable().getDBRoot()).getBoolean(GestionCommercialeGlobalPreferencePanel.ECRITURE_FACTURE_REF_LIBELLE, false)) { |
if (rowSource.getString("NOM") != null && rowSource.getString("NOM").trim().length() > 0) |
nom += " " + StringUtils.limitLength(rowSource.getString("NOM"), 30); |
} |
values.put("NOM", nom); |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/generationEcritures/Mouvement.java |
---|
25,6 → 25,7 |
public class Mouvement { |
private String numero; |
private List<Ecriture> ecritures = new ArrayList<>(); |
private List<MouvementGED> gedURLs; |
private Number id; |
private BigDecimal debit = BigDecimal.ZERO; |
private BigDecimal credit = BigDecimal.ZERO; |
62,6 → 63,22 |
return this.id; |
} |
public List<MouvementGED> getURLs() { |
return this.gedURLs; |
} |
public void addURL(MouvementGED e) { |
if (this.gedURLs == null) { |
this.gedURLs = new ArrayList<>(); |
} |
e.setEcriture(this); |
this.gedURLs.add(e); |
} |
public boolean hasURLs() { |
return this.gedURLs != null; |
} |
SQLInsert createInsert(DBRoot root, User user) { |
final SQLInsert insert = new SQLInsert(); |
final SQLTable table = root.getTable("MOUVEMENT"); |
/trunk/OpenConcerto/src/org/openconcerto/erp/generationEcritures/GenerationEcritures.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
482,7 → 482,28 |
final SQLTable tablePrefCompte = Configuration.getInstance().getRoot().findTable("PREFS_COMPTE"); |
final SQLRow rowPrefsCompte = SQLBackgroundTableCache.getInstance().getCacheForTable(tablePrefCompte).getRowFromId(2); |
SQLRow rowDefaultCptPort; |
if (achat) { |
if (rowTVAPort.getFloat("TAUX") > 0) { |
rowDefaultCptPort = cacheCompte.getRowFromId(rowPrefsCompte.getForeignID("ID_COMPTE_PCE_PORT_SOUMIS_ACHAT")); |
if (rowDefaultCptPort == null || rowDefaultCptPort.isUndefined()) { |
try { |
rowDefaultCptPort = ComptePCESQLElement.getRowComptePceDefault("PortAchatSoumisTVA"); |
} catch (Exception e) { |
e.printStackTrace(); |
} |
} |
} else { |
rowDefaultCptPort = cacheCompte.getRowFromId(rowPrefsCompte.getForeignID("ID_COMPTE_PCE_PORT_NON_SOUMIS_ACHAT")); |
if (rowDefaultCptPort == null || rowDefaultCptPort.isUndefined()) { |
try { |
rowDefaultCptPort = ComptePCESQLElement.getRowComptePceDefault("PortAchatNonSoumisTVA"); |
} catch (Exception e) { |
e.printStackTrace(); |
} |
} |
} |
} else { |
if (rowTVAPort.getFloat("TAUX") > 0) { |
rowDefaultCptPort = cacheCompte.getRowFromId(rowPrefsCompte.getForeignID("ID_COMPTE_PCE_PORT_SOUMIS")); |
if (rowDefaultCptPort == null || rowDefaultCptPort.isUndefined()) { |
try { |
501,6 → 522,7 |
} |
} |
} |
} |
final SQLRowValues rowValsArt = rowValsPort.putRowValues("ID_ARTICLE"); |
rowValsArt.put(achat ? "ID_COMPTE_PCE_ACHAT" : "ID_COMPTE_PCE", rowDefaultCptPort.getID()); |
rowValsArt.put("ID_TAXE_COMPLEMENTAIRE", null); |
606,8 → 628,14 |
SQLRow rowJournal = rowBanque.getForeignRow("ID_JOURNAL"); |
this.mEcritures.put("ID_JOURNAL", rowJournal.getID()); |
} |
} else if (sqlRow.getTable().contains("ID_TYPE_REGLEMENT") && !sqlRow.isForeignEmpty("ID_TYPE_REGLEMENT")) { |
SQLRow rowType = sqlRow.getForeignRow("ID_TYPE_REGLEMENT"); |
if (rowType.getTable().contains("ID_JOURNAL") && !rowType.isForeignEmpty("ID_JOURNAL")) { |
SQLRow rowJournal = rowType.getForeignRow("ID_JOURNAL"); |
this.mEcritures.put("ID_JOURNAL", rowJournal.getID()); |
} |
} |
} |
/** |
* Définit le compte en fonction de la banque sélectionnée |
615,7 → 643,7 |
* @param sqlRow sqlRow contenant la foreignKey Banque |
* @throws Exception |
*/ |
protected void fillCompteBanqueFromRow(SQLRow sqlRow, String defaultProps, boolean achat) throws Exception { |
protected void fillCompteBanqueFromRow(SQLRow sqlRow, String defaultProps, boolean achat) throws SQLException { |
int idPce = -1; |
if (sqlRow.getTable().contains("ID_TYPE_REGLEMENT")) { |
idPce = sqlRow.getForeign("ID_TYPE_REGLEMENT").getInt("ID_COMPTE_PCE_" + (achat ? "FOURN" : "CLIENT")); |
/trunk/OpenConcerto/src/org/openconcerto/erp/generationEcritures/GenerationMvtReglementAchat.java |
---|
33,7 → 33,7 |
import java.util.Map; |
// FIXME mettre toute les generations dans des threads à part |
public final class GenerationMvtReglementAchat extends GenerationEcritures implements Runnable { |
public final class GenerationMvtReglementAchat extends GenerationEcritures { |
private int idSaisieAchat; |
45,11 → 45,11 |
private static final SQLRow rowPrefsCompte = tablePrefCompte.getRow(2); |
private int idPere = 1; // Id du mouvement pere |
public GenerationMvtReglementAchat(SQLRow rowAchat, int idMvt) { |
public GenerationMvtReglementAchat(SQLRow rowAchat, int idMvt) throws Exception { |
setRowAnalytiqueSource(rowAchat); |
this.idSaisieAchat = rowAchat.getID(); |
this.idPere = idMvt; |
new Thread(GenerationMvtReglementAchat.this).start(); |
genereReglement(); |
} |
private void genereReglement() throws Exception { |
234,12 → 234,4 |
} |
public void run() { |
try { |
genereReglement(); |
} catch (Exception e) { |
ExceptionHandler.handle("Erreur pendant la générations des écritures comptables", e); |
e.printStackTrace(); |
} |
} |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/generationEcritures/Exercice.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
380,10 → 380,27 |
SQLUpdate.executeMultipleWithBatch(sysRoot, mvtUpdate); |
// Creation des inserts des écritures sans analytique |
final List<SQLInsert> insertsEcrituresSansAnalytique = new ArrayList<>(insertsMouvement.size() * 2); |
final List<SQLInsert> insertsEcrituresAvecAnalytique = new ArrayList<>(insertsMouvement.size() * 2); |
final List<Ecriture> ecrituresAvecAnalytique = new ArrayList<>(insertsEcrituresAvecAnalytique.size()); |
final List<SQLInsert> insertsURL = new ArrayList<>(insertsMouvement.size()); |
for (int i = 0; i < pieces.size(); i++) { |
Piece piece = pieces.get(i); |
piece.setId(idsPieces.get(i)); |
for (Mouvement m : piece.getMouvements()) { |
if (m.hasURLs()) { |
List<MouvementGED> urLs = m.getURLs(); |
for (MouvementGED urls : urLs) { |
insertsURL.add(urls.createInsert(root, user)); |
} |
} |
} |
} |
if (!insertsURL.isEmpty()) { |
SQLInsert.executeSimilarInserts(sysRoot, insertsURL, false); |
} |
// Creation des inserts des écritures sans liens ( analytique) |
final List<SQLInsert> insertsEcrituresSansLiens = new ArrayList<>(insertsMouvement.size() * 2); |
final List<SQLInsert> insertsEcrituresAvecLiens = new ArrayList<>(insertsMouvement.size() * 2); |
final List<Ecriture> ecrituresAvecLiens = new ArrayList<>(insertsEcrituresAvecLiens.size()); |
for (Piece p : pieces) { |
final List<Mouvement> mouvements = p.getMouvements(); |
final int stop = mouvements.size(); |
391,32 → 408,43 |
final Mouvement m = mouvements.get(i); |
for (Ecriture e : m.getEcritures()) { |
if (e.hasAnalytique()) { |
insertsEcrituresAvecAnalytique.add(e.createInsert(root, user)); |
ecrituresAvecAnalytique.add(e); |
insertsEcrituresAvecLiens.add(e.createInsert(root, user)); |
ecrituresAvecLiens.add(e); |
} else { |
insertsEcrituresSansAnalytique.add(e.createInsert(root, user)); |
insertsEcrituresSansLiens.add(e.createInsert(root, user)); |
} |
} |
} |
} |
if (!insertsEcrituresSansLiens.isEmpty()) { |
// Insertions des écritures des mouvements |
SQLInsert.executeSimilarInserts(sysRoot, insertsEcrituresSansAnalytique, false); |
SQLInsert.executeSimilarInserts(sysRoot, insertsEcrituresSansLiens, false); |
} |
// Insertions des écritures avec analytique |
if (!ecrituresAvecAnalytique.isEmpty()) { |
final List<Number> idsEcritues = SQLInsert.executeSimilarInserts(sysRoot, insertsEcrituresAvecAnalytique, true); |
if (!ecrituresAvecLiens.isEmpty()) { |
final List<Number> idsEcritues = SQLInsert.executeSimilarInserts(sysRoot, insertsEcrituresAvecLiens, true); |
// Analytique |
final List<SQLInsert> insertsAssociationAnalytique = new ArrayList<>(insertsEcrituresAvecAnalytique.size()); |
final int size = ecrituresAvecAnalytique.size(); |
final List<SQLInsert> insertsAssociationAnalytique = new ArrayList<>(insertsEcrituresAvecLiens.size()); |
final List<SQLInsert> insertsURLs = new ArrayList<>(insertsEcrituresAvecLiens.size()); |
final int size = ecrituresAvecLiens.size(); |
for (int i = 0; i < size; i++) { |
final Ecriture e = ecrituresAvecAnalytique.get(i); |
final Ecriture e = ecrituresAvecLiens.get(i); |
e.setId(idsEcritues.get(i)); |
if (e.hasAnalytique()) { |
for (AssociationAnalytique a : e.getAssociationsAnalytiques()) { |
insertsAssociationAnalytique.add(a.createInsert(root, user)); |
} |
} |
} |
if (!insertsAssociationAnalytique.isEmpty()) { |
SQLInsert.executeSimilarInserts(sysRoot, insertsAssociationAnalytique, false); |
} |
if (!insertsURLs.isEmpty()) { |
SQLInsert.executeSimilarInserts(sysRoot, insertsURLs, false); |
} |
} |
for (Piece p : pieces) { |
final List<Mouvement> mouvements = p.getMouvements(); |
for (Mouvement m : mouvements) { |
/trunk/OpenConcerto/src/org/openconcerto/erp/generationEcritures/GenerationMvtAcompte.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
18,13 → 18,12 |
import org.openconcerto.sql.model.SQLRow; |
import org.openconcerto.sql.model.SQLRowValues; |
import org.openconcerto.sql.model.SQLTable; |
import org.openconcerto.utils.ExceptionHandler; |
import org.openconcerto.utils.GestionDevise; |
import java.sql.SQLException; |
import java.util.Date; |
public final class GenerationMvtAcompte extends GenerationEcritures implements Runnable { |
public final class GenerationMvtAcompte extends GenerationEcritures { |
private int idSalarie; |
private long montant; |
44,10 → 43,10 |
this.montant = GestionDevise.parseLongCurrency(String.valueOf(rowAcompte.getFloat("MONTANT"))); |
SQLRow rowSal = tableSalarie.getRow(this.idSalarie); |
this.idMvt = getNewMouvement("ACOMPTE", this.idAcompte, 1, "Acompte " + rowSal.getString("NOM")); |
new Thread(GenerationMvtAcompte.this).start(); |
genereComptaAcompte(); |
} |
private void genereComptaAcompte() throws Exception { |
private void genereComptaAcompte() throws SQLException { |
System.out.println("Génération des ecritures du mouvement " + this.idMvt); |
99,12 → 98,4 |
} |
public void run() { |
try { |
genereComptaAcompte(); |
} catch (Exception e) { |
ExceptionHandler.handle("Erreur lors de la génération des mouvements", e); |
} |
} |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/edm/Attachment.java |
---|
95,6 → 95,10 |
return this.mimeType.equals(MIMETYPE_FOLDER); |
} |
public boolean isURL() { |
return this.mimeType.equals(MIMETYPE_URL); |
} |
public boolean isEncrypted() { |
return this.encrypted; |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/edm/AttachmentPanel.java |
---|
33,8 → 33,10 |
import java.awt.Frame; |
import java.awt.GridBagConstraints; |
import java.awt.GridBagLayout; |
import java.awt.Toolkit; |
import java.awt.datatransfer.DataFlavor; |
import java.awt.datatransfer.Transferable; |
import java.awt.datatransfer.UnsupportedFlavorException; |
import java.awt.dnd.DnDConstants; |
import java.awt.dnd.DropTarget; |
import java.awt.dnd.DropTargetDropEvent; |
42,6 → 44,7 |
import java.awt.event.ActionListener; |
import java.awt.event.MouseAdapter; |
import java.awt.event.MouseEvent; |
import java.awt.image.BufferedImage; |
import java.io.File; |
import java.io.IOException; |
import java.net.URI; |
55,6 → 58,7 |
import java.util.List; |
import java.util.Set; |
import javax.imageio.ImageIO; |
import javax.swing.BorderFactory; |
import javax.swing.JButton; |
import javax.swing.JLabel; |
68,7 → 72,7 |
public class AttachmentPanel extends JPanel { |
private final SQLRowAccessor rowSource; |
private SQLRowAccessor rowSource; |
private final Collection<SQLRowAccessor> rowSecondaires; |
private List<ListDataListener> listeners = new ArrayList<>(); |
94,6 → 98,11 |
setFocusable(true); |
} |
public void setRowSource(SQLRowAccessor rowSource) { |
this.rowSource = rowSource; |
initUI(); |
} |
public void addListener(ListDataListener l) { |
this.listeners.add(l); |
} |
116,6 → 125,7 |
this.filePanels.clear(); |
this.invalidate(); |
this.removeAll(); |
if (rowSource != null) { |
GridBagConstraints c = new DefaultGridBagConstraints(); |
// Recupération de la liste des fichiers |
217,6 → 227,8 |
toolbar.add(addFileButton); |
final JButton addURLButton = new JButton("Ajouter une URL"); |
toolbar.add(addURLButton); |
final JButton copyClipboard = new JButton("Coller l'image"); |
toolbar.add(copyClipboard); |
final JProgressBar progressBar = new JProgressBar(0, 100); |
progressBar.setValue(100); |
283,6 → 295,36 |
} |
}); |
copyClipboard.addActionListener(new ActionListener() { |
@Override |
public void actionPerformed(ActionEvent e) { |
Transferable content = Toolkit.getDefaultToolkit().getSystemClipboard().getContents(null); |
if (content == null) { |
System.err.println("error: nothing found in clipboard"); |
return; |
} |
if (!content.isDataFlavorSupported(DataFlavor.imageFlavor)) { |
System.err.println("error: no image found in clipbaord"); |
return; |
} |
try { |
final BufferedImage img = (BufferedImage) content.getTransferData(DataFlavor.imageFlavor); |
final File tmp = File.createTempFile("Image", ".png"); |
ImageIO.write(img, "png", tmp); |
final AttachmentUtils utils = new AttachmentUtils(); |
utils.uploadFile(tmp, AttachmentPanel.this.rowSource, AttachmentPanel.this.idParent); |
initUI(); |
tmp.delete(); |
} catch (UnsupportedFlavorException | IOException | SQLException e1) { |
ExceptionHandler.handle(AttachmentPanel.this, "Erreur lors de la récupération de l'image", e1); |
} |
} |
}); |
ScrollablePanel files = new ScrollablePanel() { |
@Override |
public Dimension getPreferredSize() { |
405,7 → 447,8 |
if (t.isDataFlavorSupported(DataFlavor.javaFileListFlavor)) { |
@SuppressWarnings("unchecked") |
List<File> fileList = (List<File>) t.getTransferData(DataFlavor.javaFileListFlavor); |
// TODO faire en arriere plan, mettre une jauge à droite du bouton ajouter |
// TODO faire en arriere plan, mettre une jauge à droite du bouton |
// ajouter |
// et mettre un bouton d'annulation |
AttachmentUtils utils = new AttachmentUtils(); |
boolean cancelledByUser = false; |
433,6 → 476,7 |
scroll.getViewport().setDropTarget(dt); |
fireDataChanged(); |
} |
} |
public Set<Attachment> getSelectedAttachments() { |
return this.selectedAttachments; |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/edm/AttachmentUtils.java |
---|
355,7 → 355,7 |
config.getDirectory().getElement(AttachmentSQLElement.class).archive(rowAttachment.getId()); |
updateAttachmentsCountFromAttachment(rowAttachment); |
if (!rowAttachment.isFolder()) { |
if (!rowAttachment.isFolder() && !rowAttachment.isURL()) { |
boolean isOnCloud = config.isOnCloud(); |
// Delete File |
String subDir = rowAttachment.getStoragePath(); |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/shipment/component/BonDeLivraisonSQLComponent.java |
---|
13,8 → 13,6 |
package org.openconcerto.erp.core.sales.shipment.component; |
import static org.openconcerto.utils.CollectionUtils.createSet; |
import org.openconcerto.erp.core.common.component.TransfertBaseSQLComponent; |
import org.openconcerto.erp.core.common.element.ComptaSQLConfElement; |
import org.openconcerto.erp.core.common.element.NumerotationAutoSQLElement; |
25,6 → 23,8 |
import org.openconcerto.erp.core.customerrelationship.customer.ui.CategorieComptableChoiceUI; |
import org.openconcerto.erp.core.finance.tax.model.TaxeCache; |
import org.openconcerto.erp.core.sales.invoice.element.SaisieVenteFactureItemSQLElement; |
import org.openconcerto.erp.core.sales.product.element.LotSQLElement; |
import org.openconcerto.erp.core.sales.product.element.LotSQLElement.TypeLot; |
import org.openconcerto.erp.core.sales.product.model.ProductComponent; |
import org.openconcerto.erp.core.sales.product.ui.ReliquatRowValuesTable; |
import org.openconcerto.erp.core.sales.shipment.element.BonDeLivraisonItemSQLElement; |
41,10 → 41,13 |
import org.openconcerto.erp.utils.TM; |
import org.openconcerto.sql.Configuration; |
import org.openconcerto.sql.element.SQLElement; |
import org.openconcerto.sql.model.ConnectionHandlerNoSetup; |
import org.openconcerto.sql.model.SQLBackgroundTableCache; |
import org.openconcerto.sql.model.SQLDataSource; |
import org.openconcerto.sql.model.SQLRow; |
import org.openconcerto.sql.model.SQLRowAccessor; |
import org.openconcerto.sql.model.SQLRowValues; |
import org.openconcerto.sql.model.SQLRowValuesListFetcher; |
import org.openconcerto.sql.model.SQLSelect; |
import org.openconcerto.sql.model.SQLTable; |
import org.openconcerto.sql.model.Where; |
55,6 → 58,7 |
import org.openconcerto.sql.sqlobject.SQLTextCombo; |
import org.openconcerto.sql.sqlobject.itemview.SimpleRowItemView; |
import org.openconcerto.sql.users.UserManager; |
import org.openconcerto.sql.utils.SQLUtils; |
import org.openconcerto.sql.view.EditFrame; |
import org.openconcerto.sql.view.list.RowValuesTable; |
import org.openconcerto.sql.view.list.RowValuesTableModel; |
77,9 → 81,11 |
import java.awt.event.ActionListener; |
import java.beans.PropertyChangeEvent; |
import java.beans.PropertyChangeListener; |
import java.io.IOException; |
import java.math.BigDecimal; |
import java.sql.SQLException; |
import java.util.ArrayList; |
import java.util.Arrays; |
import java.util.HashMap; |
import java.util.List; |
import java.util.Map; |
105,8 → 111,18 |
private PanelOOSQLComponent panelOO; |
private JUniqueTextField textNumeroUnique; |
private final SQLTable tableNum = getTable().getBase().getTable("NUMEROTATION_AUTO"); |
private final DeviseField textTotalHT = new DeviseField(6); |
private final DeviseField textTotalTVA = new DeviseField(6); |
private final DeviseField textTotalHT = new DeviseField(6) { |
@Override |
protected void textModified() { |
// No event |
} |
}; |
private final DeviseField textTotalTVA = new DeviseField(6) { |
@Override |
protected void textModified() { |
// No event |
} |
}; |
private final DeviseField textTotalTTC = new DeviseField(6); |
private final JTextField textPoidsTotal = new JTextField(6); |
private final JTextField textNom = new JTextField(25); |
127,6 → 143,20 |
} |
@Override |
public synchronized ValidState getValidState() { |
final ValidState validState = super.getValidState(); |
if (validState.isValid()) { |
final LotSQLElement element = getDirectory().getElement(LotSQLElement.class); |
ValidState lotState = element.getValidStateOfRowValuesTable(getRowValuesTable().getRowValuesTableModel(), TypeLot.LIVRAISON); |
if (lotState != ValidState.getTrueInstance()) { |
return lotState; |
} |
} |
return validState; |
} |
@Override |
protected SQLRowValues createDefaults() { |
this.textNumeroUnique.setText(NumerotationAutoSQLElement.getNextNumero(getElement().getClass())); |
this.tableBonItem.getModel().clearRows(); |
393,8 → 423,8 |
this.addView(comboContact, "ID_CONTACT"); |
// Commercial |
JLabel labelCommercial = new JLabel(getLabelFor("ID_COMMERCIAL")); |
labelCommercial.setHorizontalAlignment(SwingConstants.RIGHT); |
JLabel labelCommercial = new JLabel(getLabelFor("ID_COMMERCIAL"), SwingConstants.RIGHT); |
c.fill = GridBagConstraints.HORIZONTAL; |
c.gridx++; |
c.weightx = 0; |
539,6 → 569,8 |
addRequiredSQLObject(comboServiPar, "SERVI_PAR"); |
} |
} |
JTextField acompteCmd = new JTextField(15); |
this.addView(acompteCmd, "T_ACOMPTE"); |
if (getTable().contains("A_ATTENTION")) { |
// Date livraison |
945,19 → 977,7 |
@Override |
public void select(SQLRowAccessor r) { |
if (r == null || r.getIDNumber() == null) |
super.select(r); |
else { |
System.err.println(r); |
final SQLRowValues rVals = r.asRowValues().deepCopy(); |
final SQLRowValues vals = new SQLRowValues(r.getTable()); |
vals.load(rVals, createSet("ID_CLIENT")); |
vals.setID(rVals.getID()); |
System.err.println("Select CLIENT"); |
super.select(vals); |
rVals.remove("ID_CLIENT"); |
super.select(rVals); |
} |
if (this.tableBonReliquatItem != null) { |
this.tableBonReliquatItem.getRowValuesTable().clear(); |
if (r != null) { |
981,23 → 1001,34 |
if (tableBonReliquatItem != null) { |
this.tableBonReliquatItem.updateField("ID_BON_DE_LIVRAISON_ORIGINE", getSelectedID()); |
} |
try { |
getDirectory().getElement(LotSQLElement.class).removeLotQuantiteFromBL(Arrays.asList(getSelectedID())); |
} catch (SQLException e1) { |
ExceptionHandler.handle("Update Batch error", e1); |
} |
final List<Object> cmdClientFrom = ((BonDeLivraisonSQLElement) getElement()).getSourceTrRowsFrom(getSelectedID(), "COMMANDE_CLIENT_ELEMENT", "COMMANDE_CLIENT"); |
final List<Object> devisFrom = ((BonDeLivraisonSQLElement) getElement()).getSourceTrRowsFrom(getSelectedID(), "DEVIS_ELEMENT", "DEVIS"); |
this.tableBonItem.updateField("ID_BON_DE_LIVRAISON", getSelectedID()); |
this.tableBonItem.createArticle(getSelectedID(), this.getElement()); |
try { |
SQLUtils.executeAtomic(getTable().getDBSystemRoot().getDataSource(), new ConnectionHandlerNoSetup<Object, IOException>() { |
@Override |
public Object handle(SQLDataSource ds) throws SQLException, IOException { |
((BonDeLivraisonSQLElement) getElement()).updateQteLivree(devisFrom, "DEVIS_ELEMENT", "DEVIS"); |
((BonDeLivraisonSQLElement) getElement()).updateQteLivree(cmdClientFrom, "COMMANDE_CLIENT_ELEMENT", "COMMANDE_CLIENT"); |
updateStock(getSelectedID()); |
return null; |
} |
}); |
// generation du document |
final SQLRow row = getTable().getRow(getSelectedID()); |
BonLivraisonXmlSheet bSheet = new BonLivraisonXmlSheet(row); |
bSheet.createDocumentAsynchronous(); |
bSheet.showPrintAndExportAsynchronous(this.panelOO.isVisualisationSelected(), this.panelOO.isImpressionSelected(), true, getElement(), row); |
try { |
updateStock(getSelectedID()); |
} catch (SQLException e) { |
throw new IllegalStateException(e); |
} catch (Exception e) { |
ExceptionHandler.handle(this, "erreur", e); |
} |
} |
1048,10 → 1079,15 |
} |
} |
} else { |
final SQLRowAccessor nonEmptyForeign = r.getNonEmptyForeign("ID_" + fromTableElt); |
if (nonEmptyForeign != null && nonEmptyForeign.getTable().contains("LIVRE_FORCED") && nonEmptyForeign.getBoolean("LIVRE_FORCED")) { |
this.tableBonItem.getModel().putValue(0, i, "QTE_LIVREE"); |
} else { |
this.tableBonItem.getModel().putValue(r.getObject("QTE"), i, "QTE_LIVREE"); |
} |
} |
} |
} |
public void removeZeroQtyLines() { |
int count = this.tableBonItem.getModel().getRowCount() - 1; |
1139,9 → 1175,10 |
SQLPreferences prefs = new SQLPreferences(getTable().getDBRoot()); |
// Check if tr from bl or cmd pour DS |
boolean stockWithBL = !prefs.getBoolean(GestionArticleGlobalPreferencePanel.STOCK_FACT, true); |
SQLTable tableBlItem = getTable().getTable("BON_DE_LIVRAISON_ELEMENT"); |
if (getTable().getForeignTable("ID_CLIENT").contains("NOTE_2018")) { |
SQLRow row = getTable().getRow(id); |
List<SQLRow> items = row.getReferentRows(getTable().getTable("BON_DE_LIVRAISON_ELEMENT")); |
List<SQLRow> items = row.getReferentRows(tableBlItem); |
for (SQLRow sqlRow : items) { |
if (sqlRow.contains("ID_COMMANDE_CLIENT_ELEMENT") && !sqlRow.isForeignEmpty("ID_COMMANDE_CLIENT_ELEMENT")) { |
stockWithBL = true; |
1153,21 → 1190,36 |
if (stockWithBL) { |
SQLRow row = getTable().getRow(id); |
StockItemsUpdater stockUpdater = new StockItemsUpdater(new StockLabel() { |
final SQLTable cmdItem = tableBlItem.getForeignTable("ID_COMMANDE_CLIENT_ELEMENT"); |
SQLRowValues rowValsItem = new SQLRowValues(tableBlItem); |
rowValsItem.setAllToNull(); |
final List<SQLRowValues> fetchLinkedWithCmdItem = SQLRowValuesListFetcher.create(rowValsItem) |
.fetch(new Where(tableBlItem.getField("ID_BON_DE_LIVRAISON"), "=", id).and(new Where(tableBlItem.getField("ID_COMMANDE_CLIENT_ELEMENT"), "!=", cmdItem.getUndefinedIDNumber()))); |
StockItemsUpdater stockUpdaterLinkedItem = new StockItemsUpdater(new StockLabel() { |
@Override |
public String getLabel(SQLRowAccessor rowOrigin, SQLRowAccessor rowElt) { |
return getLibelleStock(rowOrigin, rowElt); |
} |
}, row, row.getReferentRows(getTable().getTable("BON_DE_LIVRAISON_ELEMENT")), |
getTable().contains("CREATE_VIRTUAL_STOCK") && row.getBoolean("CREATE_VIRTUAL_STOCK") ? TypeStockUpdate.REAL_VIRTUAL_DELIVER : TypeStockUpdate.REAL_DELIVER); |
}, row, fetchLinkedWithCmdItem, TypeStockUpdate.REAL_DELIVER); |
if (getTable().getDBRoot().contains("RELIQUAT_BL")) { |
List<SQLRow> l = row.getReferentRows(getTable().getTable("RELIQUAT_BL").getField("ID_BON_DE_LIVRAISON_ORIGINE")); |
for (SQLRow sqlRow : l) { |
stockUpdater.addReliquat(sqlRow.getForeign("ID_ARTICLE"), sqlRow.getInt("QTE"), sqlRow.getBigDecimal("QTE_UNITAIRE")); |
stockUpdaterLinkedItem.addReliquat(sqlRow.getForeign("ID_ARTICLE"), sqlRow.getInt("QTE"), sqlRow.getBigDecimal("QTE_UNITAIRE")); |
} |
} |
stockUpdaterLinkedItem.update(); |
final List<SQLRowValues> fetchNotLinkedWithCmdItem = SQLRowValuesListFetcher.create(rowValsItem) |
.fetch(new Where(tableBlItem.getField("ID_BON_DE_LIVRAISON"), "=", id).and(new Where(tableBlItem.getField("ID_COMMANDE_CLIENT_ELEMENT"), "=", cmdItem.getUndefinedIDNumber()))); |
StockItemsUpdater stockUpdater = new StockItemsUpdater(new StockLabel() { |
@Override |
public String getLabel(SQLRowAccessor rowOrigin, SQLRowAccessor rowElt) { |
return getLibelleStock(rowOrigin, rowElt); |
} |
}, row, fetchNotLinkedWithCmdItem, TypeStockUpdate.REAL_VIRTUAL_DELIVER); |
stockUpdater.setClearMouvementStock(false); |
stockUpdater.update(); |
} |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/shipment/element/BonDeLivraisonItemSQLElement.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
35,6 → 35,14 |
super("BON_DE_LIVRAISON_ELEMENT", "un element de bon de livraison", "éléments de bon de livraison"); |
} |
@Override |
protected void ffInited() { |
super.ffInited(); |
// Pour empecher la suppression d'une commande liée à un bl |
setAction("ID_COMMANDE_CLIENT_ELEMENT", ReferenceAction.RESTRICT); |
} |
protected List<String> getListFields() { |
final List<String> l = new ArrayList<String>(); |
l.add("ID_BON_DE_LIVRAISON"); |
49,6 → 57,7 |
l.add("POIDS"); |
l.add("T_PA_HT"); |
l.add("T_PV_HT"); |
l.add("T_PV_TTC"); |
return l; |
} |
69,7 → 78,7 |
@Override |
public ListMap<String, String> getShowAs() { |
final ListMap<String, String> res = new ListMap<String, String>(); |
res.putCollection("ID_BON_DE_LIVRAISON", "NUMERO"); |
res.putCollection("ID_BON_DE_LIVRAISON", "NUMERO", "DATE"); |
return res; |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/shipment/element/BonDeLivraisonSQLElement.java |
---|
14,6 → 14,7 |
package org.openconcerto.erp.core.sales.shipment.element; |
import org.openconcerto.erp.core.common.element.ComptaSQLConfElement; |
import org.openconcerto.erp.core.sales.product.element.LotSQLElement; |
import org.openconcerto.erp.core.sales.shipment.component.BonDeLivraisonSQLComponent; |
import org.openconcerto.erp.preferences.DefaultNXProps; |
import org.openconcerto.sql.Configuration; |
39,6 → 40,7 |
import org.openconcerto.sql.view.list.IListe; |
import org.openconcerto.sql.view.list.RowAction; |
import org.openconcerto.sql.view.list.RowAction.PredicateRowAction; |
import org.openconcerto.sql.view.list.SQLTableModelSource; |
import org.openconcerto.sql.view.list.action.ListEvent; |
import org.openconcerto.ui.preferences.DefaultProps; |
import org.openconcerto.utils.ListMap; |
90,6 → 92,13 |
req.addToGraphToFetch("VERROU_FACTURATION"); |
} |
@Override |
protected void _initTableSource(SQLTableModelSource res) { |
// TODO Auto-generated method stub |
super._initTableSource(res); |
addCommercialFilter(res, getTable().getField("ID_COMMERCIAL")); |
} |
private void updateVerrouFacture(List<SQLRowAccessor> rows, boolean state) { |
UpdateBuilder builder = new UpdateBuilder(getTable()); |
builder.setObject("VERROU_FACTURATION", state); |
130,6 → 139,7 |
} |
l.add("NOM"); |
l.add("TOTAL_HT"); |
l.add("TOTAL_TTC"); |
l.add("INFOS"); |
return l; |
} |
178,8 → 188,20 |
build.setWhere(new Where(alias.getField("ID_" + tableRoot), items)); |
getTable().getDBSystemRoot().getDataSource().execute(build.asString().replaceAll(" SET", " c SET ")); |
// Update commande state |
if (tableRoot.equalsIgnoreCase("COMMANDE_CLIENT")) { |
final SQLTable tableCmd = getTable().getTable("COMMANDE_CLIENT"); |
AliasedTable aliasCmd = new AliasedTable(tableCmd, "c"); |
Where wIN = Where.inValues(aliasCmd.getKey(), items); |
String req = "UPDATE " + tableCmd.getSQLName().quote() + " c SET \"ETAT_COMMANDE\"=5 WHERE " + wIN.getClause() |
+ "and (\"ETAT_COMMANDE\"=1 or \"ETAT_COMMANDE\"=2 or c.\"ETAT_COMMANDE\"=3 or c.\"ETAT_COMMANDE\"=4) " |
+ "and (select SUM((i.\"QTE\"*i.\"QTE_UNITAIRE\")-i.\"QTE_LIVREE\") from " + tableCmdElement.getSQLName().quote() + " i" |
+ " where i.\"ID_COMMANDE_CLIENT\"=c.\"ID\" and i.\"ARCHIVE\"=0)<=0"; |
getTable().getDBSystemRoot().getDataSource().execute(req); |
} |
} |
} |
@Override |
protected void archive(TreesOfSQLRows trees, boolean cutLinks) throws SQLException { |
211,6 → 233,7 |
} |
} |
getDirectory().getElement(LotSQLElement.class).removeLotQuantiteFromBL(ids); |
super.archive(trees, cutLinks); |
updateQteLivree(devis, "DEVIS_ELEMENT", "DEVIS"); |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/shipment/action/ListeDesElementsBLAction.java |
---|
New file |
0,0 → 1,89 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
* copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific |
* language governing permissions and limitations under the License. |
* |
* When distributing the software, include this License Header Notice in each file. |
*/ |
package org.openconcerto.erp.core.sales.shipment.action; |
import org.openconcerto.erp.action.CreateIListFrameAbstractAction; |
import org.openconcerto.erp.config.ComptaPropsConfiguration; |
import org.openconcerto.erp.core.common.ui.IListFilterDatePanel; |
import org.openconcerto.erp.core.common.ui.IListTotalPanel; |
import org.openconcerto.erp.core.common.ui.IListTotalPanel.Type; |
import org.openconcerto.erp.core.common.ui.ListeViewPanel; |
import org.openconcerto.erp.core.sales.order.element.CommandeClientElementSQLElement; |
import org.openconcerto.erp.core.sales.shipment.element.BonDeLivraisonItemSQLElement; |
import org.openconcerto.sql.element.SQLElement; |
import org.openconcerto.sql.model.Where; |
import org.openconcerto.sql.view.IListFrame; |
import org.openconcerto.sql.view.IListPanel; |
import org.openconcerto.sql.view.list.IListe; |
import org.openconcerto.sql.view.list.SQLTableModelColumn; |
import org.openconcerto.sql.view.list.SQLTableModelSource; |
import org.openconcerto.ui.DefaultGridBagConstraints; |
import org.openconcerto.utils.Tuple2; |
import java.awt.GridBagConstraints; |
import java.util.ArrayList; |
import java.util.List; |
public class ListeDesElementsBLAction extends CreateIListFrameAbstractAction<BonDeLivraisonItemSQLElement> { |
public ListeDesElementsBLAction(final ComptaPropsConfiguration conf) { |
super(conf, BonDeLivraisonItemSQLElement.class); |
} |
@Override |
protected SQLTableModelSource createTableSource() { |
final SQLTableModelSource res = super.createTableSource(); |
res.getReq().setWhere(new Where(getElem().getTable().getField("ID_BON_DE_LIVRAISON"), ">", 1)); |
return res; |
} |
@Override |
protected IListPanel instantiateListPanel(final SQLTableModelSource tableSource, String panelVariant) { |
return new ListeViewPanel(tableSource.getElem(), new IListe(tableSource)); |
} |
@Override |
protected void initFrame(IListFrame frame) { |
super.initFrame(frame); |
final SQLElement element = getElem(); |
final IListPanel listeAddPanel = frame.getPanel(); |
final SQLTableModelSource tableSource = listeAddPanel.getListe().getSource(); |
List<Tuple2<? extends SQLTableModelColumn, Type>> listField = new ArrayList<Tuple2<? extends SQLTableModelColumn, Type>>(); |
listField.add(Tuple2.create(tableSource.getColumn(element.getTable().getField("QTE")), IListTotalPanel.Type.SOMME_QTE)); |
listField.add(Tuple2.create(tableSource.getColumn(element.getTable().getField("T_PA_HT")), IListTotalPanel.Type.SOMME)); |
listField.add(Tuple2.create(tableSource.getColumn(element.getTable().getField("T_PV_HT")), IListTotalPanel.Type.SOMME)); |
listField.add(Tuple2.create(tableSource.getColumn(element.getTable().getField("T_PV_TTC")), IListTotalPanel.Type.SOMME)); |
IListTotalPanel total = new IListTotalPanel(listeAddPanel.getListe(), listField, null, "Total"); |
GridBagConstraints c = new DefaultGridBagConstraints(); |
c.gridy = 2; |
c.weightx = 0; |
c.weighty = 0; |
c.anchor = GridBagConstraints.EAST; |
c.fill = GridBagConstraints.NONE; |
listeAddPanel.add(total, c); |
frame.setTextTitle(String.valueOf(getValue(NAME))); |
frame.getPanel().getListe().setModificationAllowed(false); |
frame.getPanel().setAddVisible(false); |
frame.getPanel().setSearchFullMode(true); |
// Date panel |
IListFilterDatePanel datePanel = new IListFilterDatePanel(frame.getPanel().getListe(), element.getTable().getTable("BON_DE_LIVRAISON").getField("DATE"), IListFilterDatePanel.getDefaultMap()); |
c.gridy++; |
c.anchor = GridBagConstraints.CENTER; |
frame.getPanel().add(datePanel, c); |
} |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/shipment/action/ListeDesBonsDeLivraisonAction.java |
---|
31,14 → 31,13 |
import org.openconcerto.sql.view.ListeAddPanel; |
import org.openconcerto.sql.view.list.BaseSQLTableModelColumn; |
import org.openconcerto.sql.view.list.IListe; |
import org.openconcerto.sql.view.list.IListeAction.IListeEvent; |
import org.openconcerto.sql.view.list.RowAction; |
import org.openconcerto.sql.view.list.RowAction.PredicateRowAction; |
import org.openconcerto.sql.view.list.SQLTableModelSourceOnline; |
import org.openconcerto.ui.DefaultGridBagConstraints; |
import org.openconcerto.ui.table.PercentTableCellRenderer; |
import org.openconcerto.utils.CollectionUtils; |
import org.openconcerto.utils.DecimalUtils; |
import org.openconcerto.utils.ExceptionHandler; |
import java.awt.GridBagConstraints; |
import java.awt.GridBagLayout; |
52,8 → 51,10 |
import javax.swing.AbstractAction; |
import javax.swing.JFrame; |
import javax.swing.JOptionPane; |
import javax.swing.JPanel; |
import javax.swing.JTabbedPane; |
import javax.swing.SwingWorker; |
public class ListeDesBonsDeLivraisonAction extends CreateListFrameAbstractAction<BonDeLivraisonSQLElement, JFrame> { |
94,8 → 95,8 |
return frame; |
} |
private ListeAddPanel getPanel(final BonDeLivraisonSQLElement eltCmd, final SQLTableModelSourceOnline tableSource, final List<RowAction> allowedActions) { |
final ListeAddPanel panel = new ListeAddPanel(eltCmd, new IListe(tableSource)); |
private ListeAddPanel getPanel(final BonDeLivraisonSQLElement eltCmd, final SQLTableModelSourceOnline tableSource, final List<RowAction> allowedActions, String variant) { |
final ListeAddPanel panel = new ListeAddPanel(eltCmd, new IListe(tableSource), variant); |
final List<SQLField> fields = new ArrayList<SQLField>(2); |
fields.add(eltCmd.getTable().getField("TOTAL_HT")); |
160,7 → 161,7 |
}; |
tableSource.getColumns().add(colAvancement); |
colAvancement.setRenderer(new PercentTableCellRenderer()); |
final ListeAddPanel panel = getPanel(eltCmd, tableSource, allowedActions); |
final ListeAddPanel panel = getPanel(eltCmd, tableSource, allowedActions, "alldelivery"); |
return panel; |
} |
168,17 → 169,21 |
Collection<? extends SQLRowAccessor> rows = r.getReferentRows(r.getTable().getTable("TR_BON_DE_LIVRAISON")); |
long totalFact = 0; |
long total = r.getLong("TOTAL_HT"); |
boolean hasFact = false; |
for (SQLRowAccessor row : rows) { |
if (!row.isForeignEmpty("ID_SAISIE_VENTE_FACTURE")) { |
SQLRowAccessor rowFact = row.getForeign("ID_SAISIE_VENTE_FACTURE"); |
Long l = rowFact.getLong("T_HT"); |
totalFact += l; |
hasFact = true; |
} |
} |
if (total > 0) { |
return new BigDecimal(totalFact).divide(new BigDecimal(total), DecimalUtils.HIGH_PRECISION).movePointRight(2).setScale(2, RoundingMode.HALF_UP); |
} else if (hasFact) { |
return BigDecimal.ONE.movePointRight(2); |
} else { |
return BigDecimal.ONE.movePointRight(2); |
return BigDecimal.ZERO; |
} |
} |
191,7 → 196,7 |
final SQLInjector injector = SQLInjector.getInjector(eltCmd.getTable(), eltCmd.getTable().getTable("SAISIE_VENTE_FACTURE")); |
injector.setOnlyTransfered(tableSource); |
final ListeAddPanel panel = getPanel(eltCmd, tableSource, allowedActions); |
final ListeAddPanel panel = getPanel(eltCmd, tableSource, allowedActions, "invoiced"); |
return panel; |
} |
205,7 → 210,7 |
final SQLInjector injector = SQLInjector.getInjector(eltCmd.getTable(), eltCmd.getTable().getTable("SAISIE_VENTE_FACTURE")); |
injector.setOnlyNotTransfered(tableSource); |
final ListeAddPanel panel = getPanel(eltCmd, tableSource, allowedActions); |
final ListeAddPanel panel = getPanel(eltCmd, tableSource, allowedActions, "waiting"); |
return panel; |
} |
214,7 → 219,51 |
* |
* @param row |
*/ |
private void transfertFactureClient(List<SQLRowValues> rows) { |
TransfertBaseSQLComponent.openTransfertFrame(rows, "SAISIE_VENTE_FACTURE"); |
private void transfertFactureClient(List<SQLRowValues> selectedRows) { |
SwingWorker<Boolean, Object> worker = new SwingWorker<Boolean, Object>() { |
@Override |
protected Boolean doInBackground() throws Exception { |
boolean b = TransfertBaseSQLComponent.isAlreadyAllTransfert(selectedRows, getConf().getRootSociete().getTable("BON_DE_LIVRAISON"), |
getConf().getRootSociete().getTable("SAISIE_VENTE_FACTURE"), "TOTAL_HT", "T_HT"); |
if (b) { |
String label = "Attention "; |
if (selectedRows.size() > 1) { |
label += " les bons de livraisons ont déjà été transféré!"; |
} else { |
label += "le bon de livraison a déjà été transféré!"; |
} |
label += "\n Voulez vous continuer?"; |
int ans = JOptionPane.showConfirmDialog(null, label, "Transfert Bon de livraison", JOptionPane.YES_NO_OPTION); |
if (ans == JOptionPane.NO_OPTION) { |
return Boolean.FALSE; |
} |
} |
return Boolean.TRUE; |
} |
@Override |
protected void done() { |
try { |
Boolean b = get(); |
if (b) { |
List<SQLRowValues> selRows = new ArrayList<>(); |
for (SQLRowValues r : selectedRows) { |
selRows.add(r.createEmptyUpdateRow()); |
} |
TransfertBaseSQLComponent.openTransfertFrame(selectedRows, "SAISIE_VENTE_FACTURE"); |
} |
} catch (Exception e) { |
ExceptionHandler.handle("Erreur lors du transfert des bons de livraisons!", e); |
} |
} |
}; |
worker.execute(); |
} |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/shipment/ui/BonDeLivraisonItemTable.java |
---|
28,12 → 28,16 |
import org.openconcerto.erp.core.finance.accounting.model.CurrencyConverter; |
import org.openconcerto.erp.core.finance.tax.model.TaxeCache; |
import org.openconcerto.erp.core.sales.pos.io.BarcodeReader; |
import org.openconcerto.erp.core.sales.pos.ui.BarcodeListener; |
import org.openconcerto.erp.core.sales.pos.io.Barcode; |
import org.openconcerto.erp.core.sales.pos.io.BarcodeListener; |
import org.openconcerto.erp.core.sales.product.element.LotSQLElement; |
import org.openconcerto.erp.core.sales.product.element.ReferenceArticleSQLElement; |
import org.openconcerto.erp.core.sales.product.element.UniteVenteArticleSQLElement; |
import org.openconcerto.erp.core.sales.product.element.LotSQLElement.TypeLot; |
import org.openconcerto.erp.core.sales.product.ui.ArticleRowValuesRenderer; |
import org.openconcerto.erp.core.sales.product.ui.CurrencyWithSymbolRenderer; |
import org.openconcerto.erp.core.sales.product.ui.DeliveredQtyRowValuesRenderer; |
import org.openconcerto.erp.core.sales.product.ui.DeliveryNoteQtyRowValuesRenderer; |
import org.openconcerto.erp.core.sales.product.ui.QtyRowValuesRenderer; |
import org.openconcerto.erp.core.sales.product.ui.QteUnitRowValuesRenderer; |
import org.openconcerto.erp.core.sales.product.ui.QtyToDeliverRowValuesRenderer; |
import org.openconcerto.erp.core.sales.product.ui.ReliquatRowValuesTable; |
47,6 → 51,7 |
import org.openconcerto.sql.model.SQLRowAccessor; |
import org.openconcerto.sql.model.SQLRowListRSH; |
import org.openconcerto.sql.model.SQLRowValues; |
import org.openconcerto.sql.model.SQLRowValuesListFetcher; |
import org.openconcerto.sql.model.SQLSelect; |
import org.openconcerto.sql.model.SQLTable; |
import org.openconcerto.sql.model.UndefinedRowValuesCache; |
66,10 → 71,12 |
import org.openconcerto.sql.view.list.SQLTextComboTableCellEditor; |
import org.openconcerto.sql.view.list.ValidStateChecker; |
import org.openconcerto.ui.table.XTableColumnModel; |
import org.openconcerto.utils.CompareUtils; |
import org.openconcerto.utils.DecimalUtils; |
import org.openconcerto.utils.ExceptionHandler; |
import org.openconcerto.utils.Tuple3; |
import org.openconcerto.utils.cc.ITransformer; |
import org.openconcerto.utils.checks.ValidState; |
import org.openconcerto.utils.i18n.TranslationManager; |
import java.awt.Component; |
166,7 → 173,7 |
final SQLTableElement tableElementArticle = new SQLTableElement(e.getTable().getField("ID_ARTICLE"), true, true, true) { |
@Override |
public boolean isCellEditable(SQLRowValues vals, int rowIndex, int columnIndex) { |
boolean b = super.isCellEditable(vals, rowIndex, columnIndex); |
boolean b = super.isCellEditable(vals, rowIndex, columnIndex) && !isLotLinked(vals); |
if (e.getTable().contains("ID_COMMANDE_CLIENT_ELEMENT")) { |
boolean noCmdElt = vals.getObject("ID_COMMANDE_CLIENT_ELEMENT") == null || vals.isForeignEmpty("ID_COMMANDE_CLIENT_ELEMENT"); |
return b && noCmdElt; |
188,7 → 195,7 |
new ITextArticleWithCompletionCellEditor(e.getTable().getTable("ARTICLE"), e.getTable().getTable("ARTICLE_FOURNISSEUR"), withDeclinaison)) { |
@Override |
public boolean isCellEditable(SQLRowValues vals, int rowIndex, int columnIndex) { |
boolean b = super.isCellEditable(vals, rowIndex, columnIndex); |
boolean b = super.isCellEditable(vals, rowIndex, columnIndex) && !isLotLinked(vals); |
if (e.getTable().contains("ID_COMMANDE_CLIENT_ELEMENT")) { |
boolean noCmdElt = vals.getObject("ID_COMMANDE_CLIENT_ELEMENT") == null || vals.isForeignEmpty("ID_COMMANDE_CLIENT_ELEMENT"); |
return b && noCmdElt; |
204,7 → 211,7 |
@Override |
public boolean isCellEditable(SQLRowValues vals, int rowIndex, int columnIndex) { |
boolean b = super.isCellEditable(vals, rowIndex, columnIndex); |
boolean b = super.isCellEditable(vals, rowIndex, columnIndex) && !isLotLinked(vals); |
if (e.getTable().contains("ID_COMMANDE_CLIENT_ELEMENT")) { |
boolean noCmdElt = vals.getObject("ID_COMMANDE_CLIENT_ELEMENT") == null || vals.isForeignEmpty("ID_COMMANDE_CLIENT_ELEMENT"); |
return b && noCmdElt; |
273,7 → 280,7 |
} else if (activeCalculM2 && row != null && !row.isUndefined() && row.getID() == UniteVenteArticleSQLElement.M2) { |
return false; |
} else { |
return super.isCellEditable(vals, rowIndex, columnIndex); |
return super.isCellEditable(vals, rowIndex, columnIndex) && !isLotLinked(vals); |
} |
} |
288,7 → 295,12 |
}; |
list.add(qteU); |
SQLTableElement uniteVente = new SQLTableElement(e.getTable().getField("ID_UNITE_VENTE")); |
SQLTableElement uniteVente = new SQLTableElement(e.getTable().getField("ID_UNITE_VENTE")) { |
@Override |
public boolean isCellEditable(SQLRowValues vals, int rowIndex, int columnIndex) { |
return super.isCellEditable(vals, rowIndex, columnIndex) && !isLotLinked(vals); |
} |
}; |
list.add(uniteVente); |
// Quantité |
311,12 → 323,17 |
@Override |
public TableCellRenderer getTableCellRenderer() { |
return new DeliveredQtyRowValuesRenderer(); |
return new DeliveryNoteQtyRowValuesRenderer(); |
} |
protected Object getDefaultNullValue() { |
return Integer.valueOf(0); |
} |
@Override |
public boolean isCellEditable(SQLRowValues vals, int rowIndex, int columnIndex) { |
return super.isCellEditable(vals, rowIndex, columnIndex) && !isLotLinked(vals); |
} |
}; |
list.add(tableElement_QuantiteLivree); |
506,30 → 523,94 |
list.add(this.tableElementPoidsTotalLivree); |
// Packaging |
if (prefs.getBoolean(GestionArticleGlobalPreferencePanel.ITEM_PACKAGING, false)) { |
if (e.getTable().contains("POIDS_COLIS_NET") && prefs.getBoolean(GestionArticleGlobalPreferencePanel.ITEM_PACKAGING, false)) { |
SQLTableElement poidsColis = new SQLTableElement(e.getTable().getField("POIDS_COLIS_NET"), BigDecimal.class); |
list.add(poidsColis); |
SQLTableElement tareColis = new SQLTableElement(e.getTable().getField("TARE"), BigDecimal.class) { |
@Override |
public TableCellRenderer getTableCellRenderer() { |
return new QteUnitRowValuesRenderer(); |
} |
}; |
list.add(tareColis); |
// SQLTableElement poidsColis = new |
// SQLTableElement(e.getTable().getField("POIDS_COLIS_NET"), BigDecimal.class) { |
// @Override |
// public TableCellRenderer getTableCellRenderer() { |
// return new QteUnitRowValuesRenderer(); |
// } |
// |
// }; |
// list.add(poidsColis); |
SQLTableElement nbColis = new SQLTableElement(e.getTable().getField("NB_COLIS"), Integer.class); |
list.add(nbColis); |
final SQLTableElement totalPoidsColis = new SQLTableElement(e.getTable().getField("T_POIDS_COLIS_NET"), BigDecimal.class); |
list.add(totalPoidsColis); |
// final SQLTableElement totalPoidsColis = new |
// SQLTableElement(e.getTable().getField("T_POIDS_COLIS_NET"), BigDecimal.class) { |
// @Override |
// public TableCellRenderer getTableCellRenderer() { |
// return new QteUnitRowValuesRenderer(); |
// } |
// |
// }; |
// list.add(totalPoidsColis); |
// |
// poidsColis.addModificationListener(totalPoidsColis); |
// nbColis.addModificationListener(totalPoidsColis); |
// totalPoidsColis.setModifier(new CellDynamicModifier() { |
// public Object computeValueFrom(final SQLRowValues row, SQLTableElement source) { |
// final BigDecimal pdsColis = row.getBigDecimal("POIDS_COLIS_NET"); |
// final Object o3 = row.getObject("NB_COLIS"); |
// |
// BigDecimal pdsColisTotal = BigDecimal.ZERO; |
// |
// if (pdsColis != null && o3 != null) { |
// int nb = (Integer) o3; |
// pdsColisTotal = pdsColis.multiply(new BigDecimal(nb), DecimalUtils.HIGH_PRECISION); |
// } |
// return pdsColisTotal.setScale(totalPoidsColis.getDecimalDigits(), |
// RoundingMode.HALF_UP); |
// } |
// }); |
poidsColis.addModificationListener(totalPoidsColis); |
nbColis.addModificationListener(totalPoidsColis); |
totalPoidsColis.setModifier(new CellDynamicModifier() { |
final SQLTableElement totalPoidsBrut = new SQLTableElement(e.getTable().getField("T_POIDS_BRUT"), BigDecimal.class) { |
@Override |
public TableCellRenderer getTableCellRenderer() { |
return new QteUnitRowValuesRenderer(); |
} |
}; |
list.add(totalPoidsBrut); |
tareColis.addModificationListener(totalPoidsBrut); |
// poidsColis.addModificationListener(totalPoidsBrut); |
nbColis.addModificationListener(totalPoidsBrut); |
this.tableElementPoidsTotal.addModificationListener(totalPoidsBrut); |
totalPoidsBrut.setModifier(new CellDynamicModifier() { |
public Object computeValueFrom(final SQLRowValues row, SQLTableElement source) { |
final Object o2 = row.getObject("POIDS_COLIS_NET"); |
final BigDecimal tare = row.getBigDecimal("TARE"); |
// final int qte = row.getInt("QTE_LIVREE"); |
// final BigDecimal pdsColis = row.getBigDecimal("POIDS_COLIS_NET"); |
final Object o3 = row.getObject("NB_COLIS"); |
if (o2 != null && o3 != null) { |
BigDecimal poids = (BigDecimal) o2; |
BigDecimal pdsBrutTotal = BigDecimal.ZERO; |
if (row.getObject("T_POIDS") != null) { |
pdsBrutTotal = new BigDecimal(row.getFloat("T_POIDS")); |
} |
if (tare != null && o3 != null) { |
int nb = (Integer) o3; |
return poids.multiply(new BigDecimal(nb), DecimalUtils.HIGH_PRECISION).setScale(totalPoidsColis.getDecimalDigits(), RoundingMode.HALF_UP); |
} else { |
return row.getObject("T_POIDS_COLIS_NET"); |
pdsBrutTotal = pdsBrutTotal.add(tare.multiply(new BigDecimal(nb))); |
} |
// if (pdsColis != null && o3 != null) { |
// int nb = (Integer) o3; |
// pdsBrutTotal = pdsBrutTotal.add(pdsColis.multiply(new BigDecimal(nb), |
// DecimalUtils.HIGH_PRECISION)); |
// } |
return pdsBrutTotal.setScale(totalPoidsBrut.getDecimalDigits(), RoundingMode.HALF_UP); |
} |
}); |
662,7 → 743,7 |
this.defaultRowVals.put("NOM", ""); |
final RowValuesTableModel model = new RowValuesTableModel(e, list, e.getTable().getField("NOM"), false, this.defaultRowVals) { |
@Override |
public void commitData() { |
public void commitData() throws SQLException { |
int size = getRowCount(); |
for (int i = 0; i < size; i++) { |
SQLRowValues rowVals = getRowValuesAt(i); |
672,11 → 753,60 |
rowVals.put("PV_T_DEVISE", rowVals.getBigDecimal("PRIX_METRIQUE_VT_1").multiply(globalQty)); |
} |
} |
super.commitData(true); |
commitData(true); |
} |
@Override |
public void commitData(boolean useMultipleInsertUpdate) throws SQLException { |
super.commitData(useMultipleInsertUpdate); |
if (getSQLElement().getTable().getName().equalsIgnoreCase("BON_DE_LIVRAISON_ELEMENT")) { |
getSQLElement().getDirectory().getElement(LotSQLElement.class).updateLotQuantiteFromBLItems(getCopyOfValues()); |
} |
} |
@Override |
public List<SQLRowValues> fetchDataFromDB(SQLRowAccessor rowVals, SQLField referentField, SQLField fieldWhere, Object value) { |
final SQLTable table = getSQLElement().getTable(); |
if (table.getName().equals("BON_DE_LIVRAISON_ELEMENT")) { |
List<SQLRowValues> newRows = new ArrayList<>(); |
SQLRowValues rowValsBlItem = new SQLRowValues(table); |
rowValsBlItem.putNulls(table.getFieldsName()); |
rowValsBlItem.putRowValues("ID_UNITE_VENTE").putNulls("A_LA_PIECE"); |
rowValsBlItem.putRowValues("ID_ARTICLE").putNulls("ID", "CODE", "NOM", "DLC_REQUIS", "DLUO_REQUIS", "NUMERO_LOT_REQUIS", "NUMERO_SERIE_REQUIS"); |
final SQLTable tableLotR = table.getTable("LOT_LIVRAISON"); |
SQLRowValues rowValsLotRecp = new SQLRowValues(tableLotR); |
rowValsLotRecp.putNulls(rowValsLotRecp.getTable().getFieldsName()); |
rowValsLotRecp.put("ID_BON_DE_LIVRAISON_ELEMENT", rowValsBlItem); |
final List<SQLRowValues> fetch = SQLRowValuesListFetcher.create(rowValsBlItem).fetch(new Where(table.getField("ID_BON_DE_LIVRAISON"), "=", rowVals.getID())); |
for (SQLRowValues row2 : fetch) { |
if (fieldWhere == null || CompareUtils.equals(row2.getObject(fieldWhere.getName()), value)) { |
newRows.add(row2); |
} |
} |
return newRows; |
} else { |
return super.fetchDataFromDB(rowVals, referentField, fieldWhere, value); |
} |
} |
}; |
this.setModel(model); |
this.table = new RowValuesTable(model, getConfigurationFile()); |
model.setGestionReferentActive(true); |
this.table = new RowValuesTable(model, getConfigurationFile()) { |
@Override |
public synchronized ValidState getValidState() { |
if (getSQLElement().getTable().getName().equalsIgnoreCase("BON_DE_LIVRAISON_ELEMENT")) { |
final LotSQLElement element = getSQLElement().getDirectory().getElement(LotSQLElement.class); |
ValidState lotState = element.getValidStateOfRowValuesTable(getRowValuesTable().getRowValuesTableModel(), TypeLot.LIVRAISON); |
if (lotState != ValidState.getTrueInstance()) { |
return lotState; |
} |
} |
return super.getValidState(); |
} |
}; |
ToolTipManager.sharedInstance().unregisterComponent(this.table); |
ToolTipManager.sharedInstance().unregisterComponent(this.table.getTableHeader()); |
this.table.getClearCloneTableElement().add("ID_COMMANDE_CLIENT_ELEMENT"); |
1109,7 → 1239,7 |
} |
SQLRowAccessor foreign = row.getForeign("ID_ARTICLE"); |
if (foreign != null && !foreign.isUndefined() && foreign.getObject("CODE") != null && foreign.getString("CODE").equals(row.getString("CODE"))) { |
return foreign.getID(); |
return foreign/* .getID() */; |
} else { |
return tableArticle.getUndefinedID(); |
} |
1209,13 → 1339,13 |
} |
@Override |
public void barcodeRead(String code) { |
public void barcodeRead(Barcode code) { |
if (((JFrame) SwingUtilities.getRoot(getRowValuesTable())).isActive()) { |
final SQLSelect selArticle = new SQLSelect(); |
final SQLTable tableArticle = getSQLElement().getForeignElement("ID_ARTICLE").getTable(); |
selArticle.addSelectStar(tableArticle); |
Where w = new Where(tableArticle.getField("OBSOLETE"), "=", Boolean.FALSE); |
w = w.and(new Where(tableArticle.getField("CODE_BARRE"), "=", code)); |
w = w.and(new Where(tableArticle.getField("CODE_BARRE"), "=", code.getData())); |
selArticle.setWhere(w); |
List<SQLRow> l2 = SQLRowListRSH.execute(selArticle); |
if (l2.size() > 0) { |
1274,7 → 1404,17 |
this.buttons.add(buttonStock); |
} |
final JButton e2 = new JButton("Dump"); |
e2.addActionListener(new ActionListener() { |
@Override |
public void actionPerformed(ActionEvent e) { |
getModel().dumpValues(); |
} |
}); |
this.buttons.add(e2); |
// On réécrit la configuration au cas ou les preferences aurait changé |
this.table.writeState(); |
1344,4 → 1484,12 |
} |
} |
private boolean isLotLinked(SQLRowValues vals) { |
if (vals.getTable().getName().equals("BON_DE_LIVRAISON_ELEMENT")) { |
return !vals.getReferentRows(vals.getTable().getTable("LOT_LIVRAISON").getField("ID_BON_DE_LIVRAISON_ELEMENT")).isEmpty(); |
} |
return false; |
} |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/credit/component/AvoirClientSQLComponent.java |
---|
31,6 → 31,7 |
import org.openconcerto.erp.core.finance.accounting.element.ComptePCESQLElement; |
import org.openconcerto.erp.core.finance.accounting.element.EcritureSQLElement; |
import org.openconcerto.erp.core.finance.payment.component.ModeDeReglementSQLComponent; |
import org.openconcerto.erp.core.finance.tax.model.TaxeCache; |
import org.openconcerto.erp.core.sales.credit.ui.AvoirItemTable; |
import org.openconcerto.erp.core.supplychain.stock.element.StockItemsUpdater; |
import org.openconcerto.erp.core.supplychain.stock.element.StockItemsUpdater.TypeStockUpdate; |
37,7 → 38,6 |
import org.openconcerto.erp.core.supplychain.stock.element.StockLabel; |
import org.openconcerto.erp.generationDoc.gestcomm.AvoirClientXmlSheet; |
import org.openconcerto.erp.generationEcritures.GenerationMvtAvoirClient; |
import org.openconcerto.erp.generationEcritures.GenerationMvtSaisieVenteFacture; |
import org.openconcerto.erp.model.ISQLCompteSelector; |
import org.openconcerto.erp.panel.PanelOOSQLComponent; |
import org.openconcerto.erp.preferences.DefaultNXProps; |
219,7 → 219,11 |
this.eltModeRegl.setEditable(InteractionMode.DISABLED); |
this.eltModeRegl.setCreated(false); |
if (getTable().contains("ID_TAXE_PORT")) { |
vals.put("ID_TAXE_PORT", TaxeCache.getCache().getFirstTaxe().getID()); |
} |
// Selection du compte de service |
final SQLRow prefs = getTable().getDBRoot().getTable("PREFS_COMPTE").getTable().getRow(2); |
int idCompteVenteService = prefs.getInt("ID_COMPTE_PCE_VENTE_SERVICE"); |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/credit/element/AvoirClientSQLElement.java |
---|
32,15 → 32,21 |
import org.openconcerto.sql.model.SQLSelect; |
import org.openconcerto.sql.model.Where; |
import org.openconcerto.sql.request.ListSQLRequest; |
import org.openconcerto.sql.view.list.IListe; |
import org.openconcerto.sql.view.list.RowAction; |
import org.openconcerto.sql.view.list.SQLTableModelSource; |
import org.openconcerto.utils.ExceptionHandler; |
import org.openconcerto.utils.ListMap; |
import java.awt.event.ActionEvent; |
import java.sql.SQLException; |
import java.util.ArrayList; |
import java.util.Collection; |
import java.util.List; |
import javax.swing.AbstractAction; |
import javax.swing.JOptionPane; |
import org.apache.commons.dbutils.handlers.ArrayListHandler; |
public class AvoirClientSQLElement extends ComptaSQLConfElement { |
48,7 → 54,34 |
public AvoirClientSQLElement() { |
super("AVOIR_CLIENT", "une facture d'avoir", "factures d'avoir"); |
getRowActions().addAll(new MouseSheetXmlListeListener(this, AvoirClientXmlSheet.class).getRowActions()); |
RowAction actionRegul = new RowAction(new AbstractAction("Forcer le solde de l'avoir") { |
public void actionPerformed(ActionEvent e) { |
SQLRow row = IListe.get(e).fetchSelectedRow(); |
int answer = JOptionPane.showConfirmDialog(null, "Etes vous sûr de vouloir solder l'avoir ?"); |
if (answer == JOptionPane.YES_OPTION) { |
SQLRowValues rowVals = row.createEmptyUpdateRow(); |
rowVals.put("MONTANT_SOLDE", row.getLong("MONTANT_TTC")); |
rowVals.put("MONTANT_RESTANT", 0L); |
rowVals.put("SOLDE", Boolean.TRUE); |
try { |
rowVals.commit(); |
} catch (SQLException e1) { |
e1.printStackTrace(); |
} |
} |
} |
}, false) { |
@Override |
public boolean enabledFor(List<SQLRowValues> selection) { |
return (selection != null && selection.size() == 1); |
} |
}; |
getRowActions().add(actionRegul); |
} |
@Override |
protected void setupLinks(SQLElementLinksSetup links) { |
92,6 → 125,7 |
@Override |
protected synchronized void _initTableSource(final SQLTableModelSource table) { |
super._initTableSource(table); |
addCommercialFilter(table, getTable().getField("ID_COMMERCIAL")); |
} |
/* |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/order/element/CommandeClientElementSQLElement.java |
---|
25,6 → 25,8 |
import org.openconcerto.sql.element.SQLComponent; |
import org.openconcerto.sql.element.SQLElement; |
import org.openconcerto.sql.element.UISQLComponent; |
import org.openconcerto.sql.model.AliasedTable; |
import org.openconcerto.sql.model.SQLDataSource; |
import org.openconcerto.sql.model.SQLInjector; |
import org.openconcerto.sql.model.SQLRow; |
import org.openconcerto.sql.model.SQLRowAccessor; |
38,6 → 40,7 |
import org.openconcerto.sql.request.UpdateBuilder; |
import org.openconcerto.sql.sqlobject.ElementComboBox; |
import org.openconcerto.sql.users.UserManager; |
import org.openconcerto.sql.utils.SQLUtils; |
import org.openconcerto.sql.view.EditFrame; |
import org.openconcerto.sql.view.EditPanel.EditMode; |
import org.openconcerto.sql.view.list.IListe; |
45,6 → 48,7 |
import org.openconcerto.sql.view.list.RowAction.PredicateRowAction; |
import org.openconcerto.ui.FrameUtil; |
import org.openconcerto.utils.DecimalUtils; |
import org.openconcerto.utils.ExceptionHandler; |
import org.openconcerto.utils.ListMap; |
import java.awt.event.ActionEvent; |
52,6 → 56,7 |
import java.sql.SQLException; |
import java.util.ArrayList; |
import java.util.Arrays; |
import java.util.Collection; |
import java.util.HashSet; |
import java.util.List; |
import java.util.Set; |
82,7 → 87,7 |
public void actionPerformed(ActionEvent e) { |
List<SQLRowValues> resultId = new ArrayList<>(); |
CommandeClientSQLElement cmdElt = (CommandeClientSQLElement) getForeignElement("ID_COMMANDE_CLIENT"); |
for (SQLRowValues sqlRowAccessor : IListe.get(e).getSelectedRows()) { |
for (SQLRowAccessor sqlRowAccessor : IListe.get(e).getSelectedRowAccessors()) { |
resultId.add(sqlRowAccessor.getForeign("ID_COMMANDE_CLIENT").asRowValues()); |
} |
cmdElt.transfertBonLivraisonClient(resultId); |
96,7 → 101,7 |
@Override |
public void actionPerformed(ActionEvent e) { |
SQLRowValues selectedRow = IListe.get(e).getSelectedRow(); |
SQLRowAccessor selectedRow = IListe.get(e).getSelectedRowAccessor(); |
EditFrame f = new EditFrame(getForeignElement("ID_COMMANDE_CLIENT"), EditMode.MODIFICATION); |
f.getSQLComponent().select(selectedRow.getForeignID("ID_COMMANDE_CLIENT")); |
FrameUtil.showPacked(f); |
135,7 → 140,7 |
@Override |
public void actionPerformed(ActionEvent e) { |
recalculStockTh(); |
recalculStockTh(null); |
} |
148,24 → 153,52 |
} |
private void updateForceLivrer(ActionEvent e, Boolean state) { |
final List<SQLRowValues> selectedRows = IListe.get(e).getSelectedRows(); |
final List<SQLRowAccessor> selectedRows = IListe.get(e).getSelectedRowAccessors(); |
final Set<Integer> ids = new HashSet<Integer>(); |
for (SQLRowValues sqlRowValues : selectedRows) { |
final Set<Integer> idsArticle = new HashSet<Integer>(); |
SQLDataSource ds = null; |
for (SQLRowAccessor sqlRowValues : selectedRows) { |
ds = sqlRowValues.getTable().getDBSystemRoot().getDataSource(); |
ids.add(sqlRowValues.getID()); |
if (sqlRowValues.getNonEmptyForeign("ID_ARTICLE") != null) { |
idsArticle.add(sqlRowValues.getForeignID("ID_ARTICLE")); |
} |
} |
try { |
SQLUtils.executeAtomic(ds, new SQLUtils.SQLFactory<Object>() { |
@Override |
public Object create() throws SQLException { |
UpdateBuilder build = new UpdateBuilder(getTable()); |
build.setObject("LIVRE_FORCED", state); |
build.setWhere(new Where(getTable().getKey(), ids)); |
getTable().getDBSystemRoot().getDataSource().execute(build.asString()); |
IListe.get(e).getModel().updateAll(); |
if (!idsArticle.isEmpty()) { |
recalculStockTh(idsArticle); |
} |
for (Integer i : ids) { |
getTable().fireTableModified(i); |
} |
return null; |
} |
public void recalculStockTh() { |
}); |
} catch (SQLException e1) { |
ExceptionHandler.handle("Erreur lors du recalcul des stocks théoriques", e1); |
} |
} |
public void recalculStockTh(Collection<Integer> articles) { |
if (articles != null && articles.isEmpty()) { |
return; |
} |
// RAZ des stocks TH --> TH = REEL |
final SQLTable tableStock = getTable().getDBRoot().findTable("STOCK"); |
String req = "UPDATE " + tableStock.getSQLName().quote() + " SET " + tableStock.getField("QTE_TH").getQuotedName() + " = " + tableStock.getField("QTE_REEL").getQuotedName() + "," |
String req = "UPDATE " + tableStock.getSQLName().quote() + " s SET " + tableStock.getField("QTE_TH").getQuotedName() + " = " + tableStock.getField("QTE_REEL").getQuotedName() + "," |
+ tableStock.getField("QTE_RECEPT_ATTENTE").getQuotedName() + " = 0," + tableStock.getField("QTE_LIV_ATTENTE").getQuotedName() + "=0"; |
if (articles != null && !articles.isEmpty()) { |
req += " WHERE " + tableStock.getField("ARCHIVE").getQuotedName() + "=0 AND " + Where.inValues(new AliasedTable(tableStock, "s").getField("ID_ARTICLE"), articles).getClause(); |
} |
tableStock.getDBSystemRoot().getDataSource().execute(req); |
{ |
173,6 → 206,9 |
final SQLTable tableCmdElt = tableStock.getTable("COMMANDE_ELEMENT"); |
selCmdElt.addSelectStar(tableCmdElt); |
Where w = new Where(tableCmdElt.getField("RECU_FORCED"), "=", Boolean.FALSE).and(new Where(tableCmdElt.getField("RECU"), "=", Boolean.FALSE)); |
if (articles != null && !articles.isEmpty()) { |
w = w.and(Where.inValues(tableCmdElt.getField("ID_ARTICLE"), articles)); |
} |
w = w.and(Where.createRaw( |
tableCmdElt.getField("QTE_RECUE").getQuotedName() + " < (" + tableCmdElt.getField("QTE").getQuotedName() + "*" + tableCmdElt.getField("QTE_UNITAIRE").getQuotedName() + ")", |
tableCmdElt.getField("QTE_UNITAIRE"), tableCmdElt.getField("QTE"), tableCmdElt.getField("QTE_RECUE"))); |
202,7 → 238,9 |
w = w.and(Where.createRaw( |
tableCmdElt.getField("QTE_LIVREE").getQuotedName() + " < (" + tableCmdElt.getField("QTE").getQuotedName() + "*" + tableCmdElt.getField("QTE_UNITAIRE").getQuotedName() + ")", |
tableCmdElt.getField("QTE_UNITAIRE"), tableCmdElt.getField("QTE"), tableCmdElt.getField("QTE_LIVREE"))); |
if (articles != null && !articles.isEmpty()) { |
w = w.and(Where.inValues(tableCmdElt.getField("ID_ARTICLE"), articles)); |
} |
selCmdElt.setWhere(w); |
List<SQLRow> res = SQLRowListRSH.execute(selCmdElt); |
if (res != null && res.size() > 0) { |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/order/element/CommandeClientSQLElement.java |
---|
123,7 → 123,7 |
action.setPath(Arrays.asList("Etat", "Etat", "Etat")); |
getRowActions().add(action); |
} |
if (prefs.getBoolean(GestionCommercialeGlobalPreferencePanel.TRANSFERT_AUTOMATIQUE, false)) { |
PredicateRowAction actionTransfertBL = new PredicateRowAction(new AbstractAction("Transfert automatique vers BL") { |
@Override |
143,6 → 143,7 |
}, false); |
actionTransfertBL.setPredicate(IListeEvent.getNonEmptySelectionPredicate()); |
getRowActions().add(actionTransfertBL); |
} |
PredicateRowAction actionStock = new PredicateRowAction(new AbstractAction("Vérification des stocks") { |
163,6 → 164,7 |
actionStock.setPredicate(IListeEvent.getNonEmptySelectionPredicate()); |
getRowActions().add(actionStock); |
if (prefs.getBoolean(GestionCommercialeGlobalPreferencePanel.TRANSFERT_AUTOMATIQUE, false)) { |
PredicateRowAction actionFacture = new PredicateRowAction(new AbstractAction("Transfert automatique en facture") { |
@Override |
182,8 → 184,8 |
}, false); |
actionFacture.setPredicate(IListeEvent.getNonEmptySelectionPredicate()); |
getRowActions().add(actionFacture); |
} |
} |
if (prefs.getBoolean(GestionCommercialeGlobalPreferencePanel.ACOMPTE_DEVIS, false)) { |
PredicateRowAction actionClient = new PredicateRowAction(new AbstractAction("Saisir un acompte") { |
361,10 → 363,51 |
allowedActions.add(bonAction); |
allowedActions.add(factureAction); |
allowedActions.add(acompteAction); |
if (prefs.getBoolean(GestionCommercialeGlobalPreferencePanel.FACTURE_PREVISIONNELLE, false)) { |
RowAction acomptePrevAction = new RowAction(new AbstractAction("Créer une facture intermédiaire (prévisionnelle)") { |
public void actionPerformed(ActionEvent e) { |
transfertAcompteClient(IListe.get(e).getSelectedRows(), true); |
} |
}, false, "sales.order.create.account.prev") { |
BigDecimal cent = BigDecimal.ONE.movePointRight(2); |
@Override |
public boolean enabledFor(List<SQLRowValues> selection) { |
if (selection.isEmpty() || selection.size() > 1) { |
return false; |
} else { |
BigDecimal d = getAvancement(selection.get(0)); |
return NumberUtils.compare(d, cent) != 0; |
} |
} |
}; |
allowedActions.add(acomptePrevAction); |
} |
allowedActions.add(soldeAction); |
if (prefs.getBoolean(GestionCommercialeGlobalPreferencePanel.FACTURE_PREVISIONNELLE, false)) { |
RowAction acomptePrevAction = new RowAction(new AbstractAction("Facturer le solde (prévisionnelle)") { |
public void actionPerformed(ActionEvent e) { |
transfertSoldeClient(IListe.get(e).getSelectedRows(), true); |
} |
}, false, "sales.order.create.account.prev") { |
BigDecimal cent = BigDecimal.ONE.movePointRight(2); |
@Override |
public boolean enabledFor(List<SQLRowValues> selection) { |
if (selection.isEmpty() || selection.size() > 1) { |
return false; |
} else { |
BigDecimal d = getAvancement(selection.get(0)); |
return NumberUtils.compare(d, cent) != 0; |
} |
} |
}; |
allowedActions.add(acomptePrevAction); |
} |
allowedActions.add(cmdAction); |
allowedActions.add(reliquatAction); |
allowedActions.addAll(mouseSheetXmlListeListener.getRowActions()); |
getRowActions().addAll(allowedActions); |
} |
593,6 → 636,13 |
eltMvtStock.archive(((Number) tmp[0]).intValue()); |
} |
} |
final SQLTable tableCmdItem = getTable().getTable("COMMANDE_CLIENT_ELEMENT"); |
UpdateBuilder build = new UpdateBuilder(tableCmdItem); |
build.setObject("LIVRE_FORCED", Boolean.TRUE); |
build.setWhere(Where.inValues(tableCmdItem.getField("ID_COMMANDE_CLIENT"), ids)); |
getTable().getDBSystemRoot().getDataSource().execute(build.asString()); |
} catch (SQLException e) { |
ExceptionHandler.handle("Erreur lors de la suppression des mouvements de stocks", e); |
} |
690,6 → 740,8 |
// } |
// }); |
source.init(); |
addCommercialFilter(source, getTable().getField("ID_COMMERCIAL")); |
SQLPreferences prefs = SQLPreferences.getMemCached(getTable().getDBRoot()); |
if (prefs.getBoolean(GestionCommercialeGlobalPreferencePanel.ORDER_PACKAGING_MANAGEMENT, true)) { |
852,9 → 904,13 |
* @param row |
*/ |
public EditFrame transfertAcompteClient(List<SQLRowValues> rows) { |
return TransfertGroupSQLComponent.openTransfertFrame(rows, "SAISIE_VENTE_FACTURE", VenteFactureSituationSQLComponent.ID); |
return transfertAcompteClient(rows, false); |
} |
public EditFrame transfertAcompteClient(List<SQLRowValues> rows, boolean prev) { |
return TransfertGroupSQLComponent.openTransfertFrame(rows, "SAISIE_VENTE_FACTURE", (prev) ? VenteFactureSituationSQLComponent.ID_PREVISIONNELLE : VenteFactureSituationSQLComponent.ID); |
} |
/** |
* Transfert en Facture |
* |
864,6 → 920,10 |
return TransfertGroupSQLComponent.openTransfertFrame(rows, "SAISIE_VENTE_FACTURE", VenteFactureSoldeSQLComponent.ID); |
} |
public EditFrame transfertSoldeClient(List<SQLRowValues> rows, boolean prev) { |
return TransfertGroupSQLComponent.openTransfertFrame(rows, "SAISIE_VENTE_FACTURE", (prev) ? VenteFactureSoldeSQLComponent.ID_PREVISIONNELLE : VenteFactureSoldeSQLComponent.ID); |
} |
public BigDecimal getAvancement(SQLRowAccessor r) { |
Collection<? extends SQLRowAccessor> rows = r.getReferentRows(r.getTable().getTable("TR_COMMANDE_CLIENT")); |
long totalFact = 0; |
894,10 → 954,12 |
editFrame.setVisible(true); |
} |
}, true, "sales.quote.clone") { |
@Override |
public boolean enabledFor(java.util.List<org.openconcerto.sql.model.SQLRowValues> selection) { |
return (selection != null && selection.size() == 1); |
} |
}; |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/order/action/ListeDesElementsACommanderClientAction.java |
---|
85,7 → 85,7 |
final String quoteQte = new SQLName(input.getAlias(eltCmd.getTable()).getAlias(), "QTE").quote(); |
final String quoteQteU = new SQLName(input.getAlias(eltCmd.getTable()).getAlias(), "QTE_UNITAIRE").quote(); |
Where w = Where.createRaw(quoteQteL + " < (" + quoteQte + "*" + quoteQteU + ")", eltCmd.getTable().getField("QTE_LIVREE"), eltCmd.getTable().getField("QTE"), |
eltCmd.getTable().getField("QTE_UNITAIRE")); |
eltCmd.getTable().getField("QTE_UNITAIRE")).or(Where.isNull(input.getAlias(eltCmd.getTable()).getField("QTE_LIVREE"))); |
w = w.and(new Where(eltCmd.getTable().getField("LIVRE_FORCED"), "=", Boolean.FALSE)); |
input.setWhere(w); |
return input; |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/order/action/ListeDesCommandesClientAction.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
138,7 → 138,7 |
@Override |
public Set<FieldPath> getPaths() { |
final Path p = new PathBuilder(eltCmd.getTable()).addTable("TR_COMMANDE_CLIENT").addTable("SAISIE_VENTE_FACTURE").build(); |
return CollectionUtils.createSet(new FieldPath(p, "T_HT")); |
return CollectionUtils.createSet(new FieldPath(p, "T_HT"), new FieldPath(p, "T_TTC"), new FieldPath(p, "T_AVOIR_TTC")); |
} |
}; |
} |
200,10 → 200,15 |
for (SQLRowAccessor row : rows) { |
if (!row.isForeignEmpty("ID_SAISIE_VENTE_FACTURE")) { |
SQLRowAccessor rowFact = row.getForeign("ID_SAISIE_VENTE_FACTURE"); |
Long l = rowFact.getLong("T_HT"); |
long l = rowFact.getLong("T_HT"); |
long ttc = rowFact.getLong("T_TTC"); |
long avoir = rowFact.getLong("T_AVOIR_TTC"); |
// Test si la facture a été annulé par un avoir |
if (ttc != avoir) { |
totalFact += l; |
} |
} |
} |
if (total > 0) { |
return new BigDecimal(totalFact).divide(new BigDecimal(total), DecimalUtils.HIGH_PRECISION).movePointRight(2).setScale(2, RoundingMode.HALF_UP); |
} else { |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/order/action/ListeDesCommandesClientItemsAction.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
50,7 → 50,7 |
@Override |
protected SQLTableModelSource createTableSource() { |
final SQLTableModelSource res = super.createTableSource(); |
res.getReq().setWhere(new Where(getElem().getTable().getField("ID_COMMANDE_CLIENT"), ">", 1)); |
res.getReq().putWhere("Undef", new Where(getElem().getTable().getField("ID_COMMANDE_CLIENT"), ">", 1)); |
return res; |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/order/ui/ReliquatCommandeTableModel.java |
---|
28,7 → 28,7 |
public class ReliquatCommandeTableModel extends AbstractTableModel { |
private List<String> columns = Arrays.asList("Code", "Nom", "Qté cmd", "Reliquat"); |
private List<String> columns = Arrays.asList("Code", "Nom", "Taille", "Couleur", "Qté cmd", "Reliquat"); |
private final List<? extends SQLRowAccessor> values; |
39,16 → 39,10 |
@Override |
public Class<?> getColumnClass(int columnIndex) { |
if (columnIndex == 0) { |
if (columnIndex <= 3) { |
return String.class; |
} else if (columnIndex == 1) { |
return String.class; |
} else if (columnIndex == 2) { |
return BigDecimal.class; |
} else { |
return BigDecimal.class; |
} |
} |
72,6 → 66,20 |
} else if (columnIndex == 1) { |
return this.values.get(rowIndex).getString("NOM"); |
} else if (columnIndex == 2) { |
SQLRowAccessor rTaille = this.values.get(rowIndex).getNonEmptyForeign("ID_ARTICLE_DECLINAISON_TAILLE"); |
if (rTaille != null) { |
return rTaille.getString("NOM"); |
} else { |
return ""; |
} |
} else if (columnIndex == 3) { |
SQLRowAccessor rCouleur = this.values.get(rowIndex).getNonEmptyForeign("ID_ARTICLE_DECLINAISON_COULEUR"); |
if (rCouleur != null) { |
return rCouleur.getString("NOM"); |
} else { |
return ""; |
} |
} else if (columnIndex == 4) { |
return this.values.get(rowIndex).getBigDecimal("QTE_UNITAIRE").multiply(new BigDecimal(this.values.get(rowIndex).getString("QTE"))).setScale(2, RoundingMode.HALF_UP); |
} else { |
BigDecimal qteCmd = this.values.get(rowIndex).getBigDecimal("QTE_UNITAIRE").multiply(new BigDecimal(this.values.get(rowIndex).getString("QTE"))).setScale(2, RoundingMode.HALF_UP); |
95,9 → 103,13 |
final SQLTable table = tableCmd.getTable(tableCmd.getName() + "_ELEMENT"); |
SQLRowValues rowVals = new SQLRowValues(table); |
final String fieldQteRecueLivree = tableCmd.getName().equals("COMMANDE") ? "QTE_RECUE" : "QTE_LIVREE"; |
rowVals.putNulls("CODE", "NOM", "QTE", "QTE_UNITAIRE", fieldQteRecueLivree); |
rowVals.putRowValues("ID_ARTICLE_DECLINAISON_TAILLE").putNulls("NOM"); |
rowVals.putRowValues("ID_ARTICLE_DECLINAISON_COULEUR").putNulls("NOM"); |
final Where w = new Where(table.getField("ID_" + tableCmd.getName()), "=", rowCmd.getID()); |
final Where w = new Where(table.getField("ID_" + tableCmd.getName()), "=", rowCmd.getID()) |
.and(new Where(table.getField("ID_ARTICLE"), "!=", table.getForeignTable("ID_ARTICLE").getUndefinedIDNumber())); |
final Where w2 = Where |
.createRaw(table.getField(fieldQteRecueLivree).getQuotedName() + " < (" + table.getField("QTE").getQuotedName() + "*" + table.getField("QTE_UNITAIRE").getQuotedName() + ")", |
table.getField("QTE_UNITAIRE"), table.getField("QTE"), table.getField(fieldQteRecueLivree)) |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/order/component/CommandeClientSQLComponent.java |
---|
251,7 → 251,7 |
@Override |
public void propertyChange(PropertyChangeEvent evt) { |
if (!isFilling() && comboClient.getValue() != null) { |
if ((getMode() == Mode.INSERTION || !isFilling()) && comboClient.getValue() != null) { |
Integer id = comboClient.getValue(); |
if (id > 1) { |
563,6 → 563,7 |
// Table d'élément |
this.table = new CommandeClientItemTable(); |
this.table.getRowValuesTable().getRowValuesTableModel().setValidationField(getTable().getTable("BON_DE_LIVRAISON_ELEMENT").getField("ID_COMMANDE_CLIENT_ELEMENT")); |
JTabbedPane pane = new JTabbedPane(); |
c.fill = GridBagConstraints.BOTH; |
c.gridy++; |
930,19 → 931,8 |
@Override |
public void select(SQLRowAccessor r) { |
if (r == null || r.getIDNumber() == null) |
super.select(r); |
else { |
System.err.println(r); |
final SQLRowValues rVals = r.asRowValues().deepCopy(); |
final SQLRowValues vals = new SQLRowValues(r.getTable()); |
vals.load(rVals, createSet("ID_CLIENT")); |
vals.setID(rVals.getID()); |
System.err.println("Select CLIENT"); |
super.select(vals); |
rVals.remove("ID_CLIENT"); |
super.select(rVals); |
} |
if (r != null) { |
this.table.getRowValuesTable().insertFrom(r); |
this.tableFacturationItem.getRowValuesTable().insertFrom(r); |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/account/PartialInvoiceEditGroup.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
36,7 → 36,8 |
gCustomer.addItem("ID_ADRESSE"); |
gCustomer.addItem("ID_ADRESSE_LIVRAISON"); |
gCustomer.addItem("REMISE_HT"); |
gCustomer.addItem("POURCENT_RG"); |
gCustomer.addItem("PREVISIONNELLE"); |
add(gCustomer); |
final Group gElements = new Group("sales.invoice.partial.items"); |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/account/VenteFactureSituationSQLComponent.java |
---|
72,6 → 72,7 |
public class VenteFactureSituationSQLComponent extends TransfertGroupSQLComponent { |
public static final String ID = "sales.invoice.partial"; |
public static final String ID_PREVISIONNELLE = "sales.invoice.partial.future"; |
private PanelOOSQLComponent panelOO; |
268,6 → 269,10 |
public JComponent createEditor(String id) { |
if (id.equals("sales.invoice.number")) { |
if (getCode().equals(ID_PREVISIONNELLE)) { |
this.numberField = new JUniqueTextField(20); |
return this.numberField; |
} else { |
this.numberField = new JUniqueTextField(20) { |
@Override |
public String getAutoRefreshNumber() { |
279,6 → 284,7 |
} |
}; |
return this.numberField; |
} |
} else if (id.equals("panel.oo")) { |
this.panelOO = new PanelOOSQLComponent(this); |
return this.panelOO; |
393,8 → 399,9 |
} |
((AbstractArticleItemTable) getEditor("sales.invoice.partial.items.list")).updateField("ID_SAISIE_VENTE_FACTURE", idSaisieVF); |
if (!rowFacture.getBoolean("PREVISIONNELLE")) { |
new GenerationMvtSaisieVenteFacture(idSaisieVF); |
} |
try { |
VenteFactureXmlSheet sheet = new VenteFactureXmlSheet(rowFacture); |
sheet.createDocument(); |
421,6 → 428,7 |
final SQLRow rowFacture = getTable().getRow(id); |
((AbstractArticleItemTable) getEditor("sales.invoice.partial.items.list")).updateField("ID_SAISIE_VENTE_FACTURE", id); |
if (!rowFacture.getBoolean("PREVISIONNELLE")) { |
int idMvt = rowFacture.getInt("ID_MOUVEMENT"); |
// on supprime tout ce qui est lié à la facture |
System.err.println("Archivage des fils"); |
427,6 → 435,7 |
EcritureSQLElement eltEcr = (EcritureSQLElement) getDirectory().getElement("ECRITURE"); |
eltEcr.archiveMouvementProfondeur(idMvt, false); |
new GenerationMvtSaisieVenteFacture(id); |
} |
try { |
VenteFactureXmlSheet sheet = new VenteFactureXmlSheet(rowFacture); |
sheet.createDocument(); |
434,12 → 443,31 |
} catch (Exception e) { |
ExceptionHandler.handle("Une erreur est survenue lors de la création du document.", e); |
} |
// incrémentation du numéro auto |
if (NumerotationAutoSQLElement.getNextNumero(SaisieVenteFactureSQLElement.class, rowFacture.getDate("DATE").getTime()).equalsIgnoreCase(rowFacture.getString("NUMERO"))) { |
SQLRowValues rowVals = new SQLRowValues(this.tableNum); |
String labelNumberFor = NumerotationAutoSQLElement.getLabelNumberFor(SaisieVenteFactureSQLElement.class); |
int val = this.tableNum.getRow(2).getInt(labelNumberFor); |
val++; |
rowVals.put(labelNumberFor, Integer.valueOf(val)); |
try { |
rowVals.update(2); |
} catch (SQLException e1) { |
e1.printStackTrace(); |
} |
} |
} |
@Override |
protected SQLRowValues createDefaults() { |
SQLRowValues rowVals = new SQLRowValues(getTable()); |
if (getCode().equals(ID_PREVISIONNELLE)) { |
rowVals.put("NUMERO", "PREV_" + NumerotationAutoSQLElement.getNextNumero(SaisieVenteFactureSQLElement.class, new Date())); |
rowVals.put("PREVISIONNELLE", Boolean.TRUE); |
} else { |
rowVals.put("NUMERO", NumerotationAutoSQLElement.getNextNumero(SaisieVenteFactureSQLElement.class, new Date())); |
} |
rowVals.put("PARTIAL", Boolean.TRUE); |
return rowVals; |
} |
452,4 → 480,5 |
return super.addView(comp, id); |
} |
} |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/account/VenteFactureSoldeEditGroup.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
35,6 → 35,8 |
final Group gCustomer = new Group("sales.invoice.partial.balance.customer"); |
gCustomer.addItem("sales.invoice.customer", LayoutHints.DEFAULT_LARGE_FIELD_HINTS); |
gCustomer.addItem("REMISE_HT"); |
gCustomer.addItem("POURCENT_RG"); |
gCustomer.addItem("PREVISIONNELLE"); |
add(gCustomer); |
final Group gElements = new Group("sales.invoice.partial.balance.items"); |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/account/VenteFactureSoldeSQLComponent.java |
---|
1,7 → 1,7 |
/* |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
* |
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved. |
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved. |
* |
* The contents of this file are subject to the terms of the GNU General Public License Version 3 |
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a |
47,6 → 47,7 |
public class VenteFactureSoldeSQLComponent extends VenteFactureSituationSQLComponent { |
public static final String ID = "sales.invoice.partial.balance"; |
public static final String ID_PREVISIONNELLE = "sales.invoice.partial.balance.future"; |
public VenteFactureSoldeSQLComponent(SQLElement element) { |
super(element, (Group) GlobalMapper.getInstance().get(ID)); |
66,7 → 67,12 |
@Override |
protected SQLRowValues createDefaults() { |
SQLRowValues rowVals = new SQLRowValues(getTable()); |
if (getCode().equals(ID_PREVISIONNELLE)) { |
rowVals.put("NUMERO", "PREV_" + NumerotationAutoSQLElement.getNextNumero(SaisieVenteFactureSQLElement.class, new Date())); |
rowVals.put("PREVISIONNELLE", Boolean.TRUE); |
} else { |
rowVals.put("NUMERO", NumerotationAutoSQLElement.getNextNumero(SaisieVenteFactureSQLElement.class, new Date())); |
} |
rowVals.put("SOLDE", Boolean.TRUE); |
return rowVals; |
} |
132,10 → 138,15 |
SQLRowAccessor rowFacture = sqlRowAccessor2.getForeign("ID_SAISIE_VENTE_FACTURE"); |
if (!alreadyAdded.contains(rowFacture)) { |
alreadyAdded.add(rowFacture); |
long ttc = rowFacture.getLong("T_TTC"); |
long avoir = rowFacture.getLong("T_AVOIR_TTC"); |
// test si facture annulée |
if (ttc != avoir) { |
l += rowFacture.getLong("T_HT"); |
} |
} |
} |
} |
return l; |
} |
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/invoice/component/SaisieVenteFactureSQLComponent.java |
---|
49,7 → 49,6 |
import org.openconcerto.sql.element.ElementSQLObject; |
import org.openconcerto.sql.element.SQLComponent; |
import org.openconcerto.sql.element.SQLElement; |