OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

Rev 144 | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 144 Rev 156
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 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.
10
 * 
10
 * 
11
 * When distributing the software, include this License Header Notice in each file.
11
 * When distributing the software, include this License Header Notice in each file.
12
 */
12
 */
13
 
13
 
14
 package org.openconcerto.erp.core.common.element;
14
 package org.openconcerto.erp.core.common.element;
15
 
15
 
16
import org.openconcerto.sql.element.SQLComponent;
16
import org.openconcerto.sql.element.SQLComponent;
17
import org.openconcerto.sql.element.UISQLComponent;
17
import org.openconcerto.sql.element.UISQLComponent;
18
import org.openconcerto.sql.request.ComboSQLRequest;
18
import org.openconcerto.sql.request.ComboSQLRequest;
19
import org.openconcerto.sql.request.ComboSQLRequest.KeepMode;
19
import org.openconcerto.sql.request.ComboSQLRequest.KeepMode;
20
import org.openconcerto.utils.ProductInfo;
20
import org.openconcerto.utils.ProductInfo;
21
 
21
 
22
import java.util.ArrayList;
22
import java.util.ArrayList;
23
import java.util.Arrays;
23
import java.util.Arrays;
24
import java.util.List;
24
import java.util.List;
25
 
25
 
26
public class BanqueSQLElement extends ComptaSQLConfElement {
26
public class BanqueSQLElement extends ComptaSQLConfElement {
27
 
27
 
28
    public static final String TABLENAME = ProductInfo.getInstance().getName().equals("OpenConcerto") ? "BANQUE" : "BANQUE_POLE_PRODUIT";
28
    public static final String TABLENAME = ProductInfo.getInstance().getName().equals("OpenConcerto") ? "BANQUE" : "BANQUE_POLE_PRODUIT";
29
 
29
 
30
    public BanqueSQLElement() {
30
    public BanqueSQLElement() {
31
        super(TABLENAME, "une banque", "banques");
31
        super(TABLENAME);
32
    }
32
    }
33
 
33
 
34
    @Override
34
    @Override
35
    protected void _initComboRequest(ComboSQLRequest req) {
35
    protected void _initComboRequest(ComboSQLRequest req) {
36
        super._initComboRequest(req);
36
        super._initComboRequest(req);
37
        req.addForeignToGraphToFetch("ID_JOURNAL", Arrays.asList("ID", "CODE", "NOM"));
37
        req.addForeignToGraphToFetch("ID_JOURNAL", Arrays.asList("ID", "CODE", "NOM"));
38
        req.keepRows(KeepMode.GRAPH);
38
        req.keepRows(KeepMode.GRAPH);
39
    }
39
    }
40
 
40
 
41
    @Override
41
    @Override
42
    protected List<String> getComboFields() {
42
    protected List<String> getComboFields() {
43
        List<String> list = new ArrayList<String>();
43
        List<String> list = new ArrayList<>(2);
44
        list.add("CODE");
44
        list.add("CODE");
45
        list.add("NOM");
45
        list.add("NOM");
46
        return list;
46
        return list;
47
    }
47
    }
48
 
48
 
49
    @Override
49
    @Override
50
    protected List<String> getListFields() {
50
    protected List<String> getListFields() {
51
        List<String> list = new ArrayList<String>();
51
        List<String> list = new ArrayList<>(4);
52
        list.add("CODE");
52
        list.add("CODE");
53
        list.add("NOM");
53
        list.add("NOM");
54
 
-
 
55
        list.add("ID_JOURNAL");
54
        list.add("ID_JOURNAL");
56
        list.add("ID_COMPTE_PCE");
55
        list.add("ID_COMPTE_PCE");
57
        return list;
56
        return list;
58
    }
57
    }
59
 
58
 
60
    public SQLComponent createComponent() {
59
    public SQLComponent createComponent() {
61
        return new UISQLComponent(this, 2) {
60
        return new UISQLComponent(this, 2) {
62
            public void addViews() {
61
            public void addViews() {
63
                this.addView("CODE");
62
                this.addView("CODE");
64
                this.addView("NOM");
63
                this.addView("NOM");
65
                this.addView("NUMERO_RUE");
64
                this.addView("NUMERO_RUE");
66
                this.addView("VOIE");
65
                this.addView("VOIE");
67
                this.addView("RUE");
66
                this.addView("RUE");
68
                this.addView("VILLE");
67
                this.addView("VILLE");
69
                this.addView("BIC");
68
                this.addView("BIC");
70
                this.addView("IBAN");
69
                this.addView("IBAN");
71
                this.addView("AFFACTURAGE");
70
                this.addView("AFFACTURAGE");
72
                this.addView("ID_JOURNAL");
71
                this.addView("ID_JOURNAL");
73
                this.addView("ID_COMPTE_PCE");
72
                this.addView("ID_COMPTE_PCE");
74
                this.addView("INFOS");
73
                this.addView("INFOS");
75
 
74
 
76
            }
75
            }
77
        };
76
        };
78
    }
77
    }
-
 
78
 
-
 
79
    @Override
-
 
80
    protected String createCode() {
-
 
81
        return "bank";
-
 
82
    }
79
}
83
}