OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

Rev 144 | Details | Compare with Previous | Last modification | View Log | RSS feed

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