OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

Rev 142 | 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.supplychain.supplier.element;
15
 
16
import org.openconcerto.erp.core.common.element.ComptaSQLConfElement;
142 ilm 17
import org.openconcerto.erp.core.edm.AttachmentAction;
41 ilm 18
import org.openconcerto.erp.core.supplychain.supplier.component.FournisseurSQLComponent;
18 ilm 19
import org.openconcerto.sql.element.SQLComponent;
142 ilm 20
import org.openconcerto.sql.request.ComboSQLRequest;
21
import org.openconcerto.sql.request.ComboSQLRequest.KeepMode;
156 ilm 22
import org.openconcerto.sql.request.ListSQLRequest;
142 ilm 23
import org.openconcerto.sql.view.list.IListeAction.IListeEvent;
24
import org.openconcerto.sql.view.list.RowAction.PredicateRowAction;
18 ilm 25
 
26
import java.util.ArrayList;
132 ilm 27
import java.util.Arrays;
18 ilm 28
import java.util.List;
29
 
30
public class FournisseurSQLElement extends ComptaSQLConfElement {
31
 
32
    public FournisseurSQLElement() {
33
        super("FOURNISSEUR", "un fournisseur", "fournisseurs");
142 ilm 34
 
35
        PredicateRowAction actionAttachment = new PredicateRowAction(new AttachmentAction().getAction(), true);
36
        actionAttachment.setPredicate(IListeEvent.getSingleSelectionPredicate());
37
        getRowActions().add(actionAttachment);
18 ilm 38
    }
39
 
156 ilm 40
    @Override
18 ilm 41
    protected List<String> getListFields() {
156 ilm 42
        final List<String> l = new ArrayList<>(8);
18 ilm 43
        l.add("CODE");
44
        l.add("NOM");
45
        l.add("TYPE");
46
        l.add("TEL");
47
        l.add("FAX");
48
        l.add("ID_MODE_REGLEMENT");
49
        l.add("ID_COMPTE_PCE");
50
        l.add("ID_ADRESSE");
51
        return l;
52
    }
53
 
156 ilm 54
    @Override
18 ilm 55
    protected List<String> getComboFields() {
156 ilm 56
        final List<String> l = new ArrayList<>(2);
18 ilm 57
        l.add("NOM");
58
        l.add("CODE");
59
        return l;
60
    }
61
 
62
    @Override
142 ilm 63
    protected void _initComboRequest(ComboSQLRequest req) {
64
        super._initComboRequest(req);
65
        req.addToGraphToFetch("UE");
66
        req.addForeignToGraphToFetch("ID_COMPTE_PCE_CHARGE", Arrays.asList("ID", "NUMERO"));
67
        req.keepRows(KeepMode.GRAPH);
68
    }
69
 
70
    @Override
132 ilm 71
    protected void _initListRequest(ListSQLRequest req) {
72
        super._initListRequest(req);
73
        req.addForeignToGraphToFetch("ID_MODE_REGLEMENT", Arrays.asList("AJOURS", "LENJOUR", "DATE_FACTURE", "COMPTANT"));
142 ilm 74
 
18 ilm 75
    }
76
 
77
    /*
78
     * (non-Javadoc)
79
     *
80
     * @see org.openconcerto.devis.SQLElement#getComponent()
81
     */
82
    public SQLComponent createComponent() {
41 ilm 83
        return new FournisseurSQLComponent(this);
18 ilm 84
    }
156 ilm 85
 
86
    @Override
87
    protected String createCode() {
88
        return "supplychain.supplier";
89
    }
18 ilm 90
}