OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

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

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