OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

Rev 180 | 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 137... Line 137...
137
 
137
 
138
        this.add(labelPointageCompte, c);
138
        this.add(labelPointageCompte, c);
139
        this.selCompte = new ISQLCompteSelector();
139
        this.selCompte = new ISQLCompteSelector();
140
        SQLElement eltCpt = directory.getElement("COMPTE_PCE");
140
        SQLElement eltCpt = directory.getElement("COMPTE_PCE");
141
        final ComboSQLRequest createComboRequest = eltCpt.createComboRequest();
141
        final ComboSQLRequest createComboRequest = eltCpt.createComboRequest();
142
        String function = "REGEXP";
142
        Where w = createTierWhere(eltCpt);
143
        if (Configuration.getInstance().getBase().getServer().getSQLSystem() == SQLSystem.POSTGRESQL) {
-
 
144
            function = "~";
143
        createComboRequest.setWhere(w);
145
        }
-
 
146
        createComboRequest.setWhere(new Where(eltCpt.getTable().getField("NUMERO"), function, "^4.*$"));
-
 
147
        this.selCompte.init(eltCpt, createComboRequest);
144
        this.selCompte.init(eltCpt, createComboRequest);
148
        this.selCompte.setValue(idCompte);
145
        this.selCompte.setValue(idCompte);
149
 
146
 
150
        c.gridx++;
147
        c.gridx++;
151
        c.weightx = 1;
148
        c.weightx = 1;
152
        c.gridwidth = GridBagConstraints.REMAINDER;
149
        c.gridwidth = GridBagConstraints.REMAINDER;
153
        this.add(this.selCompte, c);
150
        this.add(this.selCompte, c);
154
 
151
 
-
 
152
        c.gridx = 0;
-
 
153
        c.gridy++;
-
 
154
        final JCheckBox boxLimitCompteTier = new JCheckBox("Limiter aux comptes de classe 4");
-
 
155
        boxLimitCompteTier.setSelected(true);
-
 
156
        boxLimitCompteTier.addActionListener(new ActionListener() {
-
 
157
            public void actionPerformed(ActionEvent e) {
-
 
158
                if (boxLimitCompteTier.isSelected()) {
-
 
159
                    selCompte.getRequest().setWhere(w);
-
 
160
                } else {
-
 
161
                    selCompte.getRequest().setWhere(null);
-
 
162
                }
-
 
163
            }
-
 
164
        });
-
 
165
 
-
 
166
        this.add(boxLimitCompteTier, c);
-
 
167
 
155
        c.gridwidth = 1;
168
        c.gridwidth = 1;
156
 
169
 
157
        // Gestion du lettrage
170
        // Gestion du lettrage
158
        c.insets = new Insets(2, 2, 1, 2);
171
        c.insets = new Insets(2, 2, 1, 2);
159
        TitledSeparator sepGestionLettrage = new TitledSeparator("Gestion du lettrage");
172
        TitledSeparator sepGestionLettrage = new TitledSeparator("Gestion du lettrage");
Line 659... Line 672...
659
                actionDelettrage(rowIndex, false);
672
                actionDelettrage(rowIndex, false);
660
            }
673
            }
661
        });
674
        });
662
 
675
 
663
        // Changement de compte
676
        // Changement de compte
664
        this.selCompte.addValueListener(new PropertyChangeListener() {
677
        this.selCompte.addModelListener("wantedID", new PropertyChangeListener() {
665
            public void propertyChange(PropertyChangeEvent evt) {
678
            public void propertyChange(PropertyChangeEvent evt) {
666
 
679
 
667
                changeListRequest();
680
                changeListRequest();
668
            };
681
            };
669
        });
682
        });
Line 725... Line 738...
725
 
738
 
726
    private String getNextCodeLettragePartiel() {
739
    private String getNextCodeLettragePartiel() {
727
        return Configuration.getInstance().getDirectory().getElement(NumerotationAutoSQLElement.class).getNextCodeLettragePartiel();
740
        return Configuration.getInstance().getDirectory().getElement(NumerotationAutoSQLElement.class).getNextCodeLettragePartiel();
728
    }
741
    }
729
 
742
 
-
 
743
    private Where createTierWhere(final SQLElement eltCpt) {
-
 
744
        String function = "REGEXP";
-
 
745
        if (eltCpt.getTable().getBase().getServer().getSQLSystem() == SQLSystem.POSTGRESQL) {
-
 
746
            function = "~";
-
 
747
        }
-
 
748
 
-
 
749
        Where w = new Where(eltCpt.getTable().getField("NUMERO"), function, "^4.*$");
-
 
750
        return w;
-
 
751
    }
-
 
752
 
730
    private String getNextCodeLettrage() {
753
    private String getNextCodeLettrage() {
731
        return Configuration.getInstance().getDirectory().getElement(NumerotationAutoSQLElement.class).getNextCodeLettrage();
754
        return Configuration.getInstance().getDirectory().getElement(NumerotationAutoSQLElement.class).getNextCodeLettrage();
732
    }
755
    }
733
 
756
 
734
    /* Menu clic Droit */
757
    /* Menu clic Droit */
Line 992... Line 1015...
992
    /*
1015
    /*
993
     * MaJ de la requete pour remplir la IListe en fonction du compte sélectionner et du mode de
1016
     * MaJ de la requete pour remplir la IListe en fonction du compte sélectionner et du mode de
994
     * sélection
1017
     * sélection
995
     */
1018
     */
996
    private void changeListRequest() {
1019
    private void changeListRequest() {
997
        Object idCpt = this.selCompte.getSelectedId();
1020
        Object idCpt = this.selCompte.getWantedID();
998
 
1021
 
999
        SQLRow row = this.tableComptePCE.getRow(Integer.valueOf(idCpt.toString()));
1022
        SQLRow row = this.tableComptePCE.getRow(Integer.valueOf(idCpt.toString()));
1000
 
1023
 
1001
        // filtre de selection
1024
        // filtre de selection
1002
        Where w = new Where(this.tableEcr.getField("ID_COMPTE_PCE"), "=", this.tableComptePCE.getKey());
1025
        Where w = new Where(this.tableEcr.getField("ID_COMPTE_PCE"), "=", this.tableComptePCE.getKey());