OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

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

Rev 177 Rev 182
Line 1... Line 1...
1
/*
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 * 
3
 * 
4
 * Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
4
 * Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved.
5
 * 
5
 * 
6
 * The contents of this file are subject to the terms of the GNU General Public License Version 3
6
 * The contents of this file are subject to the terms of the GNU General Public License Version 3
7
 * only ("GPL"). You may not use this file except in compliance with the License. You can obtain a
7
 * only ("GPL"). You may not use this file except in compliance with the License. You can obtain a
8
 * copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific
8
 * copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific
9
 * language governing permissions and limitations under the License.
9
 * language governing permissions and limitations under the License.
Line 72... Line 72...
72
    protected SQLTableElement tableElementEcoID, tableElementEco, tableElementEcoTotal;
72
    protected SQLTableElement tableElementEcoID, tableElementEco, tableElementEcoTotal;
73
    protected SQLTableElement prebilan;
73
    protected SQLTableElement prebilan;
74
    protected SQLRowAccessor rowCatComptable;
74
    protected SQLRowAccessor rowCatComptable;
75
    private RowValuesTableModel model;
75
    private RowValuesTableModel model;
76
    protected SQLRowValues defaultRowVals;
76
    protected SQLRowValues defaultRowVals;
77
    protected List<JButton> buttons = null;
77
    protected List<JButton> buttons = new ArrayList<>();
78
    protected RowValuesTableControlPanel control = null;
78
    protected RowValuesTableControlPanel control = null;
79
    private SQLRowAccessor tarif = null;
79
    private SQLRowAccessor tarif = null;
80
 
80
 
81
    public static String SHOW_TOTAL_ECO_CONTRIBUTION = "SHOW_TOTAL_ECO_CONTRIBUTION";
81
    public static String SHOW_TOTAL_ECO_CONTRIBUTION = "SHOW_TOTAL_ECO_CONTRIBUTION";
82
    public static String SHOW_ECO_CONTRIBUTION_COLUMNS = "SHOW_ECO_CONTRIBUTION_COLUMNS";
82
    public static String SHOW_ECO_CONTRIBUTION_COLUMNS = "SHOW_ECO_CONTRIBUTION_COLUMNS";
Line 142... Line 142...
142
        this.setOpaque(false);
142
        this.setOpaque(false);
143
        final GridBagConstraints c = new DefaultGridBagConstraints();
143
        final GridBagConstraints c = new DefaultGridBagConstraints();
144
 
144
 
145
        c.weightx = 1;
145
        c.weightx = 1;
146
 
146
 
-
 
147
        this.buttons.add(1, new AjoutDeclinaisonButton(this));
147
        control = new RowValuesTableControlPanel(this.table, this.buttons);
148
        control = new RowValuesTableControlPanel(this.table, this.buttons);
148
        control.setOpaque(false);
149
        control.setOpaque(false);
149
        this.add(control, c);
150
        this.add(control, c);
150
 
151
 
151
        c.gridy++;
152
        c.gridy++;
Line 281... Line 282...
281
            final List<SQLRowValues> resultNonAssigned = fetcher.fetch(w.and(w2).and(new Where(eltArticleTable.getTable().getForeignKeys(eltSource.getTable()).iterator().next(), "=", id)));
282
            final List<SQLRowValues> resultNonAssigned = fetcher.fetch(w.and(w2).and(new Where(eltArticleTable.getTable().getForeignKeys(eltSource.getTable()).iterator().next(), "=", id)));
282
 
283
 
283
            // On récupére les articles qui composent la table
284
            // On récupére les articles qui composent la table
284
            // final List<SQLRow> listElts =
285
            // final List<SQLRow> listElts =
285
            // eltSource.getTable().getRow(id).getReferentRows(eltArticleTable.getTable());
286
            // eltSource.getTable().getRow(id).getReferentRows(eltArticleTable.getTable());
286
            final SQLRowValues rowArticle = new SQLRowValues(tableArticle);
-
 
287
            final Set<SQLField> fields = tableArticle.getFields();
287
            final Set<SQLField> fields = tableArticle.getFields();
288
 
288
 
-
 
289
            SQLRow rowCmd = null;
289
            for (final SQLRowAccessor rowElt : resultNonAssigned) {
290
            for (final SQLRowAccessor rowElt : resultNonAssigned) {
-
 
291
                final SQLRowValues rowArticle = new SQLRowValues(tableArticle);
290
                // final SQLRow foreignRow = rowElt.getForeignRow("ID_ARTICLE");
292
                // final SQLRow foreignRow = rowElt.getForeignRow("ID_ARTICLE");
291
                // if (foreignRow == null || foreignRow.isUndefined()) {
293
                // if (foreignRow == null || foreignRow.isUndefined()) {
292
                final Set<String> fieldsName = rowElt.getTable().getFieldsName();
294
                final Set<String> fieldsName = rowElt.getTable().getFieldsName();
293
                // on récupére l'article qui lui correspond
295
                // on récupére l'article qui lui correspond
294
 
296
 
Line 297... Line 299...
297
                    final String name = field.getName();
299
                    final String name = field.getName();
298
                    if (fieldsName.contains(name) && !field.isPrimaryKey()) {
300
                    if (fieldsName.contains(name) && !field.isPrimaryKey()) {
299
                        rowArticle.put(name, rowElt.getObject(name));
301
                        rowArticle.put(name, rowElt.getObject(name));
300
                    }
302
                    }
301
                }
303
                }
-
 
304
                if (rowElt.getTable().getName().equals("COMMANDE_ELEMENT")) {
-
 
305
                    if (rowCmd == null) {
-
 
306
                        rowCmd = rowElt.getTable().getForeignTable("ID_COMMANDE").getRow(id);
-
 
307
                    }
-
 
308
                    rowArticle.put("ID_FOURNISSEUR", rowCmd.getForeignIDNumber("ID_FOURNISSEUR"));
-
 
309
 
-
 
310
                    SQLRowValues rowValsTarifF = new SQLRowValues(rowCmd.getTable().getTable("ARTICLE_TARIF_FOURNISSEUR"));
-
 
311
                    rowValsTarifF.put("ID_FOURNISSEUR", rowCmd.getForeignIDNumber("ID_FOURNISSEUR"));
-
 
312
                    rowValsTarifF.put("ID_ARTICLE", rowArticle);
-
 
313
                    rowValsTarifF.put("PRIX_ACHAT", rowArticle.getObject("PRIX_METRIQUE_HA_1"));
-
 
314
                    rowValsTarifF.put("PRIX_ACHAT_DEVISE_F", rowArticle.getObject("PRIX_METRIQUE_HA_1"));
-
 
315
                    rowValsTarifF.put("QTE", 1);
-
 
316
                    rowValsTarifF.put("DATE_PRIX", rowCmd.getDate("DATE").getTime());
-
 
317
                }
-
 
318
 
302
                // crée les articles si il n'existe pas
319
                // crée les articles si il n'existe pas
303
 
320
 
304
                int idArt = -1;
321
                int idArt = -1;
305
                if (modeAvance)
322
                if (modeAvance)
306
                    idArt = ReferenceArticleSQLElement.getIdForCNM(rowArticle, createArticle);
323
                    idArt = ReferenceArticleSQLElement.getIdForCNM(rowArticle, createArticle);
Line 470... Line 487...
470
 
487
 
471
    public static enum EXPAND_TYPE {
488
    public static enum EXPAND_TYPE {
472
        VIEW_ONLY, EXPAND, FLAT
489
        VIEW_ONLY, EXPAND, FLAT
473
    };
490
    };
474
 
491
 
-
 
492
    public AutoCompletionManager getCodeCompletionManager() {
-
 
493
        return null;
-
 
494
    }
-
 
495
 
475
    public void expandNomenclature(int index, AutoCompletionManager m, final EXPAND_TYPE type) {
496
    public void expandNomenclature(int index, AutoCompletionManager m, final EXPAND_TYPE type) {
476
        SQLRowValues rowValsLineFather = this.model.getRowValuesAt(index);
497
        SQLRowValues rowValsLineFather = this.model.getRowValuesAt(index);
477
        if (!rowValsLineFather.isForeignEmpty("ID_ARTICLE")) {
498
        if (!rowValsLineFather.isForeignEmpty("ID_ARTICLE")) {
478
 
499
 
479
            if (type == EXPAND_TYPE.EXPAND) {
500
            if (type == EXPAND_TYPE.EXPAND) {