OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

Rev 156 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 156 Rev 182
Line 1... Line 1...
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-2019 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.
Line 22... Line 22...
22
import org.openconcerto.erp.core.customerrelationship.customer.ui.AdresseClientItemTable;
22
import org.openconcerto.erp.core.customerrelationship.customer.ui.AdresseClientItemTable;
23
import org.openconcerto.erp.core.finance.accounting.element.ComptePCESQLElement;
23
import org.openconcerto.erp.core.finance.accounting.element.ComptePCESQLElement;
24
import org.openconcerto.erp.core.finance.payment.component.ModeDeReglementSQLComponent;
24
import org.openconcerto.erp.core.finance.payment.component.ModeDeReglementSQLComponent;
25
import org.openconcerto.erp.model.ISQLCompteSelector;
25
import org.openconcerto.erp.model.ISQLCompteSelector;
26
import org.openconcerto.erp.preferences.DefaultNXProps;
26
import org.openconcerto.erp.preferences.DefaultNXProps;
-
 
27
import org.openconcerto.erp.preferences.GestionCommercialeGlobalPreferencePanel;
27
import org.openconcerto.erp.preferences.ModeReglementDefautPrefPanel;
28
import org.openconcerto.erp.preferences.ModeReglementDefautPrefPanel;
28
import org.openconcerto.sql.Configuration;
29
import org.openconcerto.sql.Configuration;
29
import org.openconcerto.sql.element.BaseSQLComponent;
30
import org.openconcerto.sql.element.BaseSQLComponent;
30
import org.openconcerto.sql.element.ElementSQLObject;
31
import org.openconcerto.sql.element.ElementSQLObject;
31
import org.openconcerto.sql.element.SQLElement;
32
import org.openconcerto.sql.element.SQLElement;
Line 37... Line 38...
37
import org.openconcerto.sql.model.SQLRowValues;
38
import org.openconcerto.sql.model.SQLRowValues;
38
import org.openconcerto.sql.model.SQLSelect;
39
import org.openconcerto.sql.model.SQLSelect;
39
import org.openconcerto.sql.model.SQLTable;
40
import org.openconcerto.sql.model.SQLTable;
40
import org.openconcerto.sql.model.UndefinedRowValuesCache;
41
import org.openconcerto.sql.model.UndefinedRowValuesCache;
41
import org.openconcerto.sql.model.Where;
42
import org.openconcerto.sql.model.Where;
-
 
43
import org.openconcerto.sql.preferences.SQLPreferences;
42
import org.openconcerto.sql.request.SQLRowItemView;
44
import org.openconcerto.sql.request.SQLRowItemView;
43
import org.openconcerto.sql.sqlobject.ElementComboBox;
45
import org.openconcerto.sql.sqlobject.ElementComboBox;
44
import org.openconcerto.sql.sqlobject.JUniqueTextField;
46
import org.openconcerto.sql.sqlobject.JUniqueTextField;
45
import org.openconcerto.sql.sqlobject.SQLSearchableTextCombo;
47
import org.openconcerto.sql.sqlobject.SQLSearchableTextCombo;
46
import org.openconcerto.sql.sqlobject.SQLTextCombo;
48
import org.openconcerto.sql.sqlobject.SQLTextCombo;
Line 740... Line 742...
740
            this.defaultContactRowVals.put("TEL_DIRECT", r.getString("TEL"));
742
            this.defaultContactRowVals.put("TEL_DIRECT", r.getString("TEL"));
741
            this.defaultContactRowVals.put("FAX", r.getString("FAX"));
743
            this.defaultContactRowVals.put("FAX", r.getString("FAX"));
742
        }
744
        }
743
    }
745
    }
744
 
746
 
-
 
747
    private void createCompteClientFromCodeAuto(int idClient) {
-
 
748
        final SQLRow rowClient = getTable().getRow(idClient);
-
 
749
        if (rowClient.isForeignEmpty("ID_COMPTE_PCE")) {
-
 
750
            createCompteClientAuto(idClient);
-
 
751
        }
-
 
752
    }
-
 
753
 
745
    private void createCompteClientAuto(int idClient) {
754
    private void createCompteClientAuto(int idClient) {
746
        SQLRowValues rowVals = getTable().getRow(idClient).createEmptyUpdateRow();
755
        SQLRowValues rowVals = getTable().getRow(idClient).createEmptyUpdateRow();
747
        String initialClient = "";
756
        String initialClient = "";
748
        final String text = getNameValue();
757
        final String text = getNameValue();
749
        if (text != null && text.trim().length() > 1) {
758
        if (text != null && text.trim().length() > 1) {
Line 801... Line 810...
801
        this.table.updateField("ID_CLIENT", id);
810
        this.table.updateField("ID_CLIENT", id);
802
        this.adresseTable.updateField("ID_CLIENT", id);
811
        this.adresseTable.updateField("ID_CLIENT", id);
803
        if (this.boxGestionAutoCompte.isSelected()) {
812
        if (this.boxGestionAutoCompte.isSelected()) {
804
            createCompteClientAuto(id);
813
            createCompteClientAuto(id);
805
        }
814
        }
-
 
815
        SQLPreferences prefs = new SQLPreferences(getTable().getDBRoot());
-
 
816
        if (prefs.getBoolean(GestionCommercialeGlobalPreferencePanel.COMPTE_CLIENT_AUTO, Boolean.FALSE)) {
-
 
817
            createCompteClientFromCodeAuto(id);
-
 
818
        }
806
        return id;
819
        return id;
807
    }
820
    }
808
 
821
 
809
    @Override
822
    @Override
810
    protected SQLRowValues createDefaults() {
823
    protected SQLRowValues createDefaults() {