OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

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

Rev 174 Rev 177
Line 25... Line 25...
25
import org.openconcerto.erp.core.finance.accounting.model.CurrencyConverter;
25
import org.openconcerto.erp.core.finance.accounting.model.CurrencyConverter;
26
import org.openconcerto.erp.core.finance.tax.model.TaxeCache;
26
import org.openconcerto.erp.core.finance.tax.model.TaxeCache;
27
import org.openconcerto.erp.core.sales.pos.io.BarcodeReader;
27
import org.openconcerto.erp.core.sales.pos.io.BarcodeReader;
28
import org.openconcerto.erp.core.sales.pos.ui.BarcodeListener;
28
import org.openconcerto.erp.core.sales.pos.ui.BarcodeListener;
29
import org.openconcerto.erp.core.sales.product.element.ReferenceArticleSQLElement;
29
import org.openconcerto.erp.core.sales.product.element.ReferenceArticleSQLElement;
-
 
30
import org.openconcerto.erp.core.sales.product.element.UniteVenteArticleSQLElement;
30
import org.openconcerto.erp.core.sales.product.ui.ArticleRowValuesRenderer;
31
import org.openconcerto.erp.core.sales.product.ui.ArticleRowValuesRenderer;
31
import org.openconcerto.erp.core.sales.product.ui.CurrencyWithSymbolRenderer;
32
import org.openconcerto.erp.core.sales.product.ui.CurrencyWithSymbolRenderer;
32
import org.openconcerto.erp.core.sales.product.ui.DeliveredQtyRowValuesRenderer;
33
import org.openconcerto.erp.core.sales.product.ui.DeliveredQtyRowValuesRenderer;
33
import org.openconcerto.erp.core.sales.product.ui.QteUnitRowValuesRenderer;
34
import org.openconcerto.erp.core.sales.product.ui.QteUnitRowValuesRenderer;
34
import org.openconcerto.erp.core.sales.product.ui.QtyToDeliverRowValuesRenderer;
35
import org.openconcerto.erp.core.sales.product.ui.QtyToDeliverRowValuesRenderer;
35
import org.openconcerto.erp.core.sales.product.ui.ReliquatRowValuesTable;
36
import org.openconcerto.erp.core.sales.product.ui.ReliquatRowValuesTable;
-
 
37
import org.openconcerto.erp.core.supplychain.stock.element.StockSQLElement;
36
import org.openconcerto.erp.preferences.DefaultNXProps;
38
import org.openconcerto.erp.preferences.DefaultNXProps;
37
import org.openconcerto.erp.preferences.GestionArticleGlobalPreferencePanel;
39
import org.openconcerto.erp.preferences.GestionArticleGlobalPreferencePanel;
38
import org.openconcerto.sql.Configuration;
40
import org.openconcerto.sql.Configuration;
39
import org.openconcerto.sql.element.SQLElement;
41
import org.openconcerto.sql.element.SQLElement;
40
import org.openconcerto.sql.model.SQLField;
42
import org.openconcerto.sql.model.SQLField;
Line 49... Line 51...
49
import org.openconcerto.sql.preferences.SQLPreferences;
51
import org.openconcerto.sql.preferences.SQLPreferences;
50
import org.openconcerto.sql.sqlobject.ITextArticleWithCompletionCellEditor;
52
import org.openconcerto.sql.sqlobject.ITextArticleWithCompletionCellEditor;
51
import org.openconcerto.sql.sqlobject.ITextWithCompletion;
53
import org.openconcerto.sql.sqlobject.ITextWithCompletion;
52
import org.openconcerto.sql.users.rights.UserRights;
54
import org.openconcerto.sql.users.rights.UserRights;
53
import org.openconcerto.sql.users.rights.UserRightsManager;
55
import org.openconcerto.sql.users.rights.UserRightsManager;
-
 
56
import org.openconcerto.sql.view.EditFrame;
-
 
57
import org.openconcerto.sql.view.EditPanel.EditMode;
54
import org.openconcerto.sql.view.list.AutoCompletionManager;
58
import org.openconcerto.sql.view.list.AutoCompletionManager;
55
import org.openconcerto.sql.view.list.CellDynamicModifier;
59
import org.openconcerto.sql.view.list.CellDynamicModifier;
56
import org.openconcerto.sql.view.list.RowValuesTable;
60
import org.openconcerto.sql.view.list.RowValuesTable;
57
import org.openconcerto.sql.view.list.RowValuesTableModel;
61
import org.openconcerto.sql.view.list.RowValuesTableModel;
58
import org.openconcerto.sql.view.list.SQLTableElement;
62
import org.openconcerto.sql.view.list.SQLTableElement;
Line 64... Line 68...
64
import org.openconcerto.utils.cc.ITransformer;
68
import org.openconcerto.utils.cc.ITransformer;
65
import org.openconcerto.utils.i18n.TranslationManager;
69
import org.openconcerto.utils.i18n.TranslationManager;
66
 
70
 
67
import java.awt.Component;
71
import java.awt.Component;
68
import java.awt.event.ActionEvent;
72
import java.awt.event.ActionEvent;
-
 
73
import java.awt.event.ActionListener;
69
import java.awt.event.HierarchyEvent;
74
import java.awt.event.HierarchyEvent;
70
import java.awt.event.HierarchyListener;
75
import java.awt.event.HierarchyListener;
71
import java.awt.event.KeyEvent;
76
import java.awt.event.KeyEvent;
72
import java.awt.event.MouseAdapter;
77
import java.awt.event.MouseAdapter;
73
import java.awt.event.MouseEvent;
78
import java.awt.event.MouseEvent;
74
import java.math.BigDecimal;
79
import java.math.BigDecimal;
75
import java.math.RoundingMode;
80
import java.math.RoundingMode;
76
import java.util.ArrayList;
81
import java.util.ArrayList;
77
import java.util.Date;
82
import java.util.Date;
-
 
83
import java.util.HashMap;
78
import java.util.List;
84
import java.util.List;
-
 
85
import java.util.Map;
79
import java.util.Vector;
86
import java.util.Vector;
80
 
87
 
81
import javax.swing.AbstractAction;
88
import javax.swing.AbstractAction;
82
import javax.swing.JButton;
89
import javax.swing.JButton;
83
import javax.swing.JFrame;
90
import javax.swing.JFrame;
Line 103... Line 110...
103
 
110
 
104
    public void setReliquatTable(ReliquatRowValuesTable reliquatTable) {
111
    public void setReliquatTable(ReliquatRowValuesTable reliquatTable) {
105
        this.reliquatTable = reliquatTable;
112
        this.reliquatTable = reliquatTable;
106
    }
113
    }
107
 
114
 
-
 
115
    public static Map<String, Boolean> customVisibilityMap = new HashMap<String, Boolean>();
-
 
116
 
-
 
117
    @Override
-
 
118
    protected Map<String, Boolean> getCustomVisibilityMap() {
-
 
119
        return customVisibilityMap;
-
 
120
    }
-
 
121
 
108
    @Override
122
    @Override
109
    protected void init() {
123
    protected void init() {
110
        final SQLElement e = getSQLElement();
124
        final SQLElement e = getSQLElement();
111
 
125
 
112
        SQLPreferences prefs = new SQLPreferences(getSQLElement().getTable().getDBRoot());
126
        SQLPreferences prefs = new SQLPreferences(getSQLElement().getTable().getDBRoot());
113
        final boolean selectArticle = prefs.getBoolean(GestionArticleGlobalPreferencePanel.USE_CREATED_ARTICLE, false);
127
        final boolean selectArticle = prefs.getBoolean(GestionArticleGlobalPreferencePanel.USE_CREATED_ARTICLE, false);
-
 
128
        final boolean activeCalculM2 = prefs.getBoolean(GestionArticleGlobalPreferencePanel.ACTIVE_CALCUL_M2, false);
114
        final boolean createAuto = prefs.getBoolean(GestionArticleGlobalPreferencePanel.CREATE_ARTICLE_AUTO, true);
129
        final boolean createAuto = prefs.getBoolean(GestionArticleGlobalPreferencePanel.CREATE_ARTICLE_AUTO, true);
115
        final boolean filterFamilleArticle = prefs.getBoolean(GestionArticleGlobalPreferencePanel.FILTER_BY_FAMILY, false);
130
        final boolean filterFamilleArticle = prefs.getBoolean(GestionArticleGlobalPreferencePanel.FILTER_BY_FAMILY, false);
116
        final boolean showEco = prefs.getBoolean(AbstractVenteArticleItemTable.SHOW_ECO_CONTRIBUTION_COLUMNS, false);
131
        final boolean showEco = prefs.getBoolean(AbstractVenteArticleItemTable.SHOW_ECO_CONTRIBUTION_COLUMNS, false);
117
        final boolean showDevise = prefs.getBoolean(AbstractVenteArticleItemTable.ARTICLE_SHOW_DEVISE, false);
132
        final boolean showDevise = prefs.getBoolean(AbstractVenteArticleItemTable.ARTICLE_SHOW_DEVISE, false);
118
 
133
 
Line 124... Line 139...
124
        final List<SQLTableElement> list = new Vector<SQLTableElement>();
139
        final List<SQLTableElement> list = new Vector<SQLTableElement>();
125
        list.add(new SQLTableElement(e.getTable().getField("ID_STYLE")));
140
        list.add(new SQLTableElement(e.getTable().getField("ID_STYLE")));
126
 
141
 
127
        final SQLTableElement tableFamille = new SQLTableElement(e.getTable().getField("ID_FAMILLE_ARTICLE"));
142
        final SQLTableElement tableFamille = new SQLTableElement(e.getTable().getField("ID_FAMILLE_ARTICLE"));
128
        list.add(tableFamille);
143
        list.add(tableFamille);
-
 
144
 
-
 
145
        // Article
-
 
146
        SQLTableElement tableElementDepot = new SQLTableElement(e.getTable().getField("ID_DEPOT_STOCK"), true, true, true);
-
 
147
        list.add(tableElementDepot);
129
        // Article
148
        // Article
130
        final SQLTableElement tableElementArticle = new SQLTableElement(e.getTable().getField("ID_ARTICLE"), true, true, true) {
149
        final SQLTableElement tableElementArticle = new SQLTableElement(e.getTable().getField("ID_ARTICLE"), true, true, true) {
131
            @Override
150
            @Override
132
            public boolean isCellEditable(SQLRowValues vals, int rowIndex, int columnIndex) {
151
            public boolean isCellEditable(SQLRowValues vals, int rowIndex, int columnIndex) {
133
                boolean b = super.isCellEditable(vals, rowIndex, columnIndex);
152
                boolean b = super.isCellEditable(vals, rowIndex, columnIndex);
Line 319... Line 338...
319
            };
338
            };
320
            eltUnitDevise.setRenderer(new DeviseTableCellRenderer());
339
            eltUnitDevise.setRenderer(new DeviseTableCellRenderer());
321
            list.add(eltUnitDevise);
340
            list.add(eltUnitDevise);
322
        }
341
        }
323
 
342
 
-
 
343
        SQLTableElement eltLongueur = new SQLTableElement(e.getTable().getField("LONGUEUR")) {
-
 
344
            @Override
-
 
345
            public boolean isCellEditable(SQLRowValues vals, int rowIndex, int columnIndex) {
-
 
346
 
-
 
347
                int idUv = vals.getForeignID("ID_UNITE_VENTE");
-
 
348
                return idUv == UniteVenteArticleSQLElement.M2;
-
 
349
            }
-
 
350
        };
-
 
351
        list.add(eltLongueur);
-
 
352
 
-
 
353
        SQLTableElement eltLargeur = new SQLTableElement(e.getTable().getField("LARGEUR")) {
-
 
354
            @Override
-
 
355
            public boolean isCellEditable(SQLRowValues vals, int rowIndex, int columnIndex) {
-
 
356
 
-
 
357
                int idUv = vals.getForeignID("ID_UNITE_VENTE");
-
 
358
                return idUv == UniteVenteArticleSQLElement.M2;
-
 
359
            }
-
 
360
        };
-
 
361
        list.add(eltLargeur);
-
 
362
 
-
 
363
        SQLTableElement eltHauteur = new SQLTableElement(e.getTable().getField("HAUTEUR"));
-
 
364
        list.add(eltHauteur);
-
 
365
 
324
        SQLTableElement qteU = new SQLTableElement(e.getTable().getField("QTE_UNITAIRE"), BigDecimal.class) {
366
        SQLTableElement qteU = new SQLTableElement(e.getTable().getField("QTE_UNITAIRE"), BigDecimal.class) {
325
            @Override
367
            @Override
326
            public boolean isCellEditable(SQLRowValues vals, int rowIndex, int columnIndex) {
368
            public boolean isCellEditable(SQLRowValues vals, int rowIndex, int columnIndex) {
327
 
369
 
328
                SQLRowAccessor row = vals.getForeign("ID_UNITE_VENTE");
370
                SQLRowAccessor row = vals.getForeign("ID_UNITE_VENTE");
329
                if (row != null && !row.isUndefined() && row.getBoolean("A_LA_PIECE")) {
371
                if (row != null && !row.isUndefined() && row.getBoolean("A_LA_PIECE")) {
330
                    return false;
372
                    return false;
-
 
373
                } else if (activeCalculM2 && row != null && !row.isUndefined() && row.getID() == UniteVenteArticleSQLElement.M2) {
-
 
374
                    return false;
331
                } else {
375
                } else {
332
                    return super.isCellEditable(vals, rowIndex, columnIndex);
376
                    return super.isCellEditable(vals, rowIndex, columnIndex);
333
                }
377
                }
334
            }
378
            }
335
 
379
 
Line 594... Line 638...
594
                        rowVals.put("PV_U_DEVISE", rowVals.getObject("PRIX_METRIQUE_VT_1"));
638
                        rowVals.put("PV_U_DEVISE", rowVals.getObject("PRIX_METRIQUE_VT_1"));
595
                        final BigDecimal globalQty = rowVals.getBigDecimal("QTE_UNITAIRE").multiply(new BigDecimal(rowVals.getInt("QTE")));
639
                        final BigDecimal globalQty = rowVals.getBigDecimal("QTE_UNITAIRE").multiply(new BigDecimal(rowVals.getInt("QTE")));
596
                        rowVals.put("PV_T_DEVISE", rowVals.getBigDecimal("PRIX_METRIQUE_VT_1").multiply(globalQty));
640
                        rowVals.put("PV_T_DEVISE", rowVals.getBigDecimal("PRIX_METRIQUE_VT_1").multiply(globalQty));
597
                    }
641
                    }
598
                }
642
                }
599
                super.commitData();
643
                super.commitData(true);
600
            }
644
            }
601
        };
645
        };
602
        this.setModel(model);
646
        this.setModel(model);
603
        this.table = new RowValuesTable(model, getConfigurationFile());
647
        this.table = new RowValuesTable(model, getConfigurationFile());
604
        ToolTipManager.sharedInstance().unregisterComponent(this.table);
648
        ToolTipManager.sharedInstance().unregisterComponent(this.table);
605
        ToolTipManager.sharedInstance().unregisterComponent(this.table.getTableHeader());
649
        ToolTipManager.sharedInstance().unregisterComponent(this.table.getTableHeader());
-
 
650
        this.table.getClearCloneTableElement().add("ID_COMMANDE_CLIENT_ELEMENT");
606
 
651
 
607
        if (filterFamilleArticle) {
652
        if (filterFamilleArticle) {
608
            ((SQLTextComboTableCellEditor) tableElementArticle.getTableCellEditor(this.table)).setDynamicWhere(e.getTable().getTable("ARTICLE").getField("ID_FAMILLE_ARTICLE"));
653
            ((SQLTextComboTableCellEditor) tableElementArticle.getTableCellEditor(this.table)).setDynamicWhere(e.getTable().getTable("ARTICLE").getField("ID_FAMILLE_ARTICLE"));
609
        }
654
        }
610
 
655
 
Line 634... Line 679...
634
        completionField.add("PRIX_METRIQUE_VT_1");
679
        completionField.add("PRIX_METRIQUE_VT_1");
635
        completionField.add("PRIX_METRIQUE_VT_2");
680
        completionField.add("PRIX_METRIQUE_VT_2");
636
        completionField.add("PRIX_METRIQUE_VT_3");
681
        completionField.add("PRIX_METRIQUE_VT_3");
637
        completionField.add("SERVICE");
682
        completionField.add("SERVICE");
638
        completionField.add("ID_FAMILLE_ARTICLE");
683
        completionField.add("ID_FAMILLE_ARTICLE");
-
 
684
        completionField.add("LONGUEUR");
-
 
685
        completionField.add("LARGEUR");
-
 
686
        completionField.add("HAUTEUR");
639
        if (getSQLElement().getTable().getFieldsName().contains("DESCRIPTIF")) {
687
        if (getSQLElement().getTable().getFieldsName().contains("DESCRIPTIF")) {
640
            completionField.add("DESCRIPTIF");
688
            completionField.add("DESCRIPTIF");
641
        }
689
        }
642
        if (showDevise) {
690
        if (showDevise) {
643
            completionField.add("ID_DEVISE");
691
            completionField.add("ID_DEVISE");
Line 1069... Line 1117...
1069
                    return tableArticle.getUndefinedID();
1117
                    return tableArticle.getUndefinedID();
1070
                }
1118
                }
1071
            }
1119
            }
1072
        });
1120
        });
1073
 
1121
 
-
 
1122
        uniteVente.addModificationListener(qteU);
-
 
1123
        eltLargeur.addModificationListener(qteU);
-
 
1124
        eltLongueur.addModificationListener(qteU);
-
 
1125
        qteU.setModifier(new CellDynamicModifier() {
-
 
1126
            public Object computeValueFrom(SQLRowValues row, SQLTableElement source) {
-
 
1127
                SQLRowAccessor rowUnite = row.getForeign("ID_UNITE_VENTE");
-
 
1128
                if (rowUnite != null && !rowUnite.isUndefined() && rowUnite.getBoolean("A_LA_PIECE")) {
-
 
1129
                    return BigDecimal.ONE;
-
 
1130
                } else if (activeCalculM2 && rowUnite != null && !rowUnite.isUndefined() && rowUnite.getID() == UniteVenteArticleSQLElement.M2) {
-
 
1131
                    BigDecimal longueur = row.getBigDecimal("LONGUEUR");
-
 
1132
                    BigDecimal largeur = row.getBigDecimal("LARGEUR");
-
 
1133
                    if (longueur == null || largeur == null) {
-
 
1134
                        return BigDecimal.ONE;
-
 
1135
                    }
-
 
1136
                    return longueur.multiply(largeur);
-
 
1137
                } else {
-
 
1138
                    return row.getObject("QTE_UNITAIRE");
-
 
1139
                }
-
 
1140
            }
-
 
1141
 
-
 
1142
        });
-
 
1143
 
1074
        // Mode Gestion article avancé
1144
        // Mode Gestion article avancé
1075
        String valModeAvanceVt = DefaultNXProps.getInstance().getStringProperty("ArticleModeVenteAvance");
1145
        String valModeAvanceVt = DefaultNXProps.getInstance().getStringProperty("ArticleModeVenteAvance");
1076
        Boolean bModeAvance = Boolean.valueOf(valModeAvanceVt);
1146
        Boolean bModeAvance = Boolean.valueOf(valModeAvanceVt);
1077
        if (bModeAvance != null && !bModeAvance.booleanValue()) {
1147
        if (bModeAvance != null && !bModeAvance.booleanValue()) {
1078
            hideColumn(model.getColumnForField("VALEUR_METRIQUE_1"));
1148
            hideColumn(model.getColumnForField("VALEUR_METRIQUE_1"));
Line 1086... Line 1156...
1086
        // Packaging
1156
        // Packaging
1087
        if (prefs.getBoolean(GestionArticleGlobalPreferencePanel.ITEM_PACKAGING, false)) {
1157
        if (prefs.getBoolean(GestionArticleGlobalPreferencePanel.ITEM_PACKAGING, false)) {
1088
            setColumnVisible(model.getColumnForField("T_POIDS_COLIS_NET"), false);
1158
            setColumnVisible(model.getColumnForField("T_POIDS_COLIS_NET"), false);
1089
        }
1159
        }
1090
 
1160
 
-
 
1161
        // ACtivation calcul m2
-
 
1162
        setColumnVisible(model.getColumnForField("HAUTEUR"), false);
-
 
1163
        setColumnVisible(model.getColumnForField("LARGEUR"), activeCalculM2);
-
 
1164
        setColumnVisible(model.getColumnForField("LONGUEUR"), activeCalculM2);
-
 
1165
 
1091
        setColumnVisible(model.getColumnForField("ID_ARTICLE"), selectArticle);
1166
        setColumnVisible(model.getColumnForField("ID_ARTICLE"), selectArticle);
1092
        setColumnVisible(model.getColumnForField("CODE"), !selectArticle || (selectArticle && createAuto));
1167
        setColumnVisible(model.getColumnForField("CODE"), !selectArticle || (selectArticle && createAuto));
1093
        setColumnVisible(model.getColumnForField("NOM"), !selectArticle || (selectArticle && createAuto));
1168
        setColumnVisible(model.getColumnForField("NOM"), !selectArticle || (selectArticle && createAuto));
1094
 
1169
 
1095
        setColumnVisible(getModel().getColumnForField("ID_FAMILLE_ARTICLE"), filterFamilleArticle);
1170
        setColumnVisible(getModel().getColumnForField("ID_FAMILLE_ARTICLE"), filterFamilleArticle);
Line 1106... Line 1181...
1106
        setColumnVisible(model.getColumnForField("ID_UNITE_VENTE"), gestionUV);
1181
        setColumnVisible(model.getColumnForField("ID_UNITE_VENTE"), gestionUV);
1107
 
1182
 
1108
        setColumnVisible(model.getColumnForField("PRIX_METRIQUE_HA_1"), showHAPrice);
1183
        setColumnVisible(model.getColumnForField("PRIX_METRIQUE_HA_1"), showHAPrice);
1109
        setColumnVisible(model.getColumnForField("MARGE_HT"), showHAPrice);
1184
        setColumnVisible(model.getColumnForField("MARGE_HT"), showHAPrice);
1110
        setColumnVisible(model.getColumnForField("T_PA_HT"), showHAPrice);
1185
        setColumnVisible(model.getColumnForField("T_PA_HT"), showHAPrice);
-
 
1186
        setColumnVisible(model.getColumnForField("ID_DEPOT_STOCK"), prefs.getBoolean(GestionArticleGlobalPreferencePanel.STOCK_MULTI_DEPOT, false));
1111
 
1187
 
1112
        if (e.getTable().contains("ID_COMMANDE_CLIENT_ELEMENT")) {
1188
        if (e.getTable().contains("ID_COMMANDE_CLIENT_ELEMENT")) {
1113
            setColumnVisible(model.getColumnForField("ID_COMMANDE_CLIENT_ELEMENT"), false);
1189
            setColumnVisible(model.getColumnForField("ID_COMMANDE_CLIENT_ELEMENT"), false);
1114
        }
1190
        }
-
 
1191
 
-
 
1192
        for (String string : AbstractVenteArticleItemTable.getVisibilityMap().keySet()) {
-
 
1193
            setColumnVisible(model.getColumnForField(string), AbstractVenteArticleItemTable.getVisibilityMap().get(string));
-
 
1194
        }
-
 
1195
 
-
 
1196
        Map<String, Boolean> mapCustom = getCustomVisibilityMap();
-
 
1197
        if (mapCustom != null) {
-
 
1198
            for (String string : mapCustom.keySet()) {
-
 
1199
                setColumnVisible(model.getColumnForField(string), mapCustom.get(string));
-
 
1200
            }
-
 
1201
        }
-
 
1202
 
1115
        // Barcode reader
1203
        // Barcode reader
1116
        final BarcodeReader barcodeReader = ComptaPropsConfiguration.getInstanceCompta().getBarcodeReader();
1204
        final BarcodeReader barcodeReader = ComptaPropsConfiguration.getInstanceCompta().getBarcodeReader();
1117
        if (barcodeReader != null) {
1205
        if (barcodeReader != null) {
1118
 
1206
 
1119
            final BarcodeListener l = new BarcodeListener() {
1207
            final BarcodeListener l = new BarcodeListener() {
Line 1157... Line 1245...
1157
                }
1245
                }
1158
            });
1246
            });
1159
 
1247
 
1160
        }
1248
        }
1161
 
1249
 
-
 
1250
        if (this.table.getRowValuesTableModel().getColumnForField("ID_DEPOT_STOCK") >= 0 && this.table.getRowValuesTableModel().getColumnForField("ID_ARTICLE") >= 0) {
-
 
1251
            if (this.buttons == null) {
-
 
1252
                this.buttons = new ArrayList<>();
-
 
1253
            }
-
 
1254
 
-
 
1255
            JButton buttonStock = new JButton("Consulter le stock");
-
 
1256
            buttonStock.addActionListener(new ActionListener() {
-
 
1257
                public void actionPerformed(ActionEvent event) {
-
 
1258
                    SQLRowValues rowValsSel = table.getSelectedRowValues();
-
 
1259
                    if (rowValsSel != null) {
-
 
1260
                        SQLRowAccessor foreignArt = rowValsSel.getForeign("ID_ARTICLE");
-
 
1261
                        if (foreignArt != null && !foreignArt.isUndefined()) {
-
 
1262
                            SQLRowAccessor rowValsStock = StockSQLElement.getStock(rowValsSel);
-
 
1263
                            if (rowValsStock != null && !rowValsStock.isUndefined()) {
-
 
1264
                                EditFrame frame = new EditFrame(table.getRowValuesTableModel().getSQLElement().getDirectory().getElement("STOCK"), EditMode.READONLY);
-
 
1265
                                frame.selectionId(rowValsStock.getID());
-
 
1266
                                frame.setVisible(true);
-
 
1267
                            }
-
 
1268
                        }
-
 
1269
                    }
-
 
1270
 
-
 
1271
                }
-
 
1272
            });
-
 
1273
 
-
 
1274
            this.buttons.add(buttonStock);
-
 
1275
 
-
 
1276
        }
-
 
1277
 
1162
        // On réécrit la configuration au cas ou les preferences aurait changé
1278
        // On réécrit la configuration au cas ou les preferences aurait changé
1163
        this.table.writeState();
1279
        this.table.writeState();
1164
 
1280
 
1165
    }
1281
    }
1166
 
1282