OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

Rev 94 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 94 Rev 156
Line 20... Line 20...
20
import org.openconcerto.sql.model.SQLRow;
20
import org.openconcerto.sql.model.SQLRow;
21
import org.openconcerto.sql.model.SQLSelect;
21
import org.openconcerto.sql.model.SQLSelect;
22
import org.openconcerto.sql.model.SQLTable;
22
import org.openconcerto.sql.model.SQLTable;
23
import org.openconcerto.ui.DefaultGridBagConstraints;
23
import org.openconcerto.ui.DefaultGridBagConstraints;
24
import org.openconcerto.ui.warning.JLabelWarning;
24
import org.openconcerto.ui.warning.JLabelWarning;
25
import org.openconcerto.utils.ExceptionHandler;
-
 
26
 
25
 
27
import java.awt.GridBagConstraints;
26
import java.awt.GridBagConstraints;
28
import java.awt.GridBagLayout;
27
import java.awt.GridBagLayout;
29
import java.awt.event.ActionEvent;
28
import java.awt.event.ActionEvent;
30
import java.awt.event.ActionListener;
29
import java.awt.event.ActionListener;
Line 58... Line 57...
58
        this.add(panelLabel, c);
57
        this.add(panelLabel, c);
59
 
58
 
60
        // TODO afficher les numeros de mouvement implique
59
        // TODO afficher les numeros de mouvement implique
61
        int[] idS = getMouvement(rowMvt.getInt("ID_PIECE"));
60
        int[] idS = getMouvement(rowMvt.getInt("ID_PIECE"));
62
        if (idS == null) {
61
        if (idS == null) {
63
            ExceptionHandler.handle("Aucun mouvement associé à la piéce n°" + ((rowMvt != null) ? rowMvt.getInt("ID_PIECE") : "mouvement nul"));
62
            JOptionPane.showMessageDialog(null, "Aucun mouvement associé à la piéce n°" + ((rowMvt != null) ? rowMvt.getInt("ID_PIECE") : "mouvement nul"));
64
        } else {
63
        } else {
65
            StringBuffer s = new StringBuffer();
64
            StringBuffer s = new StringBuffer();
66
            s.append("Elle est composée par les mouvements : (");
65
            s.append("Elle est composée par les mouvements : (");
67
            JLabel labelMouv = new JLabel();
66
            JLabel labelMouv = new JLabel();
68
            // c.gridwidth = 1;
67
            // c.gridwidth = 1;
Line 113... Line 112...
113
        int[] idS = null;
112
        int[] idS = null;
114
 
113
 
115
        SQLBase b = ((ComptaPropsConfiguration) Configuration.getInstance()).getSQLBaseSociete();
114
        SQLBase b = ((ComptaPropsConfiguration) Configuration.getInstance()).getSQLBaseSociete();
116
        SQLTable tableMvt = b.getTable("MOUVEMENT");
115
        SQLTable tableMvt = b.getTable("MOUVEMENT");
117
 
116
 
118
        SQLSelect sel = new SQLSelect(b);
117
        SQLSelect sel = new SQLSelect();
119
        sel.addSelect(tableMvt.getField("NUMERO"));
118
        sel.addSelect(tableMvt.getField("NUMERO"));
120
        sel.setWhere(tableMvt.getField("ID_PIECE"), "=", idPiece);
119
        sel.setWhere(tableMvt.getField("ID_PIECE"), "=", idPiece);
121
 
120
 
122
        List l = (List) b.getDataSource().execute(sel.asString(), new ArrayListHandler());
121
        List l = (List) b.getDataSource().execute(sel.asString(), new ArrayListHandler());
123
 
122
 
124
        if (l.size() > 0) {
123
        if (!l.isEmpty()) {
125
            idS = new int[l.size()];
124
            idS = new int[l.size()];
126
        }
125
        }
127
 
126
 
128
        for (int i = 0; i < l.size(); i++) {
127
        for (int i = 0; i < l.size(); i++) {
129
            Object[] tmp = (Object[]) l.get(i);
128
            Object[] tmp = (Object[]) l.get(i);
130
            idS[i] = Integer.parseInt(tmp[0].toString());
129
            idS[i] = ((Number) tmp[0]).intValue();
131
        }
130
        }
132
 
131
 
133
        return idS;
132
        return idS;
134
    }
133
    }
135
 
134