OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Comparer les révisions

Ignorer les espaces blanc Révision 127 → Révision 128

/trunk/Modules/Module Project/.classpath
2,6 → 2,6
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry combineaccessrules="false" kind="src" path="/OpenConcerto GoogleCode"/>
<classpathentry combineaccessrules="false" kind="src" path="/OpenConcerto"/>
<classpathentry kind="output" path="bin"/>
</classpath>
/trunk/Modules/Module Project/src/org/openconcerto/modules/project/element/ProjectSQLElement.java
22,8 → 22,8
import org.openconcerto.sql.view.EditFrame;
import org.openconcerto.ui.JDate;
import org.openconcerto.ui.component.ITextArea;
import org.openconcerto.utils.CollectionMap;
import org.openconcerto.utils.ExceptionHandler;
import org.openconcerto.utils.ListMap;
 
public class ProjectSQLElement extends ComptaSQLConfElement {
 
52,8 → 52,8
}
 
@Override
public CollectionMap<String, String> getShowAs() {
return CollectionMap.singleton(null, getComboFields());
public ListMap<String, String> getShowAs() {
return ListMap.singleton(null, getComboFields());
}
 
@Override
/trunk/Modules/Module Project/src/org/openconcerto/modules/project/element/ProjectStateSQLElement.java
6,7 → 6,7
import org.openconcerto.erp.core.common.element.ComptaSQLConfElement;
import org.openconcerto.sql.element.SQLComponent;
import org.openconcerto.sql.element.UISQLComponent;
import org.openconcerto.utils.CollectionMap;
import org.openconcerto.utils.ListMap;
 
public class ProjectStateSQLElement extends ComptaSQLConfElement {
public static int A_TRAITER = 2;
34,8 → 34,8
}
 
@Override
public CollectionMap<String, String> getShowAs() {
return CollectionMap.singleton(null, getComboFields());
public ListMap<String, String> getShowAs() {
return ListMap.singleton(null, getComboFields());
}
 
@Override
/trunk/Modules/Module Project/src/org/openconcerto/modules/project/element/ProjectTypeSQLElement.java
6,7 → 6,7
import org.openconcerto.erp.core.common.element.ComptaSQLConfElement;
import org.openconcerto.sql.element.SQLComponent;
import org.openconcerto.sql.element.UISQLComponent;
import org.openconcerto.utils.CollectionMap;
import org.openconcerto.utils.ListMap;
 
public class ProjectTypeSQLElement extends ComptaSQLConfElement {
 
29,8 → 29,8
}
 
@Override
public CollectionMap<String, String> getShowAs() {
return CollectionMap.singleton(null, getComboFields());
public ListMap<String, String> getShowAs() {
return ListMap.singleton(null, getComboFields());
}
 
@Override
/trunk/Modules/Module Project/src/org/openconcerto/modules/project/Module.java
57,6 → 57,7
import org.openconcerto.sql.model.SQLTableEvent.Mode;
import org.openconcerto.sql.model.SQLTableModifiedListener;
import org.openconcerto.sql.model.Where;
import org.openconcerto.sql.model.graph.Link.Direction;
import org.openconcerto.sql.model.graph.Path;
import org.openconcerto.sql.utils.SQLCreateTable;
import org.openconcerto.sql.view.EditFrame;
289,6 → 290,93
 
NumerotationAutoSQLElement.addClass(ProjectSQLElement.class, PROJECT_TABLENAME);
 
for (String tableName : this.listTableAffaire) {
if (!tableName.equalsIgnoreCase("DEVIS")) {
final SQLElement elt = dir.getElement(tableName);
RowAction action = new RowAction(new AbstractAction("Historique affaire") {
@Override
public void actionPerformed(ActionEvent e) {
ProjectHistory histo = new ProjectHistory();
histo.getHistoriquePanel().selectIDinJList(IListe.get(e).getSelectedRow().getForeignID("ID_AFFAIRE"));
histo.getFrame().setVisible(true);
}
}, false) {
@Override
public boolean enabledFor(IListeEvent evt) {
if (evt.getSelectedRows().size() == 1) {
SQLRowAccessor r = evt.getSelectedRow();
return !r.isForeignEmpty("ID_AFFAIRE");
}
return false;
}
};
 
elt.getRowActions().add(action);
elt.addListColumn(new BaseSQLTableModelColumn("Affaire", String.class) {
 
@Override
protected Object show_(SQLRowAccessor r) {
if (!r.isForeignEmpty("ID_AFFAIRE") && r.getForeign("ID_AFFAIRE") != null) {
return r.getForeign("ID_AFFAIRE").getString("NUMERO");
} else {
return "";
}
}
 
@Override
public Set<FieldPath> getPaths() {
SQLTable table = elt.getTable();
Path p = new Path(table).add(table.getField("ID_AFFAIRE"));
return CollectionUtils.createSet(new FieldPath(p, "NUMERO"));
}
});
}
}
 
final SQLElement elt = dir.getElement("DEVIS");
RowAction action = new RowAction(new AbstractAction("Historique affaire") {
@Override
public void actionPerformed(ActionEvent e) {
ProjectHistory histo = new ProjectHistory();
SQLRowAccessor selectedRow = IListe.get(e).getSelectedRow();
Collection<? extends SQLRowAccessor> l = selectedRow.getReferentRows(selectedRow.getTable().getTable("AFFAIRE"));
histo.getHistoriquePanel().selectIDinJList(l.iterator().next().getID());
histo.getFrame().setVisible(true);
}
}, false) {
@Override
public boolean enabledFor(IListeEvent evt) {
if (evt.getSelectedRows().size() == 1) {
SQLRowAccessor r = evt.getSelectedRow();
Collection<? extends SQLRowAccessor> l = r.getReferentRows(r.getTable().getTable("AFFAIRE"));
return l.size() > 0;
}
return false;
}
};
 
elt.getRowActions().add(action);
 
elt.addListColumn(new BaseSQLTableModelColumn("Affaire", String.class) {
 
@Override
protected Object show_(SQLRowAccessor r) {
Collection<? extends SQLRowAccessor> rows = r.getReferentRows(elt.getTable().getTable("AFFAIRE"));
if (rows.size() == 1) {
return rows.iterator().next().getString("NUMERO");
} else {
return "";
}
}
 
@Override
public Set<FieldPath> getPaths() {
SQLTable table = elt.getTable();
Path p = new Path(table).add(table.getTable("AFFAIRE"), Direction.REFERENT);
return CollectionUtils.createSet(new FieldPath(p, "NUMERO"));
}
});
 
new QuoteToOrderSQLInjector();
new QuoteToInvoiceSQLInjector();
new OrderToInvoiceSQLInjector();
401,7 → 489,6
try {
rowVals.update();
} catch (SQLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
selectedRow.getTable().fireTableModified(selectedRow.getID());
/trunk/Modules/Module Project/src/org/openconcerto/modules/project/ProjectHistory.java
8,6 → 8,7
import java.awt.event.WindowEvent;
import java.io.File;
import java.util.Arrays;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
35,6 → 36,12
return this.listPanel;
}
 
private static Map<String, List<String>> moduleTab = new HashMap<String, List<String>>();
 
public static void addTab(String tabName, List<String> table) {
moduleTab.put(tabName, table);
}
 
public ProjectHistory() {
 
final ComptaPropsConfiguration comptaPropsConfiguration = ((ComptaPropsConfiguration) Configuration.getInstance());
45,11 → 52,14
mapList.put("Bons de commande", Arrays.asList("COMMANDE_CLIENT"));
mapList.put("Factures", Arrays.asList("SAISIE_VENTE_FACTURE"));
mapList.put("Avoirs", Arrays.asList("AVOIR_CLIENT"));
mapList.put("Achats", Arrays.asList("SAISIE_ACHAT"));
 
if (Configuration.getInstance().getRoot().findTable("AFFAIRE_TEMPS") != null) {
mapList.put("Temps", Arrays.asList("AFFAIRE_TEMPS"));
}
 
mapList.putAll(moduleTab);
 
final ComboSQLRequest request = new org.openconcerto.sql.request.ComboSQLRequest(b.getTable("AFFAIRE"), Arrays.asList("NUMERO", "ID_CLIENT"));
request.setUndefLabel("Toutes les affaires");
request.setFieldSeparator(" ");