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 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 151 Rev 156
Line 17... Line 17...
17
import org.openconcerto.erp.core.humanresources.payroll.report.LignePayeSimplifiee;
17
import org.openconcerto.erp.core.humanresources.payroll.report.LignePayeSimplifiee;
18
import org.openconcerto.erp.core.sales.order.ui.EtatCommandeClient;
18
import org.openconcerto.erp.core.sales.order.ui.EtatCommandeClient;
19
import org.openconcerto.erp.core.sales.quote.element.EtatDevisSQLElement;
19
import org.openconcerto.erp.core.sales.quote.element.EtatDevisSQLElement;
20
import org.openconcerto.erp.modules.ModuleManager;
20
import org.openconcerto.erp.modules.ModuleManager;
21
import org.openconcerto.erp.modules.ModuleReference;
21
import org.openconcerto.erp.modules.ModuleReference;
-
 
22
import org.openconcerto.sql.Configuration;
22
import org.openconcerto.sql.changer.convert.AddFK;
23
import org.openconcerto.sql.changer.convert.AddFK;
23
import org.openconcerto.sql.changer.convert.ChangeIDToInt;
24
import org.openconcerto.sql.changer.convert.ChangeIDToInt;
24
import org.openconcerto.sql.changer.correct.CorrectOrder;
25
import org.openconcerto.sql.changer.correct.CorrectOrder;
25
import org.openconcerto.sql.changer.correct.FixSerial;
26
import org.openconcerto.sql.changer.correct.FixSerial;
26
import org.openconcerto.sql.element.GroupSQLComponent;
27
import org.openconcerto.sql.element.GroupSQLComponent;
Line 136... Line 137...
136
                    @Override
137
                    @Override
137
                    public void run() {
138
                    public void run() {
138
                        System.setProperty(SQLSchema.NOAUTO_CREATE_METADATA, "false");
139
                        System.setProperty(SQLSchema.NOAUTO_CREATE_METADATA, "false");
139
                        final ComptaPropsConfiguration conf = ComptaPropsConfiguration.create(true);
140
                        final ComptaPropsConfiguration conf = ComptaPropsConfiguration.create(true);
140
 
141
 
-
 
142
                        final DBSystemRoot systemRoot = conf.getSystemRoot();
-
 
143
                        if (systemRoot.getChild(conf.getRootNameValue().getValue()) == null) {
-
 
144
                            conf.destroy();
-
 
145
                            SwingUtilities.invokeLater(new Runnable() {
-
 
146
                                @Override
-
 
147
                                public void run() {
-
 
148
                                    up.setEnabled(true);
-
 
149
                                    bar.setValue(bar.getMaximum());
-
 
150
                                    JOptionPane.showMessageDialog(InstallationPanel.this, "Votre base de données n'est pas initialisée");
-
 
151
                                }
-
 
152
                            });
-
 
153
                            return;
-
 
154
                        }
-
 
155
 
141
                        updateDatabase(conf);
156
                        updateDatabase(conf);
142
 
157
 
143
                        conf.destroy();
158
                        conf.destroy();
144
                        SwingUtilities.invokeLater(new Runnable() {
159
                        SwingUtilities.invokeLater(new Runnable() {
145
 
160
 
Line 196... Line 211...
196
            c.gridwidth = 1;
211
            c.gridwidth = 1;
197
            user.addActionListener(new ActionListener() {
212
            user.addActionListener(new ActionListener() {
198
 
213
 
199
                @Override
214
                @Override
200
                public void actionPerformed(ActionEvent e) {
215
                public void actionPerformed(ActionEvent e) {
201
                    // TODO Auto-generated method stub
-
 
202
                    try {
216
                    try {
203
                        if (finderPanel.getServerConfig().createUserIfNeeded(login.getText(), mdp.getText())) {
217
                        if (finderPanel.getServerConfig().createUserIfNeeded(login.getText(), mdp.getText())) {
204
                            JOptionPane.showMessageDialog(InstallationPanel.this, "L'utilisateur openconcerto a été correctement ajouté.");
218
                            JOptionPane.showMessageDialog(InstallationPanel.this, "L'utilisateur openconcerto a été correctement ajouté.");
205
                        } else {
219
                        } else {
206
                            JOptionPane.showMessageDialog(InstallationPanel.this, "L'utilisateur openconcerto existe déjà dans la base.");
220
                            JOptionPane.showMessageDialog(InstallationPanel.this, "L'utilisateur openconcerto existe déjà dans la base.");
207
                        }
221
                        }
208
                    } catch (Exception e1) {
222
                    } catch (Exception e1) {
209
                        // TODO Auto-generated catch block
-
 
210
                        e1.printStackTrace();
223
                        e1.printStackTrace();
211
                        JOptionPane.showMessageDialog(InstallationPanel.this, "Une erreur est survenue pendant la connexion au serveur, vérifiez vos paramètres de connexion.");
224
                        JOptionPane.showMessageDialog(InstallationPanel.this, "Une erreur est survenue pendant la connexion au serveur, vérifiez vos paramètres de connexion.");
212
                    }
225
                    }
213
                }
226
                }
214
            });
227
            });
Line 880... Line 893...
880
        final List<AlterTable> alters = new ArrayList<AlterTable>();
893
        final List<AlterTable> alters = new ArrayList<AlterTable>();
881
        final List<UpdateBuilder> builds = new ArrayList<UpdateBuilder>();
894
        final List<UpdateBuilder> builds = new ArrayList<UpdateBuilder>();
882
        for (final SQLTable t : root.getTables()) {
895
        for (final SQLTable t : root.getTables()) {
883
            final AlterTable alter = new AlterTable(t);
896
            final AlterTable alter = new AlterTable(t);
884
            for (final SQLField f : t.getFields()) {
897
            for (final SQLField f : t.getFields()) {
-
 
898
                // on PG, CLOB are text and the JDBC driver returns Types.VARCHAR, not CLOB. So test
-
 
899
                // if the type name contains "char", since we only want unbounded varchar, not
-
 
900
                // text/clob.
885
                if (f.getType().getType() == Types.VARCHAR && f.getType().getSize() == Integer.MAX_VALUE) {
901
                if (f.getType().getType() == Types.VARCHAR && f.getType().getSize() == Integer.MAX_VALUE && f.getTypeDecl().contains("char")) {
886
 
902
 
887
                    UpdateBuilder build = new UpdateBuilder(t);
903
                    UpdateBuilder build = new UpdateBuilder(t);
888
                    build.set(f.getName(), "''");
904
                    build.setObject(f.getName(), "");
889
                    build.setWhere(new Where(f, "=", (Object) null));
905
                    build.setWhere(Where.isNull(f));
890
                    builds.add(build);
906
                    builds.add(build);
891
 
907
 
892
                    final String fName = f.getName();
908
                    final String fName = f.getName();
893
                    final int size;
909
                    final int size;
894
                    if (t.getName().contains("USER") && namesSet.contains(fName))
910
                    if (t.getName().contains("USER") && namesSet.contains(fName))
Line 1239... Line 1255...
1239
 
1255
 
1240
        checkPrefsComptable(root);
1256
        checkPrefsComptable(root);
1241
        checkDepartementExists(root, "Aisne", "Laon", "Picardie", "02");
1257
        checkDepartementExists(root, "Aisne", "Laon", "Picardie", "02");
1242
 
1258
 
1243
        if (root.contains("TARIF_AGENCE")) {
1259
        if (root.contains("TARIF_AGENCE")) {
-
 
1260
            SQLTable tableCmdFA = root.getTable("COMMANDE");
-
 
1261
            if (!tableCmdFA.contains("INCOTERM")) {
-
 
1262
                AlterTable t = new AlterTable(tableCmdFA);
-
 
1263
                t.addVarCharColumn("INCOTERM", 256);
-
 
1264
                tableCmdFA.getBase().getDataSource().execute(t.asString());
-
 
1265
                tableCmdFA.getSchema().updateVersion();
-
 
1266
                tableCmdFA.fetchFields();
-
 
1267
            }
-
 
1268
 
-
 
1269
            SQLTable tableArticleA = root.getTable("ARTICLE");
-
 
1270
            if (!tableArticleA.contains("CLOSED_KIT")) {
-
 
1271
                AlterTable t = new AlterTable(tableArticleA);
-
 
1272
                t.addBooleanColumn("CLOSED_KIT", Boolean.FALSE, true);
-
 
1273
                tableArticleA.getBase().getDataSource().execute(t.asString());
-
 
1274
                tableArticleA.getSchema().updateVersion();
-
 
1275
                tableArticleA.fetchFields();
-
 
1276
            }
-
 
1277
 
-
 
1278
            if (!tableArticleA.contains("CLOSED_KIT_DESC")) {
-
 
1279
                AlterTable t = new AlterTable(tableArticleA);
-
 
1280
                t.addVarCharColumn("CLOSED_KIT_DESC", 4096);
-
 
1281
                tableArticleA.getBase().getDataSource().execute(t.asString());
-
 
1282
                tableArticleA.getSchema().updateVersion();
-
 
1283
                tableArticleA.fetchFields();
-
 
1284
            }
-
 
1285
 
-
 
1286
            SQLTable tableCmdFEltA = root.getTable("COMMANDE_ELEMENT");
-
 
1287
            if (!tableCmdFEltA.contains("INCOTERM")) {
-
 
1288
                AlterTable t = new AlterTable(tableCmdFEltA);
-
 
1289
                t.addVarCharColumn("INCOTERM", 256);
-
 
1290
                tableCmdFEltA.getBase().getDataSource().execute(t.asString());
-
 
1291
                tableCmdFEltA.getSchema().updateVersion();
-
 
1292
                tableCmdFEltA.fetchFields();
-
 
1293
            }
-
 
1294
 
-
 
1295
            if (root.getTable("VILLE") == null) {
-
 
1296
 
-
 
1297
                // INSERT INTO "OpenConcerto49"."VILLE" ("CODE_POSTAL","NOM") SELECT
-
 
1298
                // "CODE_POSTAL",
-
 
1299
                // "VILLE" FROM "OpenConcerto49"."ADRESSE" a WHERE a."ARCHIVE"=0
-
 
1300
                final SQLCreateTable createTableVille = new SQLCreateTable(root, "VILLE");
-
 
1301
                createTableVille.addVarCharColumn("NOM", 2048);
-
 
1302
                createTableVille.addVarCharColumn("CODE_POSTAL", 2048);
-
 
1303
                createTableVille.addLongColumn("X_LAMBERT", 0L, true);
-
 
1304
                createTableVille.addLongColumn("Y_LAMBERT", 0L, true);
-
 
1305
                createTableVille.addLongColumn("POPULATION", 0L, true);
-
 
1306
                try {
-
 
1307
                    root.getBase().getDataSource().execute(createTableVille.asString());
-
 
1308
                    insertUndef(createTableVille);
-
 
1309
                    root.refetchTable("VILLE");
-
 
1310
                    root.getSchema().updateVersion();
-
 
1311
                } catch (SQLException ex2) {
-
 
1312
                    throw new IllegalStateException("Erreur lors de la création de la table " + "VILLE", ex2);
-
 
1313
                }
-
 
1314
            }
-
 
1315
 
-
 
1316
            if (root.getTable("ARTICLE_PRIX_MIN_VENTE") == null) {
-
 
1317
                final SQLCreateTable createTablePrixMin = new SQLCreateTable(root, "ARTICLE_PRIX_MIN_VENTE");
-
 
1318
                createTablePrixMin.addForeignColumn("ARTICLE");
-
 
1319
                createTablePrixMin.addIntegerColumn("QTE", 1);
-
 
1320
                createTablePrixMin.addDecimalColumn("PRIX", 16, 8, BigDecimal.ZERO, true);
-
 
1321
                createTablePrixMin.addDateAndTimeColumn("DATE");
-
 
1322
                try {
-
 
1323
                    root.getBase().getDataSource().execute(createTablePrixMin.asString());
-
 
1324
                    insertUndef(createTablePrixMin);
-
 
1325
                    root.refetchTable("ARTICLE_PRIX_MIN_VENTE");
-
 
1326
                    root.getSchema().updateVersion();
-
 
1327
                } catch (SQLException ex2) {
-
 
1328
                    throw new IllegalStateException("Erreur lors de la création de la table " + "ARTICLE_PRIX_MIN_VENTE", ex2);
-
 
1329
                }
-
 
1330
            }
-
 
1331
 
-
 
1332
            {
-
 
1333
                final SQLTable tableTarifAgence = root.getTable("TARIF_AGENCE");
-
 
1334
                AlterTable tTarifAgence = new AlterTable(tableTarifAgence);
-
 
1335
                boolean updateTarifAgence = false;
-
 
1336
 
-
 
1337
                if (!tableTarifAgence.contains("PRC_AGENCE")) {
-
 
1338
                    updateTarifAgence = true;
-
 
1339
                    tTarifAgence.addDecimalColumn("PRC_AGENCE", 16, 8, BigDecimal.ZERO, true);
-
 
1340
                }
-
 
1341
                if (!tableTarifAgence.contains("CLOSED_KIT")) {
-
 
1342
                    updateTarifAgence = true;
-
 
1343
                    tTarifAgence.addBooleanColumn("CLOSED_KIT", false, true);
-
 
1344
                }
-
 
1345
                if (!tableTarifAgence.contains("PRIX_MIN_VENTE")) {
-
 
1346
                    updateTarifAgence = true;
-
 
1347
                    tTarifAgence.addDecimalColumn("PRIX_MIN_VENTE", 16, 8, BigDecimal.ZERO, true);
-
 
1348
                }
-
 
1349
 
-
 
1350
                if (updateTarifAgence) {
-
 
1351
                    tableTarifAgence.getBase().getDataSource().execute(tTarifAgence.asString());
-
 
1352
                    tableTarifAgence.getSchema().updateVersion();
-
 
1353
                    tableTarifAgence.fetchFields();
-
 
1354
                }
-
 
1355
            }
-
 
1356
            {
-
 
1357
                final SQLTable tableClient = root.getTable("CLIENT");
-
 
1358
                AlterTable tClient = new AlterTable(tableClient);
-
 
1359
                boolean updateClient = false;
-
 
1360
 
-
 
1361
                if (!tableClient.contains("ALG_REGISTRE")) {
-
 
1362
                    updateClient = true;
-
 
1363
                    tClient.addVarCharColumn("ALG_REGISTRE", 512);
-
 
1364
                }
-
 
1365
                if (!tableClient.contains("ALG_MATRICULE")) {
-
 
1366
                    updateClient = true;
-
 
1367
                    tClient.addVarCharColumn("ALG_MATRICULE", 512);
-
 
1368
                }
-
 
1369
                if (!tableClient.contains("ALG_ARTICLE")) {
-
 
1370
                    updateClient = true;
-
 
1371
                    tClient.addVarCharColumn("ALG_ARTICLE", 512);
-
 
1372
                }
-
 
1373
 
-
 
1374
                if (updateClient) {
-
 
1375
                    tableClient.getBase().getDataSource().execute(tClient.asString());
-
 
1376
                    tableClient.getSchema().updateVersion();
-
 
1377
                    tableClient.fetchFields();
-
 
1378
                }
-
 
1379
            }
-
 
1380
            final SQLTable tableMvtStock = root.getTable("MOUVEMENT_STOCK");
-
 
1381
 
-
 
1382
            if (!tableMvtStock.contains("PRICE")) {
-
 
1383
                AlterTable tMvt = new AlterTable(tableMvtStock);
-
 
1384
                tMvt.addDecimalColumn("PRICE", 16, 6, BigDecimal.ZERO, true);
-
 
1385
                tableMvtStock.getBase().getDataSource().execute(tMvt.asString());
-
 
1386
                tableMvtStock.getSchema().updateVersion();
-
 
1387
                tableMvtStock.fetchFields();
-
 
1388
            }
-
 
1389
 
-
 
1390
            final SQLTable tableArticle = root.getTable("ARTICLE");
-
 
1391
 
-
 
1392
            if (!tableArticle.contains("AUTO_PRIX_MIN_VENTE_NOMENCLATURE")) {
-
 
1393
                AlterTable tArt = new AlterTable(tableArticle);
-
 
1394
                tArt.addBooleanColumn("AUTO_PRIX_MIN_VENTE_NOMENCLATURE", false, true);
-
 
1395
                tableMvtStock.getBase().getDataSource().execute(tArt.asString());
-
 
1396
                tableMvtStock.getSchema().updateVersion();
-
 
1397
                tableMvtStock.fetchFields();
-
 
1398
            }
-
 
1399
            SQLTable tableContact = root.getTable("CONTACT");
-
 
1400
            if (!tableContact.contains("TYPE")) {
-
 
1401
                AlterTable t = new AlterTable(tableContact);
-
 
1402
                t.addVarCharColumn("TYPE", 256);
-
 
1403
                t.addVarCharColumn("SERVICE", 256);
-
 
1404
                t.addVarCharColumn("PAYS", 256);
-
 
1405
                t.addForeignColumn("ID_ADRESSE", root.getTable("ADRESSE"));
-
 
1406
                tableContact.getBase().getDataSource().execute(t.asString());
-
 
1407
                tableContact.getSchema().updateVersion();
-
 
1408
                tableContact.fetchFields();
-
 
1409
            }
-
 
1410
 
-
 
1411
            if (!root.contains("PERSONNEL_AFHYMAT")) {
-
 
1412
                final SQLCreateTable createTablePers = new SQLCreateTable(root, "PERSONNEL_AFHYMAT");
-
 
1413
                createTablePers.addVarCharColumn("NOM", 256);
-
 
1414
                createTablePers.addVarCharColumn("PRENOM", 256);
-
 
1415
                createTablePers.addVarCharColumn("FONCTION", 256);
-
 
1416
 
-
 
1417
                try {
-
 
1418
                    root.getBase().getDataSource().execute(createTablePers.asString());
-
 
1419
                    insertUndef(createTablePers);
-
 
1420
                    root.refetchTable("PERSONNEL_AFHYMAT");
-
 
1421
                    root.getSchema().updateVersion();
-
 
1422
                } catch (SQLException ex) {
-
 
1423
                    throw new IllegalStateException("Erreur lors de la création de la table " + "PERSONNEL_AFHYMAT", ex);
-
 
1424
                }
-
 
1425
 
-
 
1426
                final SQLCreateTable createTable = new SQLCreateTable(root, "PERSONNEL_AFHYMAT_COUT");
-
 
1427
                for (int i = 1; i <= 12; i++) {
-
 
1428
                    createTable.addDecimalColumn("SAL_MONTH_" + i, 16, 2, BigDecimal.ZERO, false);
-
 
1429
                    createTable.addDecimalColumn("COM_MONTH_" + i, 16, 2, BigDecimal.ZERO, false);
-
 
1430
                }
-
 
1431
                createTable.addIntegerColumn("ANNEE", 0);
-
 
1432
                createTable.addForeignColumn("ID_PERSONNEL_AFHYMAT", root.getTable("PERSONNEL_AFHYMAT"));
-
 
1433
 
-
 
1434
                try {
-
 
1435
                    root.getBase().getDataSource().execute(createTable.asString());
-
 
1436
                    insertUndef(createTable);
-
 
1437
                    root.refetchTable("PERSONNEL_AFHYMAT_COUT");
-
 
1438
                    root.getSchema().updateVersion();
-
 
1439
                } catch (SQLException ex) {
-
 
1440
                    throw new IllegalStateException("Erreur lors de la création de la table " + "PERSONNEL_AFHYMAT_COUT", ex);
-
 
1441
                }
-
 
1442
            }
1244
 
1443
 
1245
            List<String> tablesUiLocked = Arrays.asList("BON_DE_LIVRAISON", "COMMANDE_CLIENT", "SAISIE_VENTE_FACTURE", "AVOIR_CLIENT", "COMMANDE", "BON_RECEPTION", "FACTURE_FOURNISSEUR");
1444
            List<String> tablesUiLocked = Arrays.asList("BON_DE_LIVRAISON", "COMMANDE_CLIENT", "SAISIE_VENTE_FACTURE", "AVOIR_CLIENT", "COMMANDE", "BON_RECEPTION", "FACTURE_FOURNISSEUR");
1246
            for (String tableName : tablesUiLocked) {
1445
            for (String tableName : tablesUiLocked) {
1247
                final SQLTable table = root.getTable(tableName);
1446
                final SQLTable table = root.getTable(tableName);
1248
                AlterTable t = new AlterTable(table);
1447
                AlterTable t = new AlterTable(table);
Line 1275... Line 1474...
1275
                    throw new IllegalStateException("Erreur lors de la création de la table " + "RELIQUAT_BL", ex);
1474
                    throw new IllegalStateException("Erreur lors de la création de la table " + "RELIQUAT_BL", ex);
1276
                }
1475
                }
1277
            }
1476
            }
1278
 
1477
 
1279
            if (!root.getTable("ARTICLE").contains("TRANSPORT")) {
1478
            if (!root.getTable("ARTICLE").contains("TRANSPORT")) {
1280
                final SQLTable tableArticle = root.getTable("ARTICLE");
-
 
1281
                AlterTable alterArticle = new AlterTable(tableArticle);
1479
                AlterTable alterArticle = new AlterTable(tableArticle);
1282
                alterArticle.addBooleanColumn("TRANSPORT", false, false);
1480
                alterArticle.addBooleanColumn("TRANSPORT", false, false);
1283
                tableArticle.getBase().getDataSource().execute(alterArticle.asString());
1481
                tableArticle.getBase().getDataSource().execute(alterArticle.asString());
1284
                tableArticle.getSchema().updateVersion();
1482
                tableArticle.getSchema().updateVersion();
1285
                tableArticle.fetchFields();
1483
                tableArticle.fetchFields();
Line 1305... Line 1503...
1305
                }
1503
                }
1306
            }
1504
            }
1307
 
1505
 
1308
            {
1506
            {
1309
                if (root.getName().endsWith("54")) {
1507
                if (root.getName().endsWith("54")) {
1310
                    final SQLTable tableArticle = root.getTable("ARTICLE");
-
 
1311
                    AlterTable tArt = new AlterTable(tableArticle);
1508
                    AlterTable tArt = new AlterTable(tableArticle);
1312
                    if (!tableArticle.contains("LABEL_DOUANE")) {
1509
                    if (!tableArticle.contains("LABEL_DOUANE")) {
1313
                        tArt.addVarCharColumn("LABEL_DOUANE", 512);
1510
                        tArt.addVarCharColumn("LABEL_DOUANE", 512);
1314
                        tableArticle.getBase().getDataSource().execute(tArt.asString());
1511
                        tableArticle.getBase().getDataSource().execute(tArt.asString());
1315
                        tableArticle.getSchema().updateVersion();
1512
                        tableArticle.getSchema().updateVersion();
Line 2163... Line 2360...
2163
            createTable.addDecimalColumn("TAUX_COMMERCIAL", 12, 6, new BigDecimal(1), false);
2360
            createTable.addDecimalColumn("TAUX_COMMERCIAL", 12, 6, new BigDecimal(1), false);
2164
            try {
2361
            try {
2165
                root.getDBSystemRoot().getDataSource().execute(createTable.asString());
2362
                root.getDBSystemRoot().getDataSource().execute(createTable.asString());
2166
                insertUndef(createTable);
2363
                insertUndef(createTable);
2167
                tableDevis.getSchema().updateVersion();
2364
                tableDevis.getSchema().updateVersion();
-
 
2365
                root.refetchTable("DEVISE_HISTORIQUE");
2168
            } catch (SQLException ex) {
2366
            } catch (SQLException ex) {
2169
                throw new IllegalStateException("Erreur lors de la création de la table TASK", ex);
2367
                throw new IllegalStateException("Erreur lors de la création de la table TASK", ex);
2170
            }
2368
            }
2171
        }
2369
        }
2172
 
2370
 
Line 3358... Line 3556...
3358
            }
3556
            }
3359
        }
3557
        }
3360
        patchFieldElt1Dot3(table, root);
3558
        patchFieldElt1Dot3(table, root);
3361
    }
3559
    }
3362
 
3560
 
3363
    private void updateSocieteSchema(final DBRoot root) throws IOException, Exception {
3561
    private void updateSocieteSchema(final Configuration conf, final DBRoot root) throws IOException, Exception {
3364
        final DBSystemRoot sysRoot = root.getDBSystemRoot();
3562
        final DBSystemRoot sysRoot = root.getDBSystemRoot();
3365
        final SQLDataSource ds = sysRoot.getDataSource();
3563
        final SQLDataSource ds = sysRoot.getDataSource();
3366
        System.out.println("InstallationPanel.InstallationPanel() UPDATE COMMERCIAL " + root);
3564
        System.out.println("InstallationPanel.InstallationPanel() UPDATE COMMERCIAL " + root);
3367
        // Fix commercial Ordre
3565
        // Fix commercial Ordre
3368
 
3566
 
Line 3462... Line 3660...
3462
            // Suppression des champs 1.0
3660
            // Suppression des champs 1.0
3463
            System.out.println("InstallationPanel.InstallationPanel() UPDATE FROM 1.0 " + root);
3661
            System.out.println("InstallationPanel.InstallationPanel() UPDATE FROM 1.0 " + root);
3464
            final List<ChangeTable<?>> changes = new ArrayList<ChangeTable<?>>();
3662
            final List<ChangeTable<?>> changes = new ArrayList<ChangeTable<?>>();
3465
 
3663
 
3466
            final ModuleManager instance = new ModuleManager();
3664
            final ModuleManager instance = new ModuleManager();
3467
            instance.setRoot(root);
3665
            instance.setup(root, conf);
3468
            final Collection<ModuleReference> refs = instance.getModulesInstalledRemotely();
3666
            final Collection<ModuleReference> refs = instance.getModulesInstalledRemotely();
3469
            final Set<String> allUsedTable = new HashSet<String>();
3667
            final Set<String> allUsedTable = new HashSet<String>();
3470
            for (ModuleReference ref : refs) {
3668
            for (ModuleReference ref : refs) {
3471
                Set<String> tableNames = instance.getCreatedItems(ref.getID()).get0();
3669
                Set<String> tableNames = instance.getCreatedItems(ref.getID()).get0();
3472
                allUsedTable.addAll(tableNames);
3670
                allUsedTable.addAll(tableNames);
3473
            }
3671
            }
3474
            System.out.println("Tables created by modules:" + allUsedTable);
3672
            System.out.println("Tables created by modules:" + allUsedTable);
3475
 
3673
 
-
 
3674
            final Set<String> notMigrated = instance.migrateOldTransientDirs();
-
 
3675
            if (!notMigrated.isEmpty())
-
 
3676
                System.out.println("Couldn't migrate old backed up/failed modules: " + notMigrated);
-
 
3677
 
3476
            final List<String> alterRequests = ChangeTable.cat(changes, root.getName());
3678
            final List<String> alterRequests = ChangeTable.cat(changes, root.getName());
3477
            try {
3679
            try {
3478
                for (final String req : alterRequests) {
3680
                for (final String req : alterRequests) {
3479
                    ds.execute(req);
3681
                    ds.execute(req);
3480
                }
3682
                }
Line 3954... Line 4156...
3954
            rowVals.update();
4156
            rowVals.update();
3955
        }
4157
        }
3956
    }
4158
    }
3957
 
4159
 
3958
    public void updateDatabase(final ComptaPropsConfiguration conf) {
4160
    public void updateDatabase(final ComptaPropsConfiguration conf) {
-
 
4161
 
3959
        try {
4162
        try {
3960
            final SQLDataSource ds = conf.getSystemRoot().getDataSource();
4163
            final DBSystemRoot systemRoot = conf.getSystemRoot();
3961
            System.err.println("SystemRoot:" + conf.getSystemRoot());
4164
            System.err.println("SystemRoot:" + systemRoot);
-
 
4165
            final DBRoot rootCommon = conf.getRoot();
3962
            System.err.println("Root:" + conf.getRoot());
4166
            System.err.println("Root:" + rootCommon);
3963
 
4167
 
-
 
4168
            final SQLDataSource ds = systemRoot.getDataSource();
3964
            // FixUnbounded varchar
4169
            // FixUnbounded varchar
3965
            fixUnboundedVarchar(conf.getRoot());
4170
            fixUnboundedVarchar(rootCommon);
3966
 
4171
 
3967
            // FIXME DROP CONSTRAINT UNIQUE ORDRE ON
4172
            // FIXME DROP CONSTRAINT UNIQUE ORDRE ON
3968
            // CONTACT_FOURNISSEUR
4173
            // CONTACT_FOURNISSEUR
3969
 
4174
 
3970
            checkCompteDefault(conf.getRoot());
4175
            checkCompteDefault(rootCommon);
3971
 
4176
 
3972
            updateSocieteTable(conf.getRoot());
4177
            updateSocieteTable(rootCommon);
3973
            updateVille(conf.getRoot().getTable("ADRESSE"));
4178
            updateVille(rootCommon.getTable("ADRESSE"));
3974
 
4179
 
3975
            // Champ user 1.4.1
4180
            // Champ user 1.4.1
3976
            final SQLTable tableUser = conf.getRoot().getTable("USER_COMMON");
4181
            final SQLTable tableUser = rootCommon.getTable("USER_COMMON");
3977
            if (tableUser != null) {
4182
            if (tableUser != null) {
3978
                final AlterTable alter = new AlterTable(tableUser);
4183
                final AlterTable alter = new AlterTable(tableUser);
3979
                boolean alterUser = false;
4184
                boolean alterUser = false;
3980
                if (!tableUser.contains("DISABLED")) {
4185
                if (!tableUser.contains("DISABLED")) {
3981
                    alter.addBooleanColumn("DISABLED", Boolean.FALSE, false);
4186
                    alter.addBooleanColumn("DISABLED", Boolean.FALSE, false);
Line 3986... Line 4191...
3986
                    alterUser = true;
4191
                    alterUser = true;
3987
                }
4192
                }
3988
 
4193
 
3989
                if (alterUser) {
4194
                if (alterUser) {
3990
                    final String req = alter.asString();
4195
                    final String req = alter.asString();
3991
                    conf.getRoot().getDBSystemRoot().getDataSource().execute(req);
4196
                    rootCommon.getDBSystemRoot().getDataSource().execute(req);
3992
                    conf.getRoot().refetchTable(tableUser.getName());
4197
                    rootCommon.refetchTable(tableUser.getName());
3993
                    conf.getRoot().getSchema().updateVersion();
4198
                    rootCommon.getSchema().updateVersion();
3994
                }
4199
                }
3995
            }
4200
            }
3996
 
4201
 
3997
            // Champ Paye
4202
            // Champ Paye
3998
            final SQLTable tableCaisse = conf.getRoot().getTable("CAISSE_COTISATION");
4203
            final SQLTable tableCaisse = rootCommon.getTable("CAISSE_COTISATION");
3999
            if (!tableCaisse.contains("NUMERO_COMPTE_PCE")) {
4204
            if (!tableCaisse.contains("NUMERO_COMPTE_PCE")) {
4000
                final AlterTable alter = new AlterTable(tableCaisse);
4205
                final AlterTable alter = new AlterTable(tableCaisse);
4001
                alter.addVarCharColumn("NUMERO_COMPTE_PCE", 128);
4206
                alter.addVarCharColumn("NUMERO_COMPTE_PCE", 128);
4002
                alter.addVarCharColumn("NUMERO_COMPTE_PCE_CHARGES", 128);
4207
                alter.addVarCharColumn("NUMERO_COMPTE_PCE_CHARGES", 128);
4003
                final String req = alter.asString();
4208
                final String req = alter.asString();
4004
                conf.getRoot().getDBSystemRoot().getDataSource().execute(req);
4209
                rootCommon.getDBSystemRoot().getDataSource().execute(req);
4005
                conf.getRoot().refetchTable(tableCaisse.getName());
4210
                rootCommon.refetchTable(tableCaisse.getName());
4006
                conf.getRoot().getSchema().updateVersion();
4211
                rootCommon.getSchema().updateVersion();
4007
            }
4212
            }
4008
 
4213
 
4009
            final SQLTable tableRC = conf.getRoot().getTable("RUBRIQUE_COTISATION");
4214
            final SQLTable tableRC = rootCommon.getTable("RUBRIQUE_COTISATION");
4010
            if (!tableRC.contains("PART_CSG_SANS_ABATTEMENT")) {
4215
            if (!tableRC.contains("PART_CSG_SANS_ABATTEMENT")) {
4011
                final AlterTable alter = new AlterTable(tableRC);
4216
                final AlterTable alter = new AlterTable(tableRC);
4012
                alter.addBooleanColumn("PART_CSG_SANS_ABATTEMENT", Boolean.FALSE, false);
4217
                alter.addBooleanColumn("PART_CSG_SANS_ABATTEMENT", Boolean.FALSE, false);
4013
                final String req = alter.asString();
4218
                final String req = alter.asString();
4014
                conf.getRoot().getDBSystemRoot().getDataSource().execute(req);
4219
                rootCommon.getDBSystemRoot().getDataSource().execute(req);
4015
                conf.getRoot().refetchTable(tableRC.getName());
4220
                rootCommon.refetchTable(tableRC.getName());
4016
                conf.getRoot().getSchema().updateVersion();
4221
                rootCommon.getSchema().updateVersion();
4017
            }
4222
            }
4018
 
4223
 
4019
            // Paye simplifiee
4224
            // Paye simplifiee
4020
            List<SQLRow> rowRubriqueReduGvt = new ArrayList<>();
4225
            List<SQLRow> rowRubriqueReduGvt = new ArrayList<>();
4021
            {
4226
            {
4022
 
4227
 
4023
                final SQLTable tableRCom = conf.getRoot().getTable("RUBRIQUE_COMM");
4228
                final SQLTable tableRCom = rootCommon.getTable("RUBRIQUE_COMM");
4024
                if (!tableRCom.contains("REDUCTION_GVT_COM")) {
4229
                if (!tableRCom.contains("REDUCTION_GVT_COM")) {
4025
                    final AlterTable alter = new AlterTable(tableRCom);
4230
                    final AlterTable alter = new AlterTable(tableRCom);
4026
                    alter.addBooleanColumn("REDUCTION_GVT_COM", Boolean.FALSE, false);
4231
                    alter.addBooleanColumn("REDUCTION_GVT_COM", Boolean.FALSE, false);
4027
                    final String req = alter.asString();
4232
                    final String req = alter.asString();
4028
                    conf.getRoot().getDBSystemRoot().getDataSource().execute(req);
4233
                    rootCommon.getDBSystemRoot().getDataSource().execute(req);
4029
                    conf.getRoot().refetchTable(tableRCom.getName());
4234
                    rootCommon.refetchTable(tableRCom.getName());
4030
                    conf.getRoot().getSchema().updateVersion();
4235
                    rootCommon.getSchema().updateVersion();
4031
 
4236
 
4032
                    SQLRowValues rowValsCommChom = new SQLRowValues(tableRCom);
4237
                    SQLRowValues rowValsCommChom = new SQLRowValues(tableRCom);
4033
                    rowValsCommChom.put("TAUX_SAL", "1.45;");
4238
                    rowValsCommChom.put("TAUX_SAL", "1.45;");
4034
                    rowValsCommChom.put("NB_BASE", "SAL_BRUT;");
4239
                    rowValsCommChom.put("NB_BASE", "SAL_BRUT;");
4035
                    rowValsCommChom.put("NOM", "Assurance chômage reduction 2018");
4240
                    rowValsCommChom.put("NOM", "Assurance chômage reduction 2018");
Line 4064... Line 4269...
4064
                    rowValsCommCSG.put("REDUCTION_GVT_COM", Boolean.TRUE);
4269
                    rowValsCommCSG.put("REDUCTION_GVT_COM", Boolean.TRUE);
4065
                    rowValsCommCSG.putRowValues("ID_PERIODE_VALIDITE").put("JANVIER", Boolean.TRUE);
4270
                    rowValsCommCSG.putRowValues("ID_PERIODE_VALIDITE").put("JANVIER", Boolean.TRUE);
4066
                    rowRubriqueReduGvt.add(rowValsCommCSG.commit());
4271
                    rowRubriqueReduGvt.add(rowValsCommCSG.commit());
4067
 
4272
 
4068
                    SQLSelect sel = new SQLSelect();
4273
                    SQLSelect sel = new SQLSelect();
4069
                    sel.addSelect(conf.getRoot().getTable("PROFIL_PAYE").getKey());
4274
                    sel.addSelect(rootCommon.getTable("PROFIL_PAYE").getKey());
4070
                    List<SQLRow> rowsProfil = SQLRowListRSH.execute(sel);
4275
                    List<SQLRow> rowsProfil = SQLRowListRSH.execute(sel);
4071
                    int pos = 70;
4276
                    int pos = 70;
4072
                    for (SQLRow rowRub : rowRubriqueReduGvt) {
4277
                    for (SQLRow rowRub : rowRubriqueReduGvt) {
4073
                        for (SQLRow rowProfil : rowsProfil) {
4278
                        for (SQLRow rowProfil : rowsProfil) {
4074
 
4279
 
4075
                            SQLRowValues rowValsRubGvt = new SQLRowValues(conf.getRoot().getTable("PROFIL_PAYE_ELEMENT"));
4280
                            SQLRowValues rowValsRubGvt = new SQLRowValues(rootCommon.getTable("PROFIL_PAYE_ELEMENT"));
4076
                            rowValsRubGvt.put("ID_PROFIL_PAYE", rowProfil.getID());
4281
                            rowValsRubGvt.put("ID_PROFIL_PAYE", rowProfil.getID());
4077
                            rowValsRubGvt.put("POSITION", pos);
4282
                            rowValsRubGvt.put("POSITION", pos);
4078
                            rowValsRubGvt.put("IDSOURCE", rowRub.getID());
4283
                            rowValsRubGvt.put("IDSOURCE", rowRub.getID());
4079
                            rowValsRubGvt.put("SOURCE", rowRub.getTable().getName());
4284
                            rowValsRubGvt.put("SOURCE", rowRub.getTable().getName());
4080
                            rowValsRubGvt.put("NOM", rowRub.getString("NOM"));
4285
                            rowValsRubGvt.put("NOM", rowRub.getString("NOM"));
Line 4082... Line 4287...
4082
                        }
4287
                        }
4083
                        pos++;
4288
                        pos++;
4084
                    }
4289
                    }
4085
                }
4290
                }
4086
 
4291
 
4087
                final SQLTable tableRB = conf.getRoot().getTable("RUBRIQUE_BRUT");
4292
                final SQLTable tableRB = rootCommon.getTable("RUBRIQUE_BRUT");
4088
                if (!tableRB.contains("AVANTAGE_NATURE")) {
4293
                if (!tableRB.contains("AVANTAGE_NATURE")) {
4089
                    final AlterTable alter = new AlterTable(tableRB);
4294
                    final AlterTable alter = new AlterTable(tableRB);
4090
                    alter.addBooleanColumn("AVANTAGE_NATURE", Boolean.FALSE, false);
4295
                    alter.addBooleanColumn("AVANTAGE_NATURE", Boolean.FALSE, false);
4091
                    final String req = alter.asString();
4296
                    final String req = alter.asString();
4092
                    conf.getRoot().getDBSystemRoot().getDataSource().execute(req);
4297
                    rootCommon.getDBSystemRoot().getDataSource().execute(req);
4093
                    conf.getRoot().refetchTable(tableRB.getName());
4298
                    rootCommon.refetchTable(tableRB.getName());
4094
                    conf.getRoot().getSchema().updateVersion();
4299
                    rootCommon.getSchema().updateVersion();
4095
                }
4300
                }
4096
 
4301
 
4097
                if (!tableRC.contains("LIGNE_PAYE_SIMPLIFIEE")) {
4302
                if (!tableRC.contains("LIGNE_PAYE_SIMPLIFIEE")) {
4098
                    final AlterTable alter = new AlterTable(tableRC);
4303
                    final AlterTable alter = new AlterTable(tableRC);
4099
 
4304
 
4100
                    alter.addBooleanColumn("ALLEGEMENT_COTISATION", Boolean.FALSE, false);
4305
                    alter.addBooleanColumn("ALLEGEMENT_COTISATION", Boolean.FALSE, false);
4101
                    alter.addVarCharColumn("LIGNE_PAYE_SIMPLIFIEE", 256);
4306
                    alter.addVarCharColumn("LIGNE_PAYE_SIMPLIFIEE", 256);
4102
                    final String req = alter.asString();
4307
                    final String req = alter.asString();
4103
                    conf.getRoot().getDBSystemRoot().getDataSource().execute(req);
4308
                    rootCommon.getDBSystemRoot().getDataSource().execute(req);
4104
                    conf.getRoot().refetchTable(tableRC.getName());
4309
                    rootCommon.refetchTable(tableRC.getName());
4105
                    conf.getRoot().getSchema().updateVersion();
4310
                    rootCommon.getSchema().updateVersion();
4106
                    Map<String, String> liaison = new HashMap<String, String>();
4311
                    Map<String, String> liaison = new HashMap<String, String>();
4107
                    liaison.put("COTCSA", LignePayeSimplifiee.SANTE_SECURITE.getId());
4312
                    liaison.put("COTCSA", LignePayeSimplifiee.SANTE_SECURITE.getId());
4108
                    liaison.put("COTMALADIE", LignePayeSimplifiee.SANTE_SECURITE.getId());
4313
                    liaison.put("COTMALADIE", LignePayeSimplifiee.SANTE_SECURITE.getId());
4109
                    liaison.put("COTAF", LignePayeSimplifiee.FAMILLE_ALLOCATIONS.getId());
4314
                    liaison.put("COTAF", LignePayeSimplifiee.FAMILLE_ALLOCATIONS.getId());
4110
                    liaison.put("COTVEUV", LignePayeSimplifiee.SANTE_SECURITE.getId());
4315
                    liaison.put("COTVEUV", LignePayeSimplifiee.SANTE_SECURITE.getId());
Line 4123... Line 4328...
4123
 
4328
 
4124
                    liaison.put("COTCSGIMP", LignePayeSimplifiee.CSG_IMP.getId());
4329
                    liaison.put("COTCSGIMP", LignePayeSimplifiee.CSG_IMP.getId());
4125
                    liaison.put("COTCSGDED", LignePayeSimplifiee.CSG_NON_IMP.getId());
4330
                    liaison.put("COTCSGDED", LignePayeSimplifiee.CSG_NON_IMP.getId());
4126
                    liaison.put("COTFILLON", LignePayeSimplifiee.ALLEGEMENT_COTISATIONS.getId());
4331
                    liaison.put("COTFILLON", LignePayeSimplifiee.ALLEGEMENT_COTISATIONS.getId());
4127
                    liaison.put("COTFNGS", LignePayeSimplifiee.ASSURANCE_CHOMAGE_CHOMAGE.getId());
4332
                    liaison.put("COTFNGS", LignePayeSimplifiee.ASSURANCE_CHOMAGE_CHOMAGE.getId());
4128
                    liaison.put("COTCADRET1", LignePayeSimplifiee.RETRAITE_COMPLEMENTAIRE_TA.getId());
4333
                    liaison.put("COTCADRET1", LignePayeSimplifiee.RETRAITE_COMPLEMENTAIRE_T1.getId());
4129
                    liaison.put("COTCADRET2", LignePayeSimplifiee.RETRAITE_COMPLEMENTAIRE_TB.getId());
4334
                    liaison.put("COTCADRET2", LignePayeSimplifiee.RETRAITE_COMPLEMENTAIRE_T2.getId());
4130
 
4335
 
4131
                    liaison.put("COT_CADRE_RET_C_A", LignePayeSimplifiee.RETRAITE_COMPLEMENTAIRE_TA.getId());
4336
                    liaison.put("COT_CADRE_RET_C_A", LignePayeSimplifiee.RETRAITE_COMPLEMENTAIRE_T1.getId());
4132
                    liaison.put("COT_CADRE_RET_C_B", LignePayeSimplifiee.RETRAITE_COMPLEMENTAIRE_TB.getId());
4337
                    liaison.put("COT_CADRE_RET_C_B", LignePayeSimplifiee.RETRAITE_COMPLEMENTAIRE_T2.getId());
4133
                    liaison.put("COT_CADRE_RET_C_C", LignePayeSimplifiee.RETRAITE_COMPLEMENTAIRE_TC.getId());
4338
                    liaison.put("COT_CADRE_RET_C_C", LignePayeSimplifiee.RETRAITE_COMPLEMENTAIRE_T2.getId());
4134
                    liaison.put("COTAPEC", LignePayeSimplifiee.ASSURANCE_CHOMAGE_APEC.getId());
4339
                    liaison.put("COTAPEC", LignePayeSimplifiee.ASSURANCE_CHOMAGE_APEC.getId());
4135
                    liaison.put("COTAPECFORF", LignePayeSimplifiee.ASSURANCE_CHOMAGE_APEC.getId());
4340
                    liaison.put("COTAPECFORF", LignePayeSimplifiee.ASSURANCE_CHOMAGE_APEC.getId());
4136
                    liaison.put("COTCET", LignePayeSimplifiee.RETRAITE_COMPLEMENTAIRE_TA.getId());
4341
                    liaison.put("COTCET", LignePayeSimplifiee.RETRAITE_COMPLEMENTAIRE_T1.getId());
4137
 
4342
 
4138
                    liaison.put("COTPREVCADRETA", LignePayeSimplifiee.SANTE_COMPLEMENAIRE_DECES.getId());
4343
                    liaison.put("COTPREVCADRETA", LignePayeSimplifiee.SANTE_COMPLEMENAIRE_DECES.getId());
4139
                    liaison.put("COTGMP", LignePayeSimplifiee.RETRAITE_COMPLEMENTAIRE_GMP.getId());
4344
                    liaison.put("COTGMP", LignePayeSimplifiee.RETRAITE_COMPLEMENTAIRE_GMP_2019_REMOVE.getId());
4140
                    liaison.put("COTCRDSIMP", LignePayeSimplifiee.CSG_IMP.getId());
4345
                    liaison.put("COTCRDSIMP", LignePayeSimplifiee.CSG_IMP.getId());
4141
                    liaison.put("COTGMP2", LignePayeSimplifiee.RETRAITE_COMPLEMENTAIRE_GMP.getId());
4346
                    liaison.put("COTGMP2", LignePayeSimplifiee.RETRAITE_COMPLEMENTAIRE_GMP_2019_REMOVE.getId());
4142
                    liaison.put("TAXEAPPR", LignePayeSimplifiee.AUTRES_CONTRIBUTIONS.getId());
4347
                    liaison.put("TAXEAPPR", LignePayeSimplifiee.AUTRES_CONTRIBUTIONS.getId());
4143
                    liaison.put("CDA", LignePayeSimplifiee.AUTRES_CONTRIBUTIONS.getId());
4348
                    liaison.put("CDA", LignePayeSimplifiee.AUTRES_CONTRIBUTIONS.getId());
4144
 
4349
 
4145
                    liaison.put("FOR", LignePayeSimplifiee.AUTRES_CONTRIBUTIONS.getId());
4350
                    liaison.put("FOR", LignePayeSimplifiee.AUTRES_CONTRIBUTIONS.getId());
4146
                    liaison.put("COTAPECTA", LignePayeSimplifiee.ASSURANCE_CHOMAGE_APEC.getId());
4351
                    liaison.put("COTAPECTA", LignePayeSimplifiee.ASSURANCE_CHOMAGE_APEC.getId());
Line 4149... Line 4354...
4149
                    liaison.put("COTPREV", LignePayeSimplifiee.RETRAITE_SUPPLEMENTAIRE.getId());
4354
                    liaison.put("COTPREV", LignePayeSimplifiee.RETRAITE_SUPPLEMENTAIRE.getId());
4150
                    liaison.put("COT_MUTUELLE", LignePayeSimplifiee.SANTE_COMPLEMENAIRE_SANTE.getId());
4355
                    liaison.put("COT_MUTUELLE", LignePayeSimplifiee.SANTE_COMPLEMENAIRE_SANTE.getId());
4151
                    liaison.put("COT_PENIBLE", LignePayeSimplifiee.AUTRES_CONTRIBUTIONS.getId());
4356
                    liaison.put("COT_PENIBLE", LignePayeSimplifiee.AUTRES_CONTRIBUTIONS.getId());
4152
 
4357
 
4153
                    SQLSelect sel = new SQLSelect();
4358
                    SQLSelect sel = new SQLSelect();
4154
                    sel.addSelect(conf.getRoot().findTable("RUBRIQUE_COTISATION").getField("CODE"));
4359
                    sel.addSelect(rootCommon.findTable("RUBRIQUE_COTISATION").getField("CODE"));
4155
                    sel.addSelect(conf.getRoot().findTable("RUBRIQUE_COTISATION").getField("NOM"));
4360
                    sel.addSelect(rootCommon.findTable("RUBRIQUE_COTISATION").getField("NOM"));
4156
                    sel.addSelect(conf.getRoot().findTable("RUBRIQUE_COTISATION").getKey());
4361
                    sel.addSelect(rootCommon.findTable("RUBRIQUE_COTISATION").getKey());
4157
                    List<SQLRow> rubCotis = SQLRowListRSH.execute(sel);
4362
                    List<SQLRow> rubCotis = SQLRowListRSH.execute(sel);
4158
 
4363
 
4159
                    for (SQLRow sqlRow : rubCotis) {
4364
                    for (SQLRow sqlRow : rubCotis) {
4160
                        final String code = sqlRow.getString("CODE");
4365
                        final String code = sqlRow.getString("CODE");
4161
                        if (liaison.containsKey(code)) {
4366
                        if (liaison.containsKey(code)) {
Line 4166... Line 4371...
4166
                        }
4371
                        }
4167
                    }
4372
                    }
4168
                }
4373
                }
4169
            }
4374
            }
4170
 
4375
 
4171
            final SQLTable tableRnet = conf.getRoot().getTable("RUBRIQUE_NET");
4376
            final SQLTable tableRnet = rootCommon.getTable("RUBRIQUE_NET");
-
 
4377
 
4172
            if (!tableRnet.contains("NUMERO_COMPTE_PCE_CHARGES")) {
4378
            if (!tableRnet.contains("NUMERO_COMPTE_PCE_CHARGES")) {
4173
                final AlterTable alter = new AlterTable(tableRnet);
4379
                final AlterTable alter = new AlterTable(tableRnet);
4174
                alter.addVarCharColumn("NUMERO_COMPTE_PCE_CHARGES", 128);
4380
                alter.addVarCharColumn("NUMERO_COMPTE_PCE_CHARGES", 128);
4175
                final String req = alter.asString();
4381
                final String req = alter.asString();
4176
                conf.getRoot().getDBSystemRoot().getDataSource().execute(req);
4382
                rootCommon.getDBSystemRoot().getDataSource().execute(req);
4177
                conf.getRoot().refetchTable(tableRnet.getName());
4383
                rootCommon.refetchTable(tableRnet.getName());
4178
                conf.getRoot().getSchema().updateVersion();
4384
                rootCommon.getSchema().updateVersion();
4179
            }
4385
            }
4180
 
4386
 
4181
            if (!tableRC.contains("PART_PAT_IMPOSABLE")) {
4387
            if (!tableRC.contains("PART_PAT_IMPOSABLE")) {
4182
                final AlterTable alter = new AlterTable(tableRC);
4388
                final AlterTable alter = new AlterTable(tableRC);
4183
                alter.addBooleanColumn("PART_PAT_IMPOSABLE", Boolean.FALSE, false);
4389
                alter.addBooleanColumn("PART_PAT_IMPOSABLE", Boolean.FALSE, false);
4184
                final String req = alter.asString();
4390
                final String req = alter.asString();
4185
                conf.getRoot().getDBSystemRoot().getDataSource().execute(req);
4391
                rootCommon.getDBSystemRoot().getDataSource().execute(req);
4186
                conf.getRoot().refetchTable(tableRC.getName());
4392
                rootCommon.refetchTable(tableRC.getName());
4187
                conf.getRoot().getSchema().updateVersion();
4393
                rootCommon.getSchema().updateVersion();
4188
            }
4394
            }
4189
 
4395
 
4190
            if (!tableRC.contains("REDUCTION_FILLON")) {
4396
            if (!tableRC.contains("REDUCTION_FILLON")) {
4191
                final AlterTable alter = new AlterTable(tableRC);
4397
                final AlterTable alter = new AlterTable(tableRC);
4192
                alter.addBooleanColumn("REDUCTION_FILLON", Boolean.FALSE, false);
4398
                alter.addBooleanColumn("REDUCTION_FILLON", Boolean.FALSE, false);
4193
                final String req = alter.asString();
4399
                final String req = alter.asString();
4194
                conf.getRoot().getDBSystemRoot().getDataSource().execute(req);
4400
                rootCommon.getDBSystemRoot().getDataSource().execute(req);
4195
                conf.getRoot().refetchTable(tableRC.getName());
4401
                rootCommon.refetchTable(tableRC.getName());
4196
                conf.getRoot().getSchema().updateVersion();
4402
                rootCommon.getSchema().updateVersion();
4197
            }
4403
            }
4198
 
4404
 
4199
            // Vérification des droits existants
4405
            // Vérification des droits existants
4200
            checkRights(conf.getRoot());
4406
            checkRights(rootCommon);
4201
 
4407
 
4202
            if (!conf.getRoot().contains("DEVISE")) {
4408
            if (!rootCommon.contains("DEVISE")) {
4203
                System.out.println("InstallationPanel.InstallationPanel() ADD DEVISE");
4409
                System.out.println("InstallationPanel.InstallationPanel() ADD DEVISE");
4204
                try {
4410
                try {
4205
                    SQLUtils.executeAtomic(ds, new SQLUtils.SQLFactory<Object>() {
4411
                    SQLUtils.executeAtomic(ds, new SQLUtils.SQLFactory<Object>() {
4206
                        @Override
4412
                        @Override
4207
                        public Object create() throws SQLException {
4413
                        public Object create() throws SQLException {
4208
                            final SQLCreateTable createDevise = new SQLCreateTable(conf.getRoot(), "DEVISE");
4414
                            final SQLCreateTable createDevise = new SQLCreateTable(rootCommon, "DEVISE");
4209
                            createDevise.addVarCharColumn("CODE", 128);
4415
                            createDevise.addVarCharColumn("CODE", 128);
4210
                            createDevise.addVarCharColumn("NOM", 128);
4416
                            createDevise.addVarCharColumn("NOM", 128);
4211
                            createDevise.addVarCharColumn("LIBELLE", 128);
4417
                            createDevise.addVarCharColumn("LIBELLE", 128);
4212
                            createDevise.addVarCharColumn("LIBELLE_CENT", 128);
4418
                            createDevise.addVarCharColumn("LIBELLE_CENT", 128);
4213
                            createDevise.addDecimalColumn("TAUX", 16, 8, BigDecimal.ONE, false);
4419
                            createDevise.addDecimalColumn("TAUX", 16, 8, BigDecimal.ONE, false);
4214
                            createDevise.addDecimalColumn("TAUX_COMMERCIAL", 16, 8, BigDecimal.ONE, false);
4420
                            createDevise.addDecimalColumn("TAUX_COMMERCIAL", 16, 8, BigDecimal.ONE, false);
4215
                            ds.execute(createDevise.asString());
4421
                            ds.execute(createDevise.asString());
4216
                            insertUndef(createDevise);
4422
                            insertUndef(createDevise);
4217
                            conf.getRoot().getSchema().updateVersion();
4423
                            rootCommon.getSchema().updateVersion();
4218
                            return null;
4424
                            return null;
4219
                        }
4425
                        }
4220
                    });
4426
                    });
4221
                } catch (Exception ex) {
4427
                } catch (Exception ex) {
4222
                    throw new IllegalStateException("Erreur lors de la création de la table DEVISE", ex);
4428
                    throw new IllegalStateException("Erreur lors de la création de la table DEVISE", ex);
4223
                }
4429
                }
4224
            } else if (!conf.getRoot().getTable("DEVISE").contains("TAUX_COMMERCIAL")) {
4430
            } else if (!rootCommon.getTable("DEVISE").contains("TAUX_COMMERCIAL")) {
4225
                final SQLTable tDevise = conf.getRoot().getTable("DEVISE");
4431
                final SQLTable tDevise = rootCommon.getTable("DEVISE");
4226
                final AlterTable alterDevise = new AlterTable(tDevise);
4432
                final AlterTable alterDevise = new AlterTable(tDevise);
4227
                alterDevise.addDecimalColumn("TAUX_COMMERCIAL", 16, 8, BigDecimal.ONE, false);
4433
                alterDevise.addDecimalColumn("TAUX_COMMERCIAL", 16, 8, BigDecimal.ONE, false);
4228
                ds.execute(alterDevise.asString());
4434
                ds.execute(alterDevise.asString());
4229
                tDevise.getSchema().updateVersion();
4435
                tDevise.getSchema().updateVersion();
4230
            }
4436
            }
4231
 
4437
 
4232
            if (!conf.getRoot().contains("TYPE_MODELE")) {
4438
            if (!rootCommon.contains("TYPE_MODELE")) {
4233
                System.out.println("InstallationPanel.InstallationPanel() ADD TYPE_MODELE");
4439
                System.out.println("InstallationPanel.InstallationPanel() ADD TYPE_MODELE");
4234
                try {
4440
                try {
4235
                    SQLUtils.executeAtomic(ds, new SQLUtils.SQLFactory<Object>() {
4441
                    SQLUtils.executeAtomic(ds, new SQLUtils.SQLFactory<Object>() {
-
 
4442
 
4236
                        @Override
4443
                        @Override
4237
                        public Object create() throws SQLException {
4444
                        public Object create() throws SQLException {
4238
                            final SQLCreateTable createTypeModele = new SQLCreateTable(conf.getRoot(), "TYPE_MODELE");
4445
                            final SQLCreateTable createTypeModele = new SQLCreateTable(rootCommon, "TYPE_MODELE");
4239
                            createTypeModele.addVarCharColumn("NOM", 128);
4446
                            createTypeModele.addVarCharColumn("NOM", 128);
4240
                            createTypeModele.addVarCharColumn("TABLE", 128);
4447
                            createTypeModele.addVarCharColumn("TABLE", 128);
4241
                            createTypeModele.addVarCharColumn("DEFAULT_MODELE", 128);
4448
                            createTypeModele.addVarCharColumn("DEFAULT_MODELE", 128);
4242
                            ds.execute(createTypeModele.asString());
4449
                            ds.execute(createTypeModele.asString());
4243
 
4450
 
4244
                            insertUndef(createTypeModele);
4451
                            insertUndef(createTypeModele);
4245
 
4452
 
4246
                            conf.getRoot().getSchema().updateVersion();
4453
                            rootCommon.getSchema().updateVersion();
4247
 
4454
 
4248
                            conf.getRoot().refetch();
4455
                            rootCommon.refetch();
4249
 
4456
 
4250
                            return null;
4457
                            return null;
4251
                        }
4458
                        }
4252
                    });
4459
                    });
4253
                    final String[] type = new String[] { "Avoir client", "AVOIR_CLIENT", "Avoir", "Bon de livraison", "BON_DE_LIVRAISON", "BonLivraison", "Commande Client", "COMMANDE_CLIENT",
4460
                    final String[] type = new String[] { "Avoir client", "AVOIR_CLIENT", "Avoir", "Bon de livraison", "BON_DE_LIVRAISON", "BonLivraison", "Commande Client", "COMMANDE_CLIENT",
4254
                            "CommandeClient", "Devis", "DEVIS", "Devis", "Facture", "SAISIE_VENTE_FACTURE", "VenteFacture" };
4461
                            "CommandeClient", "Devis", "DEVIS", "Devis", "Facture", "SAISIE_VENTE_FACTURE", "VenteFacture" };
4255
                    // ('FR', 'Français', 1.000), ('EN',
4462
                    // ('FR', 'Français', 1.000), ('EN',
4256
                    // 'Anglais', 2.000)
4463
                    // 'Anglais', 2.000)
4257
                    final List<String> values = new ArrayList<String>();
4464
                    final List<String> values = new ArrayList<String>();
4258
                    final SQLBase base = conf.getRoot().getBase();
4465
                    final SQLBase base = rootCommon.getBase();
4259
 
4466
 
4260
                    for (int i = 0; i < type.length; i += 3) {
4467
                    for (int i = 0; i < type.length; i += 3) {
4261
                        final int order = values.size() + 1;
4468
                        final int order = values.size() + 1;
4262
                        values.add("(" + base.quoteString(type[i]) + ", " + base.quoteString(type[i + 1]) + ", " + base.quoteString(type[i + 2]) + ", " + order + ")");
4469
                        values.add("(" + base.quoteString(type[i]) + ", " + base.quoteString(type[i + 1]) + ", " + base.quoteString(type[i + 2]) + ", " + order + ")");
4263
                    }
4470
                    }
4264
                    final String valuesStr = CollectionUtils.join(values, ", ");
4471
                    final String valuesStr = CollectionUtils.join(values, ", ");
4265
                    final String insertVals = "INSERT INTO " + conf.getRoot().getTable("TYPE_MODELE").getSQLName().quote() + "(" + SQLBase.quoteIdentifier("NOM") + ", "
4472
                    final String insertVals = "INSERT INTO " + rootCommon.getTable("TYPE_MODELE").getSQLName().quote() + "(" + SQLBase.quoteIdentifier("NOM") + ", " + SQLBase.quoteIdentifier("TABLE")
4266
                            + SQLBase.quoteIdentifier("TABLE") + ", " + SQLBase.quoteIdentifier("DEFAULT_MODELE") + ", " + SQLBase.quoteIdentifier(SQLSyntax.ORDER_NAME) + ") VALUES" + valuesStr;
4473
                            + ", " + SQLBase.quoteIdentifier("DEFAULT_MODELE") + ", " + SQLBase.quoteIdentifier(SQLSyntax.ORDER_NAME) + ") VALUES" + valuesStr;
4267
 
4474
 
4268
                    ds.execute(insertVals);
4475
                    ds.execute(insertVals);
4269
                } catch (Exception ex) {
4476
                } catch (Exception ex) {
4270
                    throw new IllegalStateException("Erreur lors de la création de la table TYPE_MODELE", ex);
4477
                    throw new IllegalStateException("Erreur lors de la création de la table TYPE_MODELE", ex);
4271
                }
4478
                }
4272
            }
4479
            }
4273
 
4480
 
4274
            SQLTable.setUndefID(conf.getRoot().getSchema(), "DEVISE", 1);
4481
            SQLTable.setUndefID(rootCommon.getSchema(), "DEVISE", 1);
4275
            SQLTable.setUndefID(conf.getRoot().getSchema(), "TYPE_MODELE", 1);
4482
            SQLTable.setUndefID(rootCommon.getSchema(), "TYPE_MODELE", 1);
4276
 
4483
 
4277
            // DSN
4484
            // DSN
4278
            final DSNInstallationUtils dsnUtils = new DSNInstallationUtils();
4485
            final DSNInstallationUtils dsnUtils = new DSNInstallationUtils();
4279
            dsnUtils.updateDSNCommonTable(conf.getRoot());
4486
            dsnUtils.updateDSNCommonTable(rootCommon);
4280
 
-
 
-
 
4487
            SQLRow rowRubNetPAS = createPasCommon(rootCommon);
4281
            // ECo contribution
4488
            // ECo contribution
4282
            final EcoContributionInstallationUtils ecoUtils = new EcoContributionInstallationUtils();
4489
            final EcoContributionInstallationUtils ecoUtils = new EcoContributionInstallationUtils();
4283
            ecoUtils.updateEcoCommonTable(conf.getRoot());
4490
            ecoUtils.updateEcoCommonTable(rootCommon);
4284
 
4491
 
4285
 
4492
 
4286
            // we need to upgrade all roots
4493
            // we need to upgrade all roots
4287
            // ///////////////////////////
4494
            // ///////////////////////////
4288
            conf.getSystemRoot().mapAllRoots();
4495
            systemRoot.mapAllRoots();
4289
            conf.getSystemRoot().refetch();
4496
            systemRoot.refetch();
4290
 
4497
 
4291
            final Set<String> childrenNames = conf.getSystemRoot().getChildrenNames();
4498
            final Set<String> childrenNames = systemRoot.getChildrenNames();
4292
 
4499
 
4293
            SwingUtilities.invokeLater(new Runnable() {
4500
            SwingUtilities.invokeLater(new Runnable() {
4294
 
4501
 
4295
                @Override
4502
                @Override
4296
                public void run() {
4503
                public void run() {
Line 4309... Line 4516...
4309
                    public void run() {
4516
                    public void run() {
4310
                        bar.setValue(barValue);
4517
                        bar.setValue(barValue);
4311
                    }
4518
                    }
4312
                });
4519
                });
4313
                i++;
4520
                i++;
4314
                final DBRoot root = conf.getSystemRoot().getRoot(childName);
4521
                final DBRoot root = systemRoot.getRoot(childName);
4315
                try {
4522
                try {
4316
                    conf.getSystemRoot().getDataSource().execute("CREATE LANGUAGE plpgsql;");
4523
                    systemRoot.getDataSource().execute("CREATE LANGUAGE plpgsql;");
4317
                } catch (Exception e) {
4524
                } catch (Exception e) {
4318
                    System.err.println("Warning: cannot add language plpgsql" + e.getMessage());
4525
                    System.err.println("Warning: cannot add language plpgsql" + e.getMessage());
4319
                }
4526
                }
4320
                final SQLTable tableUndef = root.getTable(SQLTable.undefTable);
4527
                final SQLTable tableUndef = root.getTable(SQLTable.undefTable);
4321
                if (tableUndef != null && tableUndef.getField("UNDEFINED_ID").isNullable() == Boolean.FALSE) {
4528
                if (tableUndef != null && tableUndef.getField("UNDEFINED_ID").isNullable() == Boolean.FALSE) {
Line 4339... Line 4546...
4339
                } else if (childName.startsWith(conf.getAppName()) || childName.equalsIgnoreCase("Default")
4546
                } else if (childName.startsWith(conf.getAppName()) || childName.equalsIgnoreCase("Default")
4340
                ) {
4547
                ) {
4341
                    SQLUtils.executeAtomic(ds, new SQLUtils.SQLFactory<Object>() {
4548
                    SQLUtils.executeAtomic(ds, new SQLUtils.SQLFactory<Object>() {
4342
                        @Override
4549
                        @Override
4343
                        public Object create() throws SQLException {
4550
                        public Object create() throws SQLException {
4344
                            fixUnboundedVarchar(root);
-
 
4345
                            fixUnboundedNumeric(root);
4551
                            fixUnboundedNumeric(root);
4346
                            fixCompletion(root);
4552
                            fixCompletion(root);
4347
                            try {
4553
                            try {
4348
                                updateSocieteSchema(root);
4554
                                updateSocieteSchema(conf, root);
4349
                            } catch (Exception e) {
4555
                            } catch (Exception e) {
4350
                                throw new SQLException(e);
4556
                                throw new SQLException(e);
4351
                            }
4557
                            }
4352
                            updateToV1Dot2(root);
4558
                            updateToV1Dot2(root);
4353
                            updateToV1Dot3(root);
4559
                            updateToV1Dot3(root);
Line 4361... Line 4567...
4361
                            createAssocAnalytique(root, conf);
4567
                            createAssocAnalytique(root, conf);
4362
                            updateStock(root);
4568
                            updateStock(root);
4363
                            updateVille(root.getTable("ADRESSE"));
4569
                            updateVille(root.getTable("ADRESSE"));
4364
 
4570
 
4365
                            Updater_1_5.update(root);
4571
                            Updater_1_5.update(root);
-
 
4572
 
4366
                            SQLTable tableFpaye = root.getTable("FICHE_PAYE");
4573
                            SQLTable tableFpaye = root.getTable("FICHE_PAYE");
4367
                            if (!tableFpaye.contains("REDUCTION_GVT")) {
4574
                            if (!tableFpaye.contains("REDUCTION_GVT")) {
4368
                                final AlterTable alterB = new AlterTable(tableFpaye);
4575
                                final AlterTable alterB = new AlterTable(tableFpaye);
4369
                                alterB.addDecimalColumn("REDUCTION_GVT", 16, 2, BigDecimal.ZERO, false);
4576
                                alterB.addDecimalColumn("REDUCTION_GVT", 16, 2, BigDecimal.ZERO, false);
4370
                                root.getBase().getDataSource().execute(alterB.asString());
4577
                                root.getBase().getDataSource().execute(alterB.asString());
Line 4391... Line 4598...
4391
                                        rowValsRubGvt.commit();
4598
                                        rowValsRubGvt.commit();
4392
                                    }
4599
                                    }
4393
                                    pos++;
4600
                                    pos++;
4394
                                }
4601
                                }
4395
                            }
4602
                            }
-
 
4603
                            if (rowRubNetPAS != null) {
-
 
4604
                                SQLSelect sel = new SQLSelect();
-
 
4605
                                sel.addSelect(root.getTable("SALARIE").getKey());
-
 
4606
                                sel.addSelect(root.getTable("SALARIE").getField("ID_FICHE_PAYE"));
-
 
4607
                                List<SQLRow> rowsSal = SQLRowListRSH.execute(sel);
-
 
4608
                                int pos = 80;
-
 
4609
 
-
 
4610
                                for (SQLRow rowSal : rowsSal) {
-
 
4611
 
-
 
4612
                                    SQLRowValues rowValsRubPas = new SQLRowValues(root.getTable("FICHE_PAYE_ELEMENT"));
-
 
4613
                                    rowValsRubPas.put("ID_FICHE_PAYE", rowSal.getForeignID("ID_FICHE_PAYE"));
-
 
4614
                                    rowValsRubPas.put("POSITION", pos);
-
 
4615
                                    rowValsRubPas.put("IDSOURCE", rowRubNetPAS.getID());
-
 
4616
                                    rowValsRubPas.put("SOURCE", rowRubNetPAS.getTable().getName());
-
 
4617
                                    rowValsRubPas.put("NOM", rowRubNetPAS.getString("NOM"));
-
 
4618
                                    rowValsRubPas.put("IN_PERIODE", Boolean.TRUE);
-
 
4619
                                    rowValsRubPas.put("IMPRESSION", Boolean.FALSE);
-
 
4620
                                    rowValsRubPas.put("VALIDE", Boolean.FALSE);
-
 
4621
                                    rowValsRubPas.commit();
-
 
4622
                                }
-
 
4623
 
-
 
4624
                            }
-
 
4625
 
-
 
4626
                            // at the end to let Updater_1_5 change field types from varchar to text
-
 
4627
                            fixUnboundedVarchar(root);
4396
 
4628
 
4397
                            return null;
4629
                            return null;
4398
                        }
4630
                        }
4399
 
4631
 
4400
                    });
4632
                    });
Line 4406... Line 4638...
4406
            ExceptionHandler.handle("Echec de mise à jour", e1);
4638
            ExceptionHandler.handle("Echec de mise à jour", e1);
4407
            error = true;
4639
            error = true;
4408
        }
4640
        }
4409
    }
4641
    }
4410
 
4642
 
-
 
4643
    public SQLRow createPasCommon(DBRoot root) throws SQLException {
-
 
4644
        SQLRow rowRub = null;
-
 
4645
 
-
 
4646
        SQLTable tableRubNet = root.getTable("RUBRIQUE_NET");
-
 
4647
        SQLTable caisseCot = root.getTable("CAISSE_COTISATION");
-
 
4648
        if (!tableRubNet.contains("PAS")) {
-
 
4649
 
-
 
4650
            AlterTable alterTableCaisseCot = new AlterTable(caisseCot);
-
 
4651
            alterTableCaisseCot.addBooleanColumn("DGFIP", Boolean.FALSE, true);
-
 
4652
            root.getBase().getDataSource().execute(alterTableCaisseCot.asString());
-
 
4653
            root.refetchTable("CAISSE_COTISATION");
-
 
4654
            root.getSchema().updateVersion();
-
 
4655
 
-
 
4656
            SQLRowValues rowValsCaisse = new SQLRowValues(caisseCot);
-
 
4657
            rowValsCaisse.put("ORG_PROTECTION_SOCIALE", Boolean.TRUE);
-
 
4658
            rowValsCaisse.put("DGFIP", Boolean.TRUE);
-
 
4659
            rowValsCaisse.put("NOM", "DGFIP");
-
 
4660
            SQLRow rowCaisseDGFIP = rowValsCaisse.commit();
-
 
4661
 
-
 
4662
            AlterTable alterTableNet = new AlterTable(tableRubNet);
-
 
4663
            alterTableNet.addBooleanColumn("PAS", Boolean.FALSE, true);
-
 
4664
            alterTableNet.addBooleanColumn("PAS_CDD", Boolean.FALSE, true);
-
 
4665
            root.getBase().getDataSource().execute(alterTableNet.asString());
-
 
4666
            root.refetchTable("RUBRIQUE_NET");
-
 
4667
            root.getSchema().updateVersion();
-
 
4668
 
-
 
4669
            SQLRowValues rowValsPASCDD = new SQLRowValues(tableRubNet);
-
 
4670
            rowValsPASCDD.put("ID_CAISSE_COTISATION", rowCaisseDGFIP.getID());
-
 
4671
            rowValsPASCDD.put("TAUX", "TAUX_PAS;");
-
 
4672
            rowValsPASCDD.put("BASE", "Math.max(0.0D,(Math.round(NET_IMP*100.0)/100.0)-597);");
-
 
4673
            rowValsPASCDD.put("NOM", "Prélévement à la source CDD moins de 2 mois ");
-
 
4674
            rowValsPASCDD.put("CODE", "PAS_NET_CDD");
-
 
4675
            rowValsPASCDD.put("MONTANT", "Math.round(Math.max(0.0D,((Math.round(NET_IMP*100.0)/100.0)-597)) * TAUX_PAS)/100.0;");
-
 
4676
            rowValsPASCDD.put("ID_IMPRESSION_RUBRIQUE", 4);
-
 
4677
            rowValsPASCDD.put("ID_TYPE_RUBRIQUE_NET", 3);
-
 
4678
            rowValsPASCDD.put("PAS_CDD", Boolean.TRUE);
-
 
4679
            rowValsPASCDD.putRowValues("ID_PERIODE_VALIDITE").put("JANVIER", Boolean.TRUE);
-
 
4680
            rowValsPASCDD.commit();
-
 
4681
 
-
 
4682
            SQLRowValues rowValsPAS = new SQLRowValues(tableRubNet);
-
 
4683
            rowValsPAS.put("ID_CAISSE_COTISATION", rowCaisseDGFIP.getID());
-
 
4684
            rowValsPAS.put("TAUX", "TAUX_PAS;");
-
 
4685
            rowValsPAS.put("BASE", "Math.round(NET_IMP*100.0)/100.0;");
-
 
4686
            rowValsPAS.put("NOM", "Prélévement à la source");
-
 
4687
            rowValsPAS.put("CODE", "PAS_NET");
-
 
4688
            rowValsPAS.put("MONTANT", "Math.round((Math.round(NET_IMP*100.0)/100.0) * TAUX_PAS)/100.0;");
-
 
4689
            rowValsPAS.put("ID_IMPRESSION_RUBRIQUE", 4);
-
 
4690
            rowValsPAS.put("ID_TYPE_RUBRIQUE_NET", 3);
-
 
4691
            rowValsPAS.put("PAS", Boolean.TRUE);
-
 
4692
            rowValsPAS.putRowValues("ID_PERIODE_VALIDITE").put("JANVIER", Boolean.TRUE);
-
 
4693
 
-
 
4694
            rowRub = rowValsPAS.commit();
-
 
4695
 
-
 
4696
            SQLSelect sel = new SQLSelect();
-
 
4697
            sel.addSelect(root.findTable("PROFIL_PAYE").getKey());
-
 
4698
            List<SQLRow> rowsProfil = SQLRowListRSH.execute(sel);
-
 
4699
            int pos = 80;
-
 
4700
            for (SQLRow rowProfil : rowsProfil) {
-
 
4701
 
-
 
4702
                SQLRowValues rowValsRubGvt = new SQLRowValues(root.findTable("PROFIL_PAYE_ELEMENT"));
-
 
4703
                rowValsRubGvt.put("ID_PROFIL_PAYE", rowProfil.getID());
-
 
4704
                rowValsRubGvt.put("POSITION", pos);
-
 
4705
                rowValsRubGvt.put("IDSOURCE", rowRub.getID());
-
 
4706
                rowValsRubGvt.put("SOURCE", rowRub.getTable().getName());
-
 
4707
                rowValsRubGvt.put("NOM", rowRub.getString("NOM"));
-
 
4708
                rowValsRubGvt.commit();
-
 
4709
            }
-
 
4710
 
-
 
4711
        }
-
 
4712
        return rowRub;
-
 
4713
    }
-
 
4714
 
4411
}
4715
}