Merge branch 'Verze_1.0' of https://git.bukova.info/repos/git/isspst into Verze_1.0
This commit is contained in:
@@ -30,7 +30,7 @@ import java.util.Map;
|
|||||||
|
|
||||||
public class Constants {
|
public class Constants {
|
||||||
|
|
||||||
public final static long DB_VERSION = 1;
|
public final static long DB_VERSION = 2;
|
||||||
|
|
||||||
public final static String DEF_ADMIN = "admin";
|
public final static String DEF_ADMIN = "admin";
|
||||||
public final static String DEF_ADMIN_PASSWD = "admin";
|
public final static String DEF_ADMIN_PASSWD = "admin";
|
||||||
|
|||||||
@@ -20,6 +20,9 @@ public class MUnitEmb
|
|||||||
|
|
||||||
public MUnitEmb()
|
public MUnitEmb()
|
||||||
{
|
{
|
||||||
|
// Embeddable object is loaded by hibernate like NULL, if all properties
|
||||||
|
// are NULL. So, we set ID.
|
||||||
|
this.id = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MUnitEmb(MUnit munit)
|
public MUnitEmb(MUnit munit)
|
||||||
|
|||||||
@@ -64,9 +64,13 @@ public class DbInfoServiceImpl extends AbstractService<DbInfo> implements DbInfo
|
|||||||
|
|
||||||
if (Constants.DB_VERSION > dbVersion)
|
if (Constants.DB_VERSION > dbVersion)
|
||||||
{
|
{
|
||||||
|
SQLQuery sq = null;
|
||||||
|
String sql = "";
|
||||||
|
|
||||||
if (dbVersion < 1)
|
if (dbVersion < 1)
|
||||||
{
|
{
|
||||||
List<Str2Str> tables = new ArrayList<Str2Str>();
|
List<Str2Str> tables = new ArrayList<Str2Str>();
|
||||||
|
|
||||||
tables.add(new Str2Str("address", "DESCRIPTION"));
|
tables.add(new Str2Str("address", "DESCRIPTION"));
|
||||||
tables.add(new Str2Str("building", "DESCRIPTION"));
|
tables.add(new Str2Str("building", "DESCRIPTION"));
|
||||||
tables.add(new Str2Str("material", "DESCRIPTION"));
|
tables.add(new Str2Str("material", "DESCRIPTION"));
|
||||||
@@ -90,9 +94,6 @@ public class DbInfoServiceImpl extends AbstractService<DbInfo> implements DbInfo
|
|||||||
tables.add(new Str2Str("triprequirement", "VEHICLE_DESCRIPTION"));
|
tables.add(new Str2Str("triprequirement", "VEHICLE_DESCRIPTION"));
|
||||||
tables.add(new Str2Str("trip_bill_items", "BACK_VEHICLE_DESCRIPTION"));
|
tables.add(new Str2Str("trip_bill_items", "BACK_VEHICLE_DESCRIPTION"));
|
||||||
tables.add(new Str2Str("trip_bill_items", "VEHICLE_DESCRIPTION"));
|
tables.add(new Str2Str("trip_bill_items", "VEHICLE_DESCRIPTION"));
|
||||||
|
|
||||||
SQLQuery sq = null;
|
|
||||||
String sql = "";
|
|
||||||
|
|
||||||
for (Str2Str item : tables)
|
for (Str2Str item : tables)
|
||||||
{
|
{
|
||||||
@@ -102,6 +103,22 @@ public class DbInfoServiceImpl extends AbstractService<DbInfo> implements DbInfo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (dbVersion < 2)
|
||||||
|
{
|
||||||
|
List<String> tables = new ArrayList<String>();
|
||||||
|
|
||||||
|
tables.add("material");
|
||||||
|
tables.add("order_item");
|
||||||
|
tables.add("requirement_items");
|
||||||
|
|
||||||
|
for (String item : tables)
|
||||||
|
{
|
||||||
|
sql = "UPDATE " + item + " SET MUNIT_ID = 0 WHERE (MUNIT_ID Is NULL) ";
|
||||||
|
sq = this.dao.getSession().createSQLQuery(sql);
|
||||||
|
sq.executeUpdate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this.updateDatabaseVersion();
|
this.updateDatabaseVersion();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -183,7 +183,14 @@ public class RequirementForm extends FormViewModel<Requirement>
|
|||||||
if (isMaterial)
|
if (isMaterial)
|
||||||
{
|
{
|
||||||
Material materialItem = (Material) selected;
|
Material materialItem = (Material) selected;
|
||||||
item.setMunit(materialItem.getMunit());
|
MUnitEmb unit = materialItem.getMunit();
|
||||||
|
|
||||||
|
// if (unit == null)
|
||||||
|
// {
|
||||||
|
// unit = new MUnitEmb();
|
||||||
|
// }
|
||||||
|
|
||||||
|
item.setMunit(unit);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.setSelectedItem(item);
|
this.setSelectedItem(item);
|
||||||
|
|||||||
Reference in New Issue
Block a user