OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

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

Rev 180 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 51... Line 51...
51
import org.openconcerto.sql.preferences.SQLPreferences;
51
import org.openconcerto.sql.preferences.SQLPreferences;
52
import org.openconcerto.sql.sqlobject.ElementComboBox;
52
import org.openconcerto.sql.sqlobject.ElementComboBox;
53
import org.openconcerto.sql.sqlobject.JUniqueTextField;
53
import org.openconcerto.sql.sqlobject.JUniqueTextField;
54
import org.openconcerto.sql.sqlobject.SQLRequestComboBox;
54
import org.openconcerto.sql.sqlobject.SQLRequestComboBox;
55
import org.openconcerto.sql.sqlobject.SQLTextCombo;
55
import org.openconcerto.sql.sqlobject.SQLTextCombo;
-
 
56
import org.openconcerto.sql.sqlobject.itemview.SimpleRowItemView;
56
import org.openconcerto.sql.users.UserManager;
57
import org.openconcerto.sql.users.UserManager;
57
import org.openconcerto.sql.view.EditFrame;
58
import org.openconcerto.sql.view.EditFrame;
58
import org.openconcerto.sql.view.list.RowValuesTable;
59
import org.openconcerto.sql.view.list.RowValuesTable;
59
import org.openconcerto.sql.view.list.RowValuesTableModel;
60
import org.openconcerto.sql.view.list.RowValuesTableModel;
60
import org.openconcerto.ui.DefaultGridBagConstraints;
61
import org.openconcerto.ui.DefaultGridBagConstraints;
61
import org.openconcerto.ui.FormLayouter;
62
import org.openconcerto.ui.FormLayouter;
62
import org.openconcerto.ui.JDate;
63
import org.openconcerto.ui.JDate;
63
import org.openconcerto.ui.TitledSeparator;
64
import org.openconcerto.ui.TitledSeparator;
64
import org.openconcerto.ui.component.ITextArea;
65
import org.openconcerto.ui.component.ITextArea;
-
 
66
import org.openconcerto.ui.valuewrapper.ValidatedValueWrapper;
65
import org.openconcerto.utils.ExceptionHandler;
67
import org.openconcerto.utils.ExceptionHandler;
66
import org.openconcerto.utils.NumberUtils;
68
import org.openconcerto.utils.NumberUtils;
-
 
69
import org.openconcerto.utils.cc.ITransformer;
-
 
70
import org.openconcerto.utils.checks.ValidState;
67
 
71
 
68
import java.awt.Color;
72
import java.awt.Color;
69
import java.awt.GridBagConstraints;
73
import java.awt.GridBagConstraints;
70
import java.awt.GridBagLayout;
74
import java.awt.GridBagLayout;
71
import java.awt.Insets;
75
import java.awt.Insets;
Line 253... Line 257...
253
 
257
 
254
        c.gridx++;
258
        c.gridx++;
255
        c.weightx = 0;
259
        c.weightx = 0;
256
        c.weighty = 0;
260
        c.weighty = 0;
257
        c.fill = GridBagConstraints.NONE;
261
        c.fill = GridBagConstraints.NONE;
-
 
262
        final ValidatedValueWrapper<Integer> clientValidatedValueWrapper = ValidatedValueWrapper.add(new ElementComboBox(), new ITransformer<Integer, ValidState>() {
-
 
263
            @Override
-
 
264
            public ValidState transformChecked(Integer t) {
-
 
265
                ElementComboBox boxClient = (ElementComboBox) getView("ID_CLIENT").getComp();
-
 
266
                if (getMode() == Mode.INSERTION && boxClient != null && !boxClient.isEmpty()
-
 
267
                        && (boxClient.getSelectedRow().getBoolean("BLOQUE_LIVRAISON") || boxClient.getSelectedRow().getBoolean("BLOQUE"))) {
-
 
268
                    return ValidState.create(false, "Les intéractions avec ce client sont verrouillées.");
-
 
269
                } else {
-
 
270
                    return ValidState.getTrueInstance();
-
 
271
                }
-
 
272
            }
-
 
273
        });
258
        this.comboClient = new ElementComboBox();
274
        this.comboClient = (ElementComboBox) clientValidatedValueWrapper.getComp();
-
 
275
        addView(new SimpleRowItemView<Integer>(clientValidatedValueWrapper), "ID_CLIENT", REQ);
259
        this.add(this.comboClient, c);
276
        this.add(this.comboClient, c);
260
        this.addRequiredSQLObject(this.comboClient, "ID_CLIENT");
-
 
261
 
277
 
262
        if (this.displayDpt) {
278
        if (this.displayDpt) {
263
            c.gridx++;
279
            c.gridx++;
264
            c.gridwidth = 1;
280
            c.gridwidth = 1;
265
            final JLabel labelDpt = new JLabel(getLabelFor("ID_CLIENT_DEPARTEMENT"));
281
            final JLabel labelDpt = new JLabel(getLabelFor("ID_CLIENT_DEPARTEMENT"));
Line 373... Line 389...
373
            final SQLElement contactElement = getElement().getForeignElement("ID_CONTACT");
389
            final SQLElement contactElement = getElement().getForeignElement("ID_CONTACT");
374
            comboContact.init(contactElement, contactElement.getComboRequest(true));
390
            comboContact.init(contactElement, contactElement.getComboRequest(true));
375
            comboContact.getRequest().setWhere(Where.FALSE);
391
            comboContact.getRequest().setWhere(Where.FALSE);
376
            DefaultGridBagConstraints.lockMinimumSize(comboContact);
392
            DefaultGridBagConstraints.lockMinimumSize(comboContact);
377
            this.addView(comboContact, "ID_CONTACT");
393
            this.addView(comboContact, "ID_CONTACT");
-
 
394
 
-
 
395
            // Commercial
-
 
396
            JLabel labelCommercial = new JLabel(getLabelFor("ID_COMMERCIAL"));
-
 
397
            labelCommercial.setHorizontalAlignment(SwingConstants.RIGHT);
-
 
398
 
-
 
399
            c.gridx++;
-
 
400
            c.weightx = 0;
-
 
401
            this.add(labelCommercial, c);
-
 
402
 
-
 
403
            this.comboCommercial = new ElementComboBox(false, 25);
-
 
404
            this.comboCommercial.setListIconVisible(false);
-
 
405
            c.gridx++;
-
 
406
            c.fill = GridBagConstraints.NONE;
-
 
407
            c.weightx = 1;
-
 
408
            this.add(this.comboCommercial, c);
-
 
409
            addRequiredSQLObject(this.comboCommercial, "ID_COMMERCIAL");
-
 
410
 
378
            comboClient.addModelListener("wantedID", new PropertyChangeListener() {
411
            comboClient.addModelListener("wantedID", new PropertyChangeListener() {
379
 
412
 
380
                @Override
413
                @Override
381
                public void propertyChange(PropertyChangeEvent evt) {
414
                public void propertyChange(PropertyChangeEvent evt) {
382
                    int wantedID = comboClient.getWantedID();
415
                    int wantedID = comboClient.getWantedID();
383
                    System.err.println("SET WHERE ID_CLIENT = " + wantedID);
416
                    System.err.println("SET WHERE ID_CLIENT = " + wantedID);
384
                    if (wantedID != SQLRow.NONEXISTANT_ID && wantedID >= SQLRow.MIN_VALID_ID) {
417
                    if (wantedID != SQLRow.NONEXISTANT_ID && wantedID >= SQLRow.MIN_VALID_ID) {
385
 
418
 
386
                        final SQLRow rowClient = getTable().getForeignTable("ID_CLIENT").getRow(wantedID);
419
                        final SQLRow rowClient = getTable().getForeignTable("ID_CLIENT").getRow(wantedID);
-
 
420
                        String alerte = rowClient.getString("ALERTE");
-
 
421
                        if (!isFilling() && alerte != null && alerte.trim().length() > 0) {
-
 
422
                            JOptionPane.showMessageDialog(comboClient, alerte);
-
 
423
                        }
-
 
424
 
387
                        int idClient = rowClient.getID();
425
                        int idClient = rowClient.getID();
388
                        comboContact.getRequest().setWhere(new Where(contactElement.getTable().getField("ID_CLIENT"), "=", idClient));
426
                        comboContact.getRequest().setWhere(new Where(contactElement.getTable().getField("ID_CLIENT"), "=", idClient));
389
                        if (rowClient.getObject("ID_CATEGORIE_COMPTABLE") != null && !rowClient.isForeignEmpty("ID_CATEGORIE_COMPTABLE")) {
427
                        if (rowClient.getObject("ID_CATEGORIE_COMPTABLE") != null && !rowClient.isForeignEmpty("ID_CATEGORIE_COMPTABLE")) {
390
                            tableBonItem.setRowCatComptable(rowClient.getForeign("ID_CATEGORIE_COMPTABLE"));
428
                            tableBonItem.setRowCatComptable(rowClient.getForeign("ID_CATEGORIE_COMPTABLE"));
391
                        } else {
429
                        } else {
392
                            tableBonItem.setRowCatComptable(null);
430
                            tableBonItem.setRowCatComptable(null);
393
                        }
431
                        }
394
 
432
 
395
                        tableBonItem.setClient(rowClient, !isFilling());
433
                        tableBonItem.setClient(rowClient, !isFilling());
396
 
434
 
-
 
435
                        if (!isFilling() && !rowClient.isForeignEmpty("ID_COMMERCIAL")) {
-
 
436
                            comboCommercial.setValue(rowClient.getForeignID("ID_COMMERCIAL"));
-
 
437
                        }
-
 
438
 
397
                    } else {
439
                    } else {
398
                        comboContact.getRequest().setWhere(Where.FALSE);
440
                        comboContact.getRequest().setWhere(Where.FALSE);
399
                        tableBonItem.setRowCatComptable(null);
441
                        tableBonItem.setRowCatComptable(null);
400
                        if (!isFilling()) {
442
                        if (!isFilling()) {
401
                            tableBonItem.setClient(null, true);
443
                            tableBonItem.setClient(null, true);
402
                        }
444
                        }
403
                        // DevisSQLComponent.this.table.setTarif(null, false);
445
                        // DevisSQLComponent.this.table.setTarif(null, false);
404
                    }
446
                    }
405
                }
447
                }
406
            });
448
            });
407
 
-
 
408
            // Commercial
-
 
409
            JLabel labelCommercial = new JLabel(getLabelFor("ID_COMMERCIAL"));
-
 
410
            labelCommercial.setHorizontalAlignment(SwingConstants.RIGHT);
-
 
411
            c.fill = GridBagConstraints.HORIZONTAL;
-
 
412
            c.gridx++;
-
 
413
            c.weightx = 0;
-
 
414
            this.add(labelCommercial, c);
-
 
415
 
-
 
416
            this.comboCommercial = new ElementComboBox(false, 25);
-
 
417
            this.comboCommercial.setListIconVisible(false);
-
 
418
            c.gridx++;
-
 
419
            c.fill = GridBagConstraints.NONE;
-
 
420
            c.weightx = 1;
-
 
421
            this.add(this.comboCommercial, c);
-
 
422
            addRequiredSQLObject(this.comboCommercial, "ID_COMMERCIAL");
-
 
423
 
-
 
424
        }
449
        }
425
 
450
 
426
        final ElementComboBox boxTarif = new ElementComboBox();
451
        final ElementComboBox boxTarif = new ElementComboBox();
-
 
452
 
427
        this.comboClient.addValueListener(new PropertyChangeListener() {
453
        this.comboClient.addValueListener(new PropertyChangeListener() {
428
            @Override
454
            @Override
429
            public void propertyChange(PropertyChangeEvent evt) {
455
            public void propertyChange(PropertyChangeEvent evt) {
430
                if (comboClient.getElement().getTable().contains("ID_TARIF")) {
456
                if (comboClient.getElement().getTable().contains("ID_TARIF")) {
431
                    if (BonDeLivraisonSQLComponent.this.isFilling())
457
                    if (BonDeLivraisonSQLComponent.this.isFilling())
Line 734... Line 760...
734
        this.addSQLObject(textInfos, "INFOS");
760
        this.addSQLObject(textInfos, "INFOS");
735
        this.addSQLObject(this.textNom, "NOM");
761
        this.addSQLObject(this.textNom, "NOM");
736
        this.addSQLObject(this.selectCommande, "ID_COMMANDE_CLIENT");
762
        this.addSQLObject(this.selectCommande, "ID_COMMANDE_CLIENT");
737
        this.addRequiredSQLObject(this.textNumeroUnique, "NUMERO");
763
        this.addRequiredSQLObject(this.textNumeroUnique, "NUMERO");
738
 
764
 
-
 
765
        comboClient.addModelListener("wantedID", new PropertyChangeListener() {
-
 
766
 
-
 
767
            @Override
-
 
768
            public void propertyChange(PropertyChangeEvent arg0) {
-
 
769
 
-
 
770
                Integer id = comboClient.getWantedID();
-
 
771
 
-
 
772
                if (id > 1) {
-
 
773
 
-
 
774
                    SQLRow rowClient = comboClient.getElement().getTable().getRow(id);
-
 
775
                    if (rowClient.getObject("ID_CATEGORIE_COMPTABLE") != null && !rowClient.isForeignEmpty("ID_CATEGORIE_COMPTABLE")) {
-
 
776
                        panelTotal.setCategorieComptable(rowClient.getForeign("ID_CATEGORIE_COMPTABLE"));
-
 
777
                        tableBonItem.setRowCatComptable(rowClient.getForeign("ID_CATEGORIE_COMPTABLE"));
-
 
778
                    } else {
-
 
779
                        panelTotal.setCategorieComptable(null);
-
 
780
                        tableBonItem.setRowCatComptable(null);
-
 
781
                    }
-
 
782
                }
-
 
783
            }
-
 
784
        });
-
 
785
 
739
        // Doit etre locké a la fin
786
        // Doit etre locké a la fin
740
        DefaultGridBagConstraints.lockMinimumSize(comboClient);
787
        DefaultGridBagConstraints.lockMinimumSize(comboClient);
741
 
788
 
742
        textPortHT.getDocument().addDocumentListener(new DocumentListener() {
789
        textPortHT.getDocument().addDocumentListener(new DocumentListener() {
743
            public void changedUpdate(DocumentEvent e) {
790
            public void changedUpdate(DocumentEvent e) {
Line 836... Line 883...
836
            final List<Object> cmdDourceTrRowsFrom = ((BonDeLivraisonSQLElement) getElement()).getSourceTrRowsFrom(idBon, "COMMANDE_CLIENT_ELEMENT", "COMMANDE_CLIENT");
883
            final List<Object> cmdDourceTrRowsFrom = ((BonDeLivraisonSQLElement) getElement()).getSourceTrRowsFrom(idBon, "COMMANDE_CLIENT_ELEMENT", "COMMANDE_CLIENT");
837
            ((BonDeLivraisonSQLElement) getElement()).updateQteLivree(cmdDourceTrRowsFrom, "COMMANDE_CLIENT_ELEMENT", "COMMANDE_CLIENT");
884
            ((BonDeLivraisonSQLElement) getElement()).updateQteLivree(cmdDourceTrRowsFrom, "COMMANDE_CLIENT_ELEMENT", "COMMANDE_CLIENT");
838
            final List<Object> devisSourceTrRowsFrom = ((BonDeLivraisonSQLElement) getElement()).getSourceTrRowsFrom(idBon, "DEVIS_ELEMENT", "DEVIS");
885
            final List<Object> devisSourceTrRowsFrom = ((BonDeLivraisonSQLElement) getElement()).getSourceTrRowsFrom(idBon, "DEVIS_ELEMENT", "DEVIS");
839
            ((BonDeLivraisonSQLElement) getElement()).updateQteLivree(devisSourceTrRowsFrom, "DEVIS_ELEMENT", "DEVIS");
886
            ((BonDeLivraisonSQLElement) getElement()).updateQteLivree(devisSourceTrRowsFrom, "DEVIS_ELEMENT", "DEVIS");
840
            // generation du document
887
            // generation du document
-
 
888
            final SQLRow row = getTable().getRow(idBon);
841
            BonLivraisonXmlSheet bSheet = new BonLivraisonXmlSheet(getTable().getRow(idBon));
889
            BonLivraisonXmlSheet bSheet = new BonLivraisonXmlSheet(row);
842
            bSheet.createDocumentAsynchronous();
890
            bSheet.createDocumentAsynchronous();
843
            bSheet.showPrintAndExportAsynchronous(this.panelOO.isVisualisationSelected(), this.panelOO.isImpressionSelected(), true);
891
            bSheet.showPrintAndExportAsynchronous(this.panelOO.isVisualisationSelected(), this.panelOO.isImpressionSelected(), true, getElement(), row);
844
 
892
 
845
            // incrémentation du numéro auto
893
            // incrémentation du numéro auto
846
            if (NumerotationAutoSQLElement.getNextNumero(getElement().getClass()).equalsIgnoreCase(this.textNumeroUnique.getText().trim())) {
894
            if (NumerotationAutoSQLElement.getNextNumero(getElement().getClass()).equalsIgnoreCase(this.textNumeroUnique.getText().trim())) {
847
                SQLRowValues rowVals = new SQLRowValues(this.tableNum);
895
                SQLRowValues rowVals = new SQLRowValues(this.tableNum);
848
                int val = this.tableNum.getRow(2).getInt("BON_L_START");
896
                int val = this.tableNum.getRow(2).getInt("BON_L_START");
Line 854... Line 902...
854
                } catch (SQLException e) {
902
                } catch (SQLException e) {
855
                    e.printStackTrace();
903
                    e.printStackTrace();
856
                }
904
                }
857
            }
905
            }
858
 
906
 
859
            SQLPreferences prefs = new SQLPreferences(getTable().getDBRoot());
-
 
860
 
-
 
861
            if (!prefs.getBoolean(GestionArticleGlobalPreferencePanel.STOCK_FACT, true)) {
-
 
862
 
-
 
863
                try {
907
            try {
864
                    updateStock(idBon);
908
                updateStock(idBon);
865
                } catch (SQLException e) {
909
            } catch (SQLException e) {
866
                    throw new IllegalStateException(e);
910
                throw new IllegalStateException(e);
867
                }
911
            }
868
            }
912
 
869
            // updateQte(idBon);
913
            // updateQte(idBon);
870
            if (attempt > 0) {
914
            if (attempt > 0) {
871
                SwingUtilities.invokeLater(new Runnable() {
915
                SwingUtilities.invokeLater(new Runnable() {
872
                    public void run() {
916
                    public void run() {
873
                        JOptionPane.showMessageDialog(null, TM.tr("deliveryForm.numberRefreshed", num)); //$NON-NLS-1$
917
                        JOptionPane.showMessageDialog(null, TM.tr("deliveryForm.numberRefreshed", num)); //$NON-NLS-1$
874
                    }
918
                    }
875
                });
919
                });
876
            }
920
            }
-
 
921
            ((BonDeLivraisonSQLElement) getElement()).fireInsertedCmdListener(row);
877
        }
922
        }
878
 
923
 
879
        return idBon;
924
        return idBon;
880
    }
925
    }
881
 
926
 
Line 942... Line 987...
942
        this.tableBonItem.createArticle(getSelectedID(), this.getElement());
987
        this.tableBonItem.createArticle(getSelectedID(), this.getElement());
943
        ((BonDeLivraisonSQLElement) getElement()).updateQteLivree(devisFrom, "DEVIS_ELEMENT", "DEVIS");
988
        ((BonDeLivraisonSQLElement) getElement()).updateQteLivree(devisFrom, "DEVIS_ELEMENT", "DEVIS");
944
        ((BonDeLivraisonSQLElement) getElement()).updateQteLivree(cmdClientFrom, "COMMANDE_CLIENT_ELEMENT", "COMMANDE_CLIENT");
989
        ((BonDeLivraisonSQLElement) getElement()).updateQteLivree(cmdClientFrom, "COMMANDE_CLIENT_ELEMENT", "COMMANDE_CLIENT");
945
 
990
 
946
        // generation du document
991
        // generation du document
-
 
992
        final SQLRow row = getTable().getRow(getSelectedID());
947
        BonLivraisonXmlSheet bSheet = new BonLivraisonXmlSheet(getTable().getRow(getSelectedID()));
993
        BonLivraisonXmlSheet bSheet = new BonLivraisonXmlSheet(row);
948
        bSheet.createDocumentAsynchronous();
994
        bSheet.createDocumentAsynchronous();
949
        bSheet.showPrintAndExportAsynchronous(this.panelOO.isVisualisationSelected(), this.panelOO.isImpressionSelected(), true);
995
        bSheet.showPrintAndExportAsynchronous(this.panelOO.isVisualisationSelected(), this.panelOO.isImpressionSelected(), true, getElement(), row);
950
 
-
 
951
        SQLPreferences prefs = new SQLPreferences(getTable().getDBRoot());
-
 
952
        if (!prefs.getBoolean(GestionArticleGlobalPreferencePanel.STOCK_FACT, true)) {
-
 
953
 
996
 
954
            try {
997
        try {
955
                updateStock(getSelectedID());
998
            updateStock(getSelectedID());
956
            } catch (SQLException e) {
999
        } catch (SQLException e) {
957
                throw new IllegalStateException(e);
1000
            throw new IllegalStateException(e);
958
            }
1001
        }
959
        }
-
 
960
 
1002
 
961
    }
1003
    }
962
 
1004
 
963
    /**
1005
    /**
964
     * Chargement des qtés restantes à livrer
1006
     * Chargement des qtés restantes à livrer
Line 1009... Line 1051...
1009
                this.tableBonItem.getModel().putValue(r.getObject("QTE"), i, "QTE_LIVREE");
1051
                this.tableBonItem.getModel().putValue(r.getObject("QTE"), i, "QTE_LIVREE");
1010
            }
1052
            }
1011
        }
1053
        }
1012
    }
1054
    }
1013
 
1055
 
-
 
1056
    public void removeZeroQtyLines() {
-
 
1057
        int count = this.tableBonItem.getModel().getRowCount() - 1;
-
 
1058
        for (int i = count; i >= 0; i--) {
-
 
1059
            final SQLRowValues rowValuesAt = this.tableBonItem.getModel().getRowValuesAt(i);
-
 
1060
            if (rowValuesAt.getInt("QTE_LIVREE") == 0) {
-
 
1061
                this.tableBonItem.getModel().removeRowAt(i);
-
 
1062
            }
-
 
1063
        }
-
 
1064
    }
-
 
1065
 
1014
    /***********************************************************************************************
1066
    /***********************************************************************************************
1015
     * Mise à jour des quantités livrées dans les élements de facture
1067
     * Mise à jour des quantités livrées dans les élements de facture
1016
     * 
1068
     * 
1017
     * @param idBon id du bon de livraison
1069
     * @param idBon id du bon de livraison
1018
     * @throws SQLException
1070
     * @throws SQLException
Line 1087... Line 1139...
1087
        SQLPreferences prefs = new SQLPreferences(getTable().getDBRoot());
1139
        SQLPreferences prefs = new SQLPreferences(getTable().getDBRoot());
1088
        // Check if tr from bl or cmd pour DS
1140
        // Check if tr from bl or cmd pour DS
1089
        boolean stockWithBL = !prefs.getBoolean(GestionArticleGlobalPreferencePanel.STOCK_FACT, true);
1141
        boolean stockWithBL = !prefs.getBoolean(GestionArticleGlobalPreferencePanel.STOCK_FACT, true);
1090
        if (getTable().getForeignTable("ID_CLIENT").contains("NOTE_2018")) {
1142
        if (getTable().getForeignTable("ID_CLIENT").contains("NOTE_2018")) {
1091
            SQLRow row = getTable().getRow(id);
1143
            SQLRow row = getTable().getRow(id);
1092
            List<SQLRow> trCmd = row.getReferentRows(getTable().getTable("TR_COMMANDE_CLIENT"));
1144
            List<SQLRow> items = row.getReferentRows(getTable().getTable("BON_DE_LIVRAISON_ELEMENT"));
1093
            if (!trCmd.isEmpty()) {
1145
            for (SQLRow sqlRow : items) {
-
 
1146
                if (sqlRow.contains("ID_COMMANDE_CLIENT_ELEMENT") && !sqlRow.isForeignEmpty("ID_COMMANDE_CLIENT_ELEMENT")) {
1094
                stockWithBL = true;
1147
                    stockWithBL = true;
-
 
1148
                    break;
-
 
1149
                }
1095
            }
1150
            }
-
 
1151
 
1096
        }
1152
        }
1097
        if (stockWithBL) {
1153
        if (stockWithBL) {
-
 
1154
 
1098
            SQLRow row = getTable().getRow(id);
1155
            SQLRow row = getTable().getRow(id);
1099
            StockItemsUpdater stockUpdater = new StockItemsUpdater(new StockLabel() {
1156
            StockItemsUpdater stockUpdater = new StockItemsUpdater(new StockLabel() {
1100
                @Override
1157
                @Override
1101
                public String getLabel(SQLRowAccessor rowOrigin, SQLRowAccessor rowElt) {
1158
                public String getLabel(SQLRowAccessor rowOrigin, SQLRowAccessor rowElt) {
1102
                    return getLibelleStock(rowOrigin, rowElt);
1159
                    return getLibelleStock(rowOrigin, rowElt);
Line 1137... Line 1194...
1137
            for (final SQLRow rowElt : myListItem) {
1194
            for (final SQLRow rowElt : myListItem) {
1138
 
1195
 
1139
                final SQLRowValues rowVals = rowElt.createUpdateRow();
1196
                final SQLRowValues rowVals = rowElt.createUpdateRow();
1140
                rowVals.clearPrimaryKeys();
1197
                rowVals.clearPrimaryKeys();
1141
                rowVals.putEmptyLink("ID_COMMANDE_CLIENT_ELEMENT");
1198
                rowVals.putEmptyLink("ID_COMMANDE_CLIENT_ELEMENT");
1142
                getRowValuesTable().getRowValuesTableModel().addRow(rowVals);
1199
                getRowValuesTable().getRowValuesTableModel().addRow(rowVals, false);
1143
                final int rowIndex = getRowValuesTable().getRowValuesTableModel().getRowCount() - 1;
1200
                final int rowIndex = getRowValuesTable().getRowValuesTableModel().getRowCount() - 1;
1144
                getRowValuesTable().getRowValuesTableModel().fireTableModelModified(rowIndex);
1201
                getRowValuesTable().getRowValuesTableModel().fireTableModelModified(rowIndex);
1145
            }
1202
            }
1146
        } else {
1203
        } else {
1147
            getRowValuesTable().getRowValuesTableModel().clearRows();
1204
            getRowValuesTable().getRowValuesTableModel().clearRows();