OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
156 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.finance.payment.element;
15
 
16
import org.openconcerto.erp.core.common.element.ComptaSQLConfElement;
17
import org.openconcerto.sql.element.SQLComponent;
18
import org.openconcerto.sql.element.TreesOfSQLRows;
19
import org.openconcerto.sql.element.UISQLComponent;
20
import org.openconcerto.sql.model.SQLRow;
21
 
22
import java.sql.SQLException;
23
import java.util.ArrayList;
24
import java.util.List;
25
 
26
public class DepotChequeElementSQLElement extends ComptaSQLConfElement {
27
 
28
    public DepotChequeElementSQLElement() {
29
        super("DEPOT_CHEQUE_ELEMENT", "un chéque déposé", "chèques déposés");
30
    }
31
 
32
    @Override
33
    protected String getParentFFName() {
34
        return "ID_DEPOT_CHEQUE";
35
    }
36
 
37
    @Override
38
    protected List<String> getListFields() {
39
        final List<String> l = new ArrayList<String>();
40
        l.add("DATE");
41
        l.add("MONTANT");
42
        return l;
43
    }
44
 
45
    @Override
46
    protected List<String> getComboFields() {
47
        final List<String> l = new ArrayList<String>();
48
        l.add("DATE");
49
        l.add("MONTANT");
50
        return l;
51
    }
52
 
53
    /*
54
     * (non-Javadoc)
55
     *
56
     * @see org.openconcerto.devis.SQLElement#getComponent()
57
     */
58
    @Override
59
    public SQLComponent createComponent() {
60
        return new UISQLComponent(this) {
61
            public void addViews() {
62
                this.addView("DATE");
63
            }
64
        };
65
    }
66
 
67
    @Override
68
    protected void archive(TreesOfSQLRows trees, boolean cutLinks) throws SQLException {
69
        for (SQLRow row : trees.getRows()) {
70
            if (row.getObject("ID_CHEQUE_A_ENCAISSER") != null && !row.isForeignEmpty("ID_CHEQUE_A_ENCAISSER")) {
71
                row.getForeign("ID_CHEQUE_A_ENCAISSER").createEmptyUpdateRow().put("ENCAISSE", Boolean.FALSE).commit();
72
            }
73
        }
74
        super.archive(trees, cutLinks);
75
    }
76
 
77
    @Override
78
    protected String createCode() {
79
        return createCodeOfPackage() + ".depot.item";
80
    }
81
}