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
18 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.humanresources.employe.element;
15
 
16
import org.openconcerto.erp.core.common.element.ComptaSQLConfElement;
180 ilm 17
import org.openconcerto.erp.core.edm.AttachmentAction;
18 ilm 18
import org.openconcerto.sql.element.SQLComponent;
180 ilm 19
import org.openconcerto.sql.view.list.IListeAction.IListeEvent;
20
import org.openconcerto.sql.view.list.RowAction.PredicateRowAction;
132 ilm 21
import org.openconcerto.utils.ListMap;
18 ilm 22
 
23
import java.util.ArrayList;
24
import java.util.List;
25
 
26
public class CommercialSQLElement extends ComptaSQLConfElement {
27
 
28
    public CommercialSQLElement() {
156 ilm 29
        super("COMMERCIAL");
18 ilm 30
    }
31
 
32
    public CommercialSQLElement(String tableName, String singular, String plural) {
33
        super(tableName, singular, plural);
180 ilm 34
        if (getTable().contains("ATTACHMENTS")) {
35
            PredicateRowAction actionAttachment = new PredicateRowAction(new AttachmentAction().getAction(), true);
36
            actionAttachment.setPredicate(IListeEvent.getSingleSelectionPredicate());
37
            getRowActions().add(actionAttachment);
38
        }
18 ilm 39
    }
40
 
41
    protected List<String> getListFields() {
42
        final List<String> l = new ArrayList<String>();
43
        l.add("NOM");
44
        l.add("PRENOM");
45
        l.add("FONCTION");
46
        l.add("TEL_STANDARD");
47
        l.add("TEL_DIRECT");
156 ilm 48
        if (getTable().contains("ID_POLE_PRODUIT")) {
49
            l.add("ID_POLE_PRODUIT");
50
        }
18 ilm 51
        return l;
52
    }
53
 
54
    protected List<String> getComboFields() {
55
        final List<String> l = new ArrayList<String>();
132 ilm 56
        l.add("PRENOM");
18 ilm 57
        l.add("NOM");
58
        l.add("FONCTION");
59
        return l;
60
    }
61
 
28 ilm 62
    @Override
132 ilm 63
    public ListMap<String, String> getShowAs() {
64
        final ListMap<String, String> res = new ListMap<String, String>();
65
        res.putCollection(null, "NOM");
28 ilm 66
        return res;
67
    }
68
 
18 ilm 69
    /*
70
     * (non-Javadoc)
71
     *
72
     * @see org.openconcerto.devis.SQLElement#getComponent()
73
     */
74
    public SQLComponent createComponent() {
61 ilm 75
        return new CommercialSQLComponent(this);
18 ilm 76
    }
57 ilm 77
 
78
    @Override
79
    protected String createCode() {
156 ilm 80
        return this.createCodeOfPackage() + ".salesman";
57 ilm 81
    }
18 ilm 82
}