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
 *
182 ilm 4
 * Copyright 2011-2019 OpenConcerto, by ILM Informatique. All rights reserved.
83 ilm 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.supplychain.product.element;
15
 
16
import org.openconcerto.erp.config.ComptaPropsConfiguration;
17
import org.openconcerto.erp.core.common.element.ComptaSQLConfElement;
18
import org.openconcerto.erp.core.supplychain.product.component.ArticleFournisseurSQLComponent;
19
import org.openconcerto.erp.generationDoc.gestcomm.FicheArticleXmlSheet;
20
import org.openconcerto.erp.model.MouseSheetXmlListeListener;
21
import org.openconcerto.erp.preferences.DefaultNXProps;
22
import org.openconcerto.erp.preferences.GestionArticleGlobalPreferencePanel;
23
import org.openconcerto.sql.Configuration;
24
import org.openconcerto.sql.element.SQLComponent;
25
import org.openconcerto.sql.preferences.SQLPreferences;
132 ilm 26
import org.openconcerto.utils.ListMap;
83 ilm 27
 
28
import java.util.ArrayList;
29
import java.util.List;
30
 
31
public class ArticleFournisseurSQLElement extends ComptaSQLConfElement {
32
 
33
    public ArticleFournisseurSQLElement() {
34
        super("ARTICLE_FOURNISSEUR", "un article fournisseur", "articles fournisseurs");
35
 
182 ilm 36
        getRowActions().addAll(new MouseSheetXmlListeListener(this, FicheArticleXmlSheet.class).getRowActions());
83 ilm 37
 
38
    }
39
 
40
    protected List<String> getListFields() {
41
        final List<String> l = new ArrayList<String>();
42
 
43
        l.add("CODE");
44
        l.add("NOM");
45
        String articleAdvanced = DefaultNXProps.getInstance().getStringProperty("ArticleModeVenteAvance");
46
        Boolean bArticleAdvanced = Boolean.valueOf(articleAdvanced);
47
 
48
        if (bArticleAdvanced) {
49
            l.add("POIDS");
50
            l.add("PRIX_METRIQUE_HA_1");
51
            l.add("PRIX_METRIQUE_VT_1");
52
        }
53
        l.add("PA_HT");
54
        l.add("PV_HT");
55
            l.add("ID_TAXE");
56
        l.add("PV_TTC");
57
        l.add("ID_FAMILLE_ARTICLE_FOURNISSEUR");
58
        l.add("ID_FOURNISSEUR");
59
        String val = DefaultNXProps.getInstance().getStringProperty("ArticleService");
60
        Boolean b = Boolean.valueOf(val);
61
        if (b != null && b.booleanValue()) {
62
            l.add("SERVICE");
63
        }
64
        return l;
65
    }
66
 
67
    @Override
132 ilm 68
    public ListMap<String, String> getShowAs() {
69
        return ListMap.singleton(null, "NOM", "ID_FAMILLE_ARTICLE_FOURNISSEUR");
83 ilm 70
    }
71
 
72
    protected List<String> getComboFields() {
73
        final List<String> l = new ArrayList<String>();
74
        l.add("CODE");
75
        SQLPreferences prefs = new SQLPreferences(getTable().getDBRoot());
76
        if (prefs.getBoolean(GestionArticleGlobalPreferencePanel.SHOW_PRODUCT_BAR_CODE, false)) {
77
            l.add("CODE_BARRE");
78
        }
79
 
80
        l.add("NOM");
81
        return l;
82
    }
83
 
84
    /*
85
     * (non-Javadoc)
86
     *
87
     * @see org.openconcerto.devis.SQLElement#getComponent()
88
     */
89
    public SQLComponent createComponent() {
90
 
91
        return new ArticleFournisseurSQLComponent(this);
92
    }
93
 
94
    @Override
95
    protected String createCode() {
156 ilm 96
        return createCodeOfPackage();
83 ilm 97
    }
98
}