OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

Rev 76 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 76 Rev 181
Line 6... Line 6...
6
import java.sql.SQLException;
6
import java.sql.SQLException;
7
import java.util.Date;
7
import java.util.Date;
8
import java.util.List;
8
import java.util.List;
9
 
9
 
10
import org.openconcerto.erp.core.common.element.NumerotationAutoSQLElement;
10
import org.openconcerto.erp.core.common.element.NumerotationAutoSQLElement;
11
import org.openconcerto.erp.core.sales.order.element.CommandeClientSQLElement;
-
 
12
import org.openconcerto.erp.core.sales.order.report.CommandeClientXmlSheet;
11
import org.openconcerto.erp.core.sales.order.report.CommandeClientXmlSheet;
13
import org.openconcerto.erp.model.MouseSheetXmlListeListener;
12
import org.openconcerto.erp.model.MouseSheetXmlListeListener;
14
import org.openconcerto.sql.Configuration;
13
import org.openconcerto.sql.Configuration;
-
 
14
import org.openconcerto.sql.element.SQLElement;
15
import org.openconcerto.sql.model.SQLRow;
15
import org.openconcerto.sql.model.SQLRow;
16
import org.openconcerto.sql.model.SQLRowValues;
16
import org.openconcerto.sql.model.SQLRowValues;
17
import org.openconcerto.sql.model.SQLTable;
17
import org.openconcerto.sql.model.SQLTable;
18
import org.openconcerto.sql.view.list.RowAction;
18
import org.openconcerto.sql.view.list.RowAction;
19
 
19
 
Line 24... Line 24...
24
        super(Configuration.getInstance().getDirectory().getElement("COMMANDE_CLIENT"), Configuration.getInstance().getDirectory().getElement("COMMANDE_CLIENT_ELEMENT"), "COMMANDE");
24
        super(Configuration.getInstance().getDirectory().getElement("COMMANDE_CLIENT"), Configuration.getInstance().getDirectory().getElement("COMMANDE_CLIENT_ELEMENT"), "COMMANDE");
25
 
25
 
26
    }
26
    }
27
 
27
 
28
    private SQLTable tableNum = Configuration.getInstance().getRoot().findTable("NUMEROTATION_AUTO");
28
    private SQLTable tableNum = Configuration.getInstance().getRoot().findTable("NUMEROTATION_AUTO");
-
 
29
    private SQLElement eltCmd = Configuration.getInstance().getDirectory().getElement("COMMANDE_CLIENT");
29
 
30
 
30
    @Override
31
    @Override
31
    protected void injectRow(SQLRow row, SQLRowValues rowVals, Date dateNew, SQLRow rowAbonnement) {
32
    protected void injectRow(SQLRow row, SQLRowValues rowVals, Date dateNew, SQLRow rowAbonnement) {
32
        // TODO Raccord de méthode auto-généré
33
        // TODO Raccord de méthode auto-généré
33
        super.injectRow(row, rowVals, dateNew, rowAbonnement);
34
        super.injectRow(row, rowVals, dateNew, rowAbonnement);
34
        rowVals.put("NUMERO", NumerotationAutoSQLElement.getNextNumero(CommandeClientSQLElement.class));
35
        rowVals.put("NUMERO", NumerotationAutoSQLElement.getNextNumero(this.eltCmd.getClass()));
35
        // incrémentation du numéro auto
36
        // incrémentation du numéro auto
36
        final SQLRowValues rowValsNum = new SQLRowValues(this.tableNum);
37
        final SQLRowValues rowValsNum = new SQLRowValues(this.tableNum);
37
        int val = this.tableNum.getRow(2).getInt(NumerotationAutoSQLElement.getLabelNumberFor(CommandeClientSQLElement.class));
38
        int val = this.tableNum.getRow(2).getInt(NumerotationAutoSQLElement.getLabelNumberFor(this.eltCmd.getClass()));
38
        val++;
39
        val++;
39
        rowValsNum.put(NumerotationAutoSQLElement.getLabelNumberFor(CommandeClientSQLElement.class), new Integer(val));
40
        rowValsNum.put(NumerotationAutoSQLElement.getLabelNumberFor(this.eltCmd.getClass()), new Integer(val));
40
        try {
41
        try {
41
            rowValsNum.update(2);
42
            rowValsNum.update(2);
42
        } catch (final SQLException e) {
43
        } catch (final SQLException e) {
43
            e.printStackTrace();
44
            e.printStackTrace();
44
        }
45
        }