OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

Rev 156 | 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;
177 ilm 20
import org.openconcerto.utils.ListMap;
83 ilm 21
import org.openconcerto.utils.ProductInfo;
22
 
23
import java.util.ArrayList;
144 ilm 24
import java.util.Arrays;
83 ilm 25
import java.util.List;
26
 
27
public class BanqueSQLElement extends ComptaSQLConfElement {
28
 
29
    public static final String TABLENAME = ProductInfo.getInstance().getName().equals("OpenConcerto") ? "BANQUE" : "BANQUE_POLE_PRODUIT";
30
 
31
    public BanqueSQLElement() {
156 ilm 32
        super(TABLENAME);
83 ilm 33
    }
34
 
35
    @Override
177 ilm 36
    public ListMap<String, String> getShowAs() {
37
        ListMap<String, String> map = new ListMap<>();
38
        map.add(null, "NOM");
39
        return map;
40
    }
41
 
42
    @Override
144 ilm 43
    protected void _initComboRequest(ComboSQLRequest req) {
44
        super._initComboRequest(req);
45
        req.addForeignToGraphToFetch("ID_JOURNAL", Arrays.asList("ID", "CODE", "NOM"));
46
        req.keepRows(KeepMode.GRAPH);
47
    }
48
 
49
    @Override
83 ilm 50
    protected List<String> getComboFields() {
156 ilm 51
        List<String> list = new ArrayList<>(2);
83 ilm 52
        list.add("CODE");
53
        list.add("NOM");
54
        return list;
55
    }
56
 
57
    @Override
58
    protected List<String> getListFields() {
156 ilm 59
        List<String> list = new ArrayList<>(4);
83 ilm 60
        list.add("CODE");
61
        list.add("NOM");
62
        list.add("ID_JOURNAL");
63
        list.add("ID_COMPTE_PCE");
64
        return list;
65
    }
66
 
67
    public SQLComponent createComponent() {
68
        return new UISQLComponent(this, 2) {
69
            public void addViews() {
70
                this.addView("CODE");
71
                this.addView("NOM");
72
                this.addView("NUMERO_RUE");
73
                this.addView("VOIE");
74
                this.addView("RUE");
75
                this.addView("VILLE");
76
                this.addView("BIC");
77
                this.addView("IBAN");
78
                this.addView("AFFACTURAGE");
79
                this.addView("ID_JOURNAL");
80
                this.addView("ID_COMPTE_PCE");
81
                this.addView("INFOS");
82
 
83
            }
84
        };
85
    }
156 ilm 86
 
87
    @Override
88
    protected String createCode() {
89
        return "bank";
90
    }
83 ilm 91
}