Line 13... |
Line 13... |
13 |
|
13 |
|
14 |
package org.openconcerto.erp.config.update;
|
14 |
package org.openconcerto.erp.config.update;
|
15 |
|
15 |
|
16 |
import org.openconcerto.erp.config.InstallationPanel;
|
16 |
import org.openconcerto.erp.config.InstallationPanel;
|
17 |
import org.openconcerto.erp.core.common.ui.AbstractVenteArticleItemTable;
|
17 |
import org.openconcerto.erp.core.common.ui.AbstractVenteArticleItemTable;
|
- |
|
18 |
import org.openconcerto.erp.core.customerrelationship.mail.EmailTemplateSQLElement;
|
18 |
import org.openconcerto.erp.core.finance.payment.element.SDDMessageSQLElement;
|
19 |
import org.openconcerto.erp.core.finance.payment.element.SDDMessageSQLElement;
|
19 |
import org.openconcerto.erp.core.finance.payment.element.SEPAMandateSQLElement;
|
20 |
import org.openconcerto.erp.core.finance.payment.element.SEPAMandateSQLElement;
|
20 |
import org.openconcerto.erp.core.finance.payment.element.TypeReglementSQLElement;
|
21 |
import org.openconcerto.erp.core.finance.payment.element.TypeReglementSQLElement;
|
21 |
import org.openconcerto.erp.core.sales.invoice.element.SaisieVenteFactureSQLElement;
|
22 |
import org.openconcerto.erp.core.sales.invoice.element.SaisieVenteFactureSQLElement;
|
22 |
import org.openconcerto.erp.core.sales.order.ui.TypeFactureCommandeClient;
|
23 |
import org.openconcerto.erp.core.sales.order.ui.TypeFactureCommandeClient;
|
23 |
import org.openconcerto.erp.core.sales.pos.element.TicketCaisseSQLElement;
|
24 |
import org.openconcerto.erp.core.sales.pos.element.TicketCaisseSQLElement;
|
24 |
import org.openconcerto.erp.core.sales.product.element.ReferenceArticleSQLElement;
|
25 |
import org.openconcerto.erp.core.sales.product.element.ReferenceArticleSQLElement;
|
25 |
import org.openconcerto.erp.core.sales.quote.element.DevisLogMailSQLElement;
|
26 |
import org.openconcerto.erp.core.sales.quote.element.DevisLogMailSQLElement;
|
- |
|
27 |
import org.openconcerto.erp.core.supplychain.stock.element.ComposedItemStockUpdater;
|
26 |
import org.openconcerto.erp.core.supplychain.stock.element.DepotStockSQLElement;
|
28 |
import org.openconcerto.erp.core.supplychain.stock.element.DepotStockSQLElement;
|
27 |
import org.openconcerto.erp.core.supplychain.stock.element.StockItem;
|
29 |
import org.openconcerto.erp.core.supplychain.stock.element.StockItem;
|
28 |
import org.openconcerto.sql.changer.convert.AddMDFields;
|
30 |
import org.openconcerto.sql.changer.convert.AddMDFields;
|
29 |
import org.openconcerto.sql.model.DBRoot;
|
31 |
import org.openconcerto.sql.model.DBRoot;
|
30 |
import org.openconcerto.sql.model.SQLField;
|
32 |
import org.openconcerto.sql.model.SQLField;
|
Line 35... |
Line 37... |
35 |
import org.openconcerto.sql.model.SQLRowValues;
|
37 |
import org.openconcerto.sql.model.SQLRowValues;
|
36 |
import org.openconcerto.sql.model.SQLSelect;
|
38 |
import org.openconcerto.sql.model.SQLSelect;
|
37 |
import org.openconcerto.sql.model.SQLSyntax;
|
39 |
import org.openconcerto.sql.model.SQLSyntax;
|
38 |
import org.openconcerto.sql.model.SQLSystem;
|
40 |
import org.openconcerto.sql.model.SQLSystem;
|
39 |
import org.openconcerto.sql.model.SQLTable;
|
41 |
import org.openconcerto.sql.model.SQLTable;
|
- |
|
42 |
import org.openconcerto.sql.model.SQLTable.Index;
|
40 |
import org.openconcerto.sql.model.Where;
|
43 |
import org.openconcerto.sql.model.Where;
|
41 |
import org.openconcerto.sql.preferences.SQLPreferences;
|
44 |
import org.openconcerto.sql.preferences.SQLPreferences;
|
42 |
import org.openconcerto.sql.request.UpdateBuilder;
|
45 |
import org.openconcerto.sql.request.UpdateBuilder;
|
43 |
import org.openconcerto.sql.utils.AlterTable;
|
46 |
import org.openconcerto.sql.utils.AlterTable;
|
44 |
import org.openconcerto.sql.utils.ChangeTable;
|
47 |
import org.openconcerto.sql.utils.ChangeTable;
|
Line 56... |
Line 59... |
56 |
import java.util.Collections;
|
59 |
import java.util.Collections;
|
57 |
import java.util.EnumSet;
|
60 |
import java.util.EnumSet;
|
58 |
import java.util.HashMap;
|
61 |
import java.util.HashMap;
|
59 |
import java.util.List;
|
62 |
import java.util.List;
|
60 |
import java.util.Map;
|
63 |
import java.util.Map;
|
- |
|
64 |
import java.util.Set;
|
61 |
import java.util.prefs.BackingStoreException;
|
65 |
import java.util.prefs.BackingStoreException;
|
62 |
|
66 |
|
63 |
import org.apache.commons.dbutils.handlers.ArrayListHandler;
|
67 |
import org.apache.commons.dbutils.handlers.ArrayListHandler;
|
64 |
|
68 |
|
65 |
public class Updater_1_5 {
|
69 |
public class Updater_1_5 {
|
Line 1788... |
Line 1792... |
1788 |
|
1792 |
|
1789 |
root.getBase().getDataSource().execute(alterB.asString());
|
1793 |
root.getBase().getDataSource().execute(alterB.asString());
|
1790 |
root.refetchTable("VARIABLE_SALARIE");
|
1794 |
root.refetchTable("VARIABLE_SALARIE");
|
1791 |
root.getSchema().updateVersion();
|
1795 |
root.getSchema().updateVersion();
|
1792 |
}
|
1796 |
}
|
- |
|
1797 |
SQLTable tableBL = root.getTable("BON_DE_LIVRAISON");
|
- |
|
1798 |
if (!tableBL.contains("ID_COMMERCIAL")) {
|
- |
|
1799 |
final AlterTable alterB = new AlterTable(tableBL);
|
- |
|
1800 |
alterB.addForeignColumn("ID_COMMERCIAL", root.getTable("COMMERCIAL"));
|
- |
|
1801 |
root.getBase().getDataSource().execute(alterB.asString());
|
- |
|
1802 |
root.refetchTable("BON_DE_LIVRAISON");
|
- |
|
1803 |
root.getSchema().updateVersion();
|
- |
|
1804 |
}
|
1793 |
|
1805 |
|
1794 |
// fix stock
|
1806 |
// fix stock
|
1795 |
{
|
1807 |
{
|
1796 |
SQLTable tableStock = root.getTable("STOCK");
|
1808 |
SQLTable tableStock = root.getTable("STOCK");
|
1797 |
|
1809 |
|
Line 1855... |
Line 1867... |
1855 |
for (SQLRow sqlRow : badStock) {
|
1867 |
for (SQLRow sqlRow : badStock) {
|
1856 |
initStock(sqlRow);
|
1868 |
initStock(sqlRow);
|
1857 |
}
|
1869 |
}
|
1858 |
}
|
1870 |
}
|
1859 |
|
1871 |
|
- |
|
1872 |
// Tarification client par quantite
|
- |
|
1873 |
if (root.getTable("TARIF_ARTICLE_CLIENT") == null) {
|
- |
|
1874 |
final SQLCreateTable createTableQtyTarif = new SQLCreateTable(root, "TARIF_ARTICLE_CLIENT");
|
- |
|
1875 |
createTableQtyTarif.addForeignColumn("ID_ARTICLE", root.getTable("ARTICLE"));
|
- |
|
1876 |
createTableQtyTarif.addForeignColumn("ID_CLIENT", root.getTable("CLIENT"));
|
- |
|
1877 |
createTableQtyTarif.addDecimalColumn("QUANTITE", 16, 3, BigDecimal.ONE, false);
|
- |
|
1878 |
createTableQtyTarif.addDecimalColumn("POURCENT_REMISE", 16, 3, null, true);
|
- |
|
1879 |
// createTableQtyTarif.addDecimalColumn("PRIX_METRIQUE_VT_1", 16, 6, null, true);
|
- |
|
1880 |
try {
|
- |
|
1881 |
root.getBase().getDataSource().execute(createTableQtyTarif.asString());
|
- |
|
1882 |
InstallationPanel.insertUndef(createTableQtyTarif);
|
- |
|
1883 |
root.refetchTable("TARIF_ARTICLE_CLIENT");
|
- |
|
1884 |
root.getSchema().updateVersion();
|
- |
|
1885 |
} catch (SQLException ex) {
|
- |
|
1886 |
throw new IllegalStateException("Erreur lors de la création de la table " + "TARIF_QUANTITE", ex);
|
- |
|
1887 |
}
|
- |
|
1888 |
}
|
- |
|
1889 |
|
- |
|
1890 |
SQLTable tableTrCmd = root.getTable("TR_COMMANDE");
|
- |
|
1891 |
if (!tableTrCmd.contains("ID_FACTURE_FOURNISSEUR")) {
|
- |
|
1892 |
AlterTable t = new AlterTable(tableTrCmd);
|
- |
|
1893 |
t.addForeignColumn("ID_FACTURE_FOURNISSEUR", root.getTable("FACTURE_FOURNISSEUR"));
|
- |
|
1894 |
tableTrCmd.getBase().getDataSource().execute(t.asString());
|
- |
|
1895 |
root.refetchTable(tableTrCmd.getName());
|
- |
|
1896 |
root.getSchema().updateVersion();
|
- |
|
1897 |
}
|
1860 |
|
1898 |
|
- |
|
1899 |
SQLTable tableContrat = root.getTable("CONTRAT_SALARIE");
|
- |
|
1900 |
if (!tableContrat.contains("COMPLEMENT_PCS")) {
|
- |
|
1901 |
AlterTable t = new AlterTable(tableContrat);
|
- |
|
1902 |
t.addVarCharColumn("COMPLEMENT_PCS", 54);
|
- |
|
1903 |
tableContrat.getBase().getDataSource().execute(t.asString());
|
- |
|
1904 |
root.refetchTable(tableContrat.getName());
|
- |
|
1905 |
root.getSchema().updateVersion();
|
1861 |
}
|
1906 |
}
|
1862 |
|
1907 |
|
- |
|
1908 |
List<String> tablesCatComptable = Arrays.asList("DEVIS", "COMMANDE_CLIENT", "BON_DE_LIVRAISON", "SAISIE_VENTE_FACTURE", "AVOIR_CLIENT");
|
- |
|
1909 |
for (String tableToUp : tablesCatComptable) {
|
- |
|
1910 |
final SQLTable tableCatComptToAdd = root.getTable(tableToUp);
|
- |
|
1911 |
if (!tableCatComptToAdd.contains("ID_CATEGORIE_COMPTABLE")) {
|
- |
|
1912 |
final AlterTable alter = new AlterTable(tableCatComptToAdd);
|
- |
|
1913 |
alter.addForeignColumn("ID_CATEGORIE_COMPTABLE", root.getTable("CATEGORIE_COMPTABLE"));
|
- |
|
1914 |
exec(alter);
|
- |
|
1915 |
root.refetchTable(tableToUp);
|
- |
|
1916 |
root.getSchema().updateVersion();
|
- |
|
1917 |
}
|
- |
|
1918 |
}
|
- |
|
1919 |
|
- |
|
1920 |
|
- |
|
1921 |
// Modèles pour les emails
|
- |
|
1922 |
if (!root.contains(EmailTemplateSQLElement.TABLE_NAME)) {
|
- |
|
1923 |
final SQLCreateTable createTable = new SQLCreateTable(root, EmailTemplateSQLElement.TABLE_NAME);
|
- |
|
1924 |
createTable.addVarCharColumn("NOM", 80);
|
- |
|
1925 |
createTable.addVarCharColumn("TITRE", 80);
|
- |
|
1926 |
createTable.addVarCharColumn("TEXTE", 4096);
|
- |
|
1927 |
createTable.addVarCharColumn("FORMAT_DATE", 20);
|
- |
|
1928 |
createTable.addBooleanColumn("PAR_DEFAUT", Boolean.FALSE, false);
|
- |
|
1929 |
try {
|
- |
|
1930 |
root.getBase().getDataSource().execute(createTable.asString());
|
- |
|
1931 |
InstallationPanel.insertUndef(createTable);
|
- |
|
1932 |
root.refetchTable(EmailTemplateSQLElement.TABLE_NAME);
|
- |
|
1933 |
root.getSchema().updateVersion();
|
1863 |
public static void initStock(SQLRow row) {
|
1934 |
} catch (SQLException ex) {
|
- |
|
1935 |
throw new IllegalStateException("Erreur lors de la création de la table " + EmailTemplateSQLElement.TABLE_NAME, ex);
|
- |
|
1936 |
}
|
- |
|
1937 |
}
|
1864 |
SQLSelect sel = new SQLSelect();
|
1938 |
// Force undefined policy to inDb
|
- |
|
1939 |
root.setMetadata(SQLTable.UNDEFINED_ID_POLICY, "inDB");
|
- |
|
1940 |
final Map<String, Number> mapTableNameUndefined = SQLTable.getUndefIDs(root.getSchema());
|
1865 |
sel.addSelectStar(row.getTable().getTable("DEPOT_STOCK"));
|
1941 |
final Set<String> tables = root.getSchema().getTableNames();
|
- |
|
1942 |
for (String tName : tables) {
|
- |
|
1943 |
if (!mapTableNameUndefined.containsKey(tName)) {
|
- |
|
1944 |
System.err.println("Updater_1_5.update() adding undefined in db for " + tName);
|
- |
|
1945 |
SQLTable.setUndefID(root.getSchema(), tName, null);
|
- |
|
1946 |
}
|
- |
|
1947 |
}
|
- |
|
1948 |
|
- |
|
1949 |
// Création de la table Modéle
|
- |
|
1950 |
if (!root.contains("CONTACT_SALARIE")) {
|
- |
|
1951 |
|
- |
|
1952 |
SQLCreateTable createModele = new SQLCreateTable(root, "CONTACT_SALARIE");
|
- |
|
1953 |
createModele.addVarCharColumn("NOM", 256);
|
- |
|
1954 |
createModele.addVarCharColumn("PRENOM", 256);
|
- |
|
1955 |
createModele.addVarCharColumn("TEL_DIRECT", 256);
|
- |
|
1956 |
createModele.addVarCharColumn("TEL_MOBILE", 256);
|
- |
|
1957 |
createModele.addVarCharColumn("EMAIL", 256);
|
- |
|
1958 |
createModele.addVarCharColumn("FAX", 256);
|
- |
|
1959 |
createModele.addVarCharColumn("FONCTION", 256);
|
- |
|
1960 |
createModele.addVarCharColumn("TEL_PERSONEL", 256);
|
- |
|
1961 |
createModele.addVarCharColumn("TEL_STANDARD", 256);
|
- |
|
1962 |
createModele.addForeignColumn("ID_TITRE_PERSONNEL", root.findTable("TITRE_PERSONNEL"));
|
- |
|
1963 |
createModele.addForeignColumn("ID_SALARIE", root.findTable("SALARIE"));
|
- |
|
1964 |
|
- |
|
1965 |
try {
|
- |
|
1966 |
root.getBase().getDataSource().execute(createModele.asString());
|
- |
|
1967 |
root.refetchTable("CONTACT_SALARIE");
|
- |
|
1968 |
SQLRowValues rowVals = new SQLRowValues(root.getTable("CONTACT_SALARIE"));
|
1866 |
List<SQLRow> rowsDepot = SQLRowListRSH.execute(sel);
|
1969 |
SQLRow rowInserted = rowVals.commit();
|
- |
|
1970 |
SQLTable.setUndefID(root.getSchema(), "CONTACT_SALARIE", rowInserted.getID());
|
- |
|
1971 |
tableDevis.getSchema().updateVersion();
|
- |
|
1972 |
} catch (SQLException ex) {
|
- |
|
1973 |
throw new IllegalStateException("Erreur lors de la création de la table MODELE", ex);
|
- |
|
1974 |
}
|
- |
|
1975 |
}
|
- |
|
1976 |
|
- |
|
1977 |
final SQLTable tableRgltPaye = root.getTable("REGLEMENT_PAYE");
|
- |
|
1978 |
if (!tableRgltPaye.contains("IBAN")) {
|
- |
|
1979 |
final AlterTable alter = new AlterTable(tableRgltPaye);
|
- |
|
1980 |
alter.addVarCharColumn("IBAN", 128);
|
- |
|
1981 |
exec(alter);
|
- |
|
1982 |
root.refetchTable(tableRgltPaye.getName());
|
- |
|
1983 |
root.getSchema().updateVersion();
|
- |
|
1984 |
}
|
- |
|
1985 |
if (!tableRgltPaye.contains("BIC")) {
|
- |
|
1986 |
final AlterTable alter = new AlterTable(tableRgltPaye);
|
- |
|
1987 |
alter.addVarCharColumn("BIC", 40);
|
- |
|
1988 |
exec(alter);
|
- |
|
1989 |
root.refetchTable(tableRgltPaye.getName());
|
- |
|
1990 |
root.getSchema().updateVersion();
|
- |
|
1991 |
}
|
- |
|
1992 |
final SQLTable tableSalarie = root.getTable("SALARIE");
|
- |
|
1993 |
if (!tableSalarie.contains("ID_USER_COMMON")) {
|
- |
|
1994 |
final AlterTable alter = new AlterTable(tableSalarie);
|
- |
|
1995 |
alter.addForeignColumn("ID_USER_COMMON", root.findTable("USER_COMMON"));
|
- |
|
1996 |
exec(alter);
|
- |
|
1997 |
root.refetchTable(tableSalarie.getName());
|
- |
|
1998 |
root.getSchema().updateVersion();
|
- |
|
1999 |
}
|
- |
|
2000 |
|
- |
|
2001 |
final SQLTable tableInfosSalarie = root.getTable("INFOS_SALARIE_PAYE");
|
- |
|
2002 |
if (!tableInfosSalarie.contains("DUREE_FORFAIT")) {
|
- |
|
2003 |
final AlterTable alter = new AlterTable(tableInfosSalarie);
|
- |
|
2004 |
alter.addColumn("DUREE_FORFAIT", "real");
|
- |
|
2005 |
exec(alter);
|
- |
|
2006 |
root.refetchTable(tableSalarie.getName());
|
- |
|
2007 |
root.getSchema().updateVersion();
|
- |
|
2008 |
}
|
- |
|
2009 |
|
- |
|
2010 |
}
|
- |
|
2011 |
|
- |
|
2012 |
public static void initStock(SQLRow rowArticle, int idDepot) {
|
1867 |
|
2013 |
|
1868 |
SQLSelect selStock = new SQLSelect();
|
2014 |
SQLSelect selStock = new SQLSelect();
|
1869 |
selStock.addSelectStar(row.getTable().getTable("STOCK"));
|
2015 |
selStock.addSelectStar(rowArticle.getTable().getTable("STOCK"));
|
1870 |
selStock.setWhere(new Where(row.getTable().getTable("STOCK").getField("ID_ARTICLE"), "=", row.getID()));
|
2016 |
selStock.setWhere(new Where(rowArticle.getTable().getTable("STOCK").getField("ID_ARTICLE"), "=", rowArticle.getID()));
|
1871 |
List<SQLRow> rowsStock = SQLRowListRSH.execute(selStock);
|
2017 |
List<SQLRow> rowsStock = SQLRowListRSH.execute(selStock);
|
1872 |
Map<Integer, SQLRow> initedDepot = new HashMap<>();
|
2018 |
Map<Integer, SQLRow> initedDepot = new HashMap<>();
|
1873 |
for (SQLRow sqlRow : rowsStock) {
|
2019 |
for (SQLRow sqlRow : rowsStock) {
|
1874 |
initedDepot.put(sqlRow.getForeignID("ID_DEPOT_STOCK"), sqlRow);
|
2020 |
initedDepot.put(sqlRow.getForeignID("ID_DEPOT_STOCK"), sqlRow);
|
1875 |
}
|
2021 |
}
|
1876 |
|
2022 |
|
1877 |
List<StockItem> stockItems = new ArrayList<StockItem>();
|
2023 |
List<StockItem> stockItems = new ArrayList<StockItem>();
|
1878 |
for (SQLRow sqlRow : rowsDepot) {
|
- |
|
1879 |
try {
|
2024 |
try {
|
1880 |
if (!initedDepot.keySet().contains(sqlRow.getID())) {
|
2025 |
if (!initedDepot.keySet().contains(idDepot)) {
|
1881 |
SQLRowValues rowVals = new SQLRowValues(row.getTable().getTable("STOCK"));
|
2026 |
SQLRowValues rowVals = new SQLRowValues(rowArticle.getTable().getTable("STOCK"));
|
1882 |
rowVals.put("ID_ARTICLE", row.getID());
|
2027 |
rowVals.put("ID_ARTICLE", rowArticle.getID());
|
1883 |
rowVals.put("ID_DEPOT_STOCK", sqlRow.getID());
|
2028 |
rowVals.put("ID_DEPOT_STOCK", idDepot);
|
1884 |
|
2029 |
|
1885 |
SQLRow rowStock = rowVals.commit();
|
2030 |
SQLRow rowStock = rowVals.commit();
|
1886 |
if ((row.getObject("ID_DEPOT_STOCK") == null || row.isForeignEmpty("ID_DEPOT_STOCK")) && sqlRow.getID() == DepotStockSQLElement.DEFAULT_ID) {
|
2031 |
if ((rowArticle.getObject("ID_DEPOT_STOCK") == null || rowArticle.isForeignEmpty("ID_DEPOT_STOCK")) && idDepot == DepotStockSQLElement.DEFAULT_ID) {
|
1887 |
row.createEmptyUpdateRow().put("ID_STOCK", rowStock.getID()).put("ID_DEPOT_STOCK", DepotStockSQLElement.DEFAULT_ID).commit();
|
2032 |
rowArticle.createEmptyUpdateRow().put("ID_STOCK", rowStock.getID()).put("ID_DEPOT_STOCK", DepotStockSQLElement.DEFAULT_ID).commit();
|
1888 |
} else if (sqlRow.getID() == row.getForeignID("ID_DEPOT_STOCK")) {
|
2033 |
} else if (idDepot == rowArticle.getForeignID("ID_DEPOT_STOCK")) {
|
1889 |
row.createEmptyUpdateRow().put("ID_STOCK", rowStock.getID()).commit();
|
2034 |
rowArticle.createEmptyUpdateRow().put("ID_STOCK", rowStock.getID()).commit();
|
1890 |
}
|
2035 |
}
|
1891 |
stockItems.add(new StockItem(row, rowStock));
|
2036 |
stockItems.add(new StockItem(rowArticle, rowStock));
|
1892 |
|
2037 |
|
1893 |
} else {
|
2038 |
} else {
|
1894 |
SQLRow rowExisting = initedDepot.get(sqlRow.getID());
|
2039 |
SQLRow rowExisting = initedDepot.get(idDepot);
|
1895 |
if ((row.getObject("ID_DEPOT_STOCK") == null || row.isForeignEmpty("ID_DEPOT_STOCK")) && sqlRow.getID() == DepotStockSQLElement.DEFAULT_ID) {
|
2040 |
if ((rowArticle.getObject("ID_DEPOT_STOCK") == null || rowArticle.isForeignEmpty("ID_DEPOT_STOCK")) && idDepot == DepotStockSQLElement.DEFAULT_ID) {
|
1896 |
row.createEmptyUpdateRow().put("ID_STOCK", rowExisting.getID()).put("ID_DEPOT_STOCK", DepotStockSQLElement.DEFAULT_ID).commit();
|
2041 |
rowArticle.createEmptyUpdateRow().put("ID_STOCK", rowExisting.getID()).put("ID_DEPOT_STOCK", DepotStockSQLElement.DEFAULT_ID).commit();
|
1897 |
} else if (sqlRow.getID() == row.getForeignID("ID_DEPOT_STOCK")) {
|
2042 |
} else if (idDepot == rowArticle.getForeignID("ID_DEPOT_STOCK")) {
|
1898 |
row.createEmptyUpdateRow().put("ID_STOCK", rowExisting.getID()).commit();
|
2043 |
rowArticle.createEmptyUpdateRow().put("ID_STOCK", rowExisting.getID()).commit();
|
1899 |
}
|
2044 |
}
|
1900 |
stockItems.add(new StockItem(row, rowExisting));
|
2045 |
stockItems.add(new StockItem(rowArticle, rowExisting));
|
1901 |
}
|
2046 |
}
|
1902 |
} catch (SQLException e) {
|
2047 |
} catch (SQLException e) {
|
1903 |
ExceptionHandler.handle("Erreur lors de l'initialisation du stock de l'article", e);
|
2048 |
ExceptionHandler.handle("Erreur lors de l'initialisation du stock de l'article", e);
|
1904 |
}
|
2049 |
}
|
- |
|
2050 |
|
- |
|
2051 |
if (rowArticle.getReferentRows(rowArticle.getTable().getTable("ARTICLE_ELEMENT").getField("ID_ARTICLE_PARENT")).size() > 0) {
|
- |
|
2052 |
ComposedItemStockUpdater up = new ComposedItemStockUpdater(rowArticle.getTable().getDBRoot(), stockItems);
|
- |
|
2053 |
try {
|
- |
|
2054 |
up.updateNomenclature(stockItems);
|
- |
|
2055 |
} catch (SQLException e) {
|
- |
|
2056 |
ExceptionHandler.handle("Erreur lors de l'actualisation du stock!", e);
|
- |
|
2057 |
}
|
- |
|
2058 |
}
|
- |
|
2059 |
}
|
- |
|
2060 |
|
- |
|
2061 |
public static void initStock(SQLRow row) {
|
- |
|
2062 |
int foreignID = DepotStockSQLElement.DEFAULT_ID;
|
- |
|
2063 |
if (row.getObject("ID_DEPOT_STOCK") != null && !row.isForeignEmpty("ID_DEPOT_STOCK")) {
|
- |
|
2064 |
foreignID = row.getForeignID("ID_DEPOT_STOCK");
|
1905 |
}
|
2065 |
}
|
1906 |
// if
|
- |
|
1907 |
// (row.getReferentRows(row.getTable().getTable("ARTICLE_ELEMENT").getField("ID_ARTICLE_PARENT")).size()
|
- |
|
1908 |
// > 0) {
|
- |
|
1909 |
// ComposedItemStockUpdater up = new ComposedItemStockUpdater(row.getTable().getDBRoot(),
|
- |
|
1910 |
// stockItems);
|
2066 |
initStock(row, foreignID);
|
1911 |
// try {
|
- |
|
1912 |
// up.updateNomenclature(stockItems);
|
- |
|
1913 |
// } catch (SQLException e) {
|
- |
|
1914 |
// ExceptionHandler.handle("Erreur lors de l'actualisation du stock!", e);
|
- |
|
1915 |
// }
|
- |
|
1916 |
// }
|
- |
|
1917 |
}
|
2067 |
}
|
1918 |
|
2068 |
|
1919 |
public static void exec(final AlterTable alter) throws SQLException {
|
2069 |
public static void exec(final AlterTable alter) throws SQLException {
|
1920 |
alter.getTable().getDBSystemRoot().getDataSource().execute(alter.asString());
|
2070 |
alter.getTable().getDBSystemRoot().getDataSource().execute(alter.asString());
|
1921 |
alter.getTable().getSchema().updateVersion();
|
2071 |
alter.getTable().getSchema().updateVersion();
|