OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Compare Revisions

Regard whitespace Rev 185 → Rev 184

/trunk/OpenConcerto/jpackage.properties
File deleted
/trunk/OpenConcerto/.classpath
13,6 → 13,7
<classpathentry exported="true" kind="lib" path="lib/jdom-1.1.1.jar"/>
<classpathentry exported="true" kind="lib" path="lib/jgrapht-0.7.3.jar"/>
<classpathentry exported="true" kind="lib" path="lib/jpos111.jar"/>
<classpathentry exported="true" kind="lib" path="lib/ognl-2.6.5.jar"/>
<classpathentry exported="true" kind="lib" path="lib/resolver.jar"/>
<classpathentry exported="true" kind="lib" path="lib/RXTXcomm.jar"/>
<classpathentry kind="lib" path="lib/jcip-annotations.jar"/>
34,8 → 35,8
<classpathentry kind="lib" path="lib/accessors-smart-1.1.jar"/>
<classpathentry kind="lib" path="lib/gson-2.8.1.jar"/>
<classpathentry kind="lib" path="lib/icudata_56.jar"/>
<classpathentry exported="true" kind="lib" path="lib/javax.mail-1.6.0.jar"/>
<classpathentry exported="true" kind="lib" path="lib/json-smart-2.2.1.jar"/>
<classpathentry kind="lib" path="lib/javax.mail-1.6.0.jar"/>
<classpathentry kind="lib" path="lib/json-smart-2.2.1.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="lib" path="lib/piccolo-1.04.jar"/>
<classpathentry kind="lib" path="lib/javax.activation-1.1.1.jar"/>
47,6 → 48,5
<classpathentry kind="lib" path="lib/flatlaf-1.2.jar"/>
<classpathentry kind="lib" path="lib/fontbox-2.0.22.jar"/>
<classpathentry kind="lib" path="lib/pdfbox-2.0.22.jar"/>
<classpathentry kind="lib" path="lib/OGNL-3.3.2.ILM.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
/trunk/OpenConcerto/lib/OGNL-3.3.2.ILM.jar
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/OpenConcerto/lib/jOpenDocument-1.4rc2.jar
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/OpenConcerto/Configuration/Template/Labels/50x50.zpl
File deleted
\ No newline at end of file
/trunk/OpenConcerto/Configuration/Template/Labels/57x32.zpl
File deleted
\ No newline at end of file
/trunk/OpenConcerto/Configuration/Template/Default/EtatChargesPaye.odsp
File deleted
\ No newline at end of file
/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.odsp
File deleted
\ No newline at end of file
/trunk/OpenConcerto/Configuration/Template/Default/EtatRapprochement.xml
File deleted
\ No newline at end of file
/trunk/OpenConcerto/Configuration/Template/Default/RepartitionAnalytique.xml
28,11 → 28,7
<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/RepartitionAnalytique.odsp
1,7 → 1,9
<odsp>
<spliteveryrow>
<sheet number="0">69</sheet>
<sheet number="0">68</sheet>
</spliteveryrow>
<offset x="0" y ="0"/>
<resize percent="100"/>
<offset x="40" y ="20"/>
<resize percent="85"/>
 
 
</odsp>
/trunk/OpenConcerto/Configuration/Template/Default/LivrePaye.odsp
2,8 → 2,8
<spliteveryrow>
<sheet number="0">67</sheet>
</spliteveryrow>
<offset x="0" y ="0"/>
<resize percent="100"/>
<offset x="40" y ="20"/>
<resize percent="85"/>
 
 
</odsp>
/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/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/EtatVentes.ods
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/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/EtatStockInventaire.xml
3,7 → 3,7
<!-- <element location="A3" type="Value" ValueName="DATE">
</element>
-->
<table firstLine="2" endLine="-1" endPageLine="25000" lastColumn="E" table="SAISIE_VENTE_FACTURE">
<table firstLine="2" endLine="17000" endPageLine="25000" lastColumn="E" table="SAISIE_VENTE_FACTURE">
<element location="A" type="fill">
<field name="FAMILLE" />
29,9 → 29,5
<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="C7" type="fill">
<element location="D7" type="fill">
<field base="Common" table="SOCIETE_COMMON" name="NUMERO_URSSAF" />
</element>
 
<element location="F7" type="fill">
<element location="G7" type="fill">
<field base="Common" table="SOCIETE_COMMON" name="NUM_SIRET" />
</element>
 
114,10 → 114,10
<field name="DETAILS_CONGES" />
</element>
 
<element location="G52" type="fill">
<element location="H52" type="fill">
<field name="COT_SAL" />
</element>
<element location="H52" type="fill">
<element location="I52" type="fill">
<field name="COT_PAT" />
</element>
 
/trunk/OpenConcerto/src/META-INF/services/javax.script.ScriptEngineFactory
File deleted
/trunk/OpenConcerto/src/org/jopendocument/link/Component.java
1,7 → 1,7
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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,7 → 27,6
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;
55,8 → 54,7
}
 
static private final URL[] getURLs(final OOInstallation ooInstall) {
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;
final List<URL> res = ooInstall.getURLs(CollectionUtils.createSet("ridl.jar", "jurt.jar", "juh.jar", "unoil.jar"));
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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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/OGNLScriptEngine.java
File deleted
/trunk/OpenConcerto/src/org/openconcerto/ognl/OGNLScriptEngineFactory.java
File deleted
/trunk/OpenConcerto/src/org/openconcerto/odtemplate/TemplateGenerator.java
New file
0,0 → 1,99
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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.
*/
/*
* Créé le 15 nov. 2004
*/
package org.openconcerto.odtemplate;
 
import org.openconcerto.odtemplate.engine.OGNLDataModel;
import org.openconcerto.openoffice.ODPackage;
import org.openconcerto.openoffice.ODSingleXMLDocument;
import org.openconcerto.openoffice.generation.DocumentGenerator;
import org.openconcerto.openoffice.generation.ReportGeneration;
import org.openconcerto.utils.ExceptionUtils;
 
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
 
/**
* Un générateur se servant de d'une template. In this implementation only
* {@link ReportGeneration#getCommonData()} is provided to the template, subclass {@link #getData()}
* to add other objects.
*
* @author Sylvain CUAZ
* @param <R> type of generation
*/
public class TemplateGenerator<R extends ReportGeneration<?>> extends DocumentGenerator<R> {
 
private final File file;
private final ODPackage pkg;
 
public TemplateGenerator(final R rg, final File f) {
this(rg, f, null);
}
 
public TemplateGenerator(final R rg, final ODPackage pkg) {
this(rg, null, pkg);
}
 
private TemplateGenerator(final R rg, final File f, final ODPackage pkg) {
super(rg);
if ((f == null) == (pkg == null))
throw new IllegalArgumentException();
this.file = f;
this.pkg = pkg;
}
 
@Override
public final ODSingleXMLDocument generate() throws IOException, InterruptedException {
return this.substitute(this.getAllData());
}
 
protected final Map<String, Object> getAllData() throws IOException, InterruptedException {
// ce qui y est toujours
final Map<String, Object> res = new HashMap<String, Object>(this.getRg().getCommonData());
// plus les données de ce generateur en particulier
res.putAll(this.getData());
return res;
}
 
protected Map<String, Object> getData() throws InterruptedException {
return new HashMap<String, Object>();
}
 
private final ODSingleXMLDocument substitute(Map<String, Object> data) throws FileNotFoundException, IOException {
final ODPackage pkg = this.pkg == null ? new ODPackage(this.file) : this.pkg;
try {
this.transform(pkg.toSingle());
// MAYBE fireStatusChange with the number of tag done out of the total
try (final Template template = new Template(pkg)) {
return template.createDocument(new OGNLDataModel(data));
}
} catch (Exception exn) {
throw ExceptionUtils.createExn(IOException.class, "generation error in " + this, exn);
}
}
 
protected void transform(ODSingleXMLDocument single) throws Exception {
}
 
@Override
public String toString() {
return this.getClass() + (this.file != null ? (" with file " + this.file) : (" with package " + this.pkg));
}
 
}
/trunk/OpenConcerto/src/org/openconcerto/odtemplate/XMLTemplateGenerator.java
New file
0,0 → 1,45
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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.odtemplate;
 
import org.openconcerto.openoffice.generation.ReportGeneration;
 
import java.io.File;
import java.util.HashMap;
import java.util.Map;
 
import org.jdom.Element;
 
/**
* Un générateur utilisant un élément XML comme donnée.
*
* @author Sylvain CUAZ 15 nov. 2004
* @param <R> type of generation
*/
public abstract class XMLTemplateGenerator<R extends ReportGeneration<?>> extends TemplateGenerator<R> {
 
public XMLTemplateGenerator(final R rg, final File f) {
super(rg, f);
}
 
protected final Map<String, Object> getData() throws InterruptedException {
Element data = this.getDBXML();
Map<String, Object> m = new HashMap<String, Object>();
m.put(data.getName(), data);
return m;
}
 
public abstract Element getDBXML() throws InterruptedException;
 
}
/trunk/OpenConcerto/src/org/openconcerto/odtemplate/engine/ScriptEngineDataModel.java
1,7 → 1,7
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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/odtemplate/engine/DataModel.java
1,7 → 1,7
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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/odtemplate/engine/OGNLDataModel.java
1,7 → 1,7
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the GNU General Public License Version 3
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a
17,7 → 17,6
import java.util.Map;
 
import ognl.Ognl;
import ognl.OgnlContext;
import ognl.OgnlException;
 
/**
42,7 → 41,7
public OGNLDataModel(OGNLDataModel dm) {
this.root = dm.root;
final Map<String, Object> copy = new HashMap<String, Object>(dm.context);
this.context = Ognl.addDefaultContext(Ognl.getRoot(dm.context), ((OgnlContext) dm.context).getMemberAccess(), Ognl.getClassResolver(dm.context), Ognl.getTypeConverter(dm.context), copy);
this.context = Ognl.addDefaultContext(Ognl.getRoot(dm.context), Ognl.getClassResolver(dm.context), Ognl.getTypeConverter(dm.context), Ognl.getMemberAccess(dm.context), copy);
}
 
@Override
/trunk/OpenConcerto/src/org/openconcerto/odtemplate/engine/DataFormatter.java
1,7 → 1,7
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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/odtemplate/engine/Material.java
1,7 → 1,7
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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/odtemplate/engine/Parsed.java
1,7 → 1,7
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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/odtemplate/engine/Processor.java
1,7 → 1,7
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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/odtemplate/statements/Include.java
1,7 → 1,7
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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/odtemplate/statements/SetStmt.java
1,7 → 1,7
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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/odtemplate/statements/Statement.java
1,7 → 1,7
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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/odtemplate/statements/ForEach.java
1,7 → 1,7
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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/odtemplate/statements/If.java
1,7 → 1,7
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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/odtemplate/statements/BaseStatement.java
1,7 → 1,7
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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/odtemplate/TemplateException.java
1,7 → 1,7
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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/odtemplate/Template.java
1,7 → 1,7
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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,23 → 418,11
 
private void showPopup() {
assert SwingUtilities.isEventDispatchThread();
 
if (this.model.getSize() > 0) {
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));
 
if (this.popupInvoker.isShowing())
this.popup.show(this.popupInvoker, 0, this.text.getBounds().height);
}
}
}
 
public void changedUpdate(DocumentEvent e) {
updateAutoCompletion(false);
/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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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/utils/GenerationUtils.java
New file
0,0 → 1,119
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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.sql.utils;
 
import org.openconcerto.sql.element.RowBacked;
import org.openconcerto.sql.model.SQLField;
import org.openconcerto.sql.model.SQLRowAccessor;
import org.openconcerto.sql.model.SQLTable;
 
import java.util.Map;
 
import ognl.NoSuchPropertyException;
import ognl.ObjectPropertyAccessor;
import ognl.OgnlException;
import ognl.OgnlRuntime;
import ognl.PropertyAccessor;
 
public abstract class GenerationUtils {
 
static public void setPropertyAccessors() {
// comment naviguer dans eg site.id_etablissement.numero
OgnlRuntime.setPropertyAccessor(SQLRowAccessor.class, new PropertyAccessor() {
public Object getProperty(Map context, Object target, Object name) throws OgnlException {
final SQLRowAccessor r = (SQLRowAccessor) target;
final String nom = (String) name;
final SQLTable table = r.getTable();
final SQLField realField = table.getFieldRaw(nom);
// getField() used to be insensitive, but all fields are upper case
final SQLField field = realField != null ? realField : table.getFieldRaw(nom.toUpperCase());
final SQLTable refTable;
if (field != null) {
if (table.getForeignKeys().contains(field))
// si c'est une clef on trouve la ligne sur laquelle elle pointe
// MAYBE renvoyer null si pointe sur l'indéfini
return r.getForeign(field.getName());
else
// sinon on renvoie sa valeur
return r.getObject(field.getName());
} else if ((refTable = table.getDBSystemRoot().getGraph().findReferentTable(table, nom)) != null) {
// ce nest pas un champ de la ligne courante
// on essaye dans l'autre sens
return r.getReferentRows(refTable);
} else {
throw new OgnlException("'" + name + "' n'est ni un champ, ni une table référente de " + r);
}
}
 
public void setProperty(Map context, Object target, Object name, Object value) throws OgnlException {
// impossible
throw new OgnlException("", new UnsupportedOperationException("setProperty not supported on SQL rows"));
}
});
 
OgnlRuntime.setPropertyAccessor(org.jdom.Element.class, new PropertyAccessor() {
@Override
public Object getProperty(Map context, Object target, Object name) {
org.jdom.Element elem = (org.jdom.Element) target;
String n = (String) name;
// that way for XML and SQLRow, fields are accessed the same way
final String attributeValue = elem.getAttributeValue(n);
if (attributeValue != null)
return attributeValue;
else
// retourne le premier, TODO collections
return elem.getChild(n);
}
 
@Override
public void setProperty(Map context, Object target, Object name, Object value) throws OgnlException {
// impossible
throw new OgnlException("", new UnsupportedOperationException("setProperty not supported on XML elements"));
}
});
OgnlRuntime.setPropertyAccessor(org.jdom2.Element.class, new PropertyAccessor() {
@Override
public Object getProperty(Map context, Object target, Object name) {
org.jdom2.Element elem = (org.jdom2.Element) target;
String n = (String) name;
// that way for XML and SQLRow, fields are accessed the same way
final String attributeValue = elem.getAttributeValue(n);
if (attributeValue != null)
return attributeValue;
else
// retourne le premier, TODO collections
return elem.getChild(n);
}
 
@Override
public void setProperty(Map context, Object target, Object name, Object value) throws OgnlException {
// impossible
throw new OgnlException("", new UnsupportedOperationException("setProperty not supported on XML elements"));
}
});
 
OgnlRuntime.setPropertyAccessor(RowBacked.class, new ObjectPropertyAccessor() {
public Object getProperty(Map context, Object target, Object name) throws OgnlException {
// try the normal way (ie thru getters), if that fails try the get() method
try {
return super.getProperty(context, target, name);
} catch (NoSuchPropertyException e) {
final RowBacked elem = (RowBacked) target;
final String n = (String) name;
return elem.get(n.toUpperCase());
}
}
});
}
}
/trunk/OpenConcerto/src/org/openconcerto/sql/model/SQLRowValues.java
1105,17 → 1105,8
// 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) {
// 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 {
if (conv == null)
throw new IllegalArgumentException("No convertor to " + dest + " from " + source);
}
 
}
return conv.convert(source.cast(value));
}
 
/trunk/OpenConcerto/src/org/openconcerto/sql/model/SQLInjector.java
22,7 → 22,6
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;
 
194,34 → 193,20
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 + ", " + ref));
rowVals.put(to, cleanRef(label + ", " + srcRow.getString(from)));
} else {
rowVals.put(to, ref);
rowVals.put(to, srcRow.getString(from));
}
} 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", ref);
rowValsHeader.put("NOM", srcRow.getString(from));
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");
 
228,7 → 213,6
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) {
237,8 → 221,7
} else {
rowVals.put("NOM", srcRow.getString("NUMERO"));
}
}
if (prefs.getBoolean("TransfertMultiRef", false)) {
} else 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);
253,7 → 236,6
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/view/list/SQLTextComboTableCellEditor.java
1,7 → 1,7
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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,7 → 15,6
 
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;
136,13 → 135,8
}
 
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/RowValuesTableControlPanel.java
28,7 → 28,6
 
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;
134,7 → 133,6
}
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);
142,23 → 140,7
}
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/RowValuesTableModel.java
31,6 → 31,7
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;
 
57,8 → 58,6
// 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;
79,8 → 78,6
 
private Where fillWhere;
 
private boolean gestionReferentActive = false;
 
public RowValuesTableModel() {
 
}
155,10 → 152,6
return this.defautRow;
}
 
public void setGestionReferentActive(boolean gestionReferent) {
this.gestionReferentActive = gestionReferent;
}
 
public synchronized void addColumn(SQLTableElement e) {
this.nbColumn++;
this.list.add(e);
184,7 → 177,7
SQLTableElement elt = this.list.get(columnIndex);
boolean validate = false;
boolean fieldValidate = false;
if (this.validationField != null && this.validationField.getTable().getName().equals(getSQLElement().getTable().getName())) {
if (this.validationField != null) {
fieldValidate = elt.getField().getName().equalsIgnoreCase(this.validationField.getName());
validate = this.getRowValuesAt(rowIndex).getBoolean(this.validationField.getName());
}
212,14 → 205,7
SQLTableElement sqlTableElem = this.list.get(columnIndex);
Object storedObject = val.getObject(sqlTableElem.getRowField());
result = sqlTableElem.getValueFrom(val);
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)) {
if (sqlTableElem.getElementClass() != null && Number.class.isAssignableFrom(sqlTableElem.getElementClass()) && !CompareUtils.equals(result, storedObject)) {
fireTableDataChanged();
}
 
238,11 → 224,6
}
 
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);
278,7 → 259,6
if (oldValue != null && oldValue.equals(aValue)) {
return;
}
 
try {
SQLTableElement sqlTableElem = this.list.get(columnIndex);
 
287,6 → 267,10
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
311,10 → 295,8
 
/**
* Valider les modifications dans la base
*
* @throws SQLException
*/
public void commitData() throws SQLException {
public void commitData() {
commitData(false);
}
 
321,11 → 303,11
/**
* Valider les modifications dans la base
*/
public void commitData(boolean useMultipleInsertUpdate) throws SQLException {
public void commitData(boolean useMultipleInsertUpdate) {
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()));
377,38 → 359,6
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++) {
418,7 → 368,11
final SQLRow row = store.getStoredRow(r);
r.setID(row.getIDNumber());
}
 
}
} catch (SQLException e) {
ExceptionHandler.handle("Unable to commit rows", e);
}
 
}
 
588,7 → 542,7
return this.list;
}
 
public void updateField(String field, SQLRowValues rowVals, String fieldCondition) throws SQLException {
public void updateField(String field, SQLRowValues rowVals, String fieldCondition) {
checkEDT();
if (rowVals != null) {
int stop = this.rowValues.size();
636,8 → 590,11
}
}
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();
645,15 → 602,15
}
}
 
public void updateField(String field, SQLRowValues rowVals) throws SQLException {
public void updateField(String field, SQLRowValues rowVals) {
updateField(field, rowVals, null);
}
 
public void updateField(String field, int id) throws SQLException {
public void updateField(String field, int id) {
updateField(field, id, null);
}
 
public void updateField(String field, int id, String fieldCondition) throws SQLException {
public void updateField(String field, int id, String fieldCondition) {
if (id > 0) {
updateField(field, this.element.getTable().getForeignTable(field).getRow(id).createUpdateRow(), fieldCondition);
}
710,13 → 667,26
 
final List<SQLRowValues> newRows = new ArrayList<SQLRowValues>();
 
final SQLTable table = RowValuesTableModel.this.element.getTable();
if (rowVals.hasID() && !rowVals.isUndefined() && rowVals.getID() != SQLRow.NONEXISTANT_ID) {
newRows.addAll(fetchDataFromDB(rowVals, referentField, fieldWhere, value));
SQLRow row = rowVals.getTable().getRow(rowVals.getID());
List<SQLRow> rowSet;
if (referentField == null) {
rowSet = row.getReferentRows(RowValuesTableModel.this.element.getTable());
} 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(table);
colRows = rowVals.getReferentRows(RowValuesTableModel.this.element.getTable());
} else {
colRows = rowVals.getReferentRows(referentField);
}
734,27 → 704,6
}
}
 
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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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,8 → 347,7
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()) && !row.getTable().getField(this.rowField).isForeignKey()
&& !CompareUtils.equals(result, row.getObject(this.rowField))) {
if (this.getElementClass() != null && Number.class.isAssignableFrom(this.getElementClass()) && !CompareUtils.equals(result, row.getObject(this.rowField))) {
row.put(this.rowField, result);
fireModification(row);
}
/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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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,7 → 15,6
 
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;
62,7 → 61,7
return super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
}
 
protected void setValue(Object value) {
public void setValue(Object value) {
 
if (this.isLoading) {
this.toSelect = value;
77,17 → 76,11
}
try {
 
// if (value instanceof SQLRowValues) {
// newValue = ((SQLRowValues) value).getID();// getString("CODE");
// } else {
if (value instanceof SQLRowValues) {
newValue = ((SQLRowValues) value).getString("CODE");
} else {
 
final int id;
 
if (value instanceof SQLRowAccessor) {
id = ((SQLRowAccessor) value).getID();// getString("CODE");
} else {
id = Integer.parseInt(value.toString());
}
final int 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);
105,7 → 98,7
} else {
newValue = SQLTableElement.UNDEFINED_STRING;
}
// }
}
} catch (NumberFormatException e) {
e.printStackTrace();
 
/trunk/OpenConcerto/src/org/openconcerto/sql/view/list/IListe.java
49,7 → 49,6
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;
603,7 → 602,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 WrapLayout());
this.btnPanel = new JPanel(new FlowLayout(FlowLayout.LEADING));
this.addListenerOnModel(new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
/trunk/OpenConcerto/src/org/openconcerto/sql/view/list/AutoCompletionManager.java
61,21 → 61,11
this(fromTableElement, fillFrom, table, tableModel, ITextWithCompletion.MODE_CONTAINS, false);
}
 
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);
}
 
// 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) {
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) {
85,13 → 75,8
}
} else {
l.add(fillFrom.getName());
// FIXME à mettre en parametre
if (fillFrom.getName().equals("NOM") && fillFrom.getTable().contains("CODE")) {
l.add("CODE");
}
}
req = new ComboSQLRequest(fillFrom.getTable(), l);
}
ComboSQLRequest req = new ComboSQLRequest(fillFrom.getTable(), l);
init(fromTableElement, fillFrom, table, tableModel, modeCompletion, req, foreign, checker);
 
}
/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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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,7 → 27,6
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;
41,7 → 40,6
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;
69,10 → 67,6
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);
}
101,9 → 95,6
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) {
227,15 → 218,7
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;
242,11 → 225,7
}
 
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();
253,12 → 232,7
}
 
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();
265,11 → 239,7
}
 
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();
276,12 → 246,7
}
 
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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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,7 → 25,6
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;
102,21 → 101,10
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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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,10 → 47,8
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;
321,7 → 319,6
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);
509,8 → 506,6
}
 
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"));
533,8 → 528,5
// 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/DecimalUtils.java
1,7 → 1,7
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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,8 → 13,6
package org.openconcerto.utils.model;
 
import org.openconcerto.utils.cc.TruncatableList;
 
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
24,7 → 22,7
import javax.swing.AbstractListModel;
 
/**
* The default implementation for {@link IListModel}.
* Un comboBoxModel qui utilise une liste, et possède un addAll().
*
* @author Sylvain CUAZ
* @param <T> type of items
32,7 → 30,6
public class DefaultIListModel<T> extends AbstractListModel<T> implements IListModel<T> {
 
protected final List<T> objects;
protected boolean truncated;
 
/**
* Constructs an empty DefaultComboBoxModel object.
51,22 → 48,15
* @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);
74,16 → 64,8
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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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,15 → 13,11
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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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,17 → 124,11
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);
}
160,7 → 154,6
}
 
// implements javax.swing.MutableComboBoxModel
@Override
public void insertElementAt(T anObject, int index) {
this.objects.add(index, anObject);
fireIntervalAdded(this, index, index);
167,7 → 160,6
}
 
// implements javax.swing.MutableComboBoxModel
@Override
public void removeElementAt(int index) {
this.removeElementsAt(index, index);
}
263,7 → 255,7
 
// needed to implement javax.swing.MutableComboBoxModel
protected final void removeForJRE(final Object anObject) {
final int index = this.objects.indexOf(anObject);
int index = this.objects.indexOf(anObject);
if (index != -1) {
removeElementAt(index);
}
284,7 → 276,6
/**
* Empties the list.
*/
@Override
public void removeAllElements() {
final int size = this.objects.size();
if (size > 0) {
305,7 → 296,7
}
 
protected void fire(int type, int index0, int index1, CollectionChangeEventCreator c) {
final Object[] listeners = this.listenerList.getListenerList();
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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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,7 → 26,6
*/
public interface IListModel<T> extends ListModel<T> {
 
@Override
public T getElementAt(int index);
 
/**
/trunk/OpenConcerto/src/org/openconcerto/utils/model/ListComboBoxModel.java
27,6 → 27,8
*/
public class ListComboBoxModel<T> extends DefaultIMutableListModel<T> implements MutableComboBoxModel<T> {
 
private boolean truncated;
 
public ListComboBoxModel() {
this(Collections.<T> emptyList());
}
43,4 → 45,13
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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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,36 → 57,7
 
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.
870,14 → 841,6
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;
1065,26 → 1028,4
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("&amp;");
} else if (c == '\"') {
b.append("&quot;");
} else if (c == '<') {
b.append("&lt;");
} else if (c == '>') {
b.append("&gt;");
}
b.append(c);
}
 
return b.toString();
}
 
}
/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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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/TM.java
1,7 → 1,7
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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,8 → 12,6
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,8 → 12,6
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/LocalizedInstances.java
1,7 → 1,7
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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/SystemUtils.java
132,10 → 132,6
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/Backup.java
1,7 → 1,7
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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/JImageAsynchronous.java
1,7 → 1,7
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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,8 → 18,6
 
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;
36,6 → 34,8
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,8 → 136,6
}
} 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);
}
234,11 → 232,7
public static Date stringToDate(Calendar c, String d) {
c.clear();
c.set(1900, 0, 0);
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());
c.add(Calendar.DAY_OF_YEAR, Integer.parseInt(d) - 1);
return c.getTime();
}
 
/trunk/OpenConcerto/src/org/openconcerto/utils/ZippedFilesProcessor.java
1,7 → 1,7
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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/TinyMap.java
1,7 → 1,7
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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
File deleted
/trunk/OpenConcerto/src/org/openconcerto/utils/io/JSONNamed.java
File deleted
/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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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/HTMLable.java
1,7 → 1,7
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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,10 → 110,6
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);
149,8 → 145,8
public MailAccount(String name, String address, String smtpServer, int port) {
super();
this.name = name;
this.address = Objects.requireNonNull(address);
this.smtpServer = Objects.requireNonNull(smtpServer);
this.address = address;
this.smtpServer = 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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,7 → 22,6
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;
69,8 → 68,6
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) {
96,8 → 93,6
result = "#" + hexString;
} else if (param instanceof BigDecimal) {
result = ((BigDecimal) param).doubleValue();
} else if (param instanceof Enum) {
result = ((Enum<?>) param).name().toLowerCase();
} else {
result = param;
}
139,16 → 134,6
}
} 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);
}
164,10 → 149,6
}
 
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");
}
174,7 → 155,7
if (key == null) {
throw new IllegalArgumentException("null key");
}
return json.containsKey(key) ? ctor.apply(json.get(key)) : defaultValue;
return json.containsKey(key) ? getObjectFromJSON(json.get(key), type) : 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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/BOMSkipper.java
1,7 → 1,7
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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,12 → 153,10
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/ImageInfo.java
1,7 → 1,7
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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/LinkedListMap.java
1,7 → 1,7
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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/ProductInfo.java
1,7 → 1,7
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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
File deleted
/trunk/OpenConcerto/src/org/openconcerto/utils/cc/MatchedList.java
File deleted
/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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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/TransformedSet.java
1,7 → 1,7
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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/Transformer.java
1,7 → 1,7
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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 + "\nCommande : " + CollectionUtils.join(pb.command(), " "));
throw new IllegalStateException("Non zero return code: " + returnCode);
return true;
}
};
/trunk/OpenConcerto/src/org/openconcerto/utils/IScheduledFutureTask.java
1,7 → 1,7
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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
File deleted
/trunk/OpenConcerto/src/org/openconcerto/utils/ArrayComparator.java
1,7 → 1,7
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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
File deleted
/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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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
File deleted
/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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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 Math.toIntExact(o.longValue());
return o.intValue();
}
};
 
40,25 → 40,10
 
@Override
public Short unconvert(Integer o) {
final short res = o.shortValue();
if (res != o.intValue())
throw new OverflowException(o, Short.class);
return res;
return o.shortValue();
}
};
 
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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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,11 → 15,6
 
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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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/DateTSConvertor.java
1,7 → 1,7
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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,15 → 14,10
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")
37,102 → 32,39
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 IdentityConvertor;
return (ValueConvertor<T, T>) IdentityConvertor;
}
 
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);
private static final List<ValueConvertor<?, ?>> convs;
static {
// 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);
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);
}
 
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) {
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)) {
if (c1 == c2)
return (ValueConvertor<T, U>) getIdentityConvertor();
for (final ValueConvertor<?, ?> vc : convs) {
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 vc;
return (ValueConvertor<T, U>) vc;
} else if (args.get(0).equals(c2) && args.get(1).equals(c1)) {
return ReverseConvertor.create(vc);
return new ReverseConvertor<T, U>((ValueConvertor<U, T>) vc);
}
}
if (Number.class.isAssignableFrom(c1) && Number.class.isAssignableFrom(c2))
return NumberConvertor.create(c1.asSubclass(Number.class), c2.asSubclass(Number.class), !lenient);
return (ValueConvertor<T, U>) NumberConvertor.create(c1.asSubclass(Number.class), c2.asSubclass(Number.class), true);
 
return null;
}
/trunk/OpenConcerto/src/org/openconcerto/utils/PEMImporter.java
1,7 → 1,7
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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,8 → 13,6
package org.openconcerto.utils;
 
import static java.util.Base64.getMimeDecoder;
 
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.File;
38,6 → 36,7
import javax.net.ssl.KeyManagerFactory;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLServerSocketFactory;
import javax.xml.bind.DatatypeConverter;
 
public class PEMImporter {
 
92,7 → 91,7
}
r.close();
final String hexString = b.toString();
final byte[] bytes = getMimeDecoder().decode(hexString);
final byte[] bytes = DatatypeConverter.parseBase64Binary(hexString);
return generatePrivateKeyFromDER(bytes);
}
 
108,7 → 107,7
while (s != null) {
if (s.contains("END CERTIFICATE")) {
String hexString = b.toString();
final byte[] bytes = getMimeDecoder().decode(hexString);
final byte[] bytes = DatatypeConverter.parseBase64Binary(hexString);
X509Certificate cert = generateCertificateFromDER(bytes);
result.add(cert);
b = new StringBuilder();
/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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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,8 → 13,6
package org.openconcerto.utils.net;
 
import org.openconcerto.utils.StreamUtils;
 
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
36,20 → 34,12
private final int responseCode;
private final boolean authenticateError;
 
private ServerException(final String message, final int responseCode, final boolean authenticateError) {
super(message);
protected ServerException(int responseCode, boolean authenticateError) {
super("Response code was " + responseCode);
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;
}
63,18 → 53,16
 
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(con.getURL().toExternalForm(), success, con.getResponseCode(), con.getResponseMessage(), con.getContentEncoding(), con.getContentType());
return new Response(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(final String url, boolean success, int code, String message, String contentEncoding, String contentType) {
protected Response(boolean success, int code, String message, String contentEncoding, String contentType) {
super();
this.url = url;
this.success = success;
this.code = code;
this.message = message;
82,10 → 70,6
this.contentType = contentType;
}
 
public final String getURL() {
return this.url;
}
 
public final int getCode() {
return this.code;
}
105,12 → 89,7
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;
121,10 → 100,6
this.url = url;
}
 
public final String getURL() {
return this.url;
}
 
public final SSLSocketFactory getSocketFactory() {
return this.socketFactory;
}
159,13 → 134,8
 
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()) {
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);
}
if (this.throwsException() && !res.isSuccess())
throw new ServerException(res.getCode(), con.getHeaderField("WWW-Authenticate") != null);
return res;
}
 
/trunk/OpenConcerto/src/org/openconcerto/utils/IFutureTask.java
1,7 → 1,7
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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/MimeType.java
1,7 → 1,7
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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,7 → 91,6
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();
121,32 → 120,18
}
}
}
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/SystemInfo.java
20,17 → 20,10
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;
56,7 → 49,6
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);
78,14 → 70,8
}
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()) + lineBreak + rtDesc;
+ tm.translate("processors", rt.availableProcessors());
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/utils/LogUtils.java
1,7 → 1,7
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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/NoneSelectedButtonGroup.java
1,7 → 1,7
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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/MultiLock.java
1,7 → 1,7
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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,7 → 18,6
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;
429,16 → 428,6
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;
451,22 → 440,11
}
 
public static final Calendar toCalendar(final LocalDateTime dt) {
return setTime(Calendar.getInstance(), dt);
}
 
public static final Calendar setTime(final Calendar cal, final LocalDateTime dt) {
final Calendar cal = Calendar.getInstance();
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/Nombre.java
1,7 → 1,7
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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/erp/core/edm/AttachmentPanel.java
33,10 → 33,8
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;
44,7 → 42,6
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;
58,7 → 55,6
import java.util.List;
import java.util.Set;
 
import javax.imageio.ImageIO;
import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JLabel;
72,7 → 68,7
 
public class AttachmentPanel extends JPanel {
 
private SQLRowAccessor rowSource;
private final SQLRowAccessor rowSource;
private final Collection<SQLRowAccessor> rowSecondaires;
private List<ListDataListener> listeners = new ArrayList<>();
 
98,11 → 94,6
setFocusable(true);
}
 
public void setRowSource(SQLRowAccessor rowSource) {
this.rowSource = rowSource;
initUI();
}
 
public void addListener(ListDataListener l) {
this.listeners.add(l);
}
125,7 → 116,6
this.filePanels.clear();
this.invalidate();
this.removeAll();
if (rowSource != null) {
GridBagConstraints c = new DefaultGridBagConstraints();
 
// Recupération de la liste des fichiers
227,8 → 217,6
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);
295,36 → 283,6
}
});
 
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() {
447,8 → 405,7
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;
476,7 → 433,6
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() && !rowAttachment.isURL()) {
if (!rowAttachment.isFolder()) {
boolean isOnCloud = config.isOnCloud();
// Delete File
String subDir = rowAttachment.getStoragePath();
/trunk/OpenConcerto/src/org/openconcerto/erp/core/edm/Attachment.java
95,10 → 95,6
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/sales/credit/component/AvoirClientSQLComponent.java
31,7 → 31,6
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;
38,6 → 37,7
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,11 → 219,7
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,21 → 32,15
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 {
54,34 → 48,7
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) {
125,7 → 92,6
@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,8 → 25,6
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;
40,7 → 38,6
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;
48,7 → 45,6
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;
56,7 → 52,6
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;
87,7 → 82,7
public void actionPerformed(ActionEvent e) {
List<SQLRowValues> resultId = new ArrayList<>();
CommandeClientSQLElement cmdElt = (CommandeClientSQLElement) getForeignElement("ID_COMMANDE_CLIENT");
for (SQLRowAccessor sqlRowAccessor : IListe.get(e).getSelectedRowAccessors()) {
for (SQLRowValues sqlRowAccessor : IListe.get(e).getSelectedRows()) {
resultId.add(sqlRowAccessor.getForeign("ID_COMMANDE_CLIENT").asRowValues());
}
cmdElt.transfertBonLivraisonClient(resultId);
101,7 → 96,7
 
@Override
public void actionPerformed(ActionEvent e) {
SQLRowAccessor selectedRow = IListe.get(e).getSelectedRowAccessor();
SQLRowValues selectedRow = IListe.get(e).getSelectedRow();
EditFrame f = new EditFrame(getForeignElement("ID_COMMANDE_CLIENT"), EditMode.MODIFICATION);
f.getSQLComponent().select(selectedRow.getForeignID("ID_COMMANDE_CLIENT"));
FrameUtil.showPacked(f);
140,7 → 135,7
 
@Override
public void actionPerformed(ActionEvent e) {
recalculStockTh(null);
recalculStockTh();
 
}
 
153,52 → 148,24
}
 
private void updateForceLivrer(ActionEvent e, Boolean state) {
final List<SQLRowAccessor> selectedRows = IListe.get(e).getSelectedRowAccessors();
final List<SQLRowValues> selectedRows = IListe.get(e).getSelectedRows();
final Set<Integer> ids = new HashSet<Integer>();
final Set<Integer> idsArticle = new HashSet<Integer>();
SQLDataSource ds = null;
for (SQLRowAccessor sqlRowValues : selectedRows) {
ds = sqlRowValues.getTable().getDBSystemRoot().getDataSource();
for (SQLRowValues sqlRowValues : selectedRows) {
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());
 
if (!idsArticle.isEmpty()) {
recalculStockTh(idsArticle);
IListe.get(e).getModel().updateAll();
}
for (Integer i : ids) {
getTable().fireTableModified(i);
}
return null;
}
 
});
} catch (SQLException e1) {
ExceptionHandler.handle("Erreur lors du recalcul des stocks théoriques", e1);
}
}
public void recalculStockTh() {
 
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() + " s SET " + tableStock.getField("QTE_TH").getQuotedName() + " = " + tableStock.getField("QTE_REEL").getQuotedName() + ","
String req = "UPDATE " + tableStock.getSQLName().quote() + " 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);
 
{
206,9 → 173,6
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")));
238,9 → 202,7
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,7 → 143,6
}, false);
actionTransfertBL.setPredicate(IListeEvent.getNonEmptySelectionPredicate());
getRowActions().add(actionTransfertBL);
}
 
PredicateRowAction actionStock = new PredicateRowAction(new AbstractAction("Vérification des stocks") {
 
164,7 → 163,6
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
184,8 → 182,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") {
363,51 → 361,10
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);
}
 
636,13 → 593,6
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);
}
740,8 → 690,6
// }
// });
source.init();
addCommercialFilter(source, getTable().getField("ID_COMMERCIAL"));
 
SQLPreferences prefs = SQLPreferences.getMemCached(getTable().getDBRoot());
if (prefs.getBoolean(GestionCommercialeGlobalPreferencePanel.ORDER_PACKAGING_MANAGEMENT, true)) {
 
904,13 → 852,9
* @param row
*/
public EditFrame transfertAcompteClient(List<SQLRowValues> rows) {
return transfertAcompteClient(rows, false);
return TransfertGroupSQLComponent.openTransfertFrame(rows, "SAISIE_VENTE_FACTURE", VenteFactureSituationSQLComponent.ID);
}
 
public EditFrame transfertAcompteClient(List<SQLRowValues> rows, boolean prev) {
return TransfertGroupSQLComponent.openTransfertFrame(rows, "SAISIE_VENTE_FACTURE", (prev) ? VenteFactureSituationSQLComponent.ID_PREVISIONNELLE : VenteFactureSituationSQLComponent.ID);
}
 
/**
* Transfert en Facture
*
920,10 → 864,6
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;
954,12 → 894,10
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")).or(Where.isNull(input.getAlias(eltCmd.getTable()).getField("QTE_LIVREE")));
eltCmd.getTable().getField("QTE_UNITAIRE"));
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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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"), new FieldPath(p, "T_TTC"), new FieldPath(p, "T_AVOIR_TTC"));
return CollectionUtils.createSet(new FieldPath(p, "T_HT"));
}
};
}
200,15 → 200,10
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 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) {
Long l = rowFact.getLong("T_HT");
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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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().putWhere("Undef", new Where(getElem().getTable().getField("ID_COMMANDE_CLIENT"), ">", 1));
res.getReq().setWhere(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", "Taille", "Couleur", "Qté cmd", "Reliquat");
private List<String> columns = Arrays.asList("Code", "Nom", "Qté cmd", "Reliquat");
 
private final List<? extends SQLRowAccessor> values;
 
39,10 → 39,16
 
@Override
public Class<?> getColumnClass(int columnIndex) {
if (columnIndex <= 3) {
if (columnIndex == 0) {
return String.class;
} else if (columnIndex == 1) {
return String.class;
} else if (columnIndex == 2) {
return BigDecimal.class;
} else {
 
return BigDecimal.class;
 
}
}
 
66,20 → 72,6
} 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);
103,13 → 95,9
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())
.and(new Where(table.getField("ID_ARTICLE"), "!=", table.getForeignTable("ID_ARTICLE").getUndefinedIDNumber()));
final Where w = new Where(table.getField("ID_" + tableCmd.getName()), "=", rowCmd.getID());
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 ((getMode() == Mode.INSERTION || !isFilling()) && comboClient.getValue() != null) {
if (!isFilling() && comboClient.getValue() != null) {
Integer id = comboClient.getValue();
 
if (id > 1) {
563,7 → 563,6
 
// 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++;
931,8 → 930,19
 
@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/VenteFactureSoldeEditGroup.java
1,7 → 1,7
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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,8 → 35,6
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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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,7 → 47,6
 
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));
67,12 → 66,7
@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;
}
138,15 → 132,10
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/account/PartialInvoiceEditGroup.java
1,7 → 1,7
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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,8 → 36,7
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,7 → 72,6
 
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;
 
269,10 → 268,6
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() {
284,7 → 279,6
}
};
return this.numberField;
}
} else if (id.equals("panel.oo")) {
this.panelOO = new PanelOOSQLComponent(this);
return this.panelOO;
399,9 → 393,8
}
((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();
428,7 → 421,6
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");
435,7 → 427,6
EcritureSQLElement eltEcr = (EcritureSQLElement) getDirectory().getElement("ECRITURE");
eltEcr.archiveMouvementProfondeur(idMvt, false);
new GenerationMvtSaisieVenteFacture(id);
}
try {
VenteFactureXmlSheet sheet = new VenteFactureXmlSheet(rowFacture);
sheet.createDocument();
443,31 → 434,12
} 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;
}
480,5 → 452,4
return super.addView(comp, id);
}
}
 
}
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/invoice/element/UpdateCommEchFrame.java
File deleted
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/invoice/element/SaisieVenteFactureSQLElement.java
30,7 → 30,6
import org.openconcerto.erp.core.sales.invoice.component.SaisieVenteFactureSQLComponent;
import org.openconcerto.erp.core.sales.invoice.report.VenteFactureXmlSheet;
import org.openconcerto.erp.core.sales.invoice.ui.DateReglementRenderer;
import org.openconcerto.erp.core.sales.invoice.ui.InvoicePercentRenderer;
import org.openconcerto.erp.core.sales.product.element.ReferenceArticleSQLElement;
import org.openconcerto.erp.core.sales.shipment.component.BonDeLivraisonSQLComponent;
import org.openconcerto.erp.core.supplychain.stock.element.MouvementStockSQLElement;
67,26 → 66,26
import org.openconcerto.sql.view.EditPanel;
import org.openconcerto.sql.view.EditPanel.EditMode;
import org.openconcerto.sql.view.EditPanelListener;
import org.openconcerto.sql.view.IListeFilter;
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.ITableModel;
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.DefaultGridBagConstraints;
import org.openconcerto.ui.FrameUtil;
import org.openconcerto.ui.table.PercentTableCellRenderer;
import org.openconcerto.utils.CollectionUtils;
import org.openconcerto.utils.DecimalUtils;
import org.openconcerto.utils.ExceptionHandler;
import org.openconcerto.utils.ListMap;
import org.openconcerto.utils.TableSorter;
import org.openconcerto.utils.Tuple2;
import org.openconcerto.utils.cc.IClosure;
import org.openconcerto.utils.cc.ITransformer;
import org.openconcerto.utils.i18n.TranslationManager;
 
import java.awt.Component;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.event.ActionEvent;
111,9 → 110,7
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTable;
import javax.swing.SwingUtilities;
import javax.swing.table.DefaultTableCellRenderer;
 
import org.apache.commons.dbutils.handlers.ArrayListHandler;
 
143,7 → 140,6
super(TABLENAME, "une facture", "factures");
 
GlobalMapper.getInstance().map(VenteFactureSituationSQLComponent.ID, new PartialInvoiceEditGroup());
GlobalMapper.getInstance().map(VenteFactureSituationSQLComponent.ID_PREVISIONNELLE, new PartialInvoiceEditGroup());
addComponentFactory(VenteFactureSituationSQLComponent.ID, new ITransformer<Tuple2<SQLElement, String>, SQLComponent>() {
 
@Override
152,16 → 148,7
return new VenteFactureSituationSQLComponent(SaisieVenteFactureSQLElement.this);
}
});
addComponentFactory(VenteFactureSituationSQLComponent.ID_PREVISIONNELLE, new ITransformer<Tuple2<SQLElement, String>, SQLComponent>() {
 
@Override
public SQLComponent transformChecked(Tuple2<SQLElement, String> input) {
 
return new VenteFactureSituationSQLComponent(SaisieVenteFactureSQLElement.this);
}
});
GlobalMapper.getInstance().map(VenteFactureSoldeSQLComponent.ID, new VenteFactureSoldeEditGroup());
GlobalMapper.getInstance().map(VenteFactureSoldeSQLComponent.ID_PREVISIONNELLE, new VenteFactureSoldeEditGroup());
addComponentFactory(VenteFactureSoldeSQLComponent.ID, new ITransformer<Tuple2<SQLElement, String>, SQLComponent>() {
 
@Override
170,15 → 157,7
return new VenteFactureSoldeSQLComponent(SaisieVenteFactureSQLElement.this);
}
});
addComponentFactory(VenteFactureSoldeSQLComponent.ID_PREVISIONNELLE, new ITransformer<Tuple2<SQLElement, String>, SQLComponent>() {
 
@Override
public SQLComponent transformChecked(Tuple2<SQLElement, String> input) {
 
return new VenteFactureSoldeSQLComponent(SaisieVenteFactureSQLElement.this);
}
});
 
final boolean affact = UserRightsManager.getCurrentUserRights().haveRight(NXRights.ACCES_RETOUR_AFFACTURAGE.getCode());
List<RowAction> l = new ArrayList<RowAction>(5);
PredicateRowAction actionBL = new PredicateRowAction(new AbstractAction() {
372,7 → 351,7
@Override
protected synchronized void _initTableSource(final SQLTableModelSource table) {
super._initTableSource(table);
addCommercialFilter(table, getTable().getField("ID_COMMERCIAL"));
 
final BaseSQLTableModelColumn colAvancement = new BaseSQLTableModelColumn("Avancement réglement", BigDecimal.class) {
 
@Override
383,8 → 362,6
 
@Override
public Set<FieldPath> getPaths() {
Path pFact = new Path(SaisieVenteFactureSQLElement.this.getTable());
 
Path p = new Path(SaisieVenteFactureSQLElement.this.getTable());
p = p.add(getTable().getTable("ECHEANCE_CLIENT"));
 
391,29 → 368,14
Path p2 = new Path(SaisieVenteFactureSQLElement.this.getTable());
p2 = p2.add(getTable().getField("ID_AVOIR_CLIENT"));
 
return CollectionUtils.createSet(new FieldPath(pFact, "NET_A_PAYER"), new FieldPath(pFact, "AFFACTURAGE"), new FieldPath(p, "MONTANT"), new FieldPath(p, "REG_COMPTA"),
new FieldPath(p, "REGLE"), new FieldPath(p2, "MONTANT_TTC"));
return CollectionUtils.createSet(new FieldPath(p, "MONTANT"), new FieldPath(p, "REG_COMPTA"), new FieldPath(p, "REGLE"), new FieldPath(p2, "MONTANT_TTC"));
}
};
table.getColumns().add(colAvancement);
colAvancement.setRenderer(new DefaultTableCellRenderer() {
private InvoicePercentRenderer r = new InvoicePercentRenderer();
colAvancement.setRenderer(new PercentTableCellRenderer());
 
@Override
public Component getTableCellRendererComponent(JTable jtable, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
 
TableSorter sorter = (TableSorter) jtable.getModel();
SQLRowValues row2 = ((ITableModel) sorter.getTableModel()).getRow(row).getRow();
r.setSoldeAvoir(row2.getLong("NET_A_PAYER") == 0);
r.setAffacturer(row2.getTable().contains("AFFACTURAGE") && row2.getBoolean("AFFACTURAGE"));
r.setValue((Number) value);
 
return r;
}
});
 
}
 
protected List<String> getComboFields() {
final List<String> l = new ArrayList<String>();
l.add("NUMERO");
424,7 → 386,6
public Set<String> getReadOnlyFields() {
Set<String> s = new HashSet<String>(1);
s.add("CONTROLE_TECHNIQUE");
s.add("PREVISIONNELLE");
return s;
}
 
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/invoice/element/EcheanceClientSQLElement.java
28,7 → 28,6
import org.openconcerto.erp.core.sales.invoice.report.SituationCompteClientPanel;
import org.openconcerto.erp.core.sales.invoice.report.VenteFactureXmlSheet;
import org.openconcerto.erp.core.sales.invoice.ui.DecaleEcheancePanel;
import org.openconcerto.erp.preferences.GestionCommercialeGlobalPreferencePanel;
import org.openconcerto.erp.rights.ComptaUserRight;
import org.openconcerto.sql.Configuration;
import org.openconcerto.sql.element.BaseSQLComponent;
49,7 → 48,6
import org.openconcerto.sql.model.graph.Link;
import org.openconcerto.sql.model.graph.Path;
import org.openconcerto.sql.model.graph.PathBuilder;
import org.openconcerto.sql.preferences.SQLPreferences;
import org.openconcerto.sql.request.ListSQLRequest;
import org.openconcerto.sql.sqlobject.ElementComboBox;
import org.openconcerto.sql.users.rights.UserRightsManager;
134,24 → 132,6
}
 
{
 
PredicateRowAction action = new PredicateRowAction(new AbstractAction("Ajouter un commentaire") {
 
@Override
public void actionPerformed(ActionEvent arg0) {
 
SQLRow row = IListe.get(arg0).fetchSelectedRow();
 
final UpdateCommEchFrame frame = UpdateCommEchFrame.getFrame();
frame.select(row);
frame.setVisible(true);
}
}, false);
action.setPredicate(IListeEvent.getSingleSelectionPredicate());
getRowActions().add(action);
}
 
{
PredicateRowAction action = new PredicateRowAction(new AbstractAction("Envoyer un mail de relance") {
 
@Override
162,7 → 142,7
"Souhaitez vous envoyer un email de relance pour toutes les factures\ndont l'échéance est dépassée?\nLes relances ne seront pas envoyées si les factures ont déjà  une relance de moins d'un mois. ",
"Relance automatique", JOptionPane.YES_NO_OPTION);
if (result == JOptionPane.YES_OPTION) {
EmailTemplate.askTemplate(iListe, getTable().getDBRoot(), getTable().getName(), new ValueListener() {
EmailTemplate.askTemplate(iListe, getTable().getDBRoot(), new ValueListener() {
 
@Override
public void valueSelected(Object value) {
184,10 → 164,10
if (rowValues.isEmpty()) {
JOptionPane.showMessageDialog(iListe, "Aucune relance à  envoyer.");
} else {
 
sendMail(rowValues, template);
 
for (SQLRowValues row : rowValues) {
sendMail(row.asRow(), template);
}
}
} catch (Exception e) {
ExceptionHandler.handle("erreur lors de l'envoi", e);
}
206,7 → 186,7
} else {
final SQLTable primaryTable = iListe.getRequest().getPrimaryTable();
final List<Integer> selectedIDs = iListe.getSelection().getSelectedIDs();
EmailTemplate.askTemplate(iListe, getTable().getDBRoot(), getTable().getName(), new ValueListener() {
EmailTemplate.askTemplate(iListe, getTable().getDBRoot(), new ValueListener() {
 
@Override
public void valueSelected(Object value) {
216,9 → 196,9
try {
EmailTemplate template = (EmailTemplate) value;
final List<SQLRow> rows = SQLRowListRSH.fetch(primaryTable, selectedIDs);
 
sendMail(rows, template);
 
for (SQLRow row : rows) {
sendMail(row, template);
}
} catch (Exception e) {
ExceptionHandler.handle("erreur lors de l'envoi", e);
}
382,44 → 362,39
}
 
 
private void sendMail(final List<? extends SQLRowAccessor> rows, EmailTemplate template) throws Exception {
ListMap<Integer, SQLRow> mapByCustomer = new ListMap<>();
for (SQLRowAccessor sqlRow : rows) {
mapByCustomer.add(sqlRow.getForeignID("ID_CLIENT"), sqlRow.asRow());
}
for (List<SQLRow> sqlRows : mapByCustomer.values()) {
sendCustomerMail(sqlRows, template);
}
}
private void sendMail(final SQLRow row, EmailTemplate template) throws Exception {
 
private void sendCustomerMail(final List<SQLRow> rows, EmailTemplate template) throws Exception {
SQLBase base = ((ComptaPropsConfiguration) Configuration.getInstance()).getSQLBaseSociete();
 
int idMvtSource = MouvementSQLElement.getSourceId(rows.get(0).getInt("ID_MOUVEMENT"));
SQLRow rowMvtSource = getTable().getTable("MOUVEMENT").getRow(idMvtSource);
int idMvtSource = MouvementSQLElement.getSourceId(row.getInt("ID_MOUVEMENT"));
SQLRow rowMvtSource = base.getTable("MOUVEMENT").getRow(idMvtSource);
 
if (!rowMvtSource.getString("SOURCE").equalsIgnoreCase("SAISIE_VENTE_FACTURE")) {
return;
}
int idFact = rowMvtSource.getInt("IDSOURCE");
SQLRow rowFacture = base.getTable("SAISIE_VENTE_FACTURE").getRow(idFact);
 
final VenteFactureXmlSheet sheet = new VenteFactureXmlSheet(rowFacture);
 
Set<SQLField> setContact = null;
SQLTable tableContact = Configuration.getInstance().getRoot().findTable("CONTACT");
setContact = rows.get(0).getTable().getForeignKeys(tableContact);
setContact = row.getTable().getForeignKeys(tableContact);
 
Set<SQLField> setClient = null;
SQLTable tableClient = ((ComptaPropsConfiguration) Configuration.getInstance()).getSQLBaseSociete().getTable("CLIENT");
setClient = rows.get(0).getTable().getForeignKeys(tableClient);
setClient = row.getTable().getForeignKeys(tableClient);
 
// Récupération du mail du client
String mail = "";
for (SQLField field : setContact) {
if (mail == null || mail.trim().length() == 0) {
mail = rows.get(0).getForeignRow(field.getName()).getString("EMAIL");
mail = row.getForeignRow(field.getName()).getString("EMAIL");
}
}
 
for (SQLField field : setClient) {
SQLRow rowCli = rows.get(0).getForeignRow(field.getName());
SQLRow rowCli = row.getForeignRow(field.getName());
if (mail == null || mail.trim().length() == 0) {
mail = rowCli.getString("MAIL");
}
426,41 → 401,26
}
final String adresseMail = mail;
 
File[] files = new File[rows.size()];
 
MailRelanceCreator creator = new MailRelanceCreator(template, rows);
MailRelanceCreator creator = new MailRelanceCreator(template, row);
final String references = creator.getObject();
final String text = creator.getValue();
 
int i = 0;
for (SQLRow row : rows) {
final File f;
 
SQLRow rowFacture = getTable().getTable("SAISIE_VENTE_FACTURE").getRow(row.getForeignID("ID_SAISIE_VENTE_FACTURE"));
 
final VenteFactureXmlSheet sheet = new VenteFactureXmlSheet(rowFacture);
 
f = sheet.getOrCreatePDFDocumentFile(true);
files[i] = f.getAbsoluteFile();
i++;
}
 
EmailComposer.getInstance().compose(adresseMail, references, text, files);
EmailComposer.getInstance().compose(adresseMail, references, text, f.getAbsoluteFile());
 
long montant = 0;
for (SQLRow rowEch : rows) {
montant += rowEch.getLong("MONTANT");
}
// Création d'une relance
String numero = NumerotationAutoSQLElement.getNextNumero(RelanceSQLElement.class);
SQLRowValues rowValsR = new SQLRowValues(getTable().getTable("RELANCE"));
SQLRowValues rowValsR = new SQLRowValues(row.getTable().getTable("RELANCE"));
rowValsR.put("DATE", new Date());
rowValsR.put("NUMERO", numero);
rowValsR.put("ID_CLIENT", rows.get(0).getForeignID("ID_CLIENT"));
rowValsR.put("ID_SAISIE_VENTE_FACTURE", rows.get(0).getForeignID("ID_SAISIE_VENTE_FACTURE"));
rowValsR.put("MONTANT", montant);
rowValsR.put("ID_CLIENT", row.getForeignID("ID_CLIENT"));
rowValsR.put("ID_SAISIE_VENTE_FACTURE", row.getForeignID("ID_SAISIE_VENTE_FACTURE"));
rowValsR.put("MONTANT", row.getObject("MONTANT"));
rowValsR.put("INFOS", "Email");
rowValsR.put("ID_ECHEANCE_CLIENT", rows.get(0).getID());
rowValsR.put("ID_ECHEANCE_CLIENT", row.getID());
 
rowValsR.insert();
 
473,17 → 433,14
rowVals.update(2);
 
// Incrémentation du nombre de relance
for (SQLRow rowEch : rows) {
 
int nbRelance = rowEch.getInt("NOMBRE_RELANCE");
int nbRelance = row.getInt("NOMBRE_RELANCE");
nbRelance++;
 
SQLRowValues rowValsEch = new SQLRowValues(rowEch.getTable());
SQLRowValues rowValsEch = new SQLRowValues(row.getTable());
rowValsEch.put("NOMBRE_RELANCE", nbRelance);
rowValsEch.put("DATE_LAST_RELANCE", new Date());
 
rowValsEch.update(rowEch.getID());
}
rowValsEch.update(row.getID());
 
}
 
504,9 → 461,6
l.add("ID_MOUVEMENT");
l.add("NOMBRE_RELANCE");
l.add("INFOS");
if (SQLPreferences.getMemCached(getTable().getDBRoot()).getBoolean(GestionCommercialeGlobalPreferencePanel.POURCENT_RG, false)) {
l.add("RG");
}
l.add("DATE_LAST_RELANCE");
return l;
}
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/invoice/report/ReportingClientPanel.java
1,7 → 1,7
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the GNU General Public License Version 3
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a
23,7 → 23,6
import org.openconcerto.ui.JDate;
import org.openconcerto.ui.JLabelBold;
import org.openconcerto.utils.ExceptionHandler;
import org.openconcerto.utils.FileUtils;
 
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
30,11 → 29,9
import java.awt.event.ActionEvent;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.io.File;
 
import javax.swing.AbstractAction;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JLabel;
import javax.swing.JPanel;
 
65,11 → 62,6
 
c.gridy++;
c.gridx = 0;
final JCheckBox boxMail = new JCheckBox("Envoie par mail");
this.add(boxMail);
boxMail.setSelected(true);
c.gridy++;
c.gridx = 0;
c.gridwidth = 1;
this.add(new JLabel("Facture émises entre le"), c);
final JDate d1 = new JDate();
95,7 → 87,6
sheet.createDocument();
// sheet.showPrintAndExport(false, false, false);
 
if (boxMail.isSelected()) {
String mail = selectedClient.getString("MAIL");
 
try {
103,10 → 94,6
} catch (Exception exn) {
ExceptionHandler.handle(null, "Impossible de créer le courriel", exn);
}
} else {
File f = sheet.getOrCreateDocumentFile();
FileUtils.openFile(f);
}
 
} catch (Exception e) {
ExceptionHandler.handle("Une erreur est survenue lors de la création du document", e);
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/invoice/report/ReportingClientXml.java
1,7 → 1,7
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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,7 → 13,6
package org.openconcerto.erp.core.sales.invoice.report;
 
import org.openconcerto.erp.config.ComptaPropsConfiguration;
import org.openconcerto.erp.generationDoc.AbstractListeSheetXml;
import org.openconcerto.sql.Configuration;
import org.openconcerto.sql.model.SQLRow;
23,8 → 22,6
import org.openconcerto.sql.model.SQLSelect;
import org.openconcerto.sql.model.SQLTable;
import org.openconcerto.sql.model.Where;
import org.openconcerto.sql.users.User;
import org.openconcerto.sql.users.UserManager;
import org.openconcerto.utils.cc.ITransformer;
 
import java.text.DateFormat;
62,7 → 59,7
final SQLTable tableFacture = Configuration.getInstance().getDirectory().getElement("SAISIE_VENTE_FACTURE").getTable();
SQLRowValues rowValsF = new SQLRowValues(tableFacture);
rowValsF.put("ID_CLIENT", rowVals);
rowValsF.putNulls("NUMERO", "NOM", "T_HT", "T_TTC", "DATE", "NET_A_PAYER", "INFOS", "T_AVOIR_TTC").putRowValues("ID_AVOIR_CLIENT").putNulls("DATE", "NUMERO");
rowValsF.putNulls("NUMERO", "NOM", "T_HT", "T_TTC", "DATE", "INFOS");
 
final SQLTable tableEch = Configuration.getInstance().getDirectory().getElement("ECHEANCE_CLIENT").getTable();
SQLRowValues rowValsE = new SQLRowValues(tableEch);
98,27 → 95,6
mapValues.put("CLIENT", this.row.getString("NOM"));
mapValues.put("DATE", toDay.getTime());
 
final SQLRow rowSociete = ComptaPropsConfiguration.getInstanceCompta().getRowSociete();
mapValues.put("SOCIETE_NOM", rowSociete.getString("NOM"));
mapValues.put("SOCIETE_TYPE", rowSociete.getString("TYPE"));
mapValues.put("SOCIETE_SIRET", rowSociete.getString("NUM_SIRET"));
mapValues.put("SOCIETE_TVA", rowSociete.getString("NUM_NII"));
mapValues.put("SOCIETE_APE", rowSociete.getString("NUM_APE"));
mapValues.put("SOCIETE_FAX", rowSociete.getString("NUM_FAX"));
mapValues.put("SOCIETE_TEL", rowSociete.getString("NUM_TEL"));
mapValues.put("SOCIETE_ADRESSE", rowSociete.getForeign("ID_ADRESSE_COMMON").getString("RUE"));
mapValues.put("SOCIETE_ADRESSE_FULL", rowSociete.getForeign("ID_ADRESSE_COMMON").getString("RUE") + " " + rowSociete.getForeign("ID_ADRESSE_COMMON").getString("CODE_POSTAL") + " "
+ rowSociete.getForeign("ID_ADRESSE_COMMON").getString("VILLE"));
mapValues.put("SOCIETE_CODE_POSTAL", rowSociete.getForeign("ID_ADRESSE_COMMON").getString("CODE_POSTAL"));
mapValues.put("SOCIETE_VILLE", rowSociete.getForeign("ID_ADRESSE_COMMON").getString("VILLE"));
 
final User currentUser = UserManager.getInstance().getCurrentUser();
final SQLRow user = rowSociete.getTable().getTable("USER_COMMON").getRow(currentUser.getId());
mapValues.put("USER_NAME", user.getString("NOM"));
mapValues.put("USER_FIRSTNAME", user.getString("PRENOM"));
mapValues.put("USER_TEL", user.getString("TEL"));
mapValues.put("USER_MAIL", user.getString("MAIL"));
 
String upTo = "Invoices up to ";
String since = "Invoices since ";
String between = "Invoices between ";
170,10 → 146,6
 
final double ttc = sqlRowValues.getLong("T_TTC") / 100.0D;
line.put("T_TTC", ttc);
final double aPayer = sqlRowValues.getLong("NET_A_PAYER") / 100.0D;
line.put("NET_A_PAYER", aPayer);
final double avoir = sqlRowValues.getLong("T_AVOIR_TTC") / 100.0D;
line.put("T_AVOIR_TTC", avoir);
 
double du = 0;
 
197,9 → 169,9
line.put("ECHEANCE", dateEch.getTime());
 
line.put("DU", du);
line.put("REGLE", aPayer - du);
line.put("REGLE", ttc - du);
 
totalTTC += aPayer;
totalTTC += ttc;
totalDu += du;
 
if (du == 0) {
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/invoice/report/MailRelanceCreator.java
1,7 → 1,7
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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,7 → 19,6
import org.openconcerto.sql.Configuration;
import org.openconcerto.sql.model.SQLRow;
import org.openconcerto.sql.users.UserManager;
import org.openconcerto.utils.CollectionUtils;
import org.openconcerto.utils.GestionDevise;
 
import java.text.DateFormat;
26,33 → 25,21
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
 
public class MailRelanceCreator {
 
private final EmailTemplate template;
private final List<SQLRow> rowEcheances;
private final SQLRow rowEcheance;
private final Map<String, String> map;
 
public MailRelanceCreator(EmailTemplate template, List<SQLRow> row) {
public MailRelanceCreator(EmailTemplate template, SQLRow row) {
if (template == null) {
template = new EmailTemplate("default", getDefaultObject(), getDefaultValue(row.size() > 1), true, "dd/MM/yyyy");
template = new EmailTemplate("defautl", getDefaultObject(), getDefaultValue(), true, "dd/MM/yyyy");
}
this.template = template;
this.rowEcheances = row;
this.rowEcheance = row;
 
Integer client = null;
for (SQLRow sqlRow : row) {
if (client == null) {
client = sqlRow.getForeignID("ID_CLIENT");
} else if (client != sqlRow.getForeignID("ID_CLIENT")) {
throw new IllegalArgumentException("Plusieurs clients pour la relance par mail.");
}
}
 
this.map = getMapValues();
}
 
60,20 → 47,13
return "Relance {FactureNumero}";
}
 
public String getDefaultValue(boolean multiple) {
final String value;
if (!multiple) {
value = "Bonjour,\n\nSauf erreur de notre part, votre compte laisse apparaître dans nos livres un montant de {FactureRestant}€ non réglé à ce jour."
public String getDefaultValue() {
String value = "Bonjour,\n\nSauf erreur de notre part, votre compte laisse apparaître dans nos livres un montant de {FactureRestant}€ non réglé à ce jour."
+ "\nCe montant correspond à la facture {FactureNumero} datée du {FactureDate} qui a pour échéance le {FactureDateEcheance}."
+ "\nNous présumons qu'il s'agit d'un simple oubli de votre part.\n\n"
+ "Toutefois, si le paiement avait été effectué, nous vous serions très obligés de nous en communiquer la date et le mode de règlement.\n\n"
+ "Dans l'attente d’un prompt règlement,\n\n" + "Nous vous prions d\'agréer, Madame, Monsieur, l\'expression de nos sentiments distingués.";
} else {
value = "Bonjour,\n\nSauf erreur de notre part, votre compte laisse apparaître dans nos livres un montant de {FactureRestant}€ non réglé à ce jour."
+ "\nCe montant correspond aux factures :\n" + "{FacturesDetails}" + "\nNous présumons qu'il s'agit d'un simple oubli de votre part.\n\n"
+ "Toutefois, si le paiement avait été effectué, nous vous serions très obligés de nous en communiquer la date et le mode de règlement.\n\n"
+ "Dans l'attente d’un prompt règlement,\n\n" + "Nous vous prions d\'agréer, Madame, Monsieur, l\'expression de nos sentiments distingués.";
}
 
return value;
}
 
116,7 → 96,7
map.put("SocieteVille", ville);
 
SQLRow rowClient;
final SQLRow clientRowNX = this.rowEcheances.get(0).getForeignRow("ID_CLIENT");
final SQLRow clientRowNX = this.rowEcheance.getForeignRow("ID_CLIENT");
rowClient = clientRowNX;
SQLRow rowAdresse = rowClient.getForeignRow("ID_ADRESSE");
if (!clientRowNX.isForeignEmpty("ID_ADRESSE_F")) {
150,41 → 130,24
DateFormat dateFormat = new SimpleDateFormat(datePattern);
map.put("RelanceDate", dateFormat.format(d));
 
SQLRow rowFacture = this.rowEcheance.getForeignRow("ID_SAISIE_VENTE_FACTURE");
 
 
// Infos facture
Long lTotal = 0L;
Long lRestant = 0L;
Long lVerse = 0L;
 
Set<String> facturesNumero = new HashSet<>();
Set<String> facturesRef = new HashSet<>();
Set<String> facturesDate = new HashSet<>();
Set<String> facturesDetails = new HashSet<>();
for (SQLRow sqlRow : rowEcheances) {
final SQLRow foreign = sqlRow.getForeign("ID_SAISIE_VENTE_FACTURE");
lTotal += (Long) foreign.getObject("T_TTC");
lRestant += (Long) sqlRow.getObject("MONTANT");
lVerse += Long.valueOf(lTotal.longValue() - lRestant.longValue());
facturesDetails.add(foreign.getString("NUMERO") + " du " + dateFormat.format(foreign.getDate("DATE").getTime()) + " d'un montant TTC : "
+ GestionDevise.currencyToString((Long) foreign.getObject("T_TTC"), true) + "€, restant à régler " + GestionDevise.currencyToString((Long) sqlRow.getObject("MONTANT"), true)
+ "€ échéance le " + dateFormat.format(sqlRow.getDate("DATE").getTime()));
 
Date dFacture = (Date) foreign.getObject("DATE");
SQLRow modeRegRow = foreign.getForeignRow("ID_MODE_REGLEMENT");
Date dateEch = ModeDeReglementSQLElement.calculDate(modeRegRow.getInt("AJOURS"), modeRegRow.getInt("LENJOUR"), dFacture);
map.put("FactureDateEcheance", dateFormat.format(dateEch));
facturesNumero.add(foreign.getString("NUMERO"));
facturesRef.add(foreign.getString("NOM"));
facturesDate.add(dateFormat.format((Date) foreign.getObject("DATE")));
}
map.put("FactureNumero", CollectionUtils.join(facturesNumero, ","));
map.put("FactureReference", CollectionUtils.join(facturesRef, ","));
map.put("FactureDate", CollectionUtils.join(facturesDate, ","));
map.put("FacturesDetails", CollectionUtils.join(facturesDetails, "\n"));
Long lTotal = (Long) rowFacture.getObject("T_TTC");
Long lRestant = (Long) this.rowEcheance.getObject("MONTANT");
Long lVerse = Long.valueOf(lTotal.longValue() - lRestant.longValue());
map.put("FactureNumero", rowFacture.getString("NUMERO"));
map.put("FactureReference", rowFacture.getString("NOM"));
map.put("FactureTotal", GestionDevise.currencyToString(lTotal.longValue(), true));
map.put("FactureRestant", GestionDevise.currencyToString(lRestant.longValue(), true));
map.put("FactureVerse", GestionDevise.currencyToString(lVerse.longValue(), true));
map.put("FactureDate", dateFormat.format((Date) rowFacture.getObject("DATE")));
 
Date dFacture = (Date) rowFacture.getObject("DATE");
SQLRow modeRegRow = rowFacture.getForeignRow("ID_MODE_REGLEMENT");
Date dateEch = ModeDeReglementSQLElement.calculDate(modeRegRow.getInt("AJOURS"), modeRegRow.getInt("LENJOUR"), dFacture);
map.put("FactureDateEcheance", dateFormat.format(dateEch));
map.put("message", "");
return map;
}
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/invoice/report/EtatStockInventaireXmlSheet.java
16,7 → 16,6
import org.openconcerto.erp.generationDoc.AbstractListeSheetXml;
import org.openconcerto.erp.preferences.PrinterNXProps;
import org.openconcerto.sql.element.SQLElement;
import org.openconcerto.sql.element.SQLElementDirectory;
import org.openconcerto.sql.model.SQLRow;
import org.openconcerto.sql.model.SQLRowAccessor;
import org.openconcerto.sql.model.SQLRowListRSH;
36,7 → 35,6
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
 
public class EtatStockInventaireXmlSheet extends AbstractListeSheetXml {
49,14 → 47,13
private Date date;
private SQLElement eltArticle;
private SQLElement eltStock;
private Set<Number> etatStockIds;
 
public EtatStockInventaireXmlSheet(SQLElementDirectory dir, Set<Number> etatStockIds) {
public EtatStockInventaireXmlSheet(SQLRow etatStock) {
super();
this.etatStockIds = etatStockIds;
this.eltArticle = dir.getElement("ARTICLE");
this.eltStock = dir.getElement("STOCK");
this.row = etatStock;
 
this.printer = PrinterNXProps.getInstance().getStringProperty("BonPrinter");
 
}
 
@Override
79,9 → 76,8
 
protected void createListeValues() {
 
SQLRowValues rowVals = new SQLRowValues(this.eltArticle.getTable().getTable("ETAT_STOCK_ELEMENT"));
SQLRowValues rowVals = new SQLRowValues(this.row.getTable().getTable("ETAT_STOCK_ELEMENT"));
rowVals.put("QTE", null);
rowVals.putRowValues("ID_ETAT_STOCK").putRowValues("ID_DEPOT_STOCK").putNulls("NOM");
SQLRowValues rowValsArt = rowVals.putRowValues("ID_ARTICLE");
rowValsArt.put("ID_FAMILLE_ARTICLE", null);
rowValsArt.put("CODE", null);
92,9 → 88,9
rowValsArt.putRowValues("ID_ARTICLE_DECLINAISON_COULEUR").putNulls("NOM");
 
SQLRowValuesListFetcher fetch = SQLRowValuesListFetcher.create(rowVals);
List<SQLRowValues> values = fetch.fetch(Where.inValues(rowVals.getTable().getField("ID_ETAT_STOCK"), this.etatStockIds));
List<SQLRowValues> values = fetch.fetch(new Where(rowVals.getTable().getField("ID_ETAT_STOCK"), "=", this.row.getID()));
 
final SQLTable tableF = this.eltArticle.getTable().getTable("FAMILLE_ARTICLE");
final SQLTable tableF = this.row.getTable().getTable("FAMILLE_ARTICLE");
SQLSelect selFam = new SQLSelect();
selFam.addSelect(tableF.getKey());
selFam.addSelect(tableF.getField("NOM"));
106,7 → 102,7
mapF.put(sqlRow.getID(), sqlRow);
}
 
final SQLTable tableFourn = this.eltArticle.getTable().getTable("FOURNISSEUR");
final SQLTable tableFourn = this.row.getTable().getTable("FOURNISSEUR");
SQLSelect selFourn = new SQLSelect();
selFourn.addSelect(tableFourn.getKey());
selFourn.addSelect(tableFourn.getField("NOM"));
121,25 → 117,9
Map<Line, Map<Line, List<Line>>> myValues = new TreeMap<Line, Map<Line, List<Line>>>(new Comparator<Line>() {
@Override
public int compare(Line o1, Line o2) {
 
final int compareDepot = o1.getDepot().compareTo(o2.getDepot());
if (compareDepot == 0) {
int compareNom = o1.getNomArt().compareTo(o2.getNomArt());
 
if (compareNom == 0) {
int compareCouleur = o1.getCouleur().compareTo(o2.getCouleur());
if (compareCouleur == 0) {
return o1.getTaille().compareTo(o2.getTaille());
} else {
return compareCouleur;
// TODO ajouter tri sur taille et couleur
return o1.getNomArt().compareTo(o2.getNomArt());
}
} else {
return compareNom;
}
} else {
return compareDepot;
}
}
});
Line lineTotal = new Line("Total", "", BigDecimal.ZERO, BigDecimal.ZERO);
final HashMap<Integer, String> style = new HashMap<Integer, String>();
160,12 → 140,7
if (rowValsArticle.getObject("ID_ARTICLE_DECLINAISON_TAILLE") != null && !rowValsArticle.isForeignEmpty("ID_ARTICLE_DECLINAISON_TAILLE")) {
taille = rowValsArticle.getForeign("ID_ARTICLE_DECLINAISON_TAILLE").getString("NOM");
}
String depot = "Principal";
final SQLRowAccessor nonEmptyForeignDepot = vals.getForeign("ID_ETAT_STOCK").getNonEmptyForeign("ID_DEPOT_STOCK");
if (nonEmptyForeignDepot != null) {
depot = nonEmptyForeignDepot.getString("NOM");
}
Line lineArt = new Line(rowF == null || rowF.isUndefined() ? "Sans famille" : rowF.getString("NOM"), taille, couleur, nomArticle, rowValsArticle.getString("CODE"), depot, ha, qte);
Line lineArt = new Line(rowF == null || rowF.isUndefined() ? "Sans famille" : rowF.getString("NOM"), taille, couleur, nomArticle, rowValsArticle.getString("CODE"), ha, qte);
 
// Init des lines familles
 
265,15 → 240,14
private final String famille;
private final String taille;
private final String couleur;
private final String depot;
private BigDecimal totalHA;
private BigDecimal qte;
 
public Line(String nomArt, String codeArt, BigDecimal totalHA, BigDecimal qte) {
this("", "", "", nomArt, codeArt, "", totalHA, qte);
this("", "", "", nomArt, codeArt, totalHA, qte);
}
 
public Line(String famille, String taille, String couleur, String nomArt, String codeArt, String depot, BigDecimal totalHA, BigDecimal qte) {
public Line(String famille, String taille, String couleur, String nomArt, String codeArt, BigDecimal totalHA, BigDecimal qte) {
this.famille = famille;
this.nomArt = nomArt;
this.taille = taille;
281,7 → 255,6
this.codeArt = codeArt;
this.totalHA = totalHA;
this.qte = qte;
this.depot = depot;
}
 
public BigDecimal getQte() {
300,18 → 273,6
return totalHA;
}
 
public String getDepot() {
return depot;
}
 
public String getCouleur() {
return couleur;
}
 
public String getTaille() {
return taille;
}
 
public void add(Line l) {
this.totalHA = this.totalHA.add(l.getTotalHA());
this.qte = this.qte.add(l.getQte());
324,7 → 285,6
m.put("NOM", getNomArt());
m.put("TAILLE", this.taille);
m.put("COULEUR", this.couleur);
m.put("DEPOT", this.depot);
m.put("QTE", getQte());
m.put("TOTAL_HA", getTotalHA());
return m;
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/invoice/report/SituationCompteXmlSheet.java
77,7 → 77,7
final SQLTable echTable = eltEch.getTable();
SQLRowValues rowVals = new SQLRowValues(echTable);
rowVals.putNulls("DATE", "MONTANT");
rowVals.putRowValues("ID_SAISIE_VENTE_FACTURE").putNulls("NUMERO", "NET_A_PAYER", "T_AVOIR_TTC", "DATE", "NOM").putRowValues("ID_AVOIR_CLIENT").putNulls("NUMERO", "DATE");
rowVals.putRowValues("ID_SAISIE_VENTE_FACTURE").putNulls("NUMERO", "NET_A_PAYER", "DATE", "NOM");
Where w = new Where(echTable.getField("REGLE"), "=", Boolean.FALSE);
w = w.and(new Where(echTable.getField("REG_COMPTA"), "=", Boolean.FALSE));
w = w.and(new Where(echTable.getField("ID_CLIENT"), "=", row.getID()));
92,14 → 92,7
return o1.getDate("DATE").compareTo(o2.getDate("DATE"));
}
});
Collections.sort(result, new Comparator<SQLRowValues>() {
@Override
public int compare(SQLRowValues o1, SQLRowValues o2) {
 
return o1.getDate("DATE").compareTo(o2.getDate("DATE"));
}
});
 
List<Map<String, Object>> listValues = new ArrayList<Map<String, Object>>();
Map<Integer, String> styleValues = new HashMap<Integer, String>();
BigDecimal totalRegle = BigDecimal.ZERO;
124,12 → 117,9
final BigDecimal montantFact = new BigDecimal(rowFact.getLong("NET_A_PAYER"));
regle = montantFact.subtract(montantDu);
mValues.put("DU", montantFact.movePointLeft(2));
if (!rowFact.isForeignEmpty("ID_AVOIR_CLIENT")) {
mValues.put("AVOIR_TTC", new BigDecimal(rowFact.getLong("T_AVOIR_TTC")).movePointLeft(2));
mValues.put("AVOIR_NUMERO", rowFact.getForeign("ID_AVOIR_CLIENT").getString("NUMERO"));
}
mValues.put("REGLE", montantFact.subtract(montantDu).movePointLeft(2));
mValues.put("SOLDE", montantDu.movePointLeft(2));
 
} else {
regle = BigDecimal.ZERO;
mValues.put("SOLDE", montantDu.movePointLeft(2));
177,6 → 167,7
 
}
 
 
// Avoir
final SQLTable avoirTable = echTable.getTable("AVOIR_CLIENT");
SQLRowValues rowValsAvoir = new SQLRowValues(avoirTable);
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/invoice/action/ListeDesFacturesPrevisionnellesOCAction.java
File deleted
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/invoice/action/ListeDesElementsFactureAction.java
1,7 → 1,7
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the GNU General Public License Version 3
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a
44,7 → 44,7
 
IListe liste = new IListe(element.getTableSource(true));
final ListeViewPanel listeAddPanel = new ListeViewPanel(element, liste);
listeAddPanel.getListe().getRequest().putWhere("Undef",new Where(element.getTable().getField("ID_SAISIE_VENTE_FACTURE"), ">", 1));
listeAddPanel.getListe().getRequest().setWhere(new Where(element.getTable().getField("ID_SAISIE_VENTE_FACTURE"), ">", 1));
List<SQLField> l = new ArrayList<SQLField>();
l.add(element.getTable().getField("T_PV_HT"));
l.add(element.getTable().getField("T_PV_TTC"));
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/invoice/action/ListeDesFactureItemsAction.java
1,7 → 1,7
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the GNU General Public License Version 3
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a
41,7 → 41,7
@Override
protected SQLTableModelSource createTableSource() {
final SQLTableModelSource res = super.createTableSource();
res.getReq().putWhere("Undef", new Where(getElem().getTable().getField("ID_SAISIE_VENTE_FACTURE"), ">", 1));
res.getReq().setWhere(new Where(getElem().getTable().getField("ID_SAISIE_VENTE_FACTURE"), ">", 1));
return res;
}
 
49,7 → 49,6
protected IListPanel instantiateListPanel(SQLTableModelSource tableSource, String panelVariant) {
return new ListeViewPanel(tableSource.getElem(), new IListe(tableSource));
}
 
@Override
protected void initFrame(IListFrame frame) {
final SQLElement element = this.getElem();
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/invoice/ui/InvoicePercentRenderer.java
File deleted
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/invoice/ui/ListeDesVentesPanel.java
16,17 → 16,13
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.finance.accounting.ui.ListeGestCommEltPanel;
import org.openconcerto.erp.core.sales.account.VenteFactureSituationSQLComponent;
import org.openconcerto.erp.core.sales.account.VenteFactureSoldeSQLComponent;
import org.openconcerto.erp.core.sales.invoice.element.SaisieVenteFactureSQLElement;
import org.openconcerto.erp.core.sales.pos.POSConfiguration;
import org.openconcerto.erp.core.sales.pos.element.TicketCaisseSQLElement;
import org.openconcerto.erp.core.sales.pos.model.ArticleCache;
import org.openconcerto.erp.core.sales.pos.ui.TextAreaTicketPanel;
import org.openconcerto.sql.TM;
import org.openconcerto.sql.element.SQLElement;
import org.openconcerto.sql.element.SQLElementDirectory;
import org.openconcerto.sql.model.FieldPath;
35,9 → 31,6
import org.openconcerto.sql.model.SQLRowValues;
import org.openconcerto.sql.model.Where;
import org.openconcerto.sql.model.graph.Path;
import org.openconcerto.sql.view.EditFrame;
import org.openconcerto.sql.view.EditPanel;
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.ITableModel;
48,10 → 41,8
import org.openconcerto.ui.DefaultGridBagConstraints;
import org.openconcerto.ui.JLabelBold;
import org.openconcerto.ui.PanelFrame;
import org.openconcerto.utils.CollectionUtils;
import org.openconcerto.utils.ExceptionHandler;
import org.openconcerto.utils.TableSorter;
import org.openconcerto.utils.Tuple2;
import org.openconcerto.utils.cc.IClosure;
 
import java.awt.GridBagConstraints;
58,13 → 49,11
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Set;
 
import javax.swing.AbstractAction;
import javax.swing.JButton;
105,7 → 94,7
if (src.getReq().getWhere() != null) {
wPrev = wPrev.and(src.getReq().getWhere());
}
src.getReq().putWhere("Previsionnelle", wPrev);
src.getReq().setWhere(wPrev);
 
final ListeFactureRenderer rend = new ListeFactureRenderer();
for (SQLTableModelColumn column : src.getColumns()) {
155,53 → 144,10
 
this.listeFact.setOpaque(false);
this.listeFact.getListe().setModificationAllowed(true);
final PredicateRowAction action = new PredicateRowAction(new AbstractAction(TM.tr("display")) {
 
@Override
public void actionPerformed(ActionEvent e) {
EditFrame editModifyFrame;
SQLRowAccessor row = IListe.get(e).getSelectedRowAccessor();
if (eltFacture.getTable().getName().equals("SAISIE_VENTE_FACTURE") && row.getBoolean("PARTIAL")) {
editModifyFrame = new EditFrame(eltFacture.createComponent(VenteFactureSituationSQLComponent.ID), EditPanel.READONLY);
} else if (eltFacture.getTable().getName().equals("SAISIE_VENTE_FACTURE") && row.getBoolean("SOLDE")) {
editModifyFrame = new EditFrame(eltFacture.createComponent(VenteFactureSoldeSQLComponent.ID), EditPanel.READONLY);
} else {
editModifyFrame = new EditFrame(eltFacture, EditPanel.READONLY);
}
editModifyFrame.selectionId(row.getID());
editModifyFrame.setVisible(true);
 
}
}, false);
action.setPredicate(IListeEvent.getSingleSelectionPredicate());
this.listeFact.getListe().setDefaultRowAction(action);
 
final JTable tableFact = this.listeFact.getListe().getJTable();
final SQLTableModelColumn numeroCol = src.getColumn(eltFacture.getTable().getField("NUMERO"));
((TableSorter) tableFact.getModel()).setSortingStatus(src.getColumns().indexOf(numeroCol), TableSorter.ASCENDING);
 
BaseSQLTableModelColumn totalAvoirHT = new BaseSQLTableModelColumn("Fact. - Avoir HT", BigDecimal.class) {
 
@Override
protected Object show_(SQLRowAccessor r) {
BigDecimal bF = new BigDecimal(r.getLong("T_HT")).movePointLeft(2);
if (!r.isForeignEmpty("ID_AVOIR_CLIENT")) {
BigDecimal b = new BigDecimal(r.getForeign("ID_AVOIR_CLIENT").getLong("MONTANT_HT")).movePointLeft(2);
return bF.subtract(b);
}
return bF;
}
 
@Override
public Set<FieldPath> getPaths() {
Path p = new Path(eltFacture.getTable());
p = p.add(eltFacture.getTable().getField("ID_AVOIR_CLIENT"));
 
return CollectionUtils.createSet(new FieldPath(p, "MONTANT_HT"));
}
};
src.getColumns().add(src.getColumns().indexOf(src.getColumn(eltFacture.getTable().getField("T_HT"))), totalAvoirHT);
 
JPanel panelFacture = new JPanel(new GridBagLayout());
GridBagConstraints cFacture = new DefaultGridBagConstraints();
 
213,14 → 159,13
cFacture.fill = GridBagConstraints.BOTH;
panelFacture.add(this.listeFact, cFacture);
 
List<Tuple2<? extends SQLTableModelColumn, Type>> l = new ArrayList<Tuple2<? extends SQLTableModelColumn, Type>>();
List<SQLField> l = new ArrayList<SQLField>();
if (this.listeFact.getListe().getSource().getColumn(eltFacture.getTable().getField("T_HA")) != null) {
l.add(Tuple2.create(src.getColumn(eltFacture.getTable().getField("T_HA")), Type.SOMME));
l.add(eltFacture.getTable().getField("T_HA"));
}
l.add(Tuple2.create(totalAvoirHT, Type.SOMME));
l.add(Tuple2.create(src.getColumn(eltFacture.getTable().getField("T_HT")), Type.SOMME));
l.add(Tuple2.create(src.getColumn(eltFacture.getTable().getField("T_TTC")), Type.SOMME));
final IListTotalPanel total = new IListTotalPanel(this.listeFact.getListe(), l, null, "Total");
l.add(eltFacture.getTable().getField("T_HT"));
l.add(eltFacture.getTable().getField("T_TTC"));
final IListTotalPanel total = new IListTotalPanel(this.listeFact.getListe(), l);
cFacture.weighty = 0;
cFacture.fill = GridBagConstraints.NONE;
cFacture.gridy++;
228,6 → 173,7
total.setOpaque(false);
panelFacture.add(total, cFacture);
 
 
IListFilterDatePanel filterDate = new IListFilterDatePanel(this.listeFact.getListe(), eltFacture.getTable().getField("DATE"), IListFilterDatePanel.getDefaultMap());
cFacture.weighty = 0;
cFacture.fill = GridBagConstraints.HORIZONTAL;
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/invoice/component/SaisieVenteFactureSQLComponent.java
49,6 → 49,7
import org.openconcerto.sql.element.ElementSQLObject;
import org.openconcerto.sql.element.SQLComponent;
import org.openconcerto.sql.element.SQLElement;
import org.openconcerto.sql.element.SQLComponent.Mode;
import org.openconcerto.sql.model.SQLBackgroundTableCache;
import org.openconcerto.sql.model.SQLBase;
import org.openconcerto.sql.model.SQLInjector;
55,9 → 56,7
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.SQLSelectJoin;
import org.openconcerto.sql.model.SQLTable;
import org.openconcerto.sql.model.UndefinedRowValuesCache;
import org.openconcerto.sql.model.Where;
692,25 → 691,9
this.addView(acompteCmd, "ACOMPTE_COMMANDE");
}
 
if (this.getTable().getFieldsName().contains("POURCENT_RG") && prefs.getBoolean(GestionCommercialeGlobalPreferencePanel.POURCENT_RG, false)) {
// RG
c.gridy++;
c.gridx = 0;
c.weightx = 0;
c.weighty = 0;
c.gridwidth = 1;
c.fill = GridBagConstraints.HORIZONTAL;
this.add(new JLabel(getLabelFor("POURCENT_RG"), SwingConstants.RIGHT), c);
c.gridx++;
c.weightx = 1;
JTextField fieldRG = new JTextField();
this.add(fieldRG, c);
this.addView(fieldRG, "POURCENT_RG");
}
 
c.gridy++;
c.gridx = 0;
c.weightx = 1;
c.weighty = 1;
c.gridwidth = GridBagConstraints.REMAINDER;
c.fill = GridBagConstraints.BOTH;
1025,7 → 1008,7
 
});
 
this.selAvoir.addModelListener("wantedID", new PropertyChangeListener() {
this.selAvoir.addValueListener(new PropertyChangeListener() {
 
public void propertyChange(PropertyChangeEvent evt) {
refreshText();
1078,7 → 1061,7
 
this.changeCompteListener = new PropertyChangeListener() {
public void propertyChange(PropertyChangeEvent evt) {
SQLSelect sel = new SQLSelect();
SQLSelect sel = new SQLSelect(getTable().getBase());
sel.addSelect(SaisieVenteFactureSQLComponent.this.client.getTable().getKey());
Where where = new Where(SaisieVenteFactureSQLComponent.this.client.getTable().getField("ID_COMPTE_PCE"), "=", SaisieVenteFactureSQLComponent.this.compteSel.getValue());
sel.setWhere(where);
1242,10 → 1225,12
if (n != null) {
netAPayer = n.longValue();
ttc = n.longValue();
}
 
if (this.selAvoir.getWantedID() > 1) {
final SQLTable tableAvoir = getElement().getForeignElement("ID_AVOIR_CLIENT").getTable();
final SQLRow rowAvoir = tableAvoir.getRow(this.selAvoir.getWantedID());
if (this.selAvoir.getSelectedId() > 1) {
SQLTable tableAvoir = Configuration.getInstance().getDirectory().getElement("AVOIR_CLIENT").getTable();
if (n != null) {
SQLRow rowAvoir = tableAvoir.getRow(this.selAvoir.getSelectedId());
long totalAvoir = ((Number) rowAvoir.getObject("MONTANT_TTC")).longValue();
totalAvoir -= ((Number) rowAvoir.getObject("MONTANT_SOLDE")).longValue();
if (getSelectedID() > 1) {
1266,7 → 1251,6
netAPayer = l;
}
}
 
if (this.gestionTimbre) {
Long timbre = this.totalTimbre.getValue();
if (timbre != null) {
1322,17 → 1306,6
if (r != null) {
// FIXME Mettre un droit pour autoriser la modification d'une facture lettrée ou pointée
if (!r.isUndefined() && r.getObject("ID_MOUVEMENT") != null && !r.isForeignEmpty("ID_MOUVEMENT")) {
 
if (containsChequeDeposer(r)) {
SwingUtilities.invokeLater(new Runnable() {
 
@Override
public void run() {
JOptionPane.showMessageDialog(null, "Attention cette facture est référencée par un chèque déposé en banque. Vous ne pourrez pas valider les modifications!");
}
});
}
 
SQLTable tableEcr = getTable().getTable("ECRITURE");
SQLTable tableMvt = getTable().getTable("MOUVEMENT");
SQLTable tablePiece = getTable().getTable("PIECE");
1406,30 → 1379,6
} // nomClient.addValueListener(changeClientListener);
}
 
private boolean containsChequeDeposer(SQLRowAccessor r) {
if (!r.isUndefined() && r.getObject("ID_MOUVEMENT") != null && !r.isForeignEmpty("ID_MOUVEMENT")) {
final SQLTable tableCheque = getTable().getTable("CHEQUE_A_ENCAISSER");
SQLRowValues rowValsCheque = new SQLRowValues(tableCheque);
rowValsCheque.putNulls("ENCAISSE");
rowValsCheque.putRowValues("ID_MOUVEMENT").putRowValues("ID_PIECE");
 
final int idPiece = r.getForeign("ID_MOUVEMENT").getInt("ID_PIECE");
final SQLRowValuesListFetcher createFetcher = SQLRowValuesListFetcher.create(rowValsCheque);
createFetcher.addSelTransf(new ITransformer<SQLSelect, SQLSelect>() {
@Override
public SQLSelect transformChecked(SQLSelect input) {
final SQLSelectJoin joinFromField = input.getJoinFromField(r.getTable().getForeignTable("ID_MOUVEMENT").getField("ID_PIECE"));
input.setWhere(new Where(tableCheque.getField("ENCAISSE"), "=", Boolean.TRUE).and(new Where(joinFromField.getJoinedTable().getKey(), "=", idPiece)));
return input;
}
}, 0);
final List<SQLRowValues> fetch = createFetcher.fetch();
return !fetch.isEmpty();
}
return false;
 
}
 
private String getInitialesFromVerif(SQLRow row) {
String s = "";
 
1494,22 → 1443,10
rowVals.update();
}
} else {
rowFactureOld = this.getTable().getRow(getSelectedID());
if (containsChequeDeposer(rowFactureOld)) {
SwingUtilities.invokeLater(new Runnable() {
 
@Override
public void run() {
JOptionPane.showMessageDialog(null,
"Cette facture est référencée par un chèque déposé en banque. Impossible de valider les modifications!\n Supprimer le dépôt de chèque avant de modifier la facture.");
}
});
return idSaisieVF;
}
 
if (JOptionPane.showConfirmDialog(this, "Attention en modifiant cette facture, vous supprimerez les chéques et les échéances associés. Continuer?", "Modification de facture",
JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
// On recupere l'ancien total HT
rowFactureOld = this.getTable().getRow(getSelectedID());
lFactureOld = ((Number) rowFactureOld.getObject("T_HT")).longValue();
 
super.update();
1621,7 → 1558,6
}
if (attempt > 0) {
SwingUtilities.invokeLater(new Runnable() {
 
public void run() {
JOptionPane.showMessageDialog(null, "Le numéro a été actualisé en " + num);
}
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/quote/element/DevisSQLElement.java
674,7 → 674,7
@Override
protected synchronized void _initTableSource(final SQLTableModelSource table) {
super._initTableSource(table);
addCommercialFilter(table, getTable().getField("ID_COMMERCIAL"));
 
final BaseSQLTableModelColumn colAdrLiv = new BaseSQLTableModelColumn("Adresse de livraison", String.class) {
 
@Override
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/quote/action/ListeDesElementsDevisAction.java
56,7 → 56,7
c.anchor = GridBagConstraints.EAST;
c.fill = GridBagConstraints.NONE;
 
listeAddPanel.getListe().getRequest().putWhere("Undef", new Where(element.getTable().getField("ID_DEVIS"), ">", 1));
listeAddPanel.getListe().getRequest().setWhere(new Where(element.getTable().getField("ID_DEVIS"), ">", 1));
List<SQLField> l = new ArrayList<SQLField>();
l.add(element.getTable().getField("T_PV_HT"));
l.add(element.getTable().getField("T_PV_TTC"));
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/quote/ui/ListeDesDevisPanel.java
1,7 → 1,7
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the GNU General Public License Version 3
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a
317,7 → 317,7
}
if (idFilter > 1) {
Where wAttente = new Where(this.eltDevis.getTable().getField("ID_ETAT_DEVIS"), "=", idFilter);
lAttente.getReq().putWhere("ETAT", wAttente);
lAttente.getReq().setWhere(wAttente);
} else {
lAttente.getColumns().add(new BaseSQLTableModelColumn("Etat", String.class) {
 
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/quote/component/DevisSQLComponent.java
1277,16 → 1277,8
rowVals.put("ID_TAXE_FRAIS_DOCUMENT", taxeDefault.getID());
}
if (getTable().getFieldsName().contains("DATE_VALIDITE")) {
 
Calendar cal = Calendar.getInstance();
 
int jours = SQLPreferences.getMemCached(getTable().getDBRoot()).getInt(GestionCommercialeGlobalPreferencePanel.DEVIS_VALIDITE_JOURS, 30);
if (jours % 30 == 0) {
cal.add(Calendar.MONTH, jours / 30);
} else {
cal.add(Calendar.DAY_OF_YEAR, jours);
}
 
cal.add(Calendar.MONTH, 1);
rowVals.put("DATE_VALIDITE", new java.sql.Date(cal.getTimeInMillis()));
}
return rowVals;
1388,10 → 1380,24
 
@Override
public void select(final 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);
}
 
// super.select(r);
if (r != null) {
this.table.getRowValuesTable().clear();
this.table.getRowValuesTable().insertFrom(r);
this.table.insertFrom("ID_DEVIS", r.getID());
// this.radioEtat.setVisible(r.getID() > getTable().getUndefinedID());
if (getTable().contains("SITE_DIFF"))
setSiteEnabled(r.getBoolean("SITE_DIFF"), Type_Diff.SITE);
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/product/element/BatchHistoryPDF.java
File deleted
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/product/element/LotReceptionSQLElement.java
File deleted
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/product/element/LotLivraisonSQLElement.java
File deleted
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/product/element/ListeDesLotsAction.java
16,14 → 16,10
import org.openconcerto.erp.action.CreateFrameAbstractAction;
import org.openconcerto.sql.element.SQLElementDirectory;
import org.openconcerto.sql.model.SQLRowAccessor;
import org.openconcerto.sql.model.SQLSelect;
import org.openconcerto.sql.model.SQLSelectJoin;
import org.openconcerto.sql.model.Where;
import org.openconcerto.sql.view.IListFrame;
import org.openconcerto.sql.view.ListeAddPanel;
import org.openconcerto.sql.view.list.IListe;
import org.openconcerto.sql.view.list.SQLTableModelSource;
import org.openconcerto.utils.cc.ITransformer;
 
import javax.swing.JFrame;
 
38,23 → 34,8
 
@Override
public JFrame createFrame() {
final LotSQLElement element = dir.getElement(LotSQLElement.class);
final SQLTableModelSource tableSource = element.createTableSource();
if (selectedRowAccessor != null) {
tableSource.getReq().setSelectTransf(new ITransformer<SQLSelect, SQLSelect>() {
 
@Override
public SQLSelect transformChecked(SQLSelect input) {
final SQLSelectJoin join = input.getJoin(element.getTable().getField("ID_STOCK"));
input.setWhere(new Where(join.getJoinedTable().getField("ID_ARTICLE"), "=", selectedRowAccessor.getID()));
return input;
}
});
}
final SQLTableModelSource tableSource = dir.getElement(LotSQLElement.class).createTableSource();
IListFrame frame = new IListFrame(new ListeAddPanel(tableSource.getElem(), new IListe(tableSource)));
frame.getPanel().setAddVisible(false);
frame.getPanel().setModifyVisible(false);
frame.getPanel().setDeleteVisible(false);
return frame;
}
 
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/product/element/UniteVenteArticleSQLElement.java
1,7 → 1,7
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the GNU General Public License Version 3
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a
30,14 → 30,7
public class UniteVenteArticleSQLElement extends ComptaSQLConfElement {
 
public static final int A_LA_PIECE = 2;
public static final int METRE = 3;
public static final int M2 = 4;
public static final int M3 = 5;
public static final int LITRE = 6;
public static final int KG = 7;
public static final int HEURE = 8;
public static final int JOURE = 9;
public static final int MOIS = 10;
 
public UniteVenteArticleSQLElement() {
super("UNITE_VENTE", "une unité de vente", "unité de vente");
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/product/element/LotSQLElement.java
13,85 → 13,19
package org.openconcerto.erp.core.sales.product.element;
 
import org.openconcerto.erp.config.ComptaPropsConfiguration;
import org.openconcerto.erp.config.Gestion;
import org.openconcerto.erp.core.common.element.ComptaSQLConfElement;
import org.openconcerto.erp.core.finance.accounting.ui.ImpressionGrandLivrePanel;
import org.openconcerto.erp.core.sales.product.model.BatchQuantity;
import org.openconcerto.erp.core.sales.product.model.ProductComponent;
import org.openconcerto.erp.core.supplychain.stock.element.DepotStockSQLElement;
import org.openconcerto.sql.element.BaseSQLComponent;
import org.openconcerto.sql.element.SQLComponent;
import org.openconcerto.sql.model.SQLInsert;
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.SQLSelectJoin;
import org.openconcerto.sql.model.SQLTable;
import org.openconcerto.sql.model.SQLUpdate;
import org.openconcerto.sql.model.Where;
import org.openconcerto.sql.request.UpdateBuilder;
import org.openconcerto.sql.view.list.IListe;
import org.openconcerto.sql.view.list.RowValuesTableModel;
import org.openconcerto.sql.view.list.IListeAction.IListeEvent;
import org.openconcerto.sql.view.list.action.SQLRowValuesAction.PredicateRowAction;
import org.openconcerto.utils.ExceptionHandler;
import org.openconcerto.utils.ListMap;
import org.openconcerto.utils.cc.ITransformer;
import org.openconcerto.utils.checks.ValidState;
 
import java.awt.GridBagLayout;
import java.io.File;
import java.io.IOException;
import java.math.BigDecimal;
import java.sql.SQLException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
 
import javax.swing.JFileChooser;
import javax.swing.SwingUtilities;
 
public class LotSQLElement extends ComptaSQLConfElement {
 
public LotSQLElement() {
super("LOT", "un lot", "lots");
 
PredicateRowAction action = new PredicateRowAction(true, "batch.history.pdf.action",(le) -> {
JFileChooser chooser = new JFileChooser();
SimpleDateFormat df = new SimpleDateFormat("dd-MM-yyyy");
chooser.setSelectedFile(new File("BatchTracking " + le.getSelectedRow().getID() + "-" + df.format(new Date()) + ".pdf"));
int r = chooser.showSaveDialog(null);
if (r == JFileChooser.APPROVE_OPTION) {
BatchHistoryPDF pdf = new BatchHistoryPDF(ComptaPropsConfiguration.getInstanceCompta(), le.getSelectedRow());
final File file = chooser.getSelectedFile();
try {
pdf.getGeneratedPDFFile(file);
 
SwingUtilities.invokeLater(new Runnable() {
 
@Override
public void run() {
Gestion.openPDF(file);
}
});
} catch (IOException e) {
ExceptionHandler.handle("Erreur lors de la création du PDF", e);
}
}
});
action.setPredicate(IListeEvent.getSingleSelectionPredicate());
getRowValuesActions().add(action);
}
 
@Override
protected List<String> getListFields() {
118,13 → 52,6
}
 
@Override
public ListMap<String, String> getShowAs() {
ListMap<String, String> map = new ListMap<>();
map.add("ID_STOCK", "ID_DEPOT_STOCK");
return map;
}
 
@Override
public SQLComponent createComponent() {
return new BaseSQLComponent(this) {
 
136,414 → 63,8
};
}
 
public ValidState getValidStateOfRowValuesTable(RowValuesTableModel rowValuesTableModel, TypeLot type) {
for (int line = 0; line < rowValuesTableModel.getRowCount(); line++) {
final SQLRowValues rowValuesAt = rowValuesTableModel.getRowValuesAt(line);
final SQLRowAccessor nonEmptyForeign = rowValuesAt.getNonEmptyForeign("ID_ARTICLE");
if (nonEmptyForeign != null) {
final SQLRow asRowArticle = nonEmptyForeign.asRow();
final Boolean lotReq = asRowArticle.getBoolean("NUMERO_LOT_REQUIS");
final Boolean lotSerie = asRowArticle.getBoolean("NUMERO_SERIE_REQUIS");
final Boolean lotDLC = asRowArticle.getBoolean("DLC_REQUIS");
final Boolean lotDLUO = asRowArticle.getBoolean("DLUO_REQUIS");
if (lotReq || lotSerie) {
final Set<SQLRowValues> referentRows = rowValuesAt.getReferentRows(getTable().getTable(type.getTableLot()).getField("ID_" + type.getTableItems()));
List<SQLRowValues> lotRows = new ArrayList<>();
for (SQLRowValues sqlRowValues : referentRows) {
if (!sqlRowValues.contains("ARCHIVE") || !sqlRowValues.isArchived()) {
if (lotReq && sqlRowValues.getString("NUMERO_LOT").trim().length() == 0) {
return ValidState.create(false, "Ligne " + (line + 1) + " : lot sans référence!");
}
if (lotSerie && sqlRowValues.getString("NUMERO_SERIE").trim().length() == 0) {
return ValidState.create(false, "Ligne " + (line + 1) + " : numéro de série non renseigné!");
}
if (lotDLC && sqlRowValues.getDate("DLC") == null) {
return ValidState.create(false, "Ligne " + (line + 1) + " : DLC non renseignée!");
}
if (lotDLUO && sqlRowValues.getDate("DLUO") == null) {
return ValidState.create(false, "Ligne " + (line + 1) + " : DLUO non renseignée!");
}
 
lotRows.add(sqlRowValues);
 
}
}
if (lotRows.isEmpty()) {
return ValidState.create(false, "La ligne " + (line + 1) + " n'a aucun lot associé!");
}
}
 
}
}
return ValidState.getTrueInstance();
}
 
public void updateLotQuantiteFromLotItems(List<SQLRowValues> rowValues, TypeLot type) throws SQLException {
 
if (!rowValues.isEmpty()) {
final List<Integer> findOrCreateLot = findOrCreateLot(rowValues);
if (findOrCreateLot.size() != rowValues.size()) {
throw new IllegalArgumentException("La taille des lignes de bons [" + rowValues.size() + "] ne correspond pas à la liste des lots trouvés [" + findOrCreateLot.size() + "]");
}
List<String> updates = new ArrayList<>();
for (int index = 0; index < findOrCreateLot.size(); index++) {
UpdateBuilder builder = new UpdateBuilder(getTable());
builder.set("QUANTITE", getTable().getField("QUANTITE").getQuotedName() + (type == TypeLot.RECEPTION ? " + " : " - ") + rowValues.get(index).getBigDecimal("QUANTITE"));
builder.setWhere(new Where(getTable().getKey(), "=", findOrCreateLot.get(index)));
updates.add(builder.asString());
}
getTable().getDBSystemRoot().getDataSource().executeBatch(updates, true);
}
}
 
public void removeLotQuantiteFromLotItems(List<SQLRowValues> rowValuesLotReceptionOrLivraison, TypeLot type) throws SQLException {
 
if (!rowValuesLotReceptionOrLivraison.isEmpty()) {
final List<Integer> findOrCreateLot = findOrCreateLot(rowValuesLotReceptionOrLivraison);
if (findOrCreateLot.size() != rowValuesLotReceptionOrLivraison.size()) {
throw new IllegalArgumentException(
"La taille des lignes de bons [" + rowValuesLotReceptionOrLivraison.size() + "] ne correspond pas à la liste des lots trouvés [" + findOrCreateLot.size() + "]");
}
List<String> updates = new ArrayList<>();
for (int index = 0; index < findOrCreateLot.size(); index++) {
UpdateBuilder builder = new UpdateBuilder(getTable());
builder.set("QUANTITE",
getTable().getField("QUANTITE").getQuotedName() + (type == TypeLot.RECEPTION ? " - " : " + ") + rowValuesLotReceptionOrLivraison.get(index).getBigDecimal("QUANTITE"));
builder.setWhere(new Where(getTable().getKey(), "=", findOrCreateLot.get(index)));
updates.add(builder.asString());
}
getTable().getDBSystemRoot().getDataSource().executeBatch(updates, true);
}
}
 
/**
* Recherche des ids des lots qui correspondent avec le numero de serie et/ou le numero de lot
* des lignes de lot de reception/livraison passées en parametres
*
* @param rowValuesLotRecOrLiv
* @return
* @throws SQLException
*/
 
public List<Integer> findOrCreateLot(List<SQLRowValues> rowValuesLotRecOrLiv) throws SQLException {
 
final SQLTable tableItem;
if (rowValuesLotRecOrLiv.isEmpty()) {
return new ArrayList<>();
} else {
tableItem = rowValuesLotRecOrLiv.get(0).getTable();
}
 
// Récupération des numeros de lot et numeros de serie à retrouver
List<String> numeroLot = new ArrayList<>();
List<String> numeroSerie = new ArrayList<>();
for (SQLRowValues r : rowValuesLotRecOrLiv) {
if (r.isForeignEmpty("ID_LOT")) {
final String lot = r.getString("NUMERO_LOT");
final String serie = r.getString("NUMERO_SERIE");
if (lot.length() > 0) {
numeroLot.add(lot);
}
if (serie.length() > 0) {
numeroSerie.add(serie);
}
}
}
 
// Création d'une map pour faire la correspondance nuemro de lot / numero de serie avec une
// row LOT
SQLRowValues rowValsToFecth = new SQLRowValues(getTable());
rowValsToFecth.putNulls("DLC", "DLUO", "QUANTITE", "NUMERO_SERIE", "NUMERO_LOT");
rowValsToFecth.putRowValues("ID_STOCK").putNulls("ID_ARTICLE", "ID_DEPOT_STOCK");
 
SQLRowValuesListFetcher fetcher = SQLRowValuesListFetcher.create(rowValsToFecth);
final List<SQLRowValues> resultMatchLot = fetcher.fetch(Where.inValues(getTable().getField("NUMERO_LOT"), numeroLot).or(Where.inValues(getTable().getField("NUMERO_SERIE"), numeroSerie)));
Map<LotKey, SQLRowValues> mapLotSerie = new HashMap<>();
for (SQLRowValues sqlRowValues : resultMatchLot) {
final SQLRowAccessor foreignStock = sqlRowValues.getForeign("ID_STOCK");
LotKey key = new LotKey(foreignStock.getForeignID("ID_ARTICLE"), foreignStock.getForeignID("ID_DEPOT_STOCK"), sqlRowValues.getString("NUMERO_SERIE"), sqlRowValues.getString("NUMERO_LOT"));
mapLotSerie.put(key, sqlRowValues);
}
 
// Matching/Creation des Lots
List<Integer> idsLot = new ArrayList<>(rowValuesLotRecOrLiv.size());
List<SQLInsert> inserts = new ArrayList<>();
List<String> fieldsToCopy = Arrays.asList("DLC", "DLUO", "NUMERO_SERIE", "NUMERO_LOT");
for (int i = 0; i < rowValuesLotRecOrLiv.size(); i++) {
SQLRowValues rowVals = rowValuesLotRecOrLiv.get(i);
final int foreignIDDepot = rowVals.isForeignEmpty("ID_DEPOT_STOCK") ? DepotStockSQLElement.DEFAULT_ID : rowVals.getForeignID("ID_DEPOT_STOCK");
LotKey key = new LotKey(rowVals.getForeignID("ID_ARTICLE"), foreignIDDepot, rowVals.getString("NUMERO_SERIE"), rowVals.getString("NUMERO_LOT"));
 
if (!rowVals.isForeignEmpty("ID_LOT")) {
idsLot.add(rowVals.getForeignID("ID_LOT"));
} else if (mapLotSerie.containsKey(key)) {
idsLot.add(mapLotSerie.get(key).getID());
} else {
idsLot.add(null);
SQLInsert insert = new SQLInsert();
for (String f : fieldsToCopy) {
insert.add(getTable().getField(f), rowVals.getObject(f));
}
insert.add(getTable().getField("QUANTITE"), BigDecimal.ZERO);
String fieldForeignBonItem = tableItem.getName().equals("LOT_RECEPTION") ? "ID_BON_RECEPTION_ELEMENT" : "ID_BON_LIVRAISON_ELEMENT";
final SQLRowAccessor bonTiem = rowVals.getForeign(fieldForeignBonItem);
final SQLRowAccessor foreignArt = bonTiem.getForeign("ID_ARTICLE");
ProductComponent comp = ProductComponent.createFromRowArticle(foreignArt, bonTiem);
stock(comp);
insert.add(getTable().getField("ID_STOCK"), comp.getStock().getID());
inserts.add(insert);
 
}
}
if (!inserts.isEmpty()) {
List<SQLUpdate> updates = new ArrayList<>();
final List<Number> executeSimilarInserts = SQLInsert.executeSimilarInserts(getTable().getDBSystemRoot(), inserts, true);
int index = 0;
for (int i = 0; i < idsLot.size(); i++) {
Integer id = idsLot.get(i);
if (id == null) {
final int insertedId = executeSimilarInserts.get(index).intValue();
idsLot.set(i, insertedId);
SQLUpdate update = new SQLUpdate(new Where(tableItem.getKey(), "=", rowValuesLotRecOrLiv.get(i).getID()));
update.add(tableItem.getField("ID_LOT"), insertedId);
updates.add(update);
index++;
}
}
if (!updates.isEmpty()) {
SQLUpdate.executeMultipleWithBatch(tableItem.getDBSystemRoot(), updates);
}
}
return idsLot;
}
 
public List<SQLRowValues> createLotLivraison(List<BatchQuantity> l, SQLRowValues refBLRowItem) {
 
Map<Integer, SQLRowValues> rowValsExists = new HashMap<>();
final Set<SQLRowValues> referentRows = refBLRowItem.getReferentRows(getTable().getTable("LOT_LIVRAISON").getField("ID_BON_DE_LIVRAISON_ELEMENT"));
for (SQLRowValues sqlRowValues : referentRows) {
rowValsExists.put(sqlRowValues.getForeignID("ID_LOT"), sqlRowValues);
}
 
List<Integer> idBatchsNotExisting = new ArrayList<>();
Set<Integer> idBatchsExisting = new HashSet<>();
for (BatchQuantity batchQuantity : l) {
final int idBatch = batchQuantity.getIdBatch();
if (!rowValsExists.containsKey(idBatch)) {
idBatchsNotExisting.add(idBatch);
} else {
idBatchsExisting.add(idBatch);
}
}
// On retire les lots qui ne sont plus référencés
final Set<Integer> keySet = new HashSet<Integer>(rowValsExists.keySet());
keySet.removeAll(idBatchsExisting);
for (Integer integer : keySet) {
rowValsExists.get(integer).put("ARCHIVE", 1);
}
 
SQLRowValues rowValsToFetch = new SQLRowValues(getTable());
rowValsToFetch.putNulls(getTable().getFieldsName());
final SQLRowValues putRowValues = rowValsToFetch.putRowValues("ID_STOCK");
putRowValues.putNulls("ID_DEPOT_STOCK");
putRowValues.putRowValues("ID_ARTICLE").putNulls("NOM");
final List<SQLRowValues> fetch = SQLRowValuesListFetcher.create(rowValsToFetch).fetch(Where.inValues(getTable().getKey(), idBatchsNotExisting));
Map<Integer, SQLRowValues> mapLot = new HashMap<>();
for (SQLRowValues sqlRowValues : fetch) {
mapLot.put(sqlRowValues.getID(), sqlRowValues);
}
 
List<SQLRowValues> items = new ArrayList<>();
for (BatchQuantity batchQuantity : l) {
final int idBatch = batchQuantity.getIdBatch();
final BigDecimal quantity = batchQuantity.getQuantity();
final SQLRowValues rowVals;
if (rowValsExists.containsKey(idBatch)) {
rowVals = rowValsExists.get(idBatch);
} else {
rowVals = new SQLRowValues(getTable().getTable("LOT_LIVRAISON"));
final SQLRowValues rLot = mapLot.get(idBatch);
final SQLRowAccessor foreignStock = rLot.getForeign("ID_STOCK");
final SQLRowAccessor foreignArticle = foreignStock.getForeign("ID_ARTICLE");
rowVals.put("ARTICLE", foreignArticle.getString("NOM"));
rowVals.put("ID_ARTICLE", foreignArticle.getID());
rowVals.put("ID_BON_DE_LIVRAISON_ELEMENT", refBLRowItem);
rowVals.put("ID_DEPOT_STOCK", foreignStock.getForeignID("ID_DEPOT_STOCK"));
rowVals.put("ID_LOT", idBatch);
rowVals.put("NUMERO_LOT", rLot.getObject("NUMERO_LOT"));
rowVals.put("DLC", rLot.getObject("DLC"));
rowVals.put("DLUO", rLot.getObject("DLUO"));
rowVals.put("NUMERO_SERIE", rLot.getObject("NUMERO_SERIE"));
}
rowVals.put("QUANTITE", quantity);
items.add(rowVals);
}
return items;
}
 
public List<BatchQuantity> createBatchQuantity(List<SQLRowValues> lotLivraisonItems) throws SQLException {
 
final List<Integer> findOrCreateLot = findOrCreateLot(lotLivraisonItems);
List<BatchQuantity> l = new ArrayList<>();
for (int index = 0; index < findOrCreateLot.size(); index++) {
final Integer idLot = findOrCreateLot.get(index);
final SQLRowValues lotItem = lotLivraisonItems.get(index);
l.add(new BatchQuantity(idLot, lotItem.getBigDecimal("QUANTITE"), BigDecimal.ZERO));
}
return l;
}
 
public void updateLotQuantiteFromBRItems(List<SQLRowValues> rowValuesBRItems) throws SQLException {
 
updateLotQuantiteFromLotItems(fetchLotItem(SQLRow.getIDs(rowValuesBRItems), TypeLot.RECEPTION), TypeLot.RECEPTION);
 
}
 
public void removeLotQuantiteFromBR(List<SQLRowValues> rowValuesBR) throws SQLException {
 
removeLotQuantiteFromLotItems(fetchLotItemsFromBonItems(SQLRow.getIDs(rowValuesBR), TypeLot.RECEPTION), TypeLot.RECEPTION);
 
}
 
public void removeLotQuantiteFromBR(Collection<Integer> idsBR) throws SQLException {
 
removeLotQuantiteFromLotItems(fetchLotItemsFromBonItems(idsBR, TypeLot.RECEPTION), TypeLot.RECEPTION);
 
}
 
public void updateLotQuantiteFromBLItems(List<SQLRowValues> rowValuesBLItems) throws SQLException {
 
updateLotQuantiteFromLotItems(fetchLotItem(SQLRow.getIDs(rowValuesBLItems), TypeLot.LIVRAISON), TypeLot.LIVRAISON);
 
}
 
public void removeLotQuantiteFromBL(List<SQLRowValues> rowValuesBL) throws SQLException {
 
removeLotQuantiteFromLotItems(fetchLotItemsFromBonItems(SQLRow.getIDs(rowValuesBL), TypeLot.LIVRAISON), TypeLot.LIVRAISON);
 
}
 
public void removeLotQuantiteFromBL(Collection<Integer> idsBL) throws SQLException {
 
removeLotQuantiteFromLotItems(fetchLotItemsFromBonItems(idsBL, TypeLot.LIVRAISON), TypeLot.LIVRAISON);
 
}
 
public enum TypeLot {
RECEPTION("LOT_RECEPTION", "BON_RECEPTION_ELEMENT", "BON_RECEPTION"), LIVRAISON("LOT_LIVRAISON", "BON_DE_LIVRAISON_ELEMENT", "BON_DE_LIVRAISON");
 
private final String tableLot, tableItems, tableRootItems;
 
private TypeLot(String tableLot, String tableItems, String tableRootItems) {
this.tableLot = tableLot;
this.tableItems = tableItems;
this.tableRootItems = tableRootItems;
}
 
public String getTableItems() {
return tableItems;
}
 
public String getTableLot() {
return tableLot;
}
 
public String getTableRootItems() {
return tableRootItems;
}
};
 
/**
* Récupération des lignes de lotReception/LotLivraison depuis une liste de br/bl items
*
* @param idsBRItem
* @return
* @throws SQLException
*/
public List<SQLRowValues> fetchLotItem(Collection<Number> idsBRorBLItem, TypeLot type) throws SQLException {
 
final SQLTable brItemTable = getTable().getTable(type.getTableItems());
SQLRowValues rowValsBRItem = new SQLRowValues(brItemTable);
rowValsBRItem.putRowValues("ID_ARTICLE").putNulls("ID_DEPOT_STOCK");
rowValsBRItem.putNulls("ID_DEPOT_STOCK");
final SQLTable lotReceipttable = getTable().getTable(type.getTableLot());
SQLRowValues rowValsLotReceipt = new SQLRowValues(lotReceipttable);
rowValsLotReceipt.putNulls("DLC", "DLUO", "QUANTITE", "NUMERO_SERIE", "NUMERO_LOT", "ID_ARTICLE", "ID_DEPOT_STOCK", "ID_LOT").put("ID_" + type.getTableItems(), rowValsBRItem);
final SQLRowValuesListFetcher fetcher = SQLRowValuesListFetcher.create(rowValsLotReceipt);
fetcher.setSelTransf(new ITransformer<SQLSelect, SQLSelect>() {
@Override
public SQLSelect transformChecked(SQLSelect input) {
final SQLSelectJoin join = input.getJoin(lotReceipttable.getField("ID_" + type.getTableItems()));
input.setWhere(Where.inValues(join.getJoinedTable().getKey(), idsBRorBLItem));
return input;
}
});
 
return fetcher.fetch();
 
}
 
/**
* Récupération des lignes de lotReception depuis une liste de br
*
* @param idsBRItem
* @return
* @throws SQLException
*/
public List<SQLRowValues> fetchLotItemsFromBonItems(Collection<? extends Number> idsBRorBL, TypeLot type) throws SQLException {
 
final SQLTable brItemTable = getTable().getTable(type.getTableItems());
SQLRowValues rowValsBRItem = new SQLRowValues(brItemTable);
rowValsBRItem.putRowValues("ID_ARTICLE").putNulls("ID_DEPOT_STOCK");
rowValsBRItem.putNulls("ID_DEPOT_STOCK");
final SQLTable lotReceipttable = getTable().getTable(type.getTableLot());
SQLRowValues rowValsLotReceipt = new SQLRowValues(lotReceipttable);
rowValsLotReceipt.putNulls("DLC", "DLUO", "QUANTITE", "NUMERO_SERIE", "NUMERO_LOT", "ID_LOT", "ID_ARTICLE", "ID_DEPOT_STOCK").put("ID_" + type.getTableItems(), rowValsBRItem);
final SQLRowValuesListFetcher fetcher = SQLRowValuesListFetcher.create(rowValsLotReceipt);
fetcher.setSelTransf(new ITransformer<SQLSelect, SQLSelect>() {
@Override
public SQLSelect transformChecked(SQLSelect input) {
final SQLSelectJoin join = input.getJoin(lotReceipttable.getField("ID_" + type.getTableItems()));
input.setWhere(Where.inValues(join.getJoinedTable().getField("ID_" + type.getTableRootItems()), idsBRorBL));
return input;
}
});
 
return fetcher.fetch();
 
}
 
public void stock(ProductComponent comp) {
comp.getStock();
}
 
@Override
protected String createCode() {
return createCodeOfPackage() + ".batch";
}
 
class LotKey {
private final Integer idArticle, idDepot;
private final String serie, lot;
 
public LotKey(final Integer idArticle, final Integer idDepot, final String serie, final String lot) {
 
this.idArticle = idArticle;
this.idDepot = idDepot;
this.serie = serie;
this.lot = lot;
}
 
@Override
public int hashCode() {
return this.idArticle.hashCode() ^ this.idDepot.hashCode() ^ this.serie.hashCode() ^ this.lot.hashCode();
}
 
@Override
public boolean equals(Object obj) {
 
return obj instanceof LotKey && ((LotKey) obj).idArticle.equals(idArticle) && ((LotKey) obj).idDepot.equals(idDepot) && ((LotKey) obj).serie.equals(serie)
&& ((LotKey) obj).lot.equals(lot);
}
}
}
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/product/element/ReferenceArticleSQLElement.java
23,13 → 23,11
import org.openconcerto.erp.core.reports.history.ui.HistoriqueArticleFrame;
import org.openconcerto.erp.core.sales.product.action.InitializeStockPanel;
import org.openconcerto.erp.core.sales.product.action.InventairePanel;
import org.openconcerto.erp.core.sales.product.action.TransfertStockFromArticlePanel;
import org.openconcerto.erp.core.sales.product.component.ReferenceArticleSQLComponent;
import org.openconcerto.erp.core.sales.product.model.ProductComponent;
import org.openconcerto.erp.core.supplychain.stock.action.ListeDesMouvementsStockAction;
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.StockConsultPanel;
import org.openconcerto.erp.core.supplychain.stock.element.StockItem;
import org.openconcerto.erp.core.supplychain.stock.element.StockItem.TypeStockMouvement;
import org.openconcerto.erp.generationDoc.gestcomm.FicheArticleXmlSheet;
48,7 → 46,6
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.Where;
90,10 → 87,8
import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
 
import javax.swing.AbstractAction;
111,7 → 106,6
public static final int AU_POID_METRECARRE = 4;
public static final int A_LA_PIECE = 5;
public static final int AU_METRE_LARGEUR = 6;
public static final int AU_KILO = 7;
private static final int PRIX_HA = 1;
private static final int PRIX_VT = 2;
protected PredicateRowAction stock;
175,47 → 169,7
}
}, true, false).setPredicate(ListEvent.getNonEmptySelectionPredicate());
getRowActions().add(actionConvVirtuel);
 
RowAction actionTransfert = new RowAction(new AbstractAction("Transfert de stock") {
 
@Override
public void actionPerformed(ActionEvent e) {
 
final SQLRowAccessor selectedRowAccessor = IListe.get(e).getSelectedRowAccessor().fetchNewRow(false);
PanelFrame frame = new PanelFrame(new TransfertStockFromArticlePanel(ComptaPropsConfiguration.getInstance(), selectedRowAccessor, null), "Transfert de stock");
FrameUtil.showPacked(frame);
frame.setLocationRelativeTo(IListe.get(e));
}
}, true, false) {
 
@Override
public boolean enabledFor(ListEvent evt) {
return evt.getSelectedRowAccessors().size() == 1 && evt.getSelectedRowAccessors().get(0).getBoolean("GESTION_STOCK");
}
};
getRowActions().add(actionTransfert);
 
RowAction actionStockShow = new RowAction(new AbstractAction("Consulter le stock") {
 
@Override
public void actionPerformed(ActionEvent e) {
 
final StockConsultPanel p = new StockConsultPanel(ReferenceArticleSQLElement.this, IListe.get(e).getSelectedRowAccessor());
// p.load(IListe.get(e).getSelectedRowAccessor());
PanelFrame frame = new PanelFrame(p, "Consultation du stock");
FrameUtil.showPacked(frame);
frame.setLocationRelativeTo(IListe.get(e));
}
}, true, false) {
 
@Override
public boolean enabledFor(ListEvent evt) {
return evt.getSelectedRowAccessors().size() == 1 && evt.getSelectedRowAccessors().get(0).getBoolean("GESTION_STOCK");
}
};
getRowActions().add(actionStockShow);
 
}
if (prefs.getBoolean(GestionArticleGlobalPreferencePanel.ACTIVER_DECLINAISON, false)) {
 
RowAction actionConvVirtuel = new RowAction(new AbstractAction("Convertir en article virtuel") {
232,13 → 186,11
 
}
}, true, false) {
 
@Override
public boolean enabledFor(ListEvent evt) {
final List<? extends SQLRowAccessor> selection = evt.getSelectedRowAccessors();
if (selection.size() == 1) {
return !selection.get(0).getBoolean("VIRTUEL") && selection.get(0).isForeignEmpty("ID_ARTICLE_VIRTUEL_PERE");
 
}
return false;
}
266,7 → 218,6
 
}
}, true, false) {
 
@Override
public boolean enabledFor(ListEvent evt) {
final List<? extends SQLRowAccessor> selection = evt.getSelectedRowAccessors();
301,7 → 252,6
 
}
}, false, true) {
 
@Override
public boolean enabledFor(ListEvent evt) {
final List<? extends SQLRowAccessor> selection = evt.getSelectedRowAccessors();
314,7 → 264,6
getRowActions().add(actionCreateDecls);
 
}
 
PredicateRowAction history = new PredicateRowAction(new AbstractAction("Historique") {
 
@Override
338,6 → 287,7
mvtStock.setPredicate(IListeEvent.getSingleSelectionPredicate());
getRowActions().add(mvtStock);
 
if (ComptaPropsConfiguration.getInstanceCompta().isExperimental()) {
PredicateRowAction batches = new PredicateRowAction(new AbstractAction("Lots et numéros de série") {
@Override
public void actionPerformed(ActionEvent e) {
347,7 → 297,7
}, false, true);
batches.setPredicate(IListeEvent.getSingleSelectionPredicate());
getRowActions().add(batches);
 
}
PredicateRowAction clone = new PredicateRowAction(new AbstractAction("Dupliquer") {
 
@Override
448,9 → 398,6
@Override
protected Object show_(SQLRowAccessor r) {
 
if (!r.getBoolean("GESTION_STOCK")) {
return null;
}
BigDecimal totalQte = BigDecimal.ZERO;
 
Collection<? extends SQLRowAccessor> stockElt = r.getReferentRows(getTable().getTable("STOCK").getField("ID_ARTICLE"));
463,10 → 410,9
 
@Override
public Set<FieldPath> getPaths() {
final Path p = new Path(getTable());
Path p2 = p.add(getTable().getTable("STOCK").getField("ID_ARTICLE"));
Path p2 = new Path(getTable()).add(getTable().getTable("STOCK").getField("ID_ARTICLE"));
 
return CollectionUtils.createSet(new FieldPath(p, "GESTION_STOCK"), new FieldPath(p2, "QTE_REEL"));
return CollectionUtils.createSet(new FieldPath(p2, "QTE_REEL"));
}
};
colStockGlobal.setRenderer(new NumberCellRenderer());
495,7 → 441,6
p = p.add(getTable().getTable("ARTICLE_ELEMENT").getField("ID_ARTICLE_PARENT"));
return CollectionUtils.createSet(new FieldPath(p, "QTE"));
}
 
});
}
}
543,10 → 488,10
l.add("POIDS");
l.add("SKU");
 
if (!prefs.getBoolean(GestionArticleGlobalPreferencePanel.STOCK_MULTI_DEPOT, false)) {
// if (!prefs.getBoolean(GestionArticleGlobalPreferencePanel.STOCK_MULTI_DEPOT, false)) {
l.add("GESTION_STOCK");
l.add("ID_STOCK");
}
// }
String val = DefaultNXProps.getInstance().getStringProperty("ArticleService");
Boolean b = Boolean.valueOf(val);
if (b != null && b.booleanValue()) {
1050,19 → 995,4
return mvtStockQuery;
}
 
/**
* Article qui ont comme code les codes fournis en paramètre,
*/
public Map<String, SQLRowAccessor> findArticleFromCode(List<String> codes) {
final SQLRowValues rv = new SQLRowValues(getTable());
rv.setAllToNull();
final SQLRowValuesListFetcher fetcher = SQLRowValuesListFetcher.create(rv);
final List<SQLRowValues> list = fetcher.fetch(Where.inValues(getTable().getField("CODE"), codes));
final Map<String, SQLRowAccessor> result = new HashMap<>(list.size());
for (SQLRowValues r : list) {
result.put(r.getString("CODE"), r);
}
return result;
}
 
}
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/product/action/TransfertStockFromArticlePanel.java
File deleted
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/product/action/TransfertStockPanel.java
17,8 → 17,6
import org.openconcerto.erp.core.sales.product.element.ReferenceArticleSQLElement;
import org.openconcerto.sql.Configuration;
import org.openconcerto.sql.element.SQLElement;
import org.openconcerto.sql.model.Where;
import org.openconcerto.sql.request.ComboSQLRequest;
import org.openconcerto.sql.sqlobject.SQLRequestComboBox;
import org.openconcerto.ui.DefaultGridBagConstraints;
import org.openconcerto.ui.JDate;
55,11 → 53,8
final ReferenceArticleSQLElement articleElt = instance.getDirectory().getElement(ReferenceArticleSQLElement.class);
 
final SQLRequestComboBox comboArticle = new SQLRequestComboBox();
comboArticle.uiInit(articleElt.createComboRequest());
 
final ComboSQLRequest createComboRequest = articleElt.createComboRequest();
createComboRequest.putWhere("obsolete", new Where(articleElt.getTable().getField("OBSOLETE"), "=", Boolean.FALSE));
comboArticle.uiInit(createComboRequest);
 
final SQLElement stockElt = instance.getDirectory().getElement("DEPOT_STOCK");
final SQLRequestComboBox comboStockDepart = new SQLRequestComboBox();
comboStockDepart.uiInit(stockElt.createComboRequest());
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/product/ui/DeliveryNoteQtyRowValuesRenderer.java
File deleted
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/product/ui/QtyRowValuesRenderer.java
File deleted
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/product/ui/ListeDesArticlesFrame.java
15,7 → 15,6
 
import org.openconcerto.erp.config.Log;
import org.openconcerto.erp.core.common.element.ComptaSQLConfElement;
import org.openconcerto.erp.core.common.ui.IListTotalPanel;
import org.openconcerto.erp.core.sales.product.element.ReferenceArticleSQLElement;
import org.openconcerto.erp.panel.ITreeSelection;
import org.openconcerto.erp.preferences.GestionArticleGlobalPreferencePanel;
43,7 → 42,6
import org.openconcerto.ui.PanelFrame;
import org.openconcerto.utils.CollectionUtils;
import org.openconcerto.utils.DecimalUtils;
import org.openconcerto.utils.Tuple2;
 
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
214,20 → 212,6
panelMode.setBorder(BorderFactory.createTitledBorder("Vue"));
panel.add(panelMode, c2);
}
 
SQLTableModelColumn colStock = null;
for (SQLTableModelColumn col : panel.getListe().getSource().getColumns()) {
if (col.getName().equalsIgnoreCase("Valeur HT du stock")) {
colStock = col;
}
}
if (colStock != null) {
List<Tuple2<? extends SQLTableModelColumn, IListTotalPanel.Type>> fields = new ArrayList<Tuple2<? extends SQLTableModelColumn, IListTotalPanel.Type>>(1);
fields.add(Tuple2.create(colStock, IListTotalPanel.Type.SOMME));
IListTotalPanel total = new IListTotalPanel(panel.getListe(), fields, null, "Total");
c2.gridy++;
panel.add(total, c2);
}
JSplitPane pane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, new JScrollPane(panelFam), panel);
JPanel panelAll = new JPanel(new GridBagLayout());
GridBagConstraints c = new DefaultGridBagConstraints();
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/product/ui/DeliveredQtyRowValuesRenderer.java
New file
0,0 → 1,97
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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.product.ui;
 
import org.openconcerto.erp.core.common.ui.DeviseNiceTableCellRenderer;
import org.openconcerto.sql.model.SQLRowValues;
import org.openconcerto.sql.view.list.RowValuesTable;
import org.openconcerto.sql.view.list.RowValuesTableModel;
import org.openconcerto.ui.table.AlternateTableCellRenderer;
import org.openconcerto.ui.table.XTableColumnModel;
import org.openconcerto.utils.CollectionUtils;
 
import java.awt.Color;
import java.awt.Component;
 
import javax.swing.JLabel;
import javax.swing.JTable;
import javax.swing.SwingConstants;
 
public class DeliveredQtyRowValuesRenderer extends DeviseNiceTableCellRenderer {
 
// Red
public static final Color red = new Color(255, 31, 52);
public static final Color redLightGrey = new Color(240, 65, 85);
 
// Orange
public final static Color orange = new Color(243, 125, 75);
public final static Color orangeGrey = new Color(222, 107, 47);
 
// Blue
public final static Color light = new Color(232, 238, 250);
public final static Color lightGrey = new Color(211, 220, 222);
 
// Black
public final static Color lightBlack = new Color(192, 192, 192);
public final static Color lightBlackGrey = new Color(155, 155, 155);
 
private final boolean customer;
 
public DeliveredQtyRowValuesRenderer() {
this(true);
}
 
public DeliveredQtyRowValuesRenderer(boolean customer) {
AlternateTableCellRenderer.setBGColorMap(this, CollectionUtils.createMap(lightBlack, lightBlackGrey, red, redLightGrey, orange, orangeGrey));
this.customer = customer;
}
 
@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
 
Component comp = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
 
if (table instanceof RowValuesTable) {
 
((JLabel) comp).setHorizontalAlignment(SwingConstants.RIGHT);
RowValuesTable rowValuesTable = (RowValuesTable) table;
XTableColumnModel columnModel = rowValuesTable.getColumnModel();
RowValuesTableModel model = rowValuesTable.getRowValuesTableModel();
boolean qteALivrerVisible = columnModel.isColumnVisible(columnModel.getColumnByModelIndex(model.getColumnForField("QTE_A_LIVRER")));
if (qteALivrerVisible) {
SQLRowValues rowVals = model.getRowValuesAt(row);
 
Number qte;
Number qteL;
if (this.customer) {
qte = (Number) rowVals.getObject("QTE");
qteL = (Number) rowVals.getObject("QTE_LIVREE");
} else {
qte = (Number) rowVals.getObject("QTE_ORIGINE");
qteL = (Number) rowVals.getObject("QTE");
}
if (qte != null && qteL != null) {
if (qte.intValue() < qteL.intValue()) {
comp.setBackground(red);
} else if (qteL.intValue() <= 0) {
comp.setBackground(lightBlack);
} else if (qteL.intValue() != qte.intValue()) {
comp.setBackground(orange);
}
}
}
}
return comp;
}
}
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/product/model/BatchQuantity.java
File deleted
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/product/component/BatchSelectorFrame.java
File deleted
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/product/component/batch_error.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/product/component/batch.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/product/component/ReferenceArticleSQLComponent.java
925,22 → 925,18
c.gridx = 1;
c.weightx = 1;
JCheckBox DLCrequis = new JCheckBox("DLC requis");
DLCrequis.setOpaque(false);
panel.add(DLCrequis, c);
addView(DLCrequis, "DLC_REQUIS");
c.gridy++;
JCheckBox DLUOrequis = new JCheckBox("DLUO requis");
DLUOrequis.setOpaque(false);
panel.add(DLUOrequis, c);
addView(DLUOrequis, "DLUO_REQUIS");
c.gridy++;
JCheckBox numeroLotRequis = new JCheckBox("n° de lot requis");
numeroLotRequis.setOpaque(false);
panel.add(numeroLotRequis, c);
addView(numeroLotRequis, "NUMERO_LOT_REQUIS");
c.gridy++;
JCheckBox numeroSerieRequis = new JCheckBox("n° de série requis");
numeroSerieRequis.setOpaque(false);
panel.add(numeroSerieRequis, c);
addView(numeroSerieRequis, "NUMERO_SERIE_REQUIS");
 
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/pos/ui/StockErrorPanel.java
35,7 → 35,6
import java.util.Map;
 
import javax.swing.JPanel;
import javax.swing.SwingUtilities;
 
public class StockErrorPanel extends JPanel {
private final CaisseControler controller;
81,25 → 80,24
final SQLSelect select = new SQLSelect();
select.addSelect(tDepot.getField("ID"));
select.addSelect(tDepot.getField("NOM"));
int nbChoice = 0;
for (final SQLRow rowDepotDepart : SQLRowListRSH.execute(select)) {
final int idDepotDepart = rowDepotDepart.getInt("ID");
final String nomDepotDepart = rowDepotDepart.getString("NOM");
for (final SQLRow rowDepotArrivee : SQLRowListRSH.execute(select)) {
final int idDepotSource = rowDepotArrivee.getInt("ID");
final String nomDepot = rowDepotArrivee.getString("NOM");
final int idDepotIDestination = caisseFrame.getPOSConf().getDepotID();
if (idDepotDepart != idDepotIDestination) {
POSButton b = new POSButton("Créer un mouvement de stock depuis le dépôt " + nomDepotDepart);
if (idDepotSource != idDepotIDestination) {
POSButton b = new POSButton("Créer un mouvement de stock depuis le dépôt " + nomDepot);
b.addActionListener(new ActionListener() {
 
@Override
public void actionPerformed(ActionEvent ev) {
System.err.println("StockErrorPanel.StockErrorPanel(...) mouvement de stock");
final SQLRow selectedRowDepotArrivee = tDepot.getRow(idDepotIDestination);
final SQLRow selectedRowDepotDepart = tDepot.getRow(idDepotSource);
final Date date = new Date();
for (Map.Entry<TicketItem, Integer> e : missingQty.entrySet()) {
final int idArticle = e.getKey().getArticle().getId();
final BigDecimal qteReel = new BigDecimal(e.getValue());
final SQLRow selectedRowArticle = tArticle.getRow(idArticle);
dir.getElement(MouvementStockSQLElement.class).transfertStock(qteReel, date, selectedRowArticle, rowDepotDepart, selectedRowDepotArrivee, "transfert depuis caisse");
dir.getElement(MouvementStockSQLElement.class).transfertStock(qteReel, date, selectedRowArticle, selectedRowDepotDepart, rowDepotArrivee, "transfert depuis caisse");
}
caisseFrame.showCaisse();
runnable.run();
107,21 → 105,21
});
c.gridy++;
this.add(b, c);
nbChoice++;
}
}
if (nbChoice == 0) {
SwingUtilities.invokeLater(new Runnable() {
POSButton b = new POSButton("Ignorer le problème de stock");
b.addActionListener(new ActionListener() {
 
@Override
public void run() {
public void actionPerformed(ActionEvent e) {
System.err.println("StockErrorPanel.StockErrorPanel(...) ignore stock");
caisseFrame.showCaisse();
runnable.run();
 
}
});
 
} else {
 
c.gridy++;
this.add(b, c);
POSButton b2 = new POSButton("Annuler la validation du ticket");
b2.addActionListener(new ActionListener() {
 
135,6 → 133,5
c.gridy++;
this.add(b2, c);
}
}
 
}
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/pos/ui/CaisseControler.java
14,8 → 14,6
package org.openconcerto.erp.core.sales.pos.ui;
 
import org.openconcerto.erp.core.sales.pos.POSConfiguration;
import org.openconcerto.erp.core.sales.pos.io.Barcode;
import org.openconcerto.erp.core.sales.pos.io.BarcodeListener;
import org.openconcerto.erp.core.sales.pos.io.BarcodeReader;
import org.openconcerto.erp.core.sales.pos.io.ESCSerialDisplay;
import org.openconcerto.erp.core.sales.pos.io.TicketPrinter;
253,8 → 251,7
}
 
@Override
public void barcodeRead(Barcode barcode) {
String code = barcode.getData();
public void barcodeRead(String code) {
System.err.println("CaisseControler.barcodeRead() barcode : " + code);
if (code.equalsIgnoreCase("especes")) {
autoFillPaiement(this.p1);
471,6 → 468,8
return (!this.t.getItems().isEmpty()) && ((this.getTotal() >= 0 && this.getPaidTotal() >= this.getTotal()) || (this.getTotal() < 0 && this.getPaidTotal() == this.getTotal()));
}
 
 
public void setTicketItemSelected(TicketItem item) {
this.ticketItemSelected = item;
if (item == null) {
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/pos/ui/TicketClientNamePanel.java
25,7 → 25,6
import java.awt.event.ActionListener;
import java.util.Collections;
 
import javax.swing.JButton;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
68,11 → 67,9
tAdresse.setText(ticket.getClient().getAddr());
this.add(new JScrollPane(tAdresse), c);
c.gridy++;
final JButton b;
// Textfield
POSButton b = new POSButton("Imprimer");
c.fill = GridBagConstraints.NONE;
// Textfield
if (caisseFrame != null) {
b = new POSButton("Imprimer");
b.addActionListener(new ActionListener() {
 
@Override
81,23 → 78,9
ticket.getClient().setAdresse(tAdresse.getText());
printInvoice(ticket);
caisseFrame.showCaisse();
}
});
} else {
b = new JButton("Imprimer");
c.fill = GridBagConstraints.NONE;
b.addActionListener(new ActionListener() {
 
@Override
public void actionPerformed(ActionEvent e) {
ticket.getClient().setFullName(text.getText());
ticket.getClient().setAdresse(tAdresse.getText());
printInvoice(ticket);
SwingUtilities.getWindowAncestor(TicketClientNamePanel.this).dispose();
 
}
});
}
c.gridy++;
this.add(b, c);
}
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/pos/ui/BarcodeListener.java
New file
0,0 → 1,22
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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.pos.ui;
 
import java.awt.event.KeyEvent;
 
public interface BarcodeListener {
void barcodeRead(String code);
 
void keyReceived(KeyEvent ee);
}
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/pos/ui/TicketCellRenderer.java
17,7 → 17,6
import org.openconcerto.erp.core.sales.pos.model.TicketItem;
import org.openconcerto.ui.touch.ScrollableList;
import org.openconcerto.utils.QuickOrderedMap;
import org.openconcerto.utils.Tuple2;
 
import java.awt.Color;
import java.awt.Component;
113,12 → 112,12
if (s2.length() > maxLength) {
s2 = s2.substring(0, maxLength + 1) + '…';
}
QuickOrderedMap<String, Tuple2<String, BigDecimal>> decls = article.getDeclinaisons();
QuickOrderedMap<String, String> decls = article.getDeclinaisons();
String textDeclinaisons = null;
if (decls != null && !decls.isEmpty()) {
StringBuilder declinaisons = new StringBuilder();
for (int i = 0; i < decls.size(); i++) {
declinaisons.append(decls.getValue(i).get0());
declinaisons.append(decls.getValue(i));
declinaisons.append(" ");
}
 
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/pos/ui/PaiementPanel.java
13,8 → 13,6
package org.openconcerto.erp.core.sales.pos.ui;
 
import org.openconcerto.erp.core.sales.pos.io.Barcode;
import org.openconcerto.erp.core.sales.pos.io.BarcodeListener;
import org.openconcerto.erp.core.sales.pos.model.Article;
import org.openconcerto.erp.core.sales.pos.model.Paiement;
import org.openconcerto.erp.core.sales.pos.model.TicketItem;
549,7 → 547,7
}
 
@Override
public void barcodeRead(Barcode code) {
public void barcodeRead(String code) {
// Nothing to do here
}
 
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/pos/ui/ArticleSelector.java
18,7 → 18,6
import org.openconcerto.ui.touch.ScrollableList;
import org.openconcerto.utils.QuickOrderedMap;
import org.openconcerto.utils.StringUtils;
import org.openconcerto.utils.Tuple2;
 
import java.awt.Color;
import java.awt.FlowLayout;
215,14 → 214,13
label += " [" + article.getCode() + "]";
}
StringBuilder declinaisons = null;
QuickOrderedMap<String, Tuple2<String, BigDecimal>> decls = article.getDeclinaisons();
QuickOrderedMap<String, String> decls = article.getDeclinaisons();
if (decls != null && !decls.isEmpty()) {
declinaisons = new StringBuilder();
for (int i = 0; i < decls.size(); i++) {
declinaisons.append(StringUtils.firstUpThenLow(decls.getKey(i)));
declinaisons.append(": ");
final Tuple2<String, BigDecimal> value = decls.getValue(i);
declinaisons.append(value.get0());
declinaisons.append(decls.getValue(i));
declinaisons.append(" ");
}
}
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/pos/ui/CaissePanel.java
36,7 → 36,6
import org.openconcerto.utils.ExceptionHandler;
import org.openconcerto.utils.FileUtils;
import org.openconcerto.utils.StringUtils;
import org.openconcerto.utils.Tuple2;
import org.openconcerto.utils.cc.ITransformer;
 
import java.awt.Color;
223,8 → 222,7
Map<TicketItem, Integer> missingQty = new HashMap<>();
for (SQLRow row : SQLRowListRSH.execute(selStock)) {
int idArticle = row.getInt("ID_ARTICLE");
// Limite pour ne pas fixer les stock négatif et corrompre le stock principal
int qte = Math.max(0, (int) Math.round(row.getFloat("QTE_REEL")));
int qte = (int) Math.round(row.getFloat("QTE_REEL"));
TicketItem item = mapTicketItem.get(idArticle);
if (item == null) {
System.err.println("Pas d'entrée dans STOCK pour l'article " + idArticle);
320,8 → 318,8
final SQLSelect selArticle = new SQLSelect();
final SQLTable tableArticle = eltArticle.getTable();
selArticle.addAllSelect(tableArticle.getFields(VirtualFields.PRIMARY_KEY.union(VirtualFields.ARCHIVE)));
selArticle.addAllSelect(tableArticle, Arrays.asList("ID_ARTICLE_VIRTUEL_PERE", "ID_FAMILLE_ARTICLE", "NOM", "CODE", "CODE_BARRE", "ID_TAXE", "PV_HT", "PV_TTC", "ADDITIONAL_TICKET_COPY",
"ID_UNITE_VENTE", "ID_ECO_CONTRIBUTION"));
selArticle.addAllSelect(tableArticle,
Arrays.asList("ID_FAMILLE_ARTICLE", "NOM", "CODE", "CODE_BARRE", "ID_TAXE", "PV_HT", "PV_TTC", "ADDITIONAL_TICKET_COPY", "ID_UNITE_VENTE", "ID_ECO_CONTRIBUTION"));
selArticle.setWhere(new Where(tableArticle.getField("OBSOLETE"), "=", Boolean.FALSE).and(new Where(tableArticle.getField("MASQUE_CAISSE"), "=", Boolean.FALSE)));
selArticle.andWhere(new Where(tableArticle.getField("VIRTUEL"), "=", Boolean.FALSE));
 
335,15 → 333,6
}
}
 
final SQLSelect selArtVirt = new SQLSelect();
selArtVirt.addSelect(tableArticle.getKey());
selArtVirt.addSelect(tableArticle.getField("NOM"));
 
Map<Integer, String> mapVirtuel = new HashMap<>();
for (SQLRow row : SQLRowListRSH.execute(selArtVirt)) {
mapVirtuel.put(row.getID(), row.getString("NOM"));
}
 
final Categorie cUnclassified = new Categorie("Non classés", true);
cUnclassified.setUnknown();
 
350,17 → 339,16
// Fetch des declinaisons :
// "ID_ARTICLE_DECLINAISON_COULEUR" : { {3 , "noir"] } ,
// "ID_ARTICLE_DECLINAISON_TAILLE" : { {2 ,"XL"},{3,"XXL"}};
Map<String, Map<Integer, Tuple2<String, BigDecimal>>> mapDeclinaisons = new HashMap<>();
Map<String, Map<Integer, String>> mapDeclinaisons = new HashMap<>();
for (String table : tablesDeclinaisons) {
SQLTable t = eltArticle.getTable().getTable(table);
final SQLSelect selDecl = new SQLSelect();
selDecl.addSelect(t.getKey());
selDecl.addSelect(t.getField("NOM"));
selDecl.addSelect(t.getField("ORDRE"));
Map<Integer, Tuple2<String, BigDecimal>> m = new HashMap<>();
Map<Integer, String> m = new HashMap<>();
mapDeclinaisons.put("ID_" + table, m);
for (SQLRow row : SQLRowListRSH.execute(selDecl)) {
m.put(row.getID(), Tuple2.create(row.getString("NOM"), row.getBigDecimal("ORDRE")));
m.put(row.getID(), row.getString("NOM"));
}
}
// Fetch des articles
396,7 → 384,7
Map<Integer, List<TarifQuantite>> mapTarif = new HashMap<>();
System.err.println("CaissePanel.loadArticles()" + rPromotions.size() + " promotions");
for (SQLRowValues r : rPromotions) {
final Integer foreignID = r.getForeignID("ID_ARTICLE");
final Integer foreignID = ((Integer) r.getObjectNoCheck("ID_ARTICLE"));
List<TarifQuantite> list = mapTarif.get(foreignID);
if (list == null) {
list = new ArrayList<>();
454,15 → 442,11
for (String f : declinaisonsFieldNames) {
Integer idArtDeclinaison = (Integer) row.getObjectNoCheck(f);
if (idArtDeclinaison != null && idArtDeclinaison > 1) {
Map<Integer, Tuple2<String, BigDecimal>> mm = mapDeclinaisons.get(f);
Map<Integer, String> mm = mapDeclinaisons.get(f);
if (mm != null) {
Tuple2<String, BigDecimal> v = mm.get(idArtDeclinaison);
a.addDeclinaison(f.substring("ID_ARTICLE_DECLINAISON_".length()), v.get0(), v.get1());
String v = mm.get(idArtDeclinaison);
a.addDeclinaison(f.substring("ID_ARTICLE_DECLINAISON_".length()), v);
}
// Integer pere = (Integer) row.getObjectNoCheck("ID_ARTICLE_VIRTUEL_PERE");
// if (pere != null && mapVirtuel.containsKey(pere)) {
// a.setArticlePereNom(mapVirtuel.get(pere));
// }
}
}
 
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/pos/model/Categorie.java
13,10 → 13,6
package org.openconcerto.erp.core.sales.pos.model;
 
import org.openconcerto.utils.QuickOrderedMap;
import org.openconcerto.utils.Tuple2;
 
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
107,29 → 103,9
Collections.sort(result, new Comparator<Article>() {
@Override
public int compare(Article o1, Article o2) {
final boolean isChild = o1.getArticlePereNom() != null && o2.getArticlePereNom() != null && o1.getArticlePereNom().trim().length() > 0
&& o1.getArticlePereNom().equals(o2.getArticlePereNom());
final QuickOrderedMap<String, Tuple2<String, BigDecimal>> declinaisons1 = o1.getDeclinaisons();
final QuickOrderedMap<String, Tuple2<String, BigDecimal>> declinaisons2 = o2.getDeclinaisons();
final boolean hasDecl = isChild && declinaisons1 != null && !declinaisons1.isEmpty() && declinaisons2 != null && !declinaisons2.isEmpty();
if (o1.getName().compareTo(o2.getName()) == 0 && hasDecl) {
for (int i = 0; i < declinaisons1.size(); i++) {
final String key = declinaisons1.getKey(i);
final Tuple2<String, BigDecimal> tuple1 = declinaisons1.get(key);
final Tuple2<String, BigDecimal> tuple2 = declinaisons2.get(key);
if (tuple1 != null && tuple2 != null) {
BigDecimal order1 = tuple1.get1();
BigDecimal order2 = tuple2.get1();
if (order1.compareTo(order2) != 0) {
return order1.compareTo(order2);
}
}
}
}
return o1.getName().compareTo(o2.getName());
}
});
 
return result;
}
 
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/pos/model/Article.java
16,7 → 16,6
import org.openconcerto.erp.core.finance.tax.model.TaxeCache;
import org.openconcerto.utils.DecimalUtils;
import org.openconcerto.utils.QuickOrderedMap;
import org.openconcerto.utils.Tuple2;
 
import java.math.BigDecimal;
import java.math.RoundingMode;
43,13 → 42,10
private String salesUnit;
private static Map<String, List<Article>> codes = new HashMap<>();
 
// type de declinaison : nom de la déclinaison et ordre (ex "taille":"45 / 5.5",
// "couleur","rouge / 2.05"), null si pas de declinaison
private QuickOrderedMap<String, Tuple2<String, BigDecimal>> declinaisons;
 
// declinaison (ex "taille":"45", "couleur","rouge"), null si pas de declinaison
private QuickOrderedMap<String, String> declinaisons;
List<TarifQuantite> tarifs;
private String declinaison;
private String articlePereNom = null;
 
public Article(Categorie s1, String string, int id) {
this.s = s1;
72,7 → 68,7
this.ecotaxe = a.ecotaxe;
 
this.s.addArticle(this);
final QuickOrderedMap<String, Tuple2<String, BigDecimal>> decl = a.getDeclinaisons();
final QuickOrderedMap<String, String> decl = a.getDeclinaisons();
if (decl != null) {
final int size = decl.size();
this.declinaisons = new QuickOrderedMap<>(size);
113,25 → 109,17
return result;
}
 
public void addDeclinaison(String key, String value, BigDecimal ordreDeclinaison) {
public void addDeclinaison(String key, String value) {
if (this.declinaisons == null) {
this.declinaisons = new QuickOrderedMap<>(5);
}
this.declinaisons.put(key, Tuple2.create(value, ordreDeclinaison));
this.declinaisons.put(key, value);
}
 
public QuickOrderedMap<String, Tuple2<String, BigDecimal>> getDeclinaisons() {
public QuickOrderedMap<String, String> getDeclinaisons() {
return this.declinaisons;
}
 
public void setArticlePereNom(String articlePereNom) {
this.articlePereNom = articlePereNom;
}
 
public String getArticlePereNom() {
return this.articlePereNom;
}
 
public boolean isPromotion() {
return this.tarifs != null && !this.tarifs.isEmpty();
}
250,8 → 238,7
if (this.declinaisons != null) {
return "Article:" + this.code + " | " + this.name + " " + this.priceTTC + " cents" + "(HT:" + this.priceHT + ") " + getSalesUnit() + " discount:" + getDiscountPct();
}
return "Article:" + this.code + " | " + this.name + " [" + this.declinaisons + "] : " + this.priceTTC + " cents" + "(HT:" + this.priceHT + ") " + getSalesUnit() + " discount:"
+ getDiscountPct();
return "Article:" + this.code + " | " + this.name + " [" + this.declinaisons + "] : " + this.priceTTC + " cents" + "(HT:" + this.priceHT + ") " + getSalesUnit() + " discount:" + getDiscountPct();
}
 
public static List<Article> getArticleFromBarcode(String code) {
320,12 → 307,9
if (this.declinaison == null && this.declinaisons != null && !this.declinaisons.isEmpty()) {
StringBuilder b = new StringBuilder();
for (int i = 0; i < this.declinaisons.size(); i++) {
final Tuple2<String, BigDecimal> value = this.declinaisons.getValue(i);
if (value != null) {
b.append(value.get0());
b.append(this.declinaisons.getValue(i));
b.append(" ");
}
}
 
return b.toString().trim();
}
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/pos/io/Barcode.java
File deleted
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/pos/io/BarcodeListener.java
File deleted
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/pos/io/BarcodeReader.java
13,49 → 13,32
package org.openconcerto.erp.core.sales.pos.io;
 
import org.openconcerto.erp.core.sales.pos.ui.BarcodeListener;
import org.openconcerto.erp.gs1.GS1Util;
import org.openconcerto.ui.DefaultGridBagConstraints;
import org.openconcerto.ui.component.ITextArea;
import org.openconcerto.utils.StringUtils;
 
import java.awt.Color;
import java.awt.Component;
import java.awt.Desktop;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.KeyEventDispatcher;
import java.awt.KeyboardFocusManager;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Timer;
import java.util.TimerTask;
 
import javax.swing.JButton;
import javax.swing.JFileChooser;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JSpinner;
import javax.swing.JTable;
import javax.swing.JTextArea;
import javax.swing.SpinnerNumberModel;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.event.TableModelEvent;
import javax.swing.event.TableModelListener;
import javax.swing.table.DefaultTableCellRenderer;
import javax.swing.table.TableModel;
 
/**
* Lecteur code barres, intercepte les événements clavier pour détecter un scan de code. Le code
64,186 → 47,35
*/
public class BarcodeReader implements KeyEventDispatcher {
 
public class KeyEventTableModel implements TableModel {
public static final String CHAR_UNDEFINED = "CHAR_UNDEFINED";
public static final String KEY_TYPED = "Key Typed";
List<TableModelListener> listeners = new ArrayList<>();
List<KeyEvent> list = new ArrayList<>();
 
private KeyEventTableModel() {
//
}
 
@Override
public int getRowCount() {
return list.size();
}
 
@Override
public int getColumnCount() {
return 4;
}
 
@Override
public String getColumnName(int columnIndex) {
switch (columnIndex) {
case 0:
return "Date";
case 1:
return "ID";
case 2:
return "Code";
case 3:
return "Character";
default:
break;
}
return "?";
}
 
@Override
public Class<?> getColumnClass(int columnIndex) {
if (columnIndex == 0) {
return Date.class;
}
return String.class;
}
 
@Override
public boolean isCellEditable(int rowIndex, int columnIndex) {
return false;
}
 
@Override
public Object getValueAt(int rowIndex, int columnIndex) {
KeyEvent e = list.get(rowIndex);
switch (columnIndex) {
case 0:
return new Date(e.getWhen());
case 1:
int id = e.getID();
if (id == KeyEvent.KEY_TYPED) {
return KEY_TYPED;
}
if (id == KeyEvent.KEY_PRESSED) {
return "Key Pressed";
}
if (id == KeyEvent.KEY_RELEASED) {
return "Key Released";
}
return String.valueOf(id);
case 2:
int code = e.getKeyCode();
String name = "";
if (code == KeyEvent.VK_ENTER) {
name = "ENTER";
} else if (code == KeyEvent.VK_BACK_SPACE) {
name = "BACK SPACE";
} else if (code == KeyEvent.VK_SHIFT) {
name = "SHIFT";
} else if (code >= KeyEvent.VK_0 && code <= KeyEvent.VK_9) {
name = "DIGIT";
} else if (code >= KeyEvent.VK_A && code <= KeyEvent.VK_Z) {
name = "CHAR";
} else if (code == KeyEvent.VK_F8) {
name = "F8";
}
return (name + " " + String.valueOf(code) + " 0x" + charToHex((char) code)).trim();
case 3:
char kc = e.getKeyChar();
if (kc == KeyEvent.CHAR_UNDEFINED) {
return CHAR_UNDEFINED;
} else if (kc == 29) {
return "<GS>";
}
return String.valueOf(kc);
default:
break;
}
 
return null;
}
 
@Override
public void setValueAt(Object aValue, int rowIndex, int columnIndex) {
// nothing
 
}
 
@Override
public void addTableModelListener(TableModelListener l) {
this.listeners.add(l);
 
}
 
@Override
public void removeTableModelListener(TableModelListener l) {
this.listeners.remove(l);
}
 
Timer t = new Timer();
 
public void fire() {
t.cancel();
t = new Timer();
t.schedule(new TimerTask() {
 
@Override
public void run() {
for (TableModelListener l : listeners) {
l.tableChanged(new TableModelEvent(KeyEventTableModel.this));
}
 
}
}, 400);
 
}
 
public void clear() {
this.list.clear();
fire();
}
 
public void add(KeyEvent e) {
this.list.add(e);
fire();
 
}
 
}
 
private int maxInterKeyDelay = 200;
public int maxInterKeyDelay = 80;
private static final int MIN_BARCODE_LENGTH = 2;
private final List<BarcodeListener> listeners = new ArrayList<>(1);
private List<KeyEventDispatcher> dispatchers = null;
private final List<BarcodeListener> listeners = new ArrayList<BarcodeListener>(1);
private String value = "";
private final List<KeyEvent> eve = new ArrayList<>();
private final List<KeyEvent> eve = new ArrayList<KeyEvent>();
private long firstTime = -1;
private Timer timer;
// non final car un TimerTask n'est pas reutilisable
private TimerTask task;
private boolean enable = true;
private boolean debug = true;
private List<Integer> valueCode = new ArrayList<>();
private boolean debug = false;
private Map<Integer, String> mapCharacterFR = new HashMap<>();
 
public BarcodeReader(int maxInterKeyDelay) {
this.timer = null;
this.task = null;
this.maxInterKeyDelay = maxInterKeyDelay;
 
this.mapCharacterFR.put((int) '&', "1");
this.mapCharacterFR.put((int) 'é', "2");
this.mapCharacterFR.put((int) '"', "3");
this.mapCharacterFR.put((int) '\'', "4");
this.mapCharacterFR.put((int) '(', "5");
this.mapCharacterFR.put((int) '-', "6");
this.mapCharacterFR.put((int) 'è', "7");
this.mapCharacterFR.put((int) '_', "8");
this.mapCharacterFR.put((int) 'ç', "9");
this.mapCharacterFR.put((int) 'à', "0");
}
 
public void setMaxInterKeyDelay(int maxInterKeyDelay) {
this.maxInterKeyDelay = maxInterKeyDelay;
}
 
public void addKeyEventDispatcher(KeyEventDispatcher d) {
if (this.dispatchers == null) {
this.dispatchers = new ArrayList<>();
}
this.dispatchers.add(d);
}
 
public synchronized void removeBarcodeListener(BarcodeListener l) {
this.listeners.remove(l);
if (this.listeners.isEmpty()) {
258,7 → 90,7
this.listeners.add(l);
}
 
private void fire(Barcode code) {
private void fire(String code) {
for (int i = 0; i < this.listeners.size(); i++) {
this.listeners.get(i).barcodeRead(code);
}
273,7 → 105,7
// init avant que les listeners s'en servent
this.timer = new Timer(getClass().getName(), true);
KeyboardFocusManager.getCurrentKeyboardFocusManager().addKeyEventDispatcher(this);
System.err.println("BarcodeReader start : scan delay between keys" + this.maxInterKeyDelay + " ms");
System.err.println("BarcodeReader start : scan delay " + this.maxInterKeyDelay + " ms");
}
}
 
289,8 → 121,6
}
}
 
int lastPressedkeyCode = 0;
 
@Override
public boolean dispatchKeyEvent(KeyEvent e) {
if (!this.enable) {
298,17 → 128,11
}
if (this.task != null)
this.task.cancel();
if (this.dispatchers != null) {
for (KeyEventDispatcher d : this.dispatchers) {
d.dispatchKeyEvent(e);
}
}
 
final long t = e.getWhen();
if (this.firstTime < 0) {
this.firstTime = t;
}
 
int keyCode = e.getKeyCode();
 
final long delay = t - this.firstTime;
315,7 → 139,7
if (keyCode == KeyEvent.VK_BACK_SPACE || keyCode == KeyEvent.VK_DELETE || (delay > this.maxInterKeyDelay && keyCode != KeyEvent.VK_SHIFT)) {
// touche normale
if (this.debug) {
System.err.println("Touche normale " + keyCode + " delai:" + delay);
System.err.println("Touche normale " + keyCode);
}
this.eve.add(e);
redispatch();
324,173 → 148,63
 
final char keyChar = e.getKeyChar();
this.eve.add(e);
if (e.getID() == KeyEvent.KEY_PRESSED) {
lastPressedkeyCode = e.getKeyCode();
if (e.getID() == KeyEvent.KEY_RELEASED) {
if (keyCode == KeyEvent.VK_SHIFT) {
// rien
if (this.debug) {
System.err.println("SHIFT " + keyCode);
}
if (e.getID() == KeyEvent.KEY_RELEASED && keyCode == KeyEvent.VK_F8) {
this.value += '\u001D';
this.valueCode.add(lastPressedkeyCode);
} else {
if (e.getID() == KeyEvent.KEY_RELEASED && keyCode == KeyEvent.VK_ENTER && this.value.length() >= MIN_BARCODE_LENGTH) {
} else if (keyChar == ']') {
this.value += keyChar;
if (this.debug) {
System.err.println("]");
}
} else if (keyChar == '*' || keyChar == '$' || keyChar == '+' || keyChar == '/' || keyChar == '%' || keyChar == ' ') {
this.value += keyChar;
if (this.debug) {
System.err.println("KEY " + keyCode + " - " + keyChar);
}
} else if (keyCode >= KeyEvent.VK_0 && keyCode <= KeyEvent.VK_9 || keyCode >= KeyEvent.VK_A && keyCode <= KeyEvent.VK_Z) {
// from KeyEvent : same as ASCII
if (this.debug) {
System.err.println("[0-9] [A-Z] " + keyCode + " : " + keyChar);
}
this.value += (char) keyCode;
} else if (keyCode == KeyEvent.VK_ENTER && this.value.length() >= MIN_BARCODE_LENGTH) {
// fin de code barre
if (this.debug) {
System.err.println("BARCODE OK ENTER OR LENGHT " + keyCode + " length = " + this.value.length() + " min length =" + MIN_BARCODE_LENGTH);
}
this.value = this.value.trim();
if (this.value.startsWith("$")) {
// Barcode not configured for FR
StringBuilder b = new StringBuilder(this.value.length());
for (int i = 0; i < this.value.length(); i++) {
char c = this.value.charAt(i);
int kCode = this.valueCode.get(i);
if (c == '&') {
b.append('1');
} else if (c == 'é') {
b.append('2');
} else if (c == '"') {
b.append('3');
} else if (c == '\'') {
b.append('4');
} else if (c == '(') {
b.append('5');
} else if (c == '-') {
if (kCode == 109) {
b.append('-');
} else {
b.append('6');
fire(this.value);
reset();
} else if (this.mapCharacterFR.containsKey((int) keyChar)) {
if (this.debug) {
System.err.println("MAP DEFAULT FR CHAR " + keyChar + " WITH " + this.mapCharacterFR.get((int) keyChar));
}
} else if (c == 'è') {
 
b.append('7');
 
} else if (c == '_') {
b.append('8');
} else if (c == 'ç') {
b.append('9');
} else if (c == 'à') {
b.append('0');
} else if (c == '$') {
b.append(']');
} else if (c == 'M') {
b.append(':');
} else if (c == '!') {
b.append('/');
} else if (c == 'q') {
b.append('a');
} else if (c == 'a') {
b.append('q');
} else if (c == 'z') {
b.append('w');
} else if (c == 'w') {
b.append('z');
} else if (c == 'Q') {
b.append('A');
} else if (c == 'A') {
b.append('Q');
} else if (c == 'Z') {
b.append('W');
} else if (c == 'W') {
b.append('Z');
} else if (c == ',') {
b.append('m');
} else if (c == '?') {
b.append('M');
} else if (c == ':') {
b.append('.');
} else if (c == 'Ò') {
b.append('°');
} else if (c == 'ª') {
b.append('é');
} else if (c == '%') {
b.append('"');
} else if (c == 'ù') {
b.append('\'');
} else if (c == '¨') {
b.append('{');
} else if (c == '£') {
b.append('}');
} else if (c == 'ñ') {
if (kCode == 18) {
b.append('à');
} else
b.append('&');
} else if (c == '0') {
b.append(')');
} else if (c == '1') {
b.append('!');
} else if (c == '2') {
b.append('@');
} else if (c == '3') {
b.append('#');
} else if (c == '4') {
b.append('$');
} else if (c == '5') {
b.append('%');
} else if (c == '6') {
if (kCode == 54) {
b.append('^');
} else
b.append('ç');
} else if (c == '7') {
//
b.append('&');
} else if (c == '9') {
b.append('(');
} else if (c == '^') {
b.append('[');
} else if (c == 'µ') {
b.append('|');
} else if (c == '¿') {
b.append('è');
} else if (c == '²') {
b.append('`');
} else if (c == '°') {
b.append('_');
} else if (c == '/') {
b.append('>');
} else if (c == '.') {
b.append('<');
} else if (c == 'ý') {
b.append('§');
} else if (c == 'm') {
b.append(';');
} else if (c == '┤') {
b.append('ù');
} else if (c == '\\') {
b.append('*');
} else if (c == '§') {
b.append('?');
} else if (c == ';') {
b.append(',');
} else if (c == '*') {
if (kCode == 106) {
b.append('*');
} else
b.append('\\');
} else {
b.append(c);
this.value += this.mapCharacterFR.get((int) keyChar);
} else if (Character.isLetter(keyChar) || Character.isDigit(keyChar)) {
this.value += keyChar;
if (this.debug) {
System.err.println("LETTER OR DIGIT " + keyChar);
}
 
} else if (keyChar == 29) {
this.value += '\u001D';
if (this.debug) {
System.err.println("<GS>");
}
this.value = b.toString();
fire(new Barcode(this.value));
} else if (keyChar == KeyEvent.CHAR_UNDEFINED) {
System.err.println("CHAR_UNDEFINED");
this.value += '\u001D';
} else {
fire(new Barcode(this.value));
// Caractere non code barre
if (this.debug) {
System.err.println("CHAR NON CODE BARRE keyCode:" + keyCode + " keyChar:" + keyChar);
}
reset();
} else if (e.getID() == KeyEvent.KEY_TYPED) {
this.value += keyChar;
this.valueCode.add(lastPressedkeyCode);
redispatch();
}
 
}
 
// redispatch();
 
// lance un timer s'il reste des evenements non dispatchés
if (!this.eve.isEmpty())
 
{
if (!this.eve.isEmpty()) {
this.firstTime = t;
this.task = new TimerTask() {
@Override
511,7 → 225,7
}
// si pas d'evenement, pas de temps associé
assert !this.eve.isEmpty() || this.firstTime == -1;
 
}
return true;
 
}
529,22 → 243,22
 
private void reset() {
this.value = "";
this.valueCode.clear();
this.lastPressedkeyCode = 0;
this.eve.clear();
this.firstTime = -1;
}
 
public Map<Integer, String> getMapCharacterFR() {
return this.mapCharacterFR;
}
 
public void setDebug(boolean debug) {
this.debug = debug;
}
 
public static void main(String[] args) {
final String delay;
String delay = "80";
if (args.length > 0) {
delay = args[0];
} else {
delay = "40";
}
final int d = Integer.parseInt(delay);
SwingUtilities.invokeLater(new Runnable() {
556,170 → 270,32
} catch (Exception e) {
e.printStackTrace();
}
BarcodeReader reader = new BarcodeReader(d);
System.out.println("BarCode reader");
System.out.println("Using inter key delay: " + d);
JFrame f = new JFrame();
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
final JPanel panel = new JPanel();
f.setTitle("Barcode reader tester (AIM ID required for GS1)");
JPanel panel = new JPanel();
f.setTitle("Barcode reader test");
f.setContentPane(panel);
panel.setLayout(new GridBagLayout());
GridBagConstraints c = new GridBagConstraints();
 
c.gridx = 0;
c.gridy = 0;
c.weighty = 0.5;
c.fill = GridBagConstraints.BOTH;
final KeyEventTableModel keyEventTableModel = reader.new KeyEventTableModel();
JTable table = new JTable(keyEventTableModel);
SimpleDateFormat df = new SimpleDateFormat(" hh:mm:ss.SSS");
table.getColumnModel().getColumn(0).setCellRenderer(new DefaultTableCellRenderer() {
@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
Date d = (Date) value;
value = df.format(d);
if (table.getModel().getRowCount() > 0) {
Date d1 = (Date) table.getModel().getValueAt(0, 0);
value += " " + (d.getTime() - d1.getTime()) + " ms";
}
return super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
}
});
 
table.getColumnModel().getColumn(3).setCellRenderer(new DefaultTableCellRenderer() {
@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
 
Component c = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
 
String str = (String) value;
if (str.equals(KeyEventTableModel.CHAR_UNDEFINED)) {
 
String id = table.getModel().getValueAt(row, 0).toString();
if (id.equals(KeyEventTableModel.KEY_TYPED)) {
c.setBackground(Color.YELLOW);
}
}
return c;
 
}
});
 
panel.add(new JScrollPane(table), c);
GridBagConstraints c = new DefaultGridBagConstraints();
final JLabel l = new JLabel("BarCode reader output :");
panel.add(l, c);
c.gridy++;
c.weighty = 1;
c.weightx = 1;
 
final JTextArea t1 = new JTextArea(20, 10);
t1.setLineWrap(true);
t1.setWrapStyleWord(true);
t1.setMinimumSize(new Dimension(t1.getMinimumSize()));
 
c.fill = GridBagConstraints.BOTH;
final ITextArea t1 = new ITextArea();
panel.add(new JScrollPane(t1), c);
 
JPanel tools = new JPanel();
tools.setLayout(new FlowLayout(FlowLayout.RIGHT));
 
JSpinner spin = new JSpinner(new SpinnerNumberModel(d, 5, 800, 10));
spin.addChangeListener(new ChangeListener() {
 
@Override
public void stateChanged(ChangeEvent e) {
int v = ((Number) spin.getValue()).intValue();
reader.setMaxInterKeyDelay(v);
}
});
tools.add(spin);
JButton b = new JButton("Reset");
tools.add(b);
JButton bExport = new JButton("Export");
tools.add(bExport);
c.weighty = 0;
c.gridx = 0;
c.gridy++;
c.gridwidth = 2;
 
panel.add(tools, c);
 
BarcodeReader reader = new BarcodeReader(d);
reader.setDebug(true);
bExport.addActionListener(new ActionListener() {
 
@Override
public void actionPerformed(ActionEvent e) {
int colCount = keyEventTableModel.getColumnCount();
int rowCount = keyEventTableModel.getRowCount();
StringBuilder b = new StringBuilder();
SimpleDateFormat df = new SimpleDateFormat("hh:mm:ss.SSS");
for (int i = 0; i < rowCount; i++) {
for (int j = 0; j < colCount; j++) {
Object o = keyEventTableModel.getValueAt(i, j);
if (o instanceof Date) {
b.append(df.format((Date) o));
} else {
final String string = o.toString();
if (string.equals("\n")) {
b.append("\\n");
} else if (string.equals("\r")) {
b.append("\\r");
} else {
b.append(string);
System.err.println("FR MAP");
for (Entry<Integer, String> string : reader.getMapCharacterFR().entrySet()) {
System.err.println(string.getKey() + " --> " + string.getValue());
}
}
b.append(';');
}
b.append("\n");
}
 
JFileChooser fileChooser = new JFileChooser();
fileChooser.setSelectedFile(new File("OpenConcerto-KeyEvents.txt"));
int retval = fileChooser.showSaveDialog(panel);
if (retval == JFileChooser.APPROVE_OPTION) {
File file = fileChooser.getSelectedFile();
if (file == null) {
return;
}
if (!file.getName().toLowerCase().endsWith(".txt")) {
file = new File(file.getParentFile(), file.getName() + ".txt");
}
try (OutputStreamWriter out = new OutputStreamWriter(new FileOutputStream(file), "utf-8")) {
out.write(b.toString());
out.write(t1.getText());
out.write("\n");
out.write("Delay: " + delay);
out.flush();
} catch (Exception ex) {
ex.printStackTrace();
}
if (file.exists()) {
try {
Desktop.getDesktop().open(file);
} catch (IOException e1) {
e1.printStackTrace();
}
}
}
}
});
b.addActionListener(new ActionListener() {
 
@Override
public void actionPerformed(ActionEvent e) {
t1.setText("");
keyEventTableModel.clear();
 
}
});
reader.addKeyEventDispatcher(new KeyEventDispatcher() {
 
@Override
public boolean dispatchKeyEvent(KeyEvent e) {
keyEventTableModel.add(e);
return false;
}
});
reader.addBarcodeListener(new BarcodeListener() {
 
@Override
728,32 → 304,25
}
 
@Override
public void barcodeRead(Barcode code) {
t1.append("Barcode OK : '" + code.getCode() + "'\nType : " + code.getType() + " \n");
t1.append("Hex: " + bytesToHexString(code.getCode().getBytes()) + "'\n");
t1.append("Data : '" + code.getData() + "'\n");
 
public void barcodeRead(String code) {
t1.append("Barcode OK : '" + code + "'\n");
t1.append("Hex: " + StringUtils.bytesToHexString(code.getBytes()));
t1.append("\n");
GS1Util e = new GS1Util();
try {
t1.append("GS1 : " + e.parse(code).formatHumanReadable());
t1.append("GS1: " + e.parseFromScanner(code).formatHumanReadable());
} catch (Exception ex) {
final String message = ex.getMessage();
if (message == null) {
t1.append("Not a GS1 code");
} else
t1.append("Not a GS1 code : " + message);
t1.append("GS1: " + ex.getMessage());
}
t1.append("\n\n");
}
});
 
t1.setEditable(false);
f.setSize(new Dimension(640, 580));
f.setSize(new Dimension(640, 480));
f.setLocationRelativeTo(null);
f.setVisible(true);
 
}
 
});
 
}
761,25 → 330,4
public void setEnabled(boolean b) {
this.enable = b;
}
 
static final char[] hexArray = "0123456789ABCDEF".toCharArray();
 
public static String charToHex(char c) {
int v = c & 0xFF;
char[] hexChars = new char[2];
hexChars[0] = hexArray[v >>> 4];
hexChars[1] = hexArray[v & 0x0F];
return new String(hexChars);
}
 
public static String bytesToHexString(byte[] bytes) {
int length = bytes.length;
char[] hexChars = new char[length * 2];
for (int j = 0; j < length; j++) {
int v = bytes[j] & 0xFF;
hexChars[j * 2] = hexArray[v >>> 4];
hexChars[j * 2 + 1] = hexArray[v & 0x0F];
}
return new String(hexChars);
}
}
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/pos/element/TicketCaisseSQLElement.java
13,17 → 13,16
package org.openconcerto.erp.core.sales.pos.element;
 
import org.openconcerto.erp.config.ComptaPropsConfiguration;
import org.openconcerto.erp.core.common.element.ComptaSQLConfElement;
import org.openconcerto.erp.core.finance.payment.element.TypeReglementSQLElement;
import org.openconcerto.erp.core.finance.tax.model.TaxeCache;
import org.openconcerto.erp.core.sales.pos.POSConfiguration;
import org.openconcerto.erp.core.sales.pos.TicketSheetXML;
import org.openconcerto.erp.core.sales.pos.model.Article;
import org.openconcerto.erp.core.sales.pos.model.ArticleCache;
import org.openconcerto.erp.core.sales.pos.model.Categorie;
import org.openconcerto.erp.core.sales.pos.model.Paiement;
import org.openconcerto.erp.core.sales.pos.model.ReceiptCode;
import org.openconcerto.erp.core.sales.pos.model.Ticket;
import org.openconcerto.erp.core.sales.pos.ui.TicketClientNamePanel;
import org.openconcerto.sql.Configuration;
import org.openconcerto.sql.element.SQLComponent;
import org.openconcerto.sql.element.SQLElement;
36,7 → 35,6
import org.openconcerto.sql.utils.PartialUniqueTrigger;
import org.openconcerto.sql.view.list.IListeAction.IListeEvent;
import org.openconcerto.sql.view.list.action.SQLRowValuesAction.PredicateRowAction;
import org.openconcerto.ui.FrameUtil;
import org.openconcerto.utils.DecimalUtils;
import org.openconcerto.utils.ExceptionHandler;
 
44,11 → 42,11
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
 
import javax.swing.JFrame;
import javax.swing.JTextField;
 
public class TicketCaisseSQLElement extends ComptaSQLConfElement {
74,21 → 72,13
super("TICKET_CAISSE", "un ticket de caisse", "tickets de caisses");
 
PredicateRowAction action = new PredicateRowAction(true, "ticket.document.generate", (le) -> {
 
POSConfiguration posConf = POSConfiguration.getInstance();
final TicketSheetXML bSheet = new TicketSheetXML(createTicket(le.getSelectedRow().asRow()), ComptaPropsConfiguration.getInstanceCompta());
try {
if (posConf == null) {
posConf = POSConfiguration.setInstance();
ArticleCache.initCache(getDirectory());
bSheet.createDocument();
bSheet.showPrintAndExport(true, false, false, Collections.emptyList());
} catch (Exception originalExn) {
ExceptionHandler.handle("Erreur lors de la création de la facture", originalExn);
}
} catch (Exception e) {
ExceptionHandler.handle("Impossible d'initialiser la configuration de la caisse", e);
return;
}
TicketClientNamePanel p = new TicketClientNamePanel(null, createTicket(le.getSelectedRow().asRow()));
JFrame f = new JFrame("Facturation ticket");
f.add(p);
FrameUtil.showPacked(f);
});
 
action.setPredicate(IListeEvent.getSingleSelectionPredicate());
/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-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the 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,14 → 35,6
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");
57,7 → 49,6
l.add("POIDS");
l.add("T_PA_HT");
l.add("T_PV_HT");
l.add("T_PV_TTC");
return l;
}
 
78,7 → 69,7
@Override
public ListMap<String, String> getShowAs() {
final ListMap<String, String> res = new ListMap<String, String>();
res.putCollection("ID_BON_DE_LIVRAISON", "NUMERO", "DATE");
res.putCollection("ID_BON_DE_LIVRAISON", "NUMERO");
return res;
}
 
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/shipment/element/BonDeLivraisonSQLElement.java
14,7 → 14,6
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;
40,7 → 39,6
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;
92,13 → 90,6
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);
139,7 → 130,6
}
l.add("NOM");
l.add("TOTAL_HT");
l.add("TOTAL_TTC");
l.add("INFOS");
return l;
}
188,20 → 178,8
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 {
233,7 → 211,6
}
 
}
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
File deleted
/trunk/OpenConcerto/src/org/openconcerto/erp/core/sales/shipment/action/ListeDesBonsDeLivraisonAction.java
31,13 → 31,14
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;
51,10 → 52,8
 
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> {
 
95,8 → 94,8
return frame;
}
 
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);
private ListeAddPanel getPanel(final BonDeLivraisonSQLElement eltCmd, final SQLTableModelSourceOnline tableSource, final List<RowAction> allowedActions) {
final ListeAddPanel panel = new ListeAddPanel(eltCmd, new IListe(tableSource));
 
final List<SQLField> fields = new ArrayList<SQLField>(2);
fields.add(eltCmd.getTable().getField("TOTAL_HT"));
161,7 → 160,7
};
tableSource.getColumns().add(colAvancement);
colAvancement.setRenderer(new PercentTableCellRenderer());
final ListeAddPanel panel = getPanel(eltCmd, tableSource, allowedActions, "alldelivery");
final ListeAddPanel panel = getPanel(eltCmd, tableSource, allowedActions);
return panel;
}
 
169,21 → 168,17
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) {
} else {
return BigDecimal.ONE.movePointRight(2);
} else {
return BigDecimal.ZERO;
}
}
 
196,7 → 191,7
final SQLInjector injector = SQLInjector.getInjector(eltCmd.getTable(), eltCmd.getTable().getTable("SAISIE_VENTE_FACTURE"));
injector.setOnlyTransfered(tableSource);
 
final ListeAddPanel panel = getPanel(eltCmd, tableSource, allowedActions, "invoiced");
final ListeAddPanel panel = getPanel(eltCmd, tableSource, allowedActions);
return panel;
}
 
210,7 → 205,7
final SQLInjector injector = SQLInjector.getInjector(eltCmd.getTable(), eltCmd.getTable().getTable("SAISIE_VENTE_FACTURE"));
injector.setOnlyNotTransfered(tableSource);
 
final ListeAddPanel panel = getPanel(eltCmd, tableSource, allowedActions, "waiting");
final ListeAddPanel panel = getPanel(eltCmd, tableSource, allowedActions);
return panel;
}
 
219,51 → 214,7
*
* @param row
*/
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é!";
private void transfertFactureClient(List<SQLRowValues> rows) {
TransfertBaseSQLComponent.openTransfertFrame(rows, "SAISIE_VENTE_FACTURE");
}
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,16 → 28,12
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.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.pos.ui.BarcodeListener;
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.DeliveryNoteQtyRowValuesRenderer;
import org.openconcerto.erp.core.sales.product.ui.QtyRowValuesRenderer;
import org.openconcerto.erp.core.sales.product.ui.DeliveredQtyRowValuesRenderer;
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;
51,7 → 47,6
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;
71,12 → 66,10
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;
173,7 → 166,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) && !isLotLinked(vals);
boolean b = super.isCellEditable(vals, rowIndex, columnIndex);
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;
195,7 → 188,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) && !isLotLinked(vals);
boolean b = super.isCellEditable(vals, rowIndex, columnIndex);
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;
211,7 → 204,7
@Override
public boolean isCellEditable(SQLRowValues vals, int rowIndex, int columnIndex) {
 
boolean b = super.isCellEditable(vals, rowIndex, columnIndex) && !isLotLinked(vals);
boolean b = super.isCellEditable(vals, rowIndex, columnIndex);
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;
280,7 → 273,7
} else if (activeCalculM2 && row != null && !row.isUndefined() && row.getID() == UniteVenteArticleSQLElement.M2) {
return false;
} else {
return super.isCellEditable(vals, rowIndex, columnIndex) && !isLotLinked(vals);
return super.isCellEditable(vals, rowIndex, columnIndex);
}
}
 
295,12 → 288,7
};
list.add(qteU);
 
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);
}
};
SQLTableElement uniteVente = new SQLTableElement(e.getTable().getField("ID_UNITE_VENTE"));
list.add(uniteVente);
 
// Quantité
323,17 → 311,12
@Override
public TableCellRenderer getTableCellRenderer() {
 
return new DeliveryNoteQtyRowValuesRenderer();
return new DeliveredQtyRowValuesRenderer();
}
 
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);
 
523,94 → 506,30
list.add(this.tableElementPoidsTotalLivree);
 
// Packaging
if (e.getTable().contains("POIDS_COLIS_NET") && prefs.getBoolean(GestionArticleGlobalPreferencePanel.ITEM_PACKAGING, false)) {
if (prefs.getBoolean(GestionArticleGlobalPreferencePanel.ITEM_PACKAGING, false)) {
 
SQLTableElement tareColis = new SQLTableElement(e.getTable().getField("TARE"), BigDecimal.class) {
@Override
public TableCellRenderer getTableCellRenderer() {
return new QteUnitRowValuesRenderer();
}
SQLTableElement poidsColis = new SQLTableElement(e.getTable().getField("POIDS_COLIS_NET"), BigDecimal.class);
list.add(poidsColis);
 
};
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) {
// @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);
// }
// });
final SQLTableElement totalPoidsColis = new SQLTableElement(e.getTable().getField("T_POIDS_COLIS_NET"), BigDecimal.class);
list.add(totalPoidsColis);
 
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() {
poidsColis.addModificationListener(totalPoidsColis);
nbColis.addModificationListener(totalPoidsColis);
totalPoidsColis.setModifier(new CellDynamicModifier() {
public Object computeValueFrom(final SQLRowValues row, SQLTableElement source) {
final BigDecimal tare = row.getBigDecimal("TARE");
// final int qte = row.getInt("QTE_LIVREE");
// final BigDecimal pdsColis = row.getBigDecimal("POIDS_COLIS_NET");
final Object o2 = row.getObject("POIDS_COLIS_NET");
final Object o3 = row.getObject("NB_COLIS");
 
BigDecimal pdsBrutTotal = BigDecimal.ZERO;
 
if (row.getObject("T_POIDS") != null) {
pdsBrutTotal = new BigDecimal(row.getFloat("T_POIDS"));
}
 
if (tare != null && o3 != null) {
if (o2 != null && o3 != null) {
BigDecimal poids = (BigDecimal) o2;
int nb = (Integer) o3;
pdsBrutTotal = pdsBrutTotal.add(tare.multiply(new BigDecimal(nb)));
return poids.multiply(new BigDecimal(nb), DecimalUtils.HIGH_PRECISION).setScale(totalPoidsColis.getDecimalDigits(), RoundingMode.HALF_UP);
} else {
return row.getObject("T_POIDS_COLIS_NET");
}
// 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);
}
});
 
743,7 → 662,7
this.defaultRowVals.put("NOM", "");
final RowValuesTableModel model = new RowValuesTableModel(e, list, e.getTable().getField("NOM"), false, this.defaultRowVals) {
@Override
public void commitData() throws SQLException {
public void commitData() {
int size = getRowCount();
for (int i = 0; i < size; i++) {
SQLRowValues rowVals = getRowValuesAt(i);
753,60 → 672,11
rowVals.put("PV_T_DEVISE", rowVals.getBigDecimal("PRIX_METRIQUE_VT_1").multiply(globalQty));
}
}
commitData(true);
super.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);
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();
}
 
};
this.table = new RowValuesTable(model, getConfigurationFile());
ToolTipManager.sharedInstance().unregisterComponent(this.table);
ToolTipManager.sharedInstance().unregisterComponent(this.table.getTableHeader());
this.table.getClearCloneTableElement().add("ID_COMMANDE_CLIENT_ELEMENT");
1239,7 → 1109,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();
}
1339,13 → 1209,13
}
 
@Override
public void barcodeRead(Barcode code) {
public void barcodeRead(String 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.getData()));
w = w.and(new Where(tableArticle.getField("CODE_BARRE"), "=", code));
selArticle.setWhere(w);
List<SQLRow> l2 = SQLRowListRSH.execute(selArticle);
if (l2.size() > 0) {
1404,17 → 1274,7
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();
 
1484,12 → 1344,4
 
}
}
 
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/shipment/component/BonDeLivraisonSQLComponent.java
13,6 → 13,8
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;
23,8 → 25,6
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,13 → 41,10
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;
58,7 → 55,6
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;
81,11 → 77,9
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;
111,18 → 105,8
private PanelOOSQLComponent panelOO;
private JUniqueTextField textNumeroUnique;
private final SQLTable tableNum = getTable().getBase().getTable("NUMEROTATION_AUTO");
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 textTotalHT = new DeviseField(6);
private final DeviseField textTotalTVA = new DeviseField(6);
private final DeviseField textTotalTTC = new DeviseField(6);
private final JTextField textPoidsTotal = new JTextField(6);
private final JTextField textNom = new JTextField(25);
143,20 → 127,6
}
 
@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();
423,8 → 393,8
this.addView(comboContact, "ID_CONTACT");
 
// Commercial
JLabel labelCommercial = new JLabel(getLabelFor("ID_COMMERCIAL"), SwingConstants.RIGHT);
c.fill = GridBagConstraints.HORIZONTAL;
JLabel labelCommercial = new JLabel(getLabelFor("ID_COMMERCIAL"));
labelCommercial.setHorizontalAlignment(SwingConstants.RIGHT);
 
c.gridx++;
c.weightx = 0;
569,8 → 539,6
addRequiredSQLObject(comboServiPar, "SERVI_PAR");
}
}
JTextField acompteCmd = new JTextField(15);
this.addView(acompteCmd, "T_ACOMPTE");
 
if (getTable().contains("A_ATTENTION")) {
// Date livraison
977,7 → 945,19
 
@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) {
1001,34 → 981,23
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);
} catch (Exception e) {
ExceptionHandler.handle(this, "erreur", e);
 
try {
updateStock(getSelectedID());
} catch (SQLException e) {
throw new IllegalStateException(e);
}
 
}
1079,15 → 1048,10
}
}
} 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;
1175,10 → 1139,9
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(tableBlItem);
List<SQLRow> items = row.getReferentRows(getTable().getTable("BON_DE_LIVRAISON_ELEMENT"));
for (SQLRow sqlRow : items) {
if (sqlRow.contains("ID_COMMANDE_CLIENT_ELEMENT") && !sqlRow.isForeignEmpty("ID_COMMANDE_CLIENT_ELEMENT")) {
stockWithBL = true;
1190,36 → 1153,21
if (stockWithBL) {
 
SQLRow row = getTable().getRow(id);
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() {
StockItemsUpdater stockUpdater = new StockItemsUpdater(new StockLabel() {
@Override
public String getLabel(SQLRowAccessor rowOrigin, SQLRowAccessor rowElt) {
return getLibelleStock(rowOrigin, rowElt);
}
}, row, fetchLinkedWithCmdItem, TypeStockUpdate.REAL_DELIVER);
}, 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);
 
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) {
stockUpdaterLinkedItem.addReliquat(sqlRow.getForeign("ID_ARTICLE"), sqlRow.getInt("QTE"), sqlRow.getBigDecimal("QTE_UNITAIRE"));
stockUpdater.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/common/ui/AbstractArticleItemTable.java
13,22 → 13,15
package org.openconcerto.erp.core.common.ui;
 
import org.openconcerto.erp.core.common.element.ComptaSQLConfElement;
import org.openconcerto.erp.config.ComptaPropsConfiguration;
import org.openconcerto.erp.core.common.element.StyleSQLElement;
import org.openconcerto.erp.core.finance.tax.model.TaxeCache;
import org.openconcerto.erp.core.sales.product.component.BatchSelectorFrame;
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.ReferenceArticleSQLElement;
import org.openconcerto.erp.core.sales.product.element.UniteVenteArticleSQLElement;
import org.openconcerto.erp.core.sales.product.model.BatchQuantity;
import org.openconcerto.erp.core.supplychain.receipt.ui.LotReceptionUIPanel;
import org.openconcerto.erp.preferences.DefaultNXProps;
import org.openconcerto.erp.preferences.GestionArticleGlobalPreferencePanel;
import org.openconcerto.erp.utils.TM;
import org.openconcerto.sql.Configuration;
import org.openconcerto.sql.element.SQLElement;
import org.openconcerto.sql.element.SQLElementDirectory;
import org.openconcerto.sql.model.SQLField;
import org.openconcerto.sql.model.SQLRow;
import org.openconcerto.sql.model.SQLRowAccessor;
50,18 → 43,13
 
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.event.ActionEvent;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.io.File;
import java.math.BigDecimal;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
68,14 → 56,10
 
import javax.swing.AbstractAction;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.ScrollPaneConstants;
import javax.swing.SwingUtilities;
import javax.swing.table.TableCellEditor;
 
public abstract class AbstractArticleItemTable extends JPanel {
protected RowValuesTable table;
161,140 → 145,6
c.weightx = 1;
 
this.buttons.add(1, new AjoutDeclinaisonButton(this));
if (getSQLElement().getTable().getName().equals("BON_RECEPTION_ELEMENT")) {
this.buttons.add(1, new JButton(new AbstractAction("Lot / N° série") {
 
@Override
public void actionPerformed(ActionEvent e) {
final JFrame root = (JFrame) SwingUtilities.getRoot(AbstractArticleItemTable.this);
final int selectedRow = getRowValuesTable().getSelectedRow();
if (selectedRow == -1) {
JOptionPane.showMessageDialog(root, "Aucune ligne sélectionnée!");
} else {
final SQLRowValues rowValuesAt = getRowValuesTable().getRowValuesTableModel().getRowValuesAt(selectedRow);
if (rowValuesAt.isForeignEmpty("ID_ARTICLE")) {
JOptionPane.showMessageDialog(root, "Aucun article sur ligne sélectionnée!");
} else {
final Number foreignIDNumberUnite = rowValuesAt.getForeignIDNumber("ID_UNITE_VENTE");
 
JDialog d = new JDialog(root, "Lot / N° série", true);
final LotReceptionSQLElement elementLotR = getSQLElement().getDirectory().getElement(LotReceptionSQLElement.class);
d.getContentPane().add(new LotReceptionUIPanel(elementLotR, rowValuesAt));
d.pack();
d.setLocationRelativeTo(null);
d.setVisible(true);
d.addWindowListener(new WindowAdapter() {
 
@Override
public void windowClosed(WindowEvent e) {
final TableCellEditor cellEditor = getRowValuesTable().getCellEditor();
if (cellEditor != null) {
cellEditor.stopCellEditing();
}
final Set<SQLRowValues> referentRows = rowValuesAt.getReferentRows(elementLotR.getTable().getField("ID_BON_RECEPTION_ELEMENT"));
BigDecimal b = BigDecimal.ZERO;
for (SQLRowValues sqlRowValues : referentRows) {
if (!sqlRowValues.contains("ARCHIVE") || !sqlRowValues.isArchived()) {
b = b.add(sqlRowValues.getBigDecimal("QUANTITE"));
}
}
if (b.signum() != 0) {
if (foreignIDNumberUnite != null && foreignIDNumberUnite.intValue() == UniteVenteArticleSQLElement.A_LA_PIECE) {
getRowValuesTable().getRowValuesTableModel().setValueAt(b.intValue(), selectedRow, getRowValuesTable().getRowValuesTableModel().getColumnForField("QTE"));
} else {
getRowValuesTable().getRowValuesTableModel().setValueAt(1, selectedRow, getRowValuesTable().getRowValuesTableModel().getColumnForField("QTE"));
getRowValuesTable().getRowValuesTableModel().setValueAt(b, selectedRow, getRowValuesTable().getRowValuesTableModel().getColumnForField("QTE_UNITAIRE"));
}
}
}
 
});
}
}
}
}));
} else if (getSQLElement().getTable().getName().equals("BON_DE_LIVRAISON_ELEMENT")) {
this.buttons.add(1, new JButton(new AbstractAction("Lot / N° série") {
private final Map<SQLRowValues, BigDecimal> mapDBQuantity = new HashMap<>();
 
@Override
public void actionPerformed(ActionEvent e) {
final JFrame root = (JFrame) SwingUtilities.getRoot(AbstractArticleItemTable.this);
final int selectedRow = getRowValuesTable().getSelectedRow();
if (selectedRow == -1) {
JOptionPane.showMessageDialog(root, "Aucune ligne sélectionnée!");
} else {
final SQLRowValues rowValuesAt = getRowValuesTable().getRowValuesTableModel().getRowValuesAt(selectedRow);
if (rowValuesAt.isForeignEmpty("ID_ARTICLE")) {
JOptionPane.showMessageDialog(root, "Aucun article sur ligne sélectionnée!");
} else {
final Number foreignIDNumberUnite = rowValuesAt.getForeignIDNumber("ID_UNITE_VENTE");
 
final SQLElementDirectory directory = getSQLElement().getDirectory();
final Set<SQLRowValues> referentRows = rowValuesAt.getReferentRows(getSQLElement().getTable().getTable("LOT_LIVRAISON").getField("ID_BON_DE_LIVRAISON_ELEMENT"));
try {
 
List<SQLRowValues> listRefRows = new ArrayList<SQLRowValues>();
for (SQLRowValues sqlRowValues : referentRows) {
if (!mapDBQuantity.containsKey(sqlRowValues)) {
mapDBQuantity.put(sqlRowValues, sqlRowValues.getBigDecimal("QUANTITE"));
}
if (!sqlRowValues.contains("ARCHIVE") || !sqlRowValues.isArchived()) {
listRefRows.add(sqlRowValues);
}
}
 
final List<BatchQuantity> createBatchQuantity = directory.getElement(LotSQLElement.class).createBatchQuantity(listRefRows);
for (int i = 0; i < createBatchQuantity.size(); i++) {
final SQLRowValues ref = listRefRows.get(i);
if (mapDBQuantity.containsKey(ref)) {
createBatchQuantity.get(i).setQuantityInDB(mapDBQuantity.get(ref));
}
}
 
final BatchSelectorFrame frame = new BatchSelectorFrame(root, directory, rowValuesAt.getForeign("ID_ARTICLE").asRow(), createBatchQuantity);
frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
 
frame.pack();
frame.setVisible(true);
frame.setLocationRelativeTo(null);
frame.addWindowListener(new WindowAdapter() {
 
@Override
public void windowClosed(WindowEvent e) {
 
if (frame.isCancelled())
return;
 
final TableCellEditor cellEditor = getRowValuesTable().getCellEditor();
if (cellEditor != null) {
cellEditor.stopCellEditing();
}
 
final List<BatchQuantity> quantities = frame.getQuantities();
directory.getElement(LotSQLElement.class).createLotLivraison(quantities, rowValuesAt);
 
BigDecimal b = frame.getTotalSelectedQuantity();
if (b.signum() != 0) {
if (foreignIDNumberUnite != null && foreignIDNumberUnite.intValue() == UniteVenteArticleSQLElement.A_LA_PIECE) {
getRowValuesTable().getRowValuesTableModel().setValueAt(b.intValue(), selectedRow,
getRowValuesTable().getRowValuesTableModel().getColumnForField("QTE_LIVREE"));
} else {
getRowValuesTable().getRowValuesTableModel().setValueAt(1, selectedRow, getRowValuesTable().getRowValuesTableModel().getColumnForField("QTE_LIVREE"));
getRowValuesTable().getRowValuesTableModel().setValueAt(b, selectedRow, getRowValuesTable().getRowValuesTableModel().getColumnForField("QTE_UNITAIRE"));
}
}
}
 
});
} catch (SQLException e1) {
ExceptionHandler.handle("Erreur lors de la récupération des lots", e1);
}
}
}
}
}));
}
control = new RowValuesTableControlPanel(this.table, this.buttons);
control.setOpaque(false);
this.add(control, c);
414,7 → 264,7
 
final SQLElement eltArticleTable = getSQLElement();
 
final SQLTable tableArticle = getSQLElement().getTable().getTable("ARTICLE");
final SQLTable tableArticle = ((ComptaPropsConfiguration) Configuration.getInstance()).getRootSociete().getTable("ARTICLE");
 
final boolean modeAvance = DefaultNXProps.getInstance().getBooleanValue("ArticleModeVenteAvance", false);
SQLPreferences prefs = SQLPreferences.getMemCached(tableArticle.getDBRoot());
/trunk/OpenConcerto/src/org/openconcerto/erp/core/common/ui/AbstractVenteArticleItemTable.java
17,8 → 17,7
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.io.Barcode;
import org.openconcerto.erp.core.sales.pos.io.BarcodeListener;
import org.openconcerto.erp.core.sales.pos.ui.BarcodeListener;
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.model.ProductComponent;
30,7 → 29,7
import org.openconcerto.erp.core.sales.product.ui.QteUnitRowValuesRenderer;
import org.openconcerto.erp.core.sales.product.ui.QteUnitairePieceRowValuesRenderer;
import org.openconcerto.erp.core.supplychain.stock.element.DepotStockSQLElement;
import org.openconcerto.erp.core.supplychain.stock.element.StockConsultPanel;
import org.openconcerto.erp.core.supplychain.stock.element.StockSQLElement;
import org.openconcerto.erp.importer.ArrayTableModel;
import org.openconcerto.erp.importer.DataImporter;
import org.openconcerto.erp.preferences.DefaultNXProps;
52,11 → 51,12
import org.openconcerto.sql.model.Where;
import org.openconcerto.sql.model.graph.Path;
import org.openconcerto.sql.preferences.SQLPreferences;
import org.openconcerto.sql.request.ComboSQLRequest;
import org.openconcerto.sql.sqlobject.ITextArticleWithCompletionCellEditor;
import org.openconcerto.sql.sqlobject.ITextWithCompletion;
import org.openconcerto.sql.users.rights.UserRights;
import org.openconcerto.sql.users.rights.UserRightsManager;
import org.openconcerto.sql.view.EditFrame;
import org.openconcerto.sql.view.EditPanel.EditMode;
import org.openconcerto.sql.view.list.AutoCompletionManager;
import org.openconcerto.sql.view.list.CellDynamicModifier;
import org.openconcerto.sql.view.list.RowValuesTable;
93,7 → 93,6
import java.math.RoundingMode;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Collection;
import java.util.Date;
658,16 → 657,15
};
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 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);
 
680,24 → 678,23
};
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() {
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);
}
});
 
final SQLTableElement totalPoidsBrut = new SQLTableElement(e.getTable().getField("T_POIDS_BRUT"), BigDecimal.class) {
@Override
public TableCellRenderer getTableCellRenderer() {
708,14 → 705,14
list.add(totalPoidsBrut);
 
tareColis.addModificationListener(totalPoidsBrut);
// poidsColis.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 BigDecimal tare = row.getBigDecimal("TARE");
// final int qte = row.getInt("QTE");
// final BigDecimal pdsColis = row.getBigDecimal("POIDS_COLIS_NET");
final int qte = row.getInt("QTE");
final BigDecimal pdsColis = row.getBigDecimal("POIDS_COLIS_NET");
final Object o3 = row.getObject("NB_COLIS");
 
BigDecimal pdsBrutTotal = BigDecimal.ZERO;
724,16 → 721,14
pdsBrutTotal = new BigDecimal(row.getFloat("T_POIDS"));
}
 
if (tare != null && o3 != null) {
if (tare != null) {
pdsBrutTotal = pdsBrutTotal.add(tare.multiply(new BigDecimal(qte)));
}
 
if (pdsColis != null && o3 != null) {
int nb = (Integer) o3;
pdsBrutTotal = pdsBrutTotal.add(tare.multiply(new BigDecimal(nb)));
pdsBrutTotal = pdsBrutTotal.add(pdsColis.multiply(new BigDecimal(nb), DecimalUtils.HIGH_PRECISION));
}
 
// 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);
}
});
965,7 → 960,7
 
final RowValuesTableModel model = new RowValuesTableModel(e, list, e.getTable().getField("ID_TAXE"), false, defaultRowVals) {
@Override
public void commitData() throws SQLException {
public void commitData() {
int size = getRowCount();
for (int i = 0; i < size; i++) {
SQLRowValues rowVals = getRowValuesAt(i);
977,29 → 972,6
}
super.commitData(true);
}
 
@Override
public List<SQLRowValues> fetchDataFromDB(SQLRowAccessor rowVals, SQLField referentField, SQLField fieldWhere, Object value) {
List<SQLRowValues> newRows = new ArrayList<>();
final SQLTable table = getSQLElement().getTable();
SQLRowValues rowValsItem = new SQLRowValues(table);
rowValsItem.putNulls(table.getFieldsName());
rowValsItem.putRowValues("ID_ARTICLE").putNulls("ID", "CODE", "NOM", "ID_FAMILLE_ARTICLE", "DLC_REQUIS", "DLUO_REQUIS", "NUMERO_LOT_REQUIS", "NUMERO_SERIE_REQUIS");
if (table.contains("ID_UNITE_VENTE")) {
rowValsItem.putRowValues("ID_UNITE_VENTE").putNulls("A_LA_PIECE");
}
 
if (referentField == null) {
referentField = table.getField("ID_" + rowVals.getTable().getName());
}
final List<SQLRowValues> fetch = SQLRowValuesListFetcher.create(rowValsItem).fetch(new Where(referentField, "=", rowVals.getID()));
for (SQLRowValues row2 : fetch) {
if (fieldWhere == null || CompareUtils.equals(row2.getObject(fieldWhere.getName()), value)) {
newRows.add(row2);
}
}
return newRows;
}
};
setModel(model);
 
1195,10 → 1167,7
}
});
}
 
ComboSQLRequest req = new ComboSQLRequest(sqlTableArticle, Arrays.asList("NOM", "CODE"));
req.setSelectTransf(selTrans);
final AutoCompletionManager m2 = new ItemAutoCompletionManager(this, tableElementNom, sqlTableArticle.getField("NOM"), this.table, this.table.getRowValuesTableModel(), req);
final AutoCompletionManager m2 = new ItemAutoCompletionManager(this, tableElementNom, sqlTableArticle.getField("NOM"), this.table, this.table.getRowValuesTableModel());
m2.fill("CODE", "CODE");
m2.fill("ID", "ID_ARTICLE");
for (String string : completionField) {
1235,7 → 1204,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();
}
1688,13 → 1657,13
}
 
@Override
public void barcodeRead(Barcode barcode) {
public void barcodeRead(String 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"), "=", barcode.getData()));
w = w.and(new Where(tableArticle.getField("CODE_BARRE"), "=", code));
selArticle.setWhere(w);
List<SQLRow> l2 = SQLRowListRSH.execute(selArticle);
if (l2.size() > 0) {
1740,11 → 1709,14
if (rowValsSel != null) {
SQLRowAccessor foreignArt = rowValsSel.getForeign("ID_ARTICLE");
if (foreignArt != null && !foreignArt.isUndefined()) {
StockConsultPanel panel = new StockConsultPanel(getSQLElement().getForeignElement("ID_ARTICLE"), foreignArt);
PanelFrame frame = new PanelFrame(panel, "Consultation du stock");
SQLRowAccessor rowValsStock = StockSQLElement.getStock(rowValsSel);
if (rowValsStock != null && !rowValsStock.isUndefined()) {
EditFrame frame = new EditFrame(table.getRowValuesTableModel().getSQLElement().getDirectory().getElement("STOCK"), EditMode.READONLY);
frame.selectionId(rowValsStock.getID());
frame.setVisible(true);
}
}
}
} catch (Exception e) {
ExceptionHandler.handle("Erreur d'accès au stock", e);
}
2172,7 → 2144,7
}
}
 
BigDecimal remise = row.getBigDecimal("POURCENT_REMISE") == null ? BigDecimal.ZERO : row.getBigDecimal("POURCENT_REMISE");
BigDecimal remise = BigDecimal.ZERO;
 
if (rowA != null && !rowA.isUndefined() && rowA.getTable().getDBRoot().contains("TARIF_QUANTITE")) {
Collection<? extends SQLRowAccessor> col = rowA.getReferentRows(rowA.getTable().getTable("TARIF_QUANTITE"));
2231,19 → 2203,16
}
} else {
if (result != null) {
// Index -1 if drag'n'drop from xls (use completion to fillrowvalues and the row is
// not in
// Table)
if (index != -1) {
getRowValuesTable().getRowValuesTableModel().putValue(remise, index, "POURCENT_REMISE");
}
return result;
} else {
if (index != -1) {
getRowValuesTable().getRowValuesTableModel().putValue(remise, index, "POURCENT_REMISE");
}
final BigDecimal prixVT = row.getBigDecimal("PRIX_METRIQUE_VT_1");
if (fromCompletion) {
if (rowA != null && !rowA.isUndefined()) {
// TODO si le prix est différent de celui la rowvalues, afficher une popup pour
// prévenir l'utilisateur
return rowA.getObject("PRIX_METRIQUE_VT_1");
} else if (fromCompletion) {
return null;
} else {
return prixVT;
/trunk/OpenConcerto/src/org/openconcerto/erp/core/common/ui/ItemAutoCompletionManager.java
18,7 → 18,6
import org.openconcerto.sql.model.SQLRow;
import org.openconcerto.sql.model.SQLRowAccessor;
import org.openconcerto.sql.model.SQLRowValues;
import org.openconcerto.sql.request.ComboSQLRequest;
import org.openconcerto.sql.view.list.AutoCompletionManager;
import org.openconcerto.sql.view.list.RowValuesTable;
import org.openconcerto.sql.view.list.RowValuesTableModel;
37,12 → 36,6
this.t = t;
}
 
public ItemAutoCompletionManager(AbstractVenteArticleItemTable t, SQLTableElement tableElementCode, SQLField field, RowValuesTable table, RowValuesTableModel rowValuesTableModel,
ComboSQLRequest req) {
super(tableElementCode, field, table, rowValuesTableModel, req);
this.t = t;
}
 
public ItemAutoCompletionManager(AbstractVenteArticleItemTable t, SQLTableElement tableElementArticle, SQLField field, RowValuesTable table, RowValuesTableModel rowValuesTableModel,
int modeContains, boolean b, boolean c, ValidStateChecker validStateChecker) {
super(tableElementArticle, field, table, rowValuesTableModel, modeContains, b, c, validStateChecker);
64,9 → 57,6
} else {
if (piece && toField.equals("QTE_UNITAIRE")) {
to.put(toField, BigDecimal.ONE);
// On ne remet la quantité par défaut que si la quantité est égale à 1 pour ne
// pas écraser une valeur déjà saisie
if (to.getObject("QTE") == null || to.getInt("QTE") == 1) {
// Pour les pièces commercials de vente
to.put("QTE", from.getBigDecimal("QTE_UNITAIRE").setScale(0, RoundingMode.HALF_UP).intValue());
// Pour les bons de livraison
73,14 → 63,7
if (to.getTable().getName().equals("BON_DE_LIVRAISON_ELEMENT")) {
to.put("QTE_A_LIVRER", from.getBigDecimal("QTE_UNITAIRE").setScale(0, RoundingMode.HALF_UP).intValue());
}
}
} else if (toField.equals("QTE_UNITAIRE")) {
if (to.getObject("QTE_UNITAIRE") == null || to.getBigDecimal("QTE_UNITAIRE").equals(BigDecimal.ONE)) {
to.put(toField, valueFrom);
}
 
} else {
 
to.put(toField, valueFrom);
}
}
98,12 → 81,8
boolean piece = from.getForeignID("ID_UNITE_VENTE") == UniteVenteArticleSQLElement.A_LA_PIECE;
if (piece) {
if (field.equals("QTE")) {
if (rowDest.getObject("QTE") == null || rowDest.getInt("QTE") == 1) {
return from.getBigDecimal("QTE_UNITAIRE").setScale(0, RoundingMode.HALF_UP).intValue();
} else {
return rowDest.getObject("QTE");
}
}
if (field.equals("QTE_UNITAIRE")) {
return BigDecimal.ONE;
}
/trunk/OpenConcerto/src/org/openconcerto/erp/core/common/ui/DeviseField.java
1,7 → 1,7
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved.
* Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
*
* The contents of this file are subject to the terms of the GNU General Public License Version 3
* only ("GPL"). You may not use this file except in compliance with the License. You can obtain a
273,11 → 273,4
public boolean isDocTransversable() {
return false;
}
 
@Override
public void setText(String t) {
if (!this.getText().equals(t)) {
super.setText(t);
}
}
}
/trunk/OpenConcerto/src/org/openconcerto/erp/core/common/ui/AjoutDeclinaisonTableModel.java
162,10 → 162,10
final List<SQLRowAccessor> rowsVariant1 = new ArrayList<SQLRowAccessor>();
final List<SQLRowAccessor> rowsVariant2 = new ArrayList<SQLRowAccessor>();
for (SQLRowValues r : values) {
final SQLRowAccessor v1 = r.getNonEmptyForeign(variant1.getFieldName());
final SQLRowAccessor v1 = r.getForeign(variant1.getFieldName());
if (v1 != null)
rowsVariant1.add(v1);
final SQLRowAccessor v2 = r.getNonEmptyForeign(variant2.getFieldName());
final SQLRowAccessor v2 = r.getForeign(variant2.getFieldName());
if (v2 != null)
rowsVariant2.add(v2);
}
216,8 → 216,8
final Integer[][] tQuantites = new Integer[tNomsVariants1.size()][tNomsVariants2.size()];
final SQLRowValues[][] tArticles = new SQLRowValues[tNomsVariants1.size()][tNomsVariants2.size()];
for (SQLRowValues r : values) {
final SQLRowAccessor v1 = r.getNonEmptyForeign(variant1.getFieldName());
final SQLRowAccessor v2 = r.getNonEmptyForeign(variant2.getFieldName());
final SQLRowAccessor v1 = r.getForeign(variant1.getFieldName());
final SQLRowAccessor v2 = r.getForeign(variant2.getFieldName());
if (v1 != null && v2 != null) {
final Integer idVariant1 = v1.getID();
final Integer idVariant2 = v2.getID();
/trunk/OpenConcerto/src/org/openconcerto/erp/core/common/ui/AjoutDeclinaisonButton.java
13,6 → 13,7
package org.openconcerto.erp.core.common.ui;
 
import org.openconcerto.erp.core.finance.tax.model.TaxeCache;
import org.openconcerto.erp.core.sales.product.element.ReferenceArticleSQLElement;
import org.openconcerto.sql.model.DBRoot;
import org.openconcerto.sql.model.SQLField;
39,10 → 40,8
import java.beans.PropertyChangeListener;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
104,19 → 103,6
combo.uiInit(comboModel);
 
p.add(combo, c);
 
final NumericTextField fieldHT = new NumericTextField();
 
List<String> venteItemsTable = Arrays.asList("DEVIS_ELEMENT", "COMMANDE_CLIENT_ELEMENT", "BON_DE_LIVRAISON_ELEMENT", "SAISIE_VENTE_FACTURE_ELEMENT");
if (venteItemsTable.contains(this.itemTable.getSQLElement().getTable().getName())) {
c.gridy++;
c.gridx = 0;
c.weightx = 0;
p.add(new JLabel("Forcer le prix de vente HT à", SwingConstants.RIGHT), c);
c.gridx++;
c.weightx = 1;
p.add(fieldHT, c);
}
// Ligne 2 : table
AjoutDeclinaisonTableModel model = new AjoutDeclinaisonTableModel();
JTable table = new JTable(model);
160,12 → 146,10
 
// Ligne 3: boutons
final JButton bAnnuler = new JButton("Annuler");
final JButton bInserer = new JButton("Insérer");
final JButton bAjouter = new JButton("Ajouter");
final JPanel buttons = new JPanel();
buttons.setLayout(new FlowLayout());
buttons.add(bAnnuler);
buttons.add(bInserer);
buttons.add(bAjouter);
c.anchor = GridBagConstraints.SOUTHEAST;
c.gridy++;
232,49 → 216,22
 
@Override
public void run() {
fetchAndClose(f, model, fieldHT, false);
fetchAndClose(f, model);
}
});
 
}
 
});
 
bInserer.addActionListener(new ActionListener() {
 
@Override
public void actionPerformed(ActionEvent e) {
CellEditor cellEditor = table.getCellEditor();
if (cellEditor != null && table.isEditing()) {
cellEditor.stopCellEditing();
}
SwingUtilities.invokeLater(new Runnable() {
 
@Override
public void run() {
fetchAndClose(f, model, fieldHT, true);
}
});
 
}
 
});
 
}
 
private void fetchAndClose(final JFrame f, AjoutDeclinaisonTableModel model, NumericTextField fieldHT, boolean insert) {
private void fetchAndClose(final JFrame f, AjoutDeclinaisonTableModel model) {
final RowValuesTableModel rowValuesTableModel = itemTable.getRowValuesTable().getRowValuesTableModel();
List<SQLRowValues> values = model.getFilledArticles(rowValuesTableModel.getSQLElement().getTable());
System.err.println("AjoutDeclinaisonButton.actionPerformed(...).new ActionListener() {...}.actionPerformed() TODO : remplir et ajouter : " + values);
// TODO remplir et ajouter au table model
List<Number> idsArt = new ArrayList<Number>();
 
// LinkedHashMap pour respecter l'ordre d'insertion dans la table
Map<Number, SQLRowValues> mapArtFecthed = new LinkedHashMap<>();
Map<Number, Integer> mapQte = new HashMap<>();
for (SQLRowValues sqlRowValues : values) {
final Number foreignIDNumber = sqlRowValues.getForeignIDNumber("ID_ARTICLE");
idsArt.add(foreignIDNumber);
mapArtFecthed.put(foreignIDNumber, null);
mapQte.put(foreignIDNumber, sqlRowValues.getInt("QTE"));
}
 
283,48 → 240,34
SQLRowValues rowValsArtFetch = new SQLRowValues(rowValuesTableModel.getSQLElement().getTable().getForeignTable("ID_ARTICLE"));
rowValsArtFetch.putNulls(rowValsArtFetch.getTable().getFieldsName());
List<SQLRowValues> artsFetched = SQLRowValuesListFetcher.create(rowValsArtFetch).fetch(new Where(rowValsArtFetch.getTable().getKey(), idsArt));
 
for (SQLRowValues sqlRowValues : artsFetched) {
mapArtFecthed.put(sqlRowValues.getIDNumber(), sqlRowValues);
}
 
int added = 0;
for (Number id : mapArtFecthed.keySet()) {
 
SQLRowValues sqlRowValues = mapArtFecthed.get(id);
final SQLRowValues row2Insert = new SQLRowValues(itemTable.getDefaultRowValues());
row2Insert.put("ID_ARTICLE", sqlRowValues.getID());
row2Insert.put("QTE", Math.round(mapQte.get(sqlRowValues.getIDNumber())));
row2Insert.put("CODE", sqlRowValues.getObject("CODE"));
row2Insert.put("NOM", sqlRowValues.getObject("NOM"));
final int rowCount = itemTable.getRowValuesTable().getRowValuesTableModel().getRowCount();
final int rowIndexSel = itemTable.getRowValuesTable().getSelectedRow();
int index;
if (rowIndexSel >= 0 && insert) {
index = rowIndexSel + 1 + added;
added++;
itemTable.getRowValuesTable().getRowValuesTableModel().addRowAt(index, row2Insert);
} else {
index = rowCount;
itemTable.getRowValuesTable().getRowValuesTableModel().addRowAt(rowCount, row2Insert);
}
itemTable.getRowValuesTable().getRowValuesTableModel().addRowAt(itemTable.getRowValuesTable().getRowValuesTableModel().getRowCount(), row2Insert);
// Completion depuis l'article trouvé
System.err.println("AjoutDeclinaisonButton.actionPerformed(...).new ActionListener() {...}.fetchAndClose()");
 
itemTable.getCodeCompletionManager().fillRowValues(sqlRowValues, fieldsFrom, row2Insert);
 
itemTable.getRowValuesTable().getRowValuesTableModel().putValue(Math.round(mapQte.get(sqlRowValues.getIDNumber())), index, "QTE");
row2Insert.put("QTE", Math.round(mapQte.get(sqlRowValues.getIDNumber())));
if (row2Insert.contains("PV_HT") && row2Insert.getObject("PV_HT") != null) {
row2Insert.put("T_PV_HT", row2Insert.getBigDecimal("PV_HT").multiply(new BigDecimal(row2Insert.getInt("QTE"))));
if (row2Insert.contains("ID_TAXE") && row2Insert.getObject("ID_TAXE") != null) {
float taux = TaxeCache.getCache().getTauxFromId(row2Insert.getForeignID("ID_TAXE"));
row2Insert.put("T_PV_TTC", row2Insert.getBigDecimal("T_PV_HT").multiply(new BigDecimal(taux)));
}
}
 
if (fieldHT.getText().length() > 0) {
itemTable.getRowValuesTable().getRowValuesTableModel().putValue(new BigDecimal(fieldHT.getText()), index, "PRIX_METRIQUE_VT_1");
} else {
// On reforce le prix pour la complétion des tarifs spéciaux
final SQLRowValues rowValuesAt = itemTable.getRowValuesTable().getRowValuesTableModel().getRowValuesAt(index);
itemTable.getRowValuesTable().getRowValuesTableModel().putValue(rowValuesAt.getBigDecimal("PRIX_METRIQUE_VT_1"), index, "PV_HT");
}
}
// Fermeture de la fenetre
f.dispose();