OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

Rev 21 | Rev 73 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 21 Rev 25
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.generationDoc.gestcomm;
14
 package org.openconcerto.erp.generationDoc.gestcomm;
15
 
15
 
16
import org.openconcerto.erp.generationDoc.AbstractSheetXml;
16
import org.openconcerto.erp.generationDoc.AbstractSheetXMLWithDate;
17
import org.openconcerto.erp.generationDoc.SheetXml;
-
 
18
import org.openconcerto.erp.preferences.PrinterNXProps;
17
import org.openconcerto.erp.preferences.PrinterNXProps;
19
import org.openconcerto.sql.Configuration;
18
import org.openconcerto.sql.Configuration;
20
import org.openconcerto.sql.model.SQLRow;
19
import org.openconcerto.sql.model.SQLRow;
21
import org.openconcerto.utils.Tuple2;
-
 
22
 
20
 
23
import java.io.File;
-
 
24
import java.util.Calendar;
-
 
25
import java.util.Date;
21
public class CommandeXmlSheet extends AbstractSheetXMLWithDate {
26
 
22
 
27
public class CommandeXmlSheet extends AbstractSheetXml {
-
 
28
 
-
 
29
    private static final Tuple2<String, String> tuple = Tuple2.create("LocationCmd", "Commande fournisseur");
23
    public static final String TEMPLATE_ID = "Commande";
30
 
-
 
31
    public static Tuple2<String, String> getTuple2Location() {
24
    public static final String TEMPLATE_PROPERTY_NAME = "LocationCmd";
32
        return tuple;
-
 
33
    }
-
 
34
 
25
 
35
    @Override
26
    @Override
36
    public SQLRow getRowLanguage() {
27
    public SQLRow getRowLanguage() {
37
        SQLRow rowFournisseur = this.row.getForeignRow("ID_FOURNISSEUR");
28
        SQLRow rowFournisseur = this.row.getForeignRow("ID_FOURNISSEUR");
38
        if (rowFournisseur.getTable().contains("ID_LANGUE")) {
29
        if (rowFournisseur.getTable().contains("ID_LANGUE")) {
39
            return rowFournisseur.getForeignRow("ID_LANGUE");
30
            return rowFournisseur.getForeignRow("ID_LANGUE");
40
        } else {
31
        } else {
41
            return super.getRowLanguage();
32
            return super.getRowLanguage();
42
        }
33
        }
43
    }
34
    }
44
 
35
 
45
    // FIXME Prefs printer location
36
    // FIXME Prefs printer location
46
    public CommandeXmlSheet(SQLRow row) {
37
    public CommandeXmlSheet(SQLRow row) {
47
        super(row);
38
        super(row);
48
        this.printer = PrinterNXProps.getInstance().getStringProperty("CmdPrinter");
39
        this.printer = PrinterNXProps.getInstance().getStringProperty("CmdPrinter");
49
        this.elt = Configuration.getInstance().getDirectory().getElement("COMMANDE");
40
        this.elt = Configuration.getInstance().getDirectory().getElement("COMMANDE");
50
        Calendar cal = Calendar.getInstance();
-
 
51
        cal.setTime((Date) row.getObject("DATE"));
-
 
52
        this.locationOO = SheetXml.getLocationForTuple(tuple, false) + File.separator + cal.get(Calendar.YEAR);
-
 
53
        this.locationPDF = SheetXml.getLocationForTuple(tuple, false) + File.separator + cal.get(Calendar.YEAR);
-
 
54
 
-
 
55
    }
41
    }
56
 
42
 
57
    @Override
43
    @Override
58
    public String getDefaultModele() {
44
    public String getDefaultTemplateId() {
59
 
-
 
60
        return "Commande";
45
        return TEMPLATE_ID;
61
    }
46
    }
62
 
47
 
-
 
48
    @Override
63
    public String getFileName() {
49
    public String getName() {
64
 
-
 
65
        return getValidFileName("Commande_" + row.getString("NUMERO"));
50
        return "Commande_" + row.getString("NUMERO");
66
    }
51
    }
67
}
52
}