OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

Rev 151 | Rev 174 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
80 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.order.element;
15
 
94 ilm 16
import org.openconcerto.erp.core.common.element.ComptaSQLConfElement;
151 ilm 17
import org.openconcerto.erp.core.edm.AttachmentAction;
94 ilm 18
import org.openconcerto.erp.core.supplychain.order.component.FactureFournisseurSQLComponent;
19
import org.openconcerto.erp.generationDoc.gestcomm.FactureFournisseurXmlSheet;
20
import org.openconcerto.erp.model.MouseSheetXmlListeListener;
21
import org.openconcerto.sql.element.SQLComponent;
151 ilm 22
import org.openconcerto.sql.view.list.IListeAction.IListeEvent;
23
import org.openconcerto.sql.view.list.RowAction.PredicateRowAction;
142 ilm 24
import org.openconcerto.utils.ListMap;
94 ilm 25
 
151 ilm 26
import java.util.ArrayList;
156 ilm 27
import java.util.HashSet;
151 ilm 28
import java.util.List;
156 ilm 29
import java.util.Set;
151 ilm 30
 
80 ilm 31
public class FactureFournisseurSQLElement extends ComptaSQLConfElement {
32
 
33
    public FactureFournisseurSQLElement() {
34
        super("FACTURE_FOURNISSEUR", "une facture fournisseur", "factures fournisseur");
94 ilm 35
        MouseSheetXmlListeListener mouseSheetXmlListeListener = new MouseSheetXmlListeListener(FactureFournisseurXmlSheet.class);
36
        mouseSheetXmlListeListener.setGenerateHeader(true);
37
        mouseSheetXmlListeListener.setShowHeader(true);
38
        getRowActions().addAll(mouseSheetXmlListeListener.getRowActions());
151 ilm 39
        if (getTable().contains("ATTACHMENTS")) {
40
            PredicateRowAction actionAttachment = new PredicateRowAction(new AttachmentAction().getAction(), true);
41
            actionAttachment.setPredicate(IListeEvent.getSingleSelectionPredicate());
42
            getRowActions().add(actionAttachment);
43
        }
80 ilm 44
    }
45
 
156 ilm 46
    @Override
47
    public Set<String> getReadOnlyFields() {
48
        Set<String> s = new HashSet<>();
49
        s.add("NET_A_PAYER");
50
        return s;
51
    }
52
 
80 ilm 53
    protected List<String> getListFields() {
54
        final List<String> l = new ArrayList<String>();
55
        l.add("NUMERO");
56
        l.add("NOM");
57
        l.add("DATE");
58
        l.add("ID_FOURNISSEUR");
59
        l.add("T_HT");
60
        l.add("T_TTC");
61
        l.add("INFOS");
62
        return l;
63
    }
64
 
142 ilm 65
    @Override
66
    public ListMap<String, String> getShowAs() {
67
        ListMap<String, String> map = new ListMap<String, String>();
68
        map.putCollection(null, "NUMERO", "DATE");
69
        return map;
70
    }
71
 
80 ilm 72
    protected List<String> getComboFields() {
73
        final List<String> l = new ArrayList<String>();
74
        l.add("NUMERO");
75
        l.add("NOM");
76
        l.add("DATE");
77
        return l;
78
    }
79
 
80
    /*
81
     * (non-Javadoc)
82
     *
83
     * @see org.openconcerto.devis.SQLElement#getComponent()
84
     */
85
    public SQLComponent createComponent() {
86
        return new FactureFournisseurSQLComponent();
87
    }
88
 
89
    @Override
90
    protected String createCode() {
156 ilm 91
        return createCodeOfPackage() + ".invoice.purchase";
80 ilm 92
    }
93
}