OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Compare Revisions

Regard whitespace Rev 150 → Rev 151

/trunk/OpenConcerto/src/org/openconcerto/erp/config/InstallationPanel.java
903,7 → 903,7
size = 2048;
else
// e.g. IDCC.NOM > 350
size = 1024;
size = 512;
alter.alterColumn(fName, EnumSet.allOf(Properties.class), "varchar(" + size + ")", "''", false);
}
}
918,12 → 918,8
}
 
for (final String sql : ChangeTable.cat(alters, root.getName())) {
try {
// ds.execute(sql);
} catch (Exception e) {
e.printStackTrace();
ds.execute(sql);
}
}
root.refetch();
}
 
3748,37 → 3744,6
 
if (ProductInfo.getInstance().getName().equalsIgnoreCase("OpenConcerto")) {
 
final SQLTable tableExercice = root.getTable("EXERCICE_COMMON");
 
// FIXME UPDATE Base ILM 1.2->1.3 la table EXERCERCIE ne contenait pas la clef
// ID_SOCIETE_COMMON
// if (tableExercice.contains("ID_SOCIETE_COMMON")) {
String reqUp = "UPDATE " + tableExercice.getSQLName().quote() + " SET \"ID_SOCIETE_COMMON\"=1 WHERE ";
reqUp += new Where(tableExercice.getKey(), 3, 49).getClause();
root.getDBSystemRoot().getDataSource().execute(reqUp);
 
String reqUp2 = "UPDATE " + tableExercice.getSQLName().quote() + " SET \"ID_SOCIETE_COMMON\"=1 WHERE ";
reqUp2 += new Where(tableExercice.getKey(), 53, 57).getClause();
root.getDBSystemRoot().getDataSource().execute(reqUp2);
// }
// rm ID 43 - 47 de SOCIETE_COMMON
final SQLTable tableSociete = root.getTable("SOCIETE_COMMON");
String req3 = "DELETE FROM " + tableSociete.getSQLName().quote() + " WHERE ";
req3 += new Where(tableSociete.getKey(), 43, 47).getClause();
root.getDBSystemRoot().getDataSource().execute(req3);
 
// rm ID 3 à 49 de EXERCICE_COMMON
 
String req1a = "DELETE FROM " + tableExercice.getSQLName().quote() + " WHERE ";
req1a += new Where(tableExercice.getKey(), 3, 49).getClause();
root.getDBSystemRoot().getDataSource().execute(req1a);
// et 53-57
root.getDBSystemRoot().getDataSource().execute(req1a);
String req1b = "DELETE FROM " + tableExercice.getSQLName().quote() + " WHERE ";
req1b += new Where(tableExercice.getKey(), 53, 57).getClause();
root.getDBSystemRoot().getDataSource().execute(req1b);
//
 
// TACHE_COMMON, ID_USER_COMMON_*=0 -> 1
for (final String f : Arrays.asList("ID_USER_COMMON_TO", "ID_USER_COMMON_CREATE", "ID_USER_COMMON_ASSIGN_BY")) {
final SQLTable tableTache = root.getTable("TACHE_COMMON");
3799,6 → 3764,13
}
}
 
final SQLTable sociétéT = root.getTable("SOCIETE_COMMON");
if (!sociétéT.contains("SEPA_CREDITOR_ID")) {
final AlterTable alter = new AlterTable(sociétéT);
alter.addVarCharColumn("SEPA_CREDITOR_ID", 16);
Updater_1_5.exec(alter);
}
 
// FK
new AddFK(root.getDBSystemRoot()).changeAll(root);
}
3935,8 → 3907,19
}
}
 
if (!table.getFieldsName().contains("SITE_WEB")) {
AlterTable t2 = new AlterTable(table);
t2.addVarCharColumn("SITE_WEB", 128);
 
t2.alterColumn("CAPITAL", EnumSet.allOf(Properties.class), "numeric(16,2)", "0", false);
table.getBase().getDataSource().execute(t2.asString());
table.getSchema().updateVersion();
table.fetchFields();
 
}
 
}
 
private void updateVille(SQLTable tableAdresse) throws SQLException {
 
if (tableAdresse != null && tableAdresse.getField("CODE_POSTAL").getType().getJavaType() == Integer.class) {
4034,7 → 4017,73
}
 
// Paye simplifiee
List<SQLRow> rowRubriqueReduGvt = new ArrayList<>();
{
 
final SQLTable tableRCom = conf.getRoot().getTable("RUBRIQUE_COMM");
if (!tableRCom.contains("REDUCTION_GVT_COM")) {
final AlterTable alter = new AlterTable(tableRCom);
alter.addBooleanColumn("REDUCTION_GVT_COM", Boolean.FALSE, false);
final String req = alter.asString();
conf.getRoot().getDBSystemRoot().getDataSource().execute(req);
conf.getRoot().refetchTable(tableRCom.getName());
conf.getRoot().getSchema().updateVersion();
 
SQLRowValues rowValsCommChom = new SQLRowValues(tableRCom);
rowValsCommChom.put("TAUX_SAL", "1.45;");
rowValsCommChom.put("NB_BASE", "SAL_BRUT;");
rowValsCommChom.put("NOM", "Assurance chômage reduction 2018");
rowValsCommChom.put("CODE", "OC_REDUCTION_CHOMAGE");
rowValsCommChom.put("MONTANT_SAL_DED", "SAL_BRUT * 0.0145;");
rowValsCommChom.put("NB_BASE", "SAL_BRUT;");
rowValsCommChom.put("ID_IMPRESSION_RUBRIQUE", 4);
rowValsCommChom.put("REDUCTION_GVT_COM", Boolean.TRUE);
rowValsCommChom.putRowValues("ID_PERIODE_VALIDITE").put("JANVIER", Boolean.TRUE);
rowRubriqueReduGvt.add(rowValsCommChom.commit());
 
SQLRowValues rowValsCommMaladie = new SQLRowValues(tableRCom);
rowValsCommMaladie.put("TAUX_SAL", "0.75;");
rowValsCommMaladie.put("NB_BASE", "SAL_BRUT;");
rowValsCommMaladie.put("NOM", "Assurance maladie reduction 2018");
rowValsCommMaladie.put("CODE", "OC_REDUCTION_MALADIE");
rowValsCommMaladie.put("MONTANT_SAL_DED", "SAL_BRUT * 0.0075;");
rowValsCommMaladie.put("NB_BASE", "SAL_BRUT;");
rowValsCommMaladie.put("ID_IMPRESSION_RUBRIQUE", 4);
rowValsCommMaladie.put("REDUCTION_GVT_COM", Boolean.TRUE);
rowValsCommMaladie.putRowValues("ID_PERIODE_VALIDITE").put("JANVIER", Boolean.TRUE);
rowRubriqueReduGvt.add(rowValsCommMaladie.commit());
 
SQLRowValues rowValsCommCSG = new SQLRowValues(tableRCom);
rowValsCommCSG.put("TAUX_SAL", "1.7;");
rowValsCommCSG.put("NB_BASE", "CSG;");
rowValsCommCSG.put("NOM", "CSG augmentation 2018");
rowValsCommCSG.put("CODE", "OC_AUGMENTATION_CSG");
rowValsCommCSG.put("MONTANT_SAL_AJ", "CSG * 0.017;");
rowValsCommCSG.put("NB_BASE", "CSG;");
rowValsCommCSG.put("ID_IMPRESSION_RUBRIQUE", 4);
rowValsCommCSG.put("REDUCTION_GVT_COM", Boolean.TRUE);
rowValsCommCSG.putRowValues("ID_PERIODE_VALIDITE").put("JANVIER", Boolean.TRUE);
rowRubriqueReduGvt.add(rowValsCommCSG.commit());
 
SQLSelect sel = new SQLSelect();
sel.addSelect(conf.getRoot().getTable("PROFIL_PAYE").getKey());
List<SQLRow> rowsProfil = SQLRowListRSH.execute(sel);
int pos = 70;
for (SQLRow rowRub : rowRubriqueReduGvt) {
for (SQLRow rowProfil : rowsProfil) {
 
SQLRowValues rowValsRubGvt = new SQLRowValues(conf.getRoot().getTable("PROFIL_PAYE_ELEMENT"));
rowValsRubGvt.put("ID_PROFIL_PAYE", rowProfil.getID());
rowValsRubGvt.put("POSITION", pos);
rowValsRubGvt.put("IDSOURCE", rowRub.getID());
rowValsRubGvt.put("SOURCE", rowRub.getTable().getName());
rowValsRubGvt.put("NOM", rowRub.getString("NOM"));
rowValsRubGvt.commit();
}
pos++;
}
}
 
final SQLTable tableRB = conf.getRoot().getTable("RUBRIQUE_BRUT");
if (!tableRB.contains("AVANTAGE_NATURE")) {
final AlterTable alter = new AlterTable(tableRB);
4125,7 → 4174,7
alter.addVarCharColumn("NUMERO_COMPTE_PCE_CHARGES", 128);
final String req = alter.asString();
conf.getRoot().getDBSystemRoot().getDataSource().execute(req);
conf.getRoot().refetchTable(tableCaisse.getName());
conf.getRoot().refetchTable(tableRnet.getName());
conf.getRoot().getSchema().updateVersion();
}
 
4314,6 → 4363,37
updateVille(root.getTable("ADRESSE"));
 
Updater_1_5.update(root);
SQLTable tableFpaye = root.getTable("FICHE_PAYE");
if (!tableFpaye.contains("REDUCTION_GVT")) {
final AlterTable alterB = new AlterTable(tableFpaye);
alterB.addDecimalColumn("REDUCTION_GVT", 16, 2, BigDecimal.ZERO, false);
root.getBase().getDataSource().execute(alterB.asString());
root.refetchTable("FICHE_PAYE");
root.getSchema().updateVersion();
 
SQLSelect sel = new SQLSelect();
sel.addSelect(root.getTable("SALARIE").getKey());
sel.addSelect(root.getTable("SALARIE").getField("ID_FICHE_PAYE"));
List<SQLRow> rowsSal = SQLRowListRSH.execute(sel);
int pos = 70;
for (SQLRow rowRub : rowRubriqueReduGvt) {
for (SQLRow rowSal : rowsSal) {
 
SQLRowValues rowValsRubGvt = new SQLRowValues(root.getTable("FICHE_PAYE_ELEMENT"));
rowValsRubGvt.put("ID_FICHE_PAYE", rowSal.getForeignID("ID_FICHE_PAYE"));
rowValsRubGvt.put("POSITION", pos);
rowValsRubGvt.put("IDSOURCE", rowRub.getID());
rowValsRubGvt.put("SOURCE", rowRub.getTable().getName());
rowValsRubGvt.put("NOM", rowRub.getString("NOM"));
rowValsRubGvt.put("IN_PERIODE", Boolean.TRUE);
rowValsRubGvt.put("IMPRESSION", Boolean.FALSE);
rowValsRubGvt.put("VALIDE", Boolean.FALSE);
rowValsRubGvt.commit();
}
pos++;
}
}
 
return null;
}