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.Calendar;
7
import java.util.Calendar;
8
import java.util.Date;
8
import java.util.Date;
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.quote.element.DevisSQLElement;
-
 
12
import org.openconcerto.sql.Configuration;
11
import org.openconcerto.sql.Configuration;
-
 
12
import org.openconcerto.sql.element.SQLElement;
13
import org.openconcerto.sql.model.SQLRow;
13
import org.openconcerto.sql.model.SQLRow;
14
import org.openconcerto.sql.model.SQLRowValues;
14
import org.openconcerto.sql.model.SQLRowValues;
15
import org.openconcerto.sql.model.SQLTable;
15
import org.openconcerto.sql.model.SQLTable;
16
 
16
 
17
public class DevisAboPanel extends AboPanel {
17
public class DevisAboPanel extends AboPanel {
Line 19... Line 19...
19
    public DevisAboPanel() {
19
    public DevisAboPanel() {
20
        super(Configuration.getInstance().getDirectory().getElement("DEVIS"), Configuration.getInstance().getDirectory().getElement("DEVIS_ELEMENT"), "DEVIS");
20
        super(Configuration.getInstance().getDirectory().getElement("DEVIS"), Configuration.getInstance().getDirectory().getElement("DEVIS_ELEMENT"), "DEVIS");
21
    }
21
    }
22
 
22
 
23
    private SQLTable tableNum = Configuration.getInstance().getRoot().findTable("NUMEROTATION_AUTO");
23
    private SQLTable tableNum = Configuration.getInstance().getRoot().findTable("NUMEROTATION_AUTO");
-
 
24
    private SQLElement eltDev = Configuration.getInstance().getDirectory().getElement("DEVIS");
24
 
25
 
25
    @Override
26
    @Override
26
    protected void injectRow(SQLRow row, SQLRowValues rowVals, Date dateNew, SQLRow rowAbonnement) {
27
    protected void injectRow(SQLRow row, SQLRowValues rowVals, Date dateNew, SQLRow rowAbonnement) {
27
        super.injectRow(row, rowVals, dateNew, rowAbonnement);
28
        super.injectRow(row, rowVals, dateNew, rowAbonnement);
28
        String nextNumero = NumerotationAutoSQLElement.getNextNumero(DevisSQLElement.class);
29
        String nextNumero = NumerotationAutoSQLElement.getNextNumero(this.eltDev.getClass());
29
        rowVals.put("NUMERO", nextNumero);
30
        rowVals.put("NUMERO", nextNumero);
30
 
31
 
31
        // incrémentation du numéro auto
32
        // incrémentation du numéro auto
32
        final SQLRowValues rowValsNum = new SQLRowValues(this.tableNum);
33
        final SQLRowValues rowValsNum = new SQLRowValues(this.tableNum);
33
        int val = this.tableNum.getRow(2).getInt(NumerotationAutoSQLElement.getLabelNumberFor(DevisSQLElement.class));
34
        int val = this.tableNum.getRow(2).getInt(NumerotationAutoSQLElement.getLabelNumberFor(this.eltDev.getClass()));
34
        val++;
35
        val++;
35
        rowValsNum.put(NumerotationAutoSQLElement.getLabelNumberFor(DevisSQLElement.class), new Integer(val));
36
        rowValsNum.put(NumerotationAutoSQLElement.getLabelNumberFor(this.eltDev.getClass()), new Integer(val));
36
        try {
37
        try {
37
            rowValsNum.update(2);
38
            rowValsNum.update(2);
38
        } catch (final SQLException e) {
39
        } catch (final SQLException e) {
39
            e.printStackTrace();
40
            e.printStackTrace();
40
        }
41
        }