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 151 → Révision 152

/trunk/Modules/Module Project/.settings/org.eclipse.jdt.core.prefs
1,11 → 1,7
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.6
org.eclipse.jdt.core.compiler.source=1.8
/trunk/Modules/Module Project/.classpath
2,6 → 2,6
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry combineaccessrules="false" kind="src" path="/OpenConcerto"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="output" path="bin"/>
</classpath>
/trunk/Modules/Module Project/src/org/openconcerto/modules/project/Module.java
1,8 → 1,15
package org.openconcerto.modules.project;
 
import java.awt.Color;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.io.IOException;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Arrays;
13,9 → 20,12
import java.util.Set;
 
import javax.swing.AbstractAction;
import javax.swing.JButton;
import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.SwingUtilities;
 
51,7 → 61,9
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.SQLTableEvent;
import org.openconcerto.sql.model.SQLTableEvent.Mode;
59,9 → 71,12
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.request.ComboSQLRequest;
import org.openconcerto.sql.sqlobject.SQLRequestComboBox;
import org.openconcerto.sql.utils.AlterTable;
import org.openconcerto.sql.utils.SQLCreateTable;
import org.openconcerto.sql.view.EditFrame;
import org.openconcerto.sql.view.EditPanel.EditMode;
import org.openconcerto.sql.view.IListFrame;
import org.openconcerto.sql.view.ListeAddPanel;
import org.openconcerto.sql.view.column.ColumnFooterRenderer;
71,10 → 86,13
import org.openconcerto.sql.view.list.BaseSQLTableModelColumn;
import org.openconcerto.sql.view.list.IListe;
import org.openconcerto.sql.view.list.RowAction;
import org.openconcerto.ui.DefaultGridBagConstraints;
import org.openconcerto.ui.FrameUtil;
import org.openconcerto.ui.PanelFrame;
import org.openconcerto.utils.CollectionUtils;
import org.openconcerto.utils.ExceptionHandler;
import org.openconcerto.utils.Tuple2;
import org.openconcerto.utils.cc.IClosure;
import org.openconcerto.utils.cc.IExnClosure;
import org.openconcerto.utils.cc.ITransformer;
import org.openconcerto.utils.i18n.TranslationManager;
 
81,8 → 99,8
public final class Module extends AbstractModule {
 
public static final String PROJECT_TABLENAME = "AFFAIRE";
private List<String> listTableAffaire = Arrays.asList("DEMANDE_PRIX", "DEMANDE_ACHAT_ELEMENT", "SAISIE_VENTE_FACTURE", "AVOIR_CLIENT", "BON_DE_LIVRAISON", "COMMANDE_CLIENT", "DEVIS", "COMMANDE",
"SAISIE_ACHAT", "AVOIR_FOURNISSEUR");
private List<String> listTableAffaire = Arrays.asList("DEMANDE_PRIX", "BON_RECEPTION", "DEMANDE_ACHAT_ELEMENT", "SAISIE_VENTE_FACTURE", "AVOIR_CLIENT", "BON_DE_LIVRAISON", "COMMANDE_CLIENT",
"DEVIS", "COMMANDE", "SAISIE_ACHAT", "AVOIR_FOURNISSEUR");
 
public Module(ModuleFactory f) throws IOException {
super(f);
90,7 → 108,7
}
 
@Override
protected void install(DBContext ctxt) {
protected void install(DBContext ctxt) throws SQLException, IOException {
super.install(ctxt);
 
if (ctxt.getLastInstalledVersion() == null) {
121,62 → 139,50
alter.addForeignColumn("ID_AFFAIRE", createTable);
}
}
ctxt.manipulateData(new IClosure<DBRoot>() {
 
ctxt.manipulateData(new IExnClosure<DBRoot, SQLException>() {
 
@Override
public void executeChecked(DBRoot input) {
public void executeChecked(DBRoot input) throws SQLException {
// Undefined Affaire
SQLTable tableAff = input.getTable(PROJECT_TABLENAME);
SQLRowValues rowVals = new SQLRowValues(tableAff);
try {
rowVals.insert();
} catch (SQLException exn) {
// TODO Bloc catch auto-généré
exn.printStackTrace();
}
rowVals.insert();
 
// Etat Affaire
SQLTable tableTypeAffaire = input.getTable("TYPE_AFFAIRE");
rowVals = new SQLRowValues(tableTypeAffaire);
try {
rowVals.put("NOM", "Indéfini");
rowVals.insert();
} catch (SQLException exn) {
// TODO Bloc catch auto-généré
exn.printStackTrace();
}
rowVals.put("NOM", "Indéfini");
rowVals.insert();
 
// Etat Affaire
SQLTable tableEtatAffaire = input.getTable("ETAT_AFFAIRE");
rowVals = new SQLRowValues(tableEtatAffaire);
try {
rowVals.put("NOM", "Indéfini");
rowVals.insert();
rowVals.put("NOM", "Indéfini");
rowVals.insert();
 
rowVals.clear();
rowVals.put("NOM", "A traiter");
rowVals.insert();
rowVals.clear();
rowVals.put("NOM", "A traiter");
rowVals.insert();
 
rowVals.clear();
rowVals.put("NOM", "En cours");
rowVals.insert();
rowVals.clear();
rowVals.put("NOM", "En cours");
rowVals.insert();
 
rowVals.clear();
rowVals.put("NOM", "Traitement terminé");
rowVals.insert();
rowVals.clear();
rowVals.put("NOM", "Traitement terminé");
rowVals.insert();
 
rowVals.clear();
rowVals.put("NOM", "A facturer");
rowVals.insert();
rowVals.clear();
rowVals.put("NOM", "A facturer");
rowVals.insert();
 
rowVals.clear();
rowVals.put("NOM", "Dossier clos");
rowVals.insert();
} catch (SQLException exn) {
exn.printStackTrace();
}
 
rowVals.clear();
rowVals.put("NOM", "Dossier clos");
rowVals.insert();
}
});
 
}
}
 
307,6 → 313,7
histo.getFrame().setVisible(true);
}
}, false) {
 
@Override
public boolean enabledFor(IListeEvent evt) {
if (evt.getSelectedRows().size() == 1) {
350,6 → 357,7
histo.getFrame().setVisible(true);
}
}, false) {
 
@Override
public boolean enabledFor(IListeEvent evt) {
if (evt.getSelectedRows().size() == 1) {
382,13 → 390,17
return CollectionUtils.createSet(new FieldPath(p, "NUMERO"));
}
});
 
new CmdToBrSQLInjector();
new QuoteToOrderSQLInjector();
new QuoteToInvoiceSQLInjector();
new OrderToInvoiceSQLInjector();
}
 
public void checkAffaire(int id) {
public static JFrame checkAffaire(int id) {
return checkAffaire(id, true);
}
 
public static JFrame checkAffaire(int id, final boolean createCommandeClient) {
final SQLTable tableDevis = Configuration.getInstance().getRoot().findTable("DEVIS");
final SQLTable tableNum = Configuration.getInstance().getRoot().findTable("NUMEROTATION_AUTO");
final SQLRow row = tableDevis.getRow(id);
396,38 → 408,105
if (rowAffaire == null || rowAffaire.isUndefined()) {
if (row.getInt("ID_ETAT_DEVIS") == EtatDevisSQLElement.ACCEPTE) {
// FIXME Vérifier si le devis n'est pas déjà rattaché à une affaire
final SQLTable table = tableDevis.getTable(PROJECT_TABLENAME);
final SQLRowValues rowVals = new SQLRowValues(table);
 
final String nextNumero = NumerotationAutoSQLElement.getNextNumero(ProjectSQLElement.class);
rowVals.put("NUMERO", nextNumero);
JPanel p = new JPanel(new GridBagLayout());
GridBagConstraints c = new DefaultGridBagConstraints();
c.gridwidth = GridBagConstraints.REMAINDER;
p.add(new JLabel("Voulez vous intégrer ce devis sur une affaire existante?"), c);
c.gridy++;
c.gridwidth = 1;
p.add(new JLabel("Rattacher à l'affaire : "), c);
c.gridx++;
final SQLRequestComboBox box = new SQLRequestComboBox();
final ComboSQLRequest comboRequest = Configuration.getInstance().getDirectory().getElement("AFFAIRE").getComboRequest(true);
Where w = new Where(comboRequest.getPrimaryTable().getField("ID_CLIENT"), "=", row.getForeignID("ID_CLIENT"));
comboRequest.setWhere(w);
box.uiInit(comboRequest);
p.add(box, c);
c.gridy++;
c.gridx = 0;
final JButton buttonApply = new JButton("Appliquer");
JButton buttonAnnuler = new JButton("Nouvelle affaire");
p.add(buttonApply, c);
buttonApply.setEnabled(false);
box.addValueListener(new PropertyChangeListener() {
 
// incrémentation du numéro auto
final SQLRowValues rowValsNum = new SQLRowValues(tableNum);
int val = tableNum.getRow(2).getInt(NumerotationAutoSQLElement.getLabelNumberFor(ProjectSQLElement.class));
val++;
rowValsNum.put(NumerotationAutoSQLElement.getLabelNumberFor(ProjectSQLElement.class), new Integer(val));
try {
rowValsNum.update(2);
} catch (final SQLException e) {
e.printStackTrace();
}
@Override
public void propertyChange(PropertyChangeEvent evt) {
buttonApply.setEnabled(box.getSelectedRow() != null);
 
rowVals.put("ID_DEVIS", row.getID());
rowVals.put("ID_CLIENT", row.getObject("ID_CLIENT"));
rowVals.put("ID_COMMERCIAL", row.getObject("ID_COMMERCIAL"));
rowVals.put("DATE", new Date());
rowVals.put("ID_ETAT_AFFAIRE", ProjectStateSQLElement.EN_COURS);
}
});
c.gridx++;
p.add(buttonAnnuler, c);
final PanelFrame f = new PanelFrame(p, "Affection d'un devis à une affaire");
 
SQLRowValues rowValsDevis = row.asRowValues();
rowValsDevis.put("ID_AFFAIRE", rowVals);
buttonAnnuler.addActionListener(new ActionListener() {
 
try {
rowVals.commit();
} catch (SQLException exn) {
// TODO Bloc catch auto-généré
exn.printStackTrace();
}
@Override
public void actionPerformed(ActionEvent ae) {
f.dispose();
final SQLTable table = tableDevis.getTable(PROJECT_TABLENAME);
final SQLRowValues rowVals = new SQLRowValues(table);
 
final String nextNumero = NumerotationAutoSQLElement.getNextNumero(ProjectSQLElement.class);
rowVals.put("NUMERO", nextNumero);
 
// incrémentation du numéro auto
final SQLRowValues rowValsNum = new SQLRowValues(tableNum);
int val = tableNum.getRow(2).getInt(NumerotationAutoSQLElement.getLabelNumberFor(ProjectSQLElement.class));
val++;
rowValsNum.put(NumerotationAutoSQLElement.getLabelNumberFor(ProjectSQLElement.class), new Integer(val));
try {
rowValsNum.update(2);
} catch (final SQLException e) {
e.printStackTrace();
}
 
rowVals.put("ID_DEVIS", row.getID());
rowVals.put("ID_CLIENT", row.getObject("ID_CLIENT"));
rowVals.put("ID_COMMERCIAL", row.getObject("ID_COMMERCIAL"));
rowVals.put("DATE", new Date());
rowVals.put("ID_ETAT_AFFAIRE", ProjectStateSQLElement.EN_COURS);
 
SQLRowValues rowValsDevis = row.asRowValues();
rowValsDevis.put("ID_AFFAIRE", rowVals);
 
try {
int id = rowVals.commit().getID();
row.fetchValues();
if (createCommandeClient) {
Configuration.getInstance().getDirectory().getElement(DevisSQLElement.class).transfertCommandeClient(Arrays.asList(row.asRowValues()));
EditFrame frame = new EditFrame(Configuration.getInstance().getDirectory().getElement("AFFAIRE"), EditMode.MODIFICATION);
frame.selectionId(id);
FrameUtil.showPacked(frame);
}
} catch (SQLException exn) {
// TODO Bloc catch auto-généré
exn.printStackTrace();
}
}
});
 
buttonApply.addActionListener(new ActionListener() {
 
@Override
public void actionPerformed(ActionEvent e) {
f.dispose();
 
SQLRowValues rowValsDevis = row.asRowValues();
rowValsDevis.put("ID_AFFAIRE", box.getSelectedId());
 
try {
rowValsDevis.commit();
} catch (SQLException exn) {
// TODO Bloc catch auto-généré
exn.printStackTrace();
}
}
});
FrameUtil.show(f);
return f;
}
 
} else if (row.getInt("ID_ETAT_DEVIS") != EtatDevisSQLElement.ACCEPTE) {
439,6 → 518,7
exn.printStackTrace();
}
}
return null;
}
 
List<Integer> idsAsked = new ArrayList<Integer>();
501,6 → 581,7
checkAffaire(selectedRow.getID());
}
}, false, "project.accept") {
 
public boolean enabledFor(List<SQLRowValues> selection) {
if (selection != null && selection.size() == 1) {
if (selection.get(0).getInt("ID_ETAT_DEVIS") == EtatDevisSQLElement.EN_ATTENTE) {
509,13 → 590,15
}
return false;
};
 
};
}
 
@Override
protected void setupComponents(final ComponentsContext ctxt) {
 
DBRoot root = ComptaPropsConfiguration.getInstanceCompta().getRootSociete();
List<String> table2check = Arrays.asList("DEMANDE_PRIX", "DEMANDE_ACHAT_ELEMENT");
List<String> table2check = Arrays.asList("BON_RECEPTION", "DEMANDE_PRIX", "DEMANDE_ACHAT_ELEMENT");
for (String table : table2check) {
if (root.contains(table)) {
SQLTable tableCR = root.getTable(table);
535,6 → 618,7
}
}
}
 
for (String table : this.listTableAffaire) {
if (!table.equalsIgnoreCase("DEVIS"))
ctxt.putAdditionalField(table, "ID_AFFAIRE");
567,164 → 651,152
}
}, MainFrame.CREATE_MENU);
 
// ctxt.addMenuItem(new AbstractAction("Export Affaire") {
// @Override
// public void actionPerformed(ActionEvent e) {
// ProjectImportExport importExport = new
// ProjectImportExport(ctxt.getElement("AFFAIRE").getTable().getDBRoot());
// importExport.export();
// }
// }, MainFrame.HELP_MENU);
//
// ctxt.addMenuItem(new AbstractAction("Import Affaire") {
// @Override
// public void actionPerformed(ActionEvent e) {
// ProjectImportExport importExport = new
// ProjectImportExport(ctxt.getElement("AFFAIRE").getTable().getDBRoot());
// importExport.importProjects();
// }
// }, MainFrame.HELP_MENU);
//
// ctxt.addMenuItem(new AbstractAction("Fix ID_AFFAIRE") {
// @Override
// public void actionPerformed(ActionEvent e) {
// {
// SQLTable tableCmd = ctxt.getElement("COMMANDE_CLIENT").getTable();
// SQLSelect selBadCmd = new SQLSelect();
// selBadCmd.addSelect(tableCmd.getKey());
// selBadCmd.addSelect(tableCmd.getField("ID_AFFAIRE"));
// SQLSelectJoin joinTR = selBadCmd.addBackwardJoin("RIGHT", "tr",
// tableCmd.getTable().getTable("TR_DEVIS").getField("ID_COMMANDE_CLIENT"), null);
// SQLSelectJoin joinDevis = selBadCmd.addJoin("LEFT",
// joinTR.getJoinedTable().getField("ID_DEVIS"));
// SQLSelectJoin joinAff = selBadCmd.addBackwardJoin("LEFT", "aff",
// tableCmd.getTable().getTable("AFFAIRE").getField("ID_DEVIS"), null);
// selBadCmd.addSelect(joinAff.getJoinedTable().getKey());
//
// selBadCmd.setWhere(Where.isNull(tableCmd.getField("ID_AFFAIRE")));
// System.err.println(selBadCmd.asString());
//
// List<Object[]> result = (List<Object[]>)
// tableCmd.getDBSystemRoot().getDataSource().executeA(selBadCmd.asString());
// try {
// for (Object[] objects : result) {
// if (objects[2] != null && objects[2].toString().trim().length() > 0)
// tableCmd.getRow(((Number)
// objects[0]).intValue()).createEmptyUpdateRow().put("ID_AFFAIRE", ((Number)
// objects[2]).intValue()).commit();
// }
// } catch (SQLException e1) {
// // TODO Auto-generated catch block
// e1.printStackTrace();
// }
//
// // List<SQLRow> list = SQLRowListRSH.execute(selBadVF);
// }
// {
// SQLTable tableVF = ctxt.getElement("SAISIE_VENTE_FACTURE").getTable();
// SQLSelect selBadVF = new SQLSelect();
// selBadVF.addSelect(tableVF.getKey());
// selBadVF.addSelect(tableVF.getField("ID_AFFAIRE"));
// SQLSelectJoin joinTR = selBadVF.addBackwardJoin("RIGHT", "tr",
// tableVF.getTable().getTable("TR_COMMANDE_CLIENT").getField("ID_SAISIE_VENTE_FACTURE"),
// null);
// SQLSelectJoin joinCmd = selBadVF.addJoin("LEFT",
// joinTR.getJoinedTable().getField("ID_COMMANDE_CLIENT"));
// selBadVF.addSelect(joinCmd.getJoinedTable().getField("ID_AFFAIRE"));
//
// selBadVF.setWhere(Where.isNull(tableVF.getField("ID_AFFAIRE")));
// System.err.println(selBadVF.asString());
// List<Object[]> result = (List<Object[]>)
// tableVF.getDBSystemRoot().getDataSource().executeA(selBadVF.asString());
// try {
// for (Object[] objects : result) {
// if (objects[2] != null && objects[2].toString().trim().length() > 0)
// tableVF.getRow(((Number) objects[0]).intValue()).createEmptyUpdateRow().put("ID_AFFAIRE",
// ((Number) objects[2]).intValue()).commit();
// }
// } catch (SQLException e1) {
// // TODO Auto-generated catch block
// e1.printStackTrace();
// }
// }
// }
// }, MainFrame.CREATE_MENU);
//
// ctxt.addMenuItem(new AbstractAction("Recalcul Total achat facture prorata") {
// @Override
// public void actionPerformed(ActionEvent e) {
//
// {
// final SQLTable table = ctxt.getElement("SAISIE_VENTE_FACTURE").getTable();
// SQLRowValues rowValsFact = new SQLRowValues(table);
// rowValsFact.putNulls("SOLDE", "PARTIAL", "T_HA", "T_HT");
//
// final SQLTable tableCmd = ctxt.getElement("COMMANDE_CLIENT").getTable();
// SQLRowValues rowValsCmd = new SQLRowValues(tableCmd);
// rowValsCmd.putNulls("T_HT");
//
// final SQLTable tableCmdElt = ctxt.getElement("COMMANDE_CLIENT_ELEMENT").getTable();
// SQLRowValues rowValsCmdElt = new SQLRowValues(tableCmdElt);
// rowValsCmdElt.put("ID_COMMANDE_CLIENT", rowValsCmd);
// rowValsCmdElt.putNulls("T_PA_HT", "NIVEAU");
//
// final SQLTable tableTR = table.getTable("TR_COMMANDE_CLIENT");
// SQLRowValues rowValsTR = new SQLRowValues(tableTR);
// rowValsTR.put("ID_SAISIE_VENTE_FACTURE", rowValsFact);
// rowValsTR.put("ID_COMMANDE_CLIENT", rowValsCmd);
//
// SQLRowValuesListFetcher fetcher = SQLRowValuesListFetcher.create(rowValsFact);
// fetcher.appendSelTransf(new ITransformer<SQLSelect, SQLSelect>() {
// @Override
// public SQLSelect transformChecked(SQLSelect input) {
// Where w = new Where(table.getField("SOLDE"), "=", Boolean.TRUE);
// w = w.or(new Where(table.getField("PARTIAL"), "=", Boolean.TRUE));
// input.setWhere(w);
// return input;
// }
// });
//
// List<SQLRowValues> rowVals = fetcher.fetch();
//
// for (SQLRowValues sqlRowValues : rowVals) {
// // Recuperation de la commande
// final Collection<SQLRowValues> referentRows = sqlRowValues.getReferentRows(tableTR);
// if (!referentRows.isEmpty()) {
// SQLRowAccessor rowTR = referentRows.iterator().next();
// SQLRowAccessor rowCmd = rowTR.getForeign("ID_COMMANDE_CLIENT");
// final long htCmd = rowCmd.getLong("T_HT");
// if (htCmd != 0) {
//
// BigDecimal totalHA = BigDecimal.ZERO;
// Collection<? extends SQLRowAccessor> elt = rowCmd.getReferentRows(tableCmdElt);
// for (SQLRowAccessor sqlRowAccessor : elt) {
// if (sqlRowAccessor.getInt("NIVEAU") == 1) {
// totalHA = totalHA.add(sqlRowAccessor.getBigDecimal("T_PA_HT"));
// }
// }
// BigDecimal prorata = new BigDecimal((double) sqlRowValues.getLong("T_HT") / (double)
// htCmd);
// try {
// sqlRowValues.createEmptyUpdateRow().put("T_HA",
// totalHA.multiply(prorata).movePointRight(2).setScale(0,
// RoundingMode.HALF_UP).longValue()).update();
// } catch (SQLException e1) {
// e1.printStackTrace();
// }
// }
// }
// }
// }
// }
// }, MainFrame.CREATE_MENU);
addMenuImportExport(ctxt);
 
}
 
private void addMenuImportExport(final MenuContext ctxt) {
////
 
ctxt.addMenuItem(new AbstractAction("Export Affaire") {
@Override
public void actionPerformed(ActionEvent e) {
ProjectImportExport importExport = new ProjectImportExport(ctxt.getElement("AFFAIRE").getTable().getDBRoot());
importExport.export();
}
}, MainFrame.HELP_MENU);
 
ctxt.addMenuItem(new AbstractAction("Import Affaire") {
@Override
public void actionPerformed(ActionEvent e) {
ProjectImportExport importExport = new ProjectImportExport(ctxt.getElement("AFFAIRE").getTable().getDBRoot());
importExport.importProjects();
}
}, MainFrame.HELP_MENU);
 
ctxt.addMenuItem(new AbstractAction("Fix ID_AFFAIRE") {
@Override
public void actionPerformed(ActionEvent e) {
{
SQLTable tableCmd = ctxt.getElement("COMMANDE_CLIENT").getTable();
SQLSelect selBadCmd = new SQLSelect();
selBadCmd.addSelect(tableCmd.getKey());
selBadCmd.addSelect(tableCmd.getField("ID_AFFAIRE"));
SQLSelectJoin joinTR = selBadCmd.addBackwardJoin("RIGHT", "tr", tableCmd.getTable().getTable("TR_DEVIS").getField("ID_COMMANDE_CLIENT"), null);
SQLSelectJoin joinDevis = selBadCmd.addJoin("LEFT", joinTR.getJoinedTable().getField("ID_DEVIS"));
SQLSelectJoin joinAff = selBadCmd.addBackwardJoin("LEFT", "aff", tableCmd.getTable().getTable("AFFAIRE").getField("ID_DEVIS"), null);
selBadCmd.addSelect(joinAff.getJoinedTable().getKey());
 
selBadCmd.setWhere(Where.isNull(tableCmd.getField("ID_AFFAIRE")));
System.err.println(selBadCmd.asString());
 
List<Object[]> result = (List<Object[]>) tableCmd.getDBSystemRoot().getDataSource().executeA(selBadCmd.asString());
try {
for (Object[] objects : result) {
if (objects[2] != null && objects[2].toString().trim().length() > 0)
tableCmd.getRow(((Number) objects[0]).intValue()).createEmptyUpdateRow().put("ID_AFFAIRE", ((Number) objects[2]).intValue()).commit();
}
} catch (SQLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
 
// List<SQLRow> list = SQLRowListRSH.execute(selBadVF);
}
{
SQLTable tableVF = ctxt.getElement("SAISIE_VENTE_FACTURE").getTable();
SQLSelect selBadVF = new SQLSelect();
selBadVF.addSelect(tableVF.getKey());
selBadVF.addSelect(tableVF.getField("ID_AFFAIRE"));
SQLSelectJoin joinTR = selBadVF.addBackwardJoin("RIGHT", "tr", tableVF.getTable().getTable("TR_COMMANDE_CLIENT").getField("ID_SAISIE_VENTE_FACTURE"), null);
SQLSelectJoin joinCmd = selBadVF.addJoin("LEFT", joinTR.getJoinedTable().getField("ID_COMMANDE_CLIENT"));
selBadVF.addSelect(joinCmd.getJoinedTable().getField("ID_AFFAIRE"));
 
selBadVF.setWhere(Where.isNull(tableVF.getField("ID_AFFAIRE")));
System.err.println(selBadVF.asString());
List<Object[]> result = (List<Object[]>) tableVF.getDBSystemRoot().getDataSource().executeA(selBadVF.asString());
try {
for (Object[] objects : result) {
if (objects[2] != null && objects[2].toString().trim().length() > 0)
tableVF.getRow(((Number) objects[0]).intValue()).createEmptyUpdateRow().put("ID_AFFAIRE", ((Number) objects[2]).intValue()).commit();
}
} catch (SQLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
}
}, MainFrame.CREATE_MENU);
 
ctxt.addMenuItem(new AbstractAction("Recalcul Total achat facture prorata") {
@Override
public void actionPerformed(ActionEvent e) {
 
{
final SQLTable table = ctxt.getElement("SAISIE_VENTE_FACTURE").getTable();
SQLRowValues rowValsFact = new SQLRowValues(table);
rowValsFact.putNulls("SOLDE", "PARTIAL", "T_HA", "T_HT");
 
final SQLTable tableCmd = ctxt.getElement("COMMANDE_CLIENT").getTable();
SQLRowValues rowValsCmd = new SQLRowValues(tableCmd);
rowValsCmd.putNulls("T_HT");
 
final SQLTable tableCmdElt = ctxt.getElement("COMMANDE_CLIENT_ELEMENT").getTable();
SQLRowValues rowValsCmdElt = new SQLRowValues(tableCmdElt);
rowValsCmdElt.put("ID_COMMANDE_CLIENT", rowValsCmd);
rowValsCmdElt.putNulls("T_PA_HT", "NIVEAU");
 
final SQLTable tableTR = table.getTable("TR_COMMANDE_CLIENT");
SQLRowValues rowValsTR = new SQLRowValues(tableTR);
rowValsTR.put("ID_SAISIE_VENTE_FACTURE", rowValsFact);
rowValsTR.put("ID_COMMANDE_CLIENT", rowValsCmd);
 
SQLRowValuesListFetcher fetcher = SQLRowValuesListFetcher.create(rowValsFact);
fetcher.appendSelTransf(new ITransformer<SQLSelect, SQLSelect>() {
@Override
public SQLSelect transformChecked(SQLSelect input) {
Where w = new Where(table.getField("SOLDE"), "=", Boolean.TRUE);
w = w.or(new Where(table.getField("PARTIAL"), "=", Boolean.TRUE));
input.setWhere(w);
return input;
}
});
 
List<SQLRowValues> rowVals = fetcher.fetch();
 
for (SQLRowValues sqlRowValues : rowVals) {
// Recuperation de la commande
final Collection<SQLRowValues> referentRows = sqlRowValues.getReferentRows(tableTR);
if (!referentRows.isEmpty()) {
SQLRowAccessor rowTR = referentRows.iterator().next();
SQLRowAccessor rowCmd = rowTR.getForeign("ID_COMMANDE_CLIENT");
final long htCmd = rowCmd.getLong("T_HT");
if (htCmd != 0) {
 
BigDecimal totalHA = BigDecimal.ZERO;
Collection<? extends SQLRowAccessor> elt = rowCmd.getReferentRows(tableCmdElt);
for (SQLRowAccessor sqlRowAccessor : elt) {
if (sqlRowAccessor.getInt("NIVEAU") == 1) {
totalHA = totalHA.add(sqlRowAccessor.getBigDecimal("T_PA_HT"));
}
}
BigDecimal prorata = new BigDecimal((double) sqlRowValues.getLong("T_HT") / (double) htCmd);
try {
sqlRowValues.createEmptyUpdateRow().put("T_HA", totalHA.multiply(prorata).movePointRight(2).setScale(0, RoundingMode.HALF_UP).longValue()).update();
} catch (SQLException e1) {
e1.printStackTrace();
}
}
}
}
}
}
}, MainFrame.CREATE_MENU);
}
 
@Override
protected void start() {
 
 
 
final JComponent quoteComponent = createQuotePanel();
final JComponent orderComponent = createOrderPanel();
MainFrame.getInstance().getTabbedPane().addTab("Commandes en cours", orderComponent);
/trunk/Modules/Module Project/src/org/openconcerto/modules/project/ProjectImportExport.java
Nouveau fichier
0,0 → 1,285
package org.openconcerto.modules.project;
 
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.sql.SQLException;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
 
import javax.swing.JFileChooser;
 
import org.openconcerto.sql.model.DBRoot;
import org.openconcerto.sql.model.SQLRow;
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.utils.StringUtils;
 
public class ProjectImportExport {
 
private final DBRoot root;
 
public ProjectImportExport(DBRoot root) {
this.root = root;
}
 
public File export() {
File exportedFile = null;
JFileChooser chooser = new JFileChooser();
chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
if (chooser.showDialog(null, null) == JFileChooser.APPROVE_OPTION) {
exportedFile = new File(chooser.getSelectedFile(), "exportedProjects.txt");
final SQLTable affaireTable = this.root.findTable("AFFAIRE");
SQLRowValues rowVals = new SQLRowValues(affaireTable);
rowVals.putNulls(affaireTable.getFieldsName());
 
final SQLTable commandeFTable = this.root.getTable("COMMANDE");
SQLRowValues rowValsCommandeF = new SQLRowValues(commandeFTable);
rowValsCommandeF.putNulls("NUMERO");
rowValsCommandeF.put("ID_AFFAIRE", rowVals);
 
final SQLTable devisTable = this.root.getTable("DEVIS");
SQLRowValues rowValsDevis = new SQLRowValues(devisTable);
rowValsDevis.putNulls("NUMERO");
rowValsDevis.put("ID_AFFAIRE", rowVals);
 
final SQLTable avoirTable = this.root.getTable("AVOIR_CLIENT");
SQLRowValues rowValsAvoir = new SQLRowValues(avoirTable);
rowValsAvoir.putNulls("NUMERO");
rowValsAvoir.put("ID_AFFAIRE", rowVals);
 
final SQLTable cmdTable = this.root.getTable("COMMANDE_CLIENT");
SQLRowValues rowValsCmd = new SQLRowValues(cmdTable);
rowValsCmd.putNulls("NUMERO");
rowValsCmd.put("ID_AFFAIRE", rowVals);
 
final SQLTable blTable = this.root.getTable("BON_DE_LIVRAISON");
SQLRowValues rowValsBL = new SQLRowValues(blTable);
rowValsBL.putNulls("NUMERO");
rowValsBL.put("ID_AFFAIRE", rowVals);
 
final SQLTable factTable = this.root.getTable("SAISIE_VENTE_FACTURE");
SQLRowValues rowValsFact = new SQLRowValues(factTable);
rowValsFact.putNulls("NUMERO");
rowValsFact.put("ID_AFFAIRE", rowVals);
 
List<SQLRowValues> results = SQLRowValuesListFetcher.create(rowVals).fetch();
BufferedOutputStream stream = null;
try {
stream = new BufferedOutputStream(new FileOutputStream(exportedFile));
for (SQLRowValues sqlRowValues : results) {
if (sqlRowValues.getDate("DATE") != null) {
StringBuffer buf = new StringBuffer();
buf.append(sqlRowValues.getString("NUMERO"));
buf.append("\t");
buf.append(sqlRowValues.getString("INFOS"));
buf.append("\t");
buf.append(sqlRowValues.getInt("ID_CLIENT"));
buf.append("\t");
DateFormat format = new SimpleDateFormat("dd MM yyyy");
buf.append(format.format(sqlRowValues.getDate("DATE").getTime()));
buf.append("\t");
buf.append(sqlRowValues.getInt("ID_COMMERCIAL"));
buf.append("\t");
buf.append(sqlRowValues.getInt("ID_ETAT_AFFAIRE"));
buf.append("\t");
buf.append(sqlRowValues.getInt("ID_DEVIS"));
buf.append("\t");
 
List<String> devis = new ArrayList<String>();
Collection<SQLRowValues> devisRows = sqlRowValues.getReferentRows(devisTable);
for (SQLRowValues sqlRowValuesDevis : devisRows) {
devis.add(sqlRowValuesDevis.getString("NUMERO"));
}
buf.append(devis.toString());
buf.append("\t");
 
List<String> commandes = new ArrayList<String>();
Collection<SQLRowValues> commandesRows = sqlRowValues.getReferentRows(commandeFTable);
for (SQLRowValues sqlRowValuesCommande : commandesRows) {
commandes.add(sqlRowValuesCommande.getString("NUMERO"));
}
buf.append(commandes.toString());
buf.append("\t");
 
List<String> avoirs = new ArrayList<String>();
Collection<SQLRowValues> avoirsRows = sqlRowValues.getReferentRows(avoirTable);
for (SQLRowValues sqlRowValuesAvoir : avoirsRows) {
avoirs.add(sqlRowValuesAvoir.getString("NUMERO"));
}
buf.append(avoirs.toString());
buf.append("\t");
 
List<String> bls = new ArrayList<String>();
Collection<SQLRowValues> blRows = sqlRowValues.getReferentRows(blTable);
for (SQLRowValues sqlRowValuesBL : blRows) {
bls.add(sqlRowValuesBL.getString("NUMERO"));
}
buf.append(bls.toString());
buf.append("\t");
 
List<String> cmdClients = new ArrayList<String>();
Collection<SQLRowValues> cmdCliRows = sqlRowValues.getReferentRows(cmdTable);
for (SQLRowValues sqlRowValuesCmd : cmdCliRows) {
cmdClients.add(sqlRowValuesCmd.getString("NUMERO"));
}
buf.append(cmdClients.toString());
buf.append("\t");
 
List<String> facts = new ArrayList<String>();
Collection<SQLRowValues> factRows = sqlRowValues.getReferentRows(factTable);
for (SQLRowValues sqlRowValuesFact : factRows) {
facts.add(sqlRowValuesFact.getString("NUMERO"));
}
buf.append(facts.toString());
buf.append("\t\n");
stream.write(buf.toString().getBytes());
}
}
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} finally {
if (stream != null) {
try {
stream.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
}
return exportedFile;
 
}
 
public void importProjects() {
File importFile = null;
JFileChooser chooser = new JFileChooser();
chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
if (chooser.showDialog(null, null) == JFileChooser.APPROVE_OPTION) {
importFile = chooser.getSelectedFile();
final SQLTable affaireTable = this.root.findTable("AFFAIRE");
SQLSelect sel = new SQLSelect();
sel.addSelectStar(affaireTable);
List<SQLRow> re = SQLRowListRSH.execute(sel);
List<String> numbersAff = new ArrayList<String>();
for (SQLRow sqlRow : re) {
numbersAff.add(sqlRow.getString("NUMERO"));
}
BufferedReader stream = null;
try {
stream = new BufferedReader(new InputStreamReader(new FileInputStream(importFile)));
 
String line = null;
 
while ((line = stream.readLine()) != null) {
List<String> values = StringUtils.fastSplitTrimmed(line, '\t');
SQLRowValues rowValsAffaire = new SQLRowValues(affaireTable);
final String number = values.get(0);
if (!numbersAff.contains(number)) {
rowValsAffaire.put("NUMERO", number);
 
rowValsAffaire.put("INFOS", values.get(1));
rowValsAffaire.put("ID_CLIENT", Integer.valueOf(values.get(2)));
DateFormat format = new SimpleDateFormat("dd MM yyyy");
rowValsAffaire.put("DATE", format.parse(values.get(3)));
rowValsAffaire.put("ID_COMMERCIAL", Integer.valueOf(values.get(4)));
rowValsAffaire.put("ID_ETAT_AFFAIRE", Integer.valueOf(values.get(5)));
rowValsAffaire.put("ID_DEVIS", Integer.valueOf(values.get(6)));
 
int id = rowValsAffaire.commit().getID();
 
final String stringDevis = values.get(7);
List<String> devis = Arrays.asList(stringDevis.substring(1, stringDevis.length() - 1).split("\\s*,\\s*"));
link(devis, id, affaireTable.getTable("DEVIS"));
 
final String stringCommandes = values.get(8);
List<String> cmds = Arrays.asList(stringCommandes.substring(1, stringCommandes.length() - 1).split("\\s*,\\s*"));
link(cmds, id, affaireTable.getTable("COMMANDE"));
 
final String stringAvoirs = values.get(9);
List<String> avoirs = Arrays.asList(stringAvoirs.substring(1, stringAvoirs.length() - 1).split("\\s*,\\s*"));
link(avoirs, id, affaireTable.getTable("AVOIR_CLIENT"));
 
final String stringBls = values.get(10);
List<String> bls = Arrays.asList(stringBls.substring(1, stringBls.length() - 1).split("\\s*,\\s*"));
link(bls, id, affaireTable.getTable("BON_DE_LIVRAISON"));
 
final String stringCmdClis = values.get(11);
List<String> cmdClis = Arrays.asList(stringCmdClis.substring(1, stringCmdClis.length() - 1).split("\\s*,\\s*"));
link(cmdClis, id, affaireTable.getTable("COMMANDE_CLIENT"));
 
final String stringVFs = values.get(12);
List<String> vfs = Arrays.asList(stringVFs.substring(1, stringVFs.length() - 1).split("\\s*,\\s*"));
link(vfs, id, affaireTable.getTable("SAISIE_VENTE_FACTURE"));
}
}
} catch (NumberFormatException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
 
}
 
Map<SQLTable, Map<String, SQLRow>> cache = new HashMap<SQLTable, Map<String, SQLRow>>();
 
private void link(List<String> number, int id, SQLTable table) throws SQLException {
 
Map<String, SQLRow> linkMap = cache.get(table);
 
if (linkMap == null) {
linkMap = new HashMap<String, SQLRow>();
cache.put(table, linkMap);
SQLSelect sel = new SQLSelect();
sel.addSelect(table.getKey());
sel.addSelect(table.getField("NUMERO"));
 
List<SQLRow> rows = SQLRowListRSH.execute(sel);
for (SQLRow sqlRow : rows) {
linkMap.put(sqlRow.getString("NUMERO"), sqlRow);
}
}
 
for (String string : number) {
if (string.trim().length() > 0) {
if (linkMap.containsKey(string)) {
linkMap.get(string).createEmptyUpdateRow().put("ID_AFFAIRE", id).commit();
} else {
System.err.println(table.getName() + " NUMERO " + string + " NOT FOUND!!!!!!!!!");
}
}
}
 
}
 
}
/trunk/Modules/Module Project/src/org/openconcerto/modules/project/CmdToBrSQLInjector.java
Nouveau fichier
0,0 → 1,13
package org.openconcerto.modules.project;
 
import org.openconcerto.sql.Configuration;
 
public class CmdToBrSQLInjector extends org.openconcerto.erp.injector.CommandeBrSQLInjector {
 
public CmdToBrSQLInjector() {
super(Configuration.getInstance().getRoot());
if (getSource().contains("ID_AFFAIRE") && getDestination().contains("ID_AFFAIRE")) {
map(getSource().getField("ID_AFFAIRE"), getDestination().getField("ID_AFFAIRE"));
}
}
}
/trunk/Modules/Module Time Tracking/src/org/openconcerto/modules/timetracking/Module.java
3,6 → 3,7
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.io.IOException;
import java.sql.SQLException;
import java.util.Arrays;
import java.util.List;
import java.util.Set;
59,7 → 60,7
}
 
@Override
protected void install(DBContext ctxt) {
protected void install(DBContext ctxt) throws SQLException, IOException {
super.install(ctxt);
if (!ctxt.getRoot().findTable("AFFAIRE").contains("ENVOI_MAIL_AUTO")) {
final AlterTableRestricted alter = ctxt.getAlterTable("AFFAIRE");
/trunk/Modules/Module Subscription/src/org/openconcerto/modules/subscription/SubscriptionChecker.java
47,6 → 47,8
vals.put("NUMERO", null);
vals.put("DATE", null);
vals.put("ID_ABONNEMENT", null);
vals.put("PREVISIONNELLE", null);
vals.put("CREATION_AUTO_VALIDER", null);
 
final SQLRowValuesListFetcher fetcher = new SQLRowValuesListFetcher(vals);
fetcher.setSelTransf(new ITransformer<SQLSelect, SQLSelect>() {
92,7 → 94,7
Calendar calStartFact = sqlRow.getDate("DATE_DEBUT_" + this.type);
SQLRowValues rowFact = map.get(sqlRow.getID());
if (rowFact != null) {
if (rowFact.getObject("CREATION_AUTO_VALIDER") != null && rowFact.getBoolean("CREATION_AUTO_VALIDER")) {
if (rowFact.getObject("PREVISIONNELLE") != null && !rowFact.getBoolean("PREVISIONNELLE")) {
calStartFact = rowFact.getDate("DATE");
} else {
// Si le dernier element de l'abonnement n'a pas été validé on ne crée pas
/trunk/Modules/Module Subscription/src/org/openconcerto/modules/subscription/panel/AboPanel.java
240,6 → 240,7
SubscriptionChecker checker = new SubscriptionChecker(elt.getTable());
Map<SQLRow, Calendar> listLastCreateElt = checker.check();
 
Date today = new Date();
for (SQLRow rowAbonnement : listLastCreateElt.keySet()) {
 
// FIXME On recupere des abonnements archives (à tester sur BD 2Si)
249,26 → 250,29
Calendar date = listLastCreateElt.get(rowAbonnement);
if (date == null) {
date = rowsCmd.getDate("DATE");
date.add(Calendar.MONTH, rowAbonnement.getInt("NB_MOIS_" + type));
}
date.add(Calendar.MONTH, rowAbonnement.getInt("NB_MOIS_" + type));
while (date.getTime().compareTo(today) < 0) {
 
// Si l'abonnement n'est pas expiré
if (rowAbonnement.getObject("DATE_FIN_" + type) == null || date.compareTo(rowAbonnement.getDate("DATE_FIN_" + type)) <= 0) {
// Si l'abonnement n'est pas expiré
if (rowAbonnement.getObject("DATE_FIN_" + type) == null || date.compareTo(rowAbonnement.getDate("DATE_FIN_" + type)) <= 0) {
 
final SQLRowValues rowVals = new SQLRowValues(elt.getTable());
final SQLRowValues rowVals = new SQLRowValues(elt.getTable());
 
injectRow(rowsCmd, rowVals, date.getTime(), rowAbonnement);
// On duplique items
copyItems(rowsCmd, itemsElement.getTable(), rowVals);
injectRow(rowsCmd, rowVals, date.getTime(), rowAbonnement);
// On duplique items
copyItems(rowsCmd, itemsElement.getTable(), rowVals);
 
try {
try {
 
rowVals.commit();
// FIXME Voir avec Guillaume create or not create document
} catch (SQLException exn) {
rowVals.commit();
// FIXME Voir avec Guillaume create or not create document
} catch (SQLException exn) {
 
ExceptionHandler.handle("Erreur lors de la création " + elt.getSingularName() + " d'abonnement.", exn);
ExceptionHandler.handle("Erreur lors de la création " + elt.getSingularName() + " d'abonnement.", exn);
}
}
date.add(Calendar.MONTH, rowAbonnement.getInt("NB_MOIS_" + type));
}
}
}
/trunk/Modules/Module Subscription/src/org/openconcerto/modules/subscription/panel/FacturesAboPanel.java
75,10 → 75,12
 
idMvt = sqlRowAccessor.getInt("ID_MOUVEMENT");
 
// on supprime tout ce qui est lié à la facture
System.err.println("Archivage des fils");
EcritureSQLElement eltEcr = (EcritureSQLElement) Configuration.getInstance().getDirectory().getElement("ECRITURE");
eltEcr.archiveMouvementProfondeur(idMvt, false);
if (idMvt > 1) {
// on supprime tout ce qui est lié à la facture
System.err.println("Archivage des fils");
EcritureSQLElement eltEcr = (EcritureSQLElement) Configuration.getInstance().getDirectory().getElement("ECRITURE");
eltEcr.archiveMouvementProfondeur(idMvt, false);
}
}
 
System.err.println("Regeneration des ecritures");
/trunk/Modules/Module Subscription/src/org/openconcerto/modules/subscription/Module.java
2,6 → 2,7
 
import java.awt.event.ActionEvent;
import java.io.IOException;
import java.sql.SQLException;
import java.util.Calendar;
 
import javax.swing.AbstractAction;
49,7 → 50,7
}
 
@Override
protected void install(DBContext ctxt) {
protected void install(DBContext ctxt) throws SQLException, IOException {
super.install(ctxt);
 
if (ctxt.getLastInstalledVersion() == null) {
82,21 → 83,6
createTable.addColumn("NB_MOIS_COMMANDE", "int DEFAULT 3");
createTable.addColumn("CREATE_COMMANDE", "boolean DEFAULT false");
 
// ctxt.manipulateData(new IClosure<DBRoot>() {
// @Override
// public void executeChecked(DBRoot input) {
// // Undefined Affaire
// SQLRowValues rowVals = new SQLRowValues(input.getTable("ABONNEMENT"));
// try {
// rowVals.insert();
// } catch (SQLException exn) {
// // TODO Bloc catch auto-généré
// exn.printStackTrace();
// }
//
// }
// });
 
AlterTableRestricted alterNumero = ctxt.getAlterTable("NUMEROTATION_AUTO");
alterNumero.addVarCharColumn("ABONNEMENT_FORMAT", 128);
alterNumero.addIntegerColumn("ABONNEMENT_START", 1);
113,6 → 99,9
alterCmd.addForeignColumn("ID_ABONNEMENT", createTable);
alterCmd.addColumn("CREATION_AUTO_VALIDER", "boolean DEFAULT false");
 
ctxt.executeSQL();
SQLRowValues rowVals = new SQLRowValues(ctxt.getRoot().getTable("ABONNEMENT"));
rowVals.insert();
}
 
}