Compare commits
1 Commits
1.0
..
multitenant
| Author | SHA1 | Date | |
|---|---|---|---|
| 885e20a400 |
@@ -202,6 +202,12 @@
|
|||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- DB -->
|
<!-- DB -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>postgresql</groupId>
|
||||||
|
<artifactId>postgresql</artifactId>
|
||||||
|
<version>9.1-901-1.jdbc4</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>mysql</groupId>
|
<groupId>mysql</groupId>
|
||||||
<artifactId>mysql-connector-java</artifactId>
|
<artifactId>mysql-connector-java</artifactId>
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ public class AppInitListener implements ServletContextListener {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void contextInitialized(ServletContextEvent evt) {
|
public void contextInitialized(ServletContextEvent evt) {
|
||||||
Logger logger = LoggerFactory.getLogger(AppInitListener.class);
|
/*Logger logger = LoggerFactory.getLogger(AppInitListener.class);
|
||||||
logger.info("Initializing database");
|
logger.info("Initializing database");
|
||||||
|
|
||||||
WebApplicationContext ctx = WebApplicationContextUtils.getRequiredWebApplicationContext(evt.getServletContext());
|
WebApplicationContext ctx = WebApplicationContextUtils.getRequiredWebApplicationContext(evt.getServletContext());
|
||||||
@@ -71,7 +71,7 @@ public class AppInitListener implements ServletContextListener {
|
|||||||
this.checkGlobalSettings();
|
this.checkGlobalSettings();
|
||||||
userService.removeAccess();
|
userService.removeAccess();
|
||||||
|
|
||||||
loadModuleReports();
|
loadModuleReports();*/
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkMUnits()
|
private void checkMUnits()
|
||||||
|
|||||||
@@ -1,13 +0,0 @@
|
|||||||
package info.bukova.isspst;
|
|
||||||
|
|
||||||
|
|
||||||
public class BooleanUtils
|
|
||||||
{
|
|
||||||
public static boolean isEqualByBoolean(Boolean b1, Boolean b2)
|
|
||||||
{
|
|
||||||
boolean bool1 = ((b1 == null) ? false : b1.booleanValue());
|
|
||||||
boolean bool2 = ((b2 == null) ? false : b2.booleanValue());
|
|
||||||
boolean equals = (bool1 == bool2);
|
|
||||||
return equals;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,78 @@
|
|||||||
|
package info.bukova.isspst;
|
||||||
|
|
||||||
|
import java.sql.Connection;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
|
||||||
|
import javax.sql.DataSource;
|
||||||
|
|
||||||
|
import org.hibernate.HibernateException;
|
||||||
|
import org.hibernate.service.UnknownUnwrapTypeException;
|
||||||
|
import org.hibernate.service.jdbc.connections.spi.ConnectionProvider;
|
||||||
|
import org.hibernate.service.jdbc.connections.spi.MultiTenantConnectionProvider;
|
||||||
|
|
||||||
|
public class ClientConnectionPrivider implements MultiTenantConnectionProvider {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private static final long serialVersionUID = 2142963179208004018L;
|
||||||
|
|
||||||
|
private DataSource dataSource;
|
||||||
|
|
||||||
|
public ClientConnectionPrivider(DataSource dataSource) {
|
||||||
|
this.dataSource = dataSource;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("rawtypes")
|
||||||
|
@Override
|
||||||
|
public boolean isUnwrappableAs(Class unwrapType) {
|
||||||
|
return ConnectionProvider.class.equals( unwrapType ) || MultiTenantConnectionProvider.class.equals( unwrapType ) || ClientConnectionPrivider.class.isAssignableFrom( unwrapType );
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
@Override
|
||||||
|
public <T> T unwrap(Class<T> unwrapType) {
|
||||||
|
if ( isUnwrappableAs( unwrapType ) ) {
|
||||||
|
return (T) this;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
throw new UnknownUnwrapTypeException( unwrapType );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Connection getAnyConnection() throws SQLException {
|
||||||
|
return dataSource.getConnection();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void releaseAnyConnection(Connection connection) throws SQLException {
|
||||||
|
connection.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Connection getConnection(String tenantIdentifier)
|
||||||
|
throws SQLException {
|
||||||
|
|
||||||
|
Connection con = getAnyConnection();
|
||||||
|
try {
|
||||||
|
con.createStatement().execute("SET schema '" + tenantIdentifier + "'");
|
||||||
|
} catch ( SQLException e ) {
|
||||||
|
throw new HibernateException("Could not alter JDBC connection to specified schema [" + tenantIdentifier + "]", e);
|
||||||
|
}
|
||||||
|
|
||||||
|
return con;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void releaseConnection(String tenantIdentifier, Connection connection)
|
||||||
|
throws SQLException {
|
||||||
|
releaseAnyConnection(connection);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean supportsAggressiveRelease() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
package info.bukova.isspst;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
|
import org.hibernate.context.spi.CurrentTenantIdentifierResolver;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
||||||
|
public class ClientResolver implements CurrentTenantIdentifierResolver {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private HttpServletRequest request;
|
||||||
|
private static final String TOP_DOMAIN = "localhost"; // Bude se tahat z konfigurace...
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String resolveCurrentTenantIdentifier() {
|
||||||
|
String hostName = request.getServerName();
|
||||||
|
String tenant = "";
|
||||||
|
|
||||||
|
if (hostName.contains(".")) {
|
||||||
|
tenant = hostName.substring(0, hostName.indexOf("." + TOP_DOMAIN));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (tenant.isEmpty()) {
|
||||||
|
tenant = "public";
|
||||||
|
}
|
||||||
|
|
||||||
|
return tenant;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean validateExistingCurrentSessions() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,39 +0,0 @@
|
|||||||
package info.bukova.isspst;
|
|
||||||
|
|
||||||
import info.bukova.isspst.data.DataModel;
|
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
|
|
||||||
public class CommonUrlResolver implements EntityUrlResolver {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private HttpServletRequest request;
|
|
||||||
protected String defaultUrl;
|
|
||||||
|
|
||||||
public CommonUrlResolver() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String entityUrl(Object entity) {
|
|
||||||
if (defaultUrl == null) {
|
|
||||||
this.defaultUrl = request.getRequestURL().toString();
|
|
||||||
this.defaultUrl = defaultUrl.substring(0, defaultUrl.indexOf(request.getServletPath()));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!DataModel.class.isAssignableFrom(entity.getClass())) {
|
|
||||||
return defaultUrl + "/app";
|
|
||||||
}
|
|
||||||
|
|
||||||
String url = Constants.URL_MAP.get(entity.getClass());
|
|
||||||
|
|
||||||
if (url == null) {
|
|
||||||
return defaultUrl + "/app";
|
|
||||||
}
|
|
||||||
|
|
||||||
return defaultUrl + url + "?select=" + String.valueOf(((DataModel)entity).getId());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,23 +1,16 @@
|
|||||||
package info.bukova.isspst;
|
package info.bukova.isspst;
|
||||||
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import info.bukova.isspst.data.Permission;
|
import info.bukova.isspst.data.Permission;
|
||||||
import info.bukova.isspst.data.PermissionType;
|
import info.bukova.isspst.data.PermissionType;
|
||||||
import info.bukova.isspst.data.Requirement;
|
|
||||||
import info.bukova.isspst.data.RequirementType;
|
import info.bukova.isspst.data.RequirementType;
|
||||||
import info.bukova.isspst.data.Role;
|
import info.bukova.isspst.data.Role;
|
||||||
import info.bukova.isspst.data.TripRequirement;
|
|
||||||
import info.bukova.isspst.reporting.Report;
|
import info.bukova.isspst.reporting.Report;
|
||||||
import info.bukova.isspst.reporting.ReportMapping;
|
import info.bukova.isspst.reporting.ReportMapping;
|
||||||
import info.bukova.isspst.services.addressbook.AdbService;
|
import info.bukova.isspst.services.addressbook.AdbService;
|
||||||
|
import info.bukova.isspst.services.approved.ApprovedService;
|
||||||
|
import info.bukova.isspst.services.approved.OrderService;
|
||||||
import info.bukova.isspst.services.buildings.BuildingService;
|
import info.bukova.isspst.services.buildings.BuildingService;
|
||||||
import info.bukova.isspst.services.invoicing.InvoicingService;
|
|
||||||
import info.bukova.isspst.services.munits.MUnitService;
|
import info.bukova.isspst.services.munits.MUnitService;
|
||||||
import info.bukova.isspst.services.orders.ApprovedService;
|
|
||||||
import info.bukova.isspst.services.orders.OrderService;
|
|
||||||
import info.bukova.isspst.services.reqsubjects.MaterialService;
|
import info.bukova.isspst.services.reqsubjects.MaterialService;
|
||||||
import info.bukova.isspst.services.reqsubjects.ServiceItemService;
|
import info.bukova.isspst.services.reqsubjects.ServiceItemService;
|
||||||
import info.bukova.isspst.services.requirement.RequirementService;
|
import info.bukova.isspst.services.requirement.RequirementService;
|
||||||
@@ -78,7 +71,6 @@ public class Constants {
|
|||||||
public final static String MOD_TRIPBILL = "TRIPBILL";
|
public final static String MOD_TRIPBILL = "TRIPBILL";
|
||||||
public final static String MOD_APPROVED = "APPROVED";
|
public final static String MOD_APPROVED = "APPROVED";
|
||||||
public final static String MOD_ORDER = "ORDER";
|
public final static String MOD_ORDER = "ORDER";
|
||||||
public final static String MOD_INVOICING = "INVOICING";
|
|
||||||
public final static Module MODULES[] = {
|
public final static Module MODULES[] = {
|
||||||
new Module(MOD_USERS, "Uživatelé", UserService.class),
|
new Module(MOD_USERS, "Uživatelé", UserService.class),
|
||||||
new Module(MOD_PERMISSIONS, "Práva", RoleService.class),
|
new Module(MOD_PERMISSIONS, "Práva", RoleService.class),
|
||||||
@@ -93,8 +85,7 @@ public class Constants {
|
|||||||
new Module(MOD_WORKFLOW, "Procesy schválení", RequirementTypeService.class),
|
new Module(MOD_WORKFLOW, "Procesy schválení", RequirementTypeService.class),
|
||||||
new Module(MOD_TRIPBILL, "Cestovní příkazy", TripBillService.class),
|
new Module(MOD_TRIPBILL, "Cestovní příkazy", TripBillService.class),
|
||||||
new Module(MOD_APPROVED, "Schválené položky požadavků", ApprovedService.class),
|
new Module(MOD_APPROVED, "Schválené položky požadavků", ApprovedService.class),
|
||||||
new Module(MOD_ORDER, "Objednávky", OrderService.class),
|
new Module(MOD_ORDER, "Objednávky", OrderService.class) };
|
||||||
new Module(MOD_INVOICING, "Fakturace požadavků", InvoicingService.class) };
|
|
||||||
|
|
||||||
public final static String PERM_APPROVE = "PERM_APPROVE";
|
public final static String PERM_APPROVE = "PERM_APPROVE";
|
||||||
public final static String PERM_SHOW_WORKGROUP_REQ = "PERM_SHOW_WORKGROUP_REQ";
|
public final static String PERM_SHOW_WORKGROUP_REQ = "PERM_SHOW_WORKGROUP_REQ";
|
||||||
@@ -135,10 +126,4 @@ public class Constants {
|
|||||||
|
|
||||||
public final static long REQ_TYPE_MATERIAL = 1;
|
public final static long REQ_TYPE_MATERIAL = 1;
|
||||||
public final static long REQ_TYPE_SERVICES = 2;
|
public final static long REQ_TYPE_SERVICES = 2;
|
||||||
|
|
||||||
@SuppressWarnings("serial")
|
|
||||||
public final static Map<Class<?>, String> URL_MAP = Collections.unmodifiableMap(new HashMap<Class<?>, String>() {{
|
|
||||||
put(Requirement.class, "/main/orders/");
|
|
||||||
put(TripRequirement.class, "/main/trips/requirements/");
|
|
||||||
}} );
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +0,0 @@
|
|||||||
package info.bukova.isspst;
|
|
||||||
|
|
||||||
public interface EntityUrlResolver {
|
|
||||||
|
|
||||||
public String entityUrl(Object entity);
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,39 +0,0 @@
|
|||||||
package info.bukova.isspst;
|
|
||||||
|
|
||||||
import info.bukova.isspst.data.Requirement;
|
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
|
|
||||||
public class RequirementUrlResolver implements EntityUrlResolver {
|
|
||||||
|
|
||||||
private String defaultUrl;
|
|
||||||
@Autowired
|
|
||||||
private HttpServletRequest request;
|
|
||||||
|
|
||||||
public RequirementUrlResolver() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String entityUrl(Object entity) {
|
|
||||||
if (!(entity instanceof Requirement)) {
|
|
||||||
return defaultUrl + "/app";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (defaultUrl == null) {
|
|
||||||
this.defaultUrl = request.getRequestURL().toString();
|
|
||||||
this.defaultUrl = defaultUrl.substring(0, defaultUrl.indexOf(request.getServletPath()));
|
|
||||||
}
|
|
||||||
|
|
||||||
Requirement req = (Requirement)entity;
|
|
||||||
|
|
||||||
if (req.getKind() == Constants.REQ_TYPE_MATERIAL) {
|
|
||||||
return defaultUrl + Constants.URL_MAP.get(req) + "material/?select=" + String.valueOf(req.getId());
|
|
||||||
} else {
|
|
||||||
return defaultUrl + Constants.URL_MAP.get(req) + "services/?select=" + String.valueOf(req.getId());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -7,12 +7,12 @@ import org.zkoss.util.resource.Labels;
|
|||||||
public class StringUtils
|
public class StringUtils
|
||||||
{
|
{
|
||||||
|
|
||||||
public static String nullToEmptyString(String str)
|
private static String nullStr(String str)
|
||||||
{
|
{
|
||||||
return str == null ? "" : str;
|
return str == null ? "" : str;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String zeroToEmptyString(long i)
|
private static String not0ToStr(long i)
|
||||||
{
|
{
|
||||||
return i == 0 ? "" : String.valueOf(i);
|
return i == 0 ? "" : String.valueOf(i);
|
||||||
}
|
}
|
||||||
@@ -60,8 +60,8 @@ public class StringUtils
|
|||||||
|
|
||||||
public static boolean isEqualForFilter(String value, String search)
|
public static boolean isEqualForFilter(String value, String search)
|
||||||
{
|
{
|
||||||
value = StringUtils.nullToEmptyString(value).toLowerCase();
|
value = StringUtils.nullStr(value).toLowerCase();
|
||||||
search = StringUtils.nullToEmptyString(search).toLowerCase();
|
search = StringUtils.nullStr(search).toLowerCase();
|
||||||
|
|
||||||
if (search.isEmpty())
|
if (search.isEmpty())
|
||||||
{
|
{
|
||||||
@@ -73,8 +73,8 @@ public class StringUtils
|
|||||||
|
|
||||||
public static boolean isIcEqualForFilter(long value, long search)
|
public static boolean isIcEqualForFilter(long value, long search)
|
||||||
{
|
{
|
||||||
String compareValue = StringUtils.zeroToEmptyString(value);
|
String compareValue = StringUtils.not0ToStr(value);
|
||||||
String searchValue = StringUtils.zeroToEmptyString(search);
|
String searchValue = StringUtils.not0ToStr(search);
|
||||||
return compareValue.startsWith(searchValue);
|
return compareValue.startsWith(searchValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -124,7 +124,7 @@ public class StringUtils
|
|||||||
|
|
||||||
for (int i = 0; i < list.size(); i++)
|
for (int i = 0; i < list.size(); i++)
|
||||||
{
|
{
|
||||||
String item = StringUtils.nullToEmptyString(list.get(i));
|
String item = StringUtils.nullStr(list.get(i));
|
||||||
result = StringUtils.addSeparator(result, separator);
|
result = StringUtils.addSeparator(result, separator);
|
||||||
result += item;
|
result += item;
|
||||||
}
|
}
|
||||||
@@ -138,7 +138,7 @@ public class StringUtils
|
|||||||
|
|
||||||
for (int i = 0; i < list.size(); i++)
|
for (int i = 0; i < list.size(); i++)
|
||||||
{
|
{
|
||||||
String item = StringUtils.nullToEmptyString(list.get(i));
|
String item = StringUtils.nullStr(list.get(i));
|
||||||
|
|
||||||
if (!item.isEmpty())
|
if (!item.isEmpty())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,30 +0,0 @@
|
|||||||
package info.bukova.isspst;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
public class UrlResolverHolder {
|
|
||||||
|
|
||||||
private EntityUrlResolver commonResolver;
|
|
||||||
private Map<Class<?>, EntityUrlResolver> resolvers;
|
|
||||||
|
|
||||||
public UrlResolverHolder(EntityUrlResolver common) {
|
|
||||||
this.commonResolver = common;
|
|
||||||
resolvers = new HashMap<Class<?>, EntityUrlResolver>();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setResolvers(Map<Class<?>, EntityUrlResolver> resolvers) {
|
|
||||||
this.resolvers = resolvers;
|
|
||||||
}
|
|
||||||
|
|
||||||
public EntityUrlResolver resolverFor(Class<?> clazz) {
|
|
||||||
EntityUrlResolver res = resolvers.get(clazz);
|
|
||||||
|
|
||||||
if (res == null) {
|
|
||||||
return commonResolver;
|
|
||||||
}
|
|
||||||
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
package info.bukova.isspst.dao;
|
|
||||||
|
|
||||||
import info.bukova.isspst.data.Invoicing;
|
|
||||||
|
|
||||||
public interface InvoicingDao extends BaseDao<Invoicing> {
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
package info.bukova.isspst.dao;
|
|
||||||
|
|
||||||
import info.bukova.isspst.data.RequirementItem;
|
|
||||||
|
|
||||||
public interface RequirementItemDao extends BaseDao<RequirementItem>
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
package info.bukova.isspst.dao.jpa;
|
|
||||||
|
|
||||||
import info.bukova.isspst.dao.InvoicingDao;
|
|
||||||
import info.bukova.isspst.data.Invoicing;
|
|
||||||
|
|
||||||
public class InvoicingDaoJPA extends BaseDaoJPA<Invoicing> implements InvoicingDao {
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
package info.bukova.isspst.dao.jpa;
|
|
||||||
|
|
||||||
import info.bukova.isspst.dao.RequirementItemDao;
|
|
||||||
import info.bukova.isspst.data.RequirementItem;
|
|
||||||
|
|
||||||
public class RequirementItemDaoJPA extends BaseDaoJPA<RequirementItem> implements RequirementItemDao
|
|
||||||
{
|
|
||||||
}
|
|
||||||
@@ -1,58 +0,0 @@
|
|||||||
package info.bukova.isspst.data;
|
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import javax.persistence.CascadeType;
|
|
||||||
import javax.persistence.Column;
|
|
||||||
import javax.persistence.Entity;
|
|
||||||
import javax.persistence.FetchType;
|
|
||||||
import javax.persistence.JoinColumn;
|
|
||||||
import javax.persistence.OneToMany;
|
|
||||||
import javax.persistence.OneToOne;
|
|
||||||
import javax.persistence.Table;
|
|
||||||
|
|
||||||
import org.hibernate.annotations.LazyCollection;
|
|
||||||
import org.hibernate.annotations.LazyCollectionOption;
|
|
||||||
|
|
||||||
@Entity
|
|
||||||
@Table(name = "INVOICING")
|
|
||||||
public class Invoicing extends BaseData {
|
|
||||||
|
|
||||||
@OneToOne(fetch = FetchType.EAGER, cascade = CascadeType.ALL)
|
|
||||||
@JoinColumn(name = "REQUIREMENT_ID")
|
|
||||||
private Requirement requirement;
|
|
||||||
|
|
||||||
@OneToMany(cascade = CascadeType.ALL, orphanRemoval = true)
|
|
||||||
@LazyCollection(LazyCollectionOption.TRUE)
|
|
||||||
@JoinColumn(name = "INVOICING_ID")
|
|
||||||
private List<InvoicingItem> items;
|
|
||||||
|
|
||||||
@Column(name = "TOTAL_INVOICED", precision = 15, scale = 4)
|
|
||||||
private BigDecimal totalInvoiced;
|
|
||||||
|
|
||||||
public Requirement getRequirement() {
|
|
||||||
return requirement;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRequirement(Requirement requirement) {
|
|
||||||
this.requirement = requirement;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<InvoicingItem> getItems() {
|
|
||||||
return items;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setItems(List<InvoicingItem> items) {
|
|
||||||
this.items = items;
|
|
||||||
}
|
|
||||||
|
|
||||||
public BigDecimal getTotalInvoiced() {
|
|
||||||
return totalInvoiced;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTotalInvoiced(BigDecimal totalInvoiced) {
|
|
||||||
this.totalInvoiced = totalInvoiced;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,87 +0,0 @@
|
|||||||
package info.bukova.isspst.data;
|
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
import javax.persistence.Column;
|
|
||||||
import javax.persistence.Entity;
|
|
||||||
import javax.persistence.GeneratedValue;
|
|
||||||
import javax.persistence.Id;
|
|
||||||
import javax.persistence.Table;
|
|
||||||
|
|
||||||
@Entity
|
|
||||||
@Table(name = "INVOICING_ITEM")
|
|
||||||
public class InvoicingItem {
|
|
||||||
|
|
||||||
@Id
|
|
||||||
@Column(name = "ID")
|
|
||||||
@GeneratedValue
|
|
||||||
private int id;
|
|
||||||
|
|
||||||
@Column(name = "INVOICE_DATE")
|
|
||||||
private Date invoiceDate;
|
|
||||||
|
|
||||||
@Column(name = "INVOICE_NUMBER")
|
|
||||||
private String invoiceNumber;
|
|
||||||
|
|
||||||
@Column(name = "AMOUNT", precision = 15, scale = 4)
|
|
||||||
private BigDecimal amount;
|
|
||||||
|
|
||||||
public int getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(int id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Date getInvoiceDate() {
|
|
||||||
return invoiceDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setInvoiceDate(Date invoiceDate) {
|
|
||||||
this.invoiceDate = invoiceDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getInvoiceNumber() {
|
|
||||||
return invoiceNumber;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setInvoiceNumber(String invoiceNumber) {
|
|
||||||
this.invoiceNumber = invoiceNumber;
|
|
||||||
}
|
|
||||||
|
|
||||||
public BigDecimal getAmount() {
|
|
||||||
return amount;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAmount(BigDecimal amount) {
|
|
||||||
this.amount = amount;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object obj)
|
|
||||||
{
|
|
||||||
if (obj != null)
|
|
||||||
{
|
|
||||||
if (obj instanceof InvoicingItem)
|
|
||||||
{
|
|
||||||
InvoicingItem item = (InvoicingItem)obj;
|
|
||||||
|
|
||||||
int thisId = this.getId();
|
|
||||||
int itemId = item.getId();
|
|
||||||
boolean equalsId = (thisId == itemId);
|
|
||||||
|
|
||||||
if (equalsId && (thisId == 0))
|
|
||||||
{
|
|
||||||
return super.equals(obj);
|
|
||||||
}
|
|
||||||
|
|
||||||
return equalsId;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -19,7 +19,7 @@ import org.hibernate.annotations.LazyCollectionOption;
|
|||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "ORDERS")
|
@Table(name = "ORDERS")
|
||||||
public class Order extends BaseData implements Cloneable
|
public class Order extends BaseData
|
||||||
{
|
{
|
||||||
|
|
||||||
@Column(name = "NUMSER")
|
@Column(name = "NUMSER")
|
||||||
@@ -110,10 +110,20 @@ public class Order extends BaseData implements Cloneable
|
|||||||
@Column(name = "DELIVERED")
|
@Column(name = "DELIVERED")
|
||||||
private boolean delivered;
|
private boolean delivered;
|
||||||
|
|
||||||
|
@Column(name = "INVOICED")
|
||||||
|
private boolean invoiced;
|
||||||
|
|
||||||
|
@Column(name = "INVOICE_NUMBER")
|
||||||
|
private String invoiceNumber;
|
||||||
|
|
||||||
|
@Column(name = "INVOICE_TOTAL", precision = 15, scale = 4)
|
||||||
|
private BigDecimal invoiceTotal;
|
||||||
|
|
||||||
public Order()
|
public Order()
|
||||||
{
|
{
|
||||||
this.items = new ArrayList<OrderItem>();
|
this.items = new ArrayList<OrderItem>();
|
||||||
this.total = BigDecimal.ZERO;
|
this.total = BigDecimal.ZERO;
|
||||||
|
this.invoiceTotal = BigDecimal.ZERO;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getNumser()
|
public String getNumser()
|
||||||
@@ -222,6 +232,26 @@ public class Order extends BaseData implements Cloneable
|
|||||||
this.delivered = delivered;
|
this.delivered = delivered;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isInvoiced()
|
||||||
|
{
|
||||||
|
return invoiced;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setInvoiced(boolean invoiced)
|
||||||
|
{
|
||||||
|
this.invoiced = invoiced;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getInvoiceNumber()
|
||||||
|
{
|
||||||
|
return invoiceNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setInvoiceNumber(String invoiceNumber)
|
||||||
|
{
|
||||||
|
this.invoiceNumber = invoiceNumber;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isOrdered()
|
public boolean isOrdered()
|
||||||
{
|
{
|
||||||
return ordered;
|
return ordered;
|
||||||
@@ -252,29 +282,14 @@ public class Order extends BaseData implements Cloneable
|
|||||||
this.total = total;
|
this.total = total;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isIcludedRequirementItemFromAnotherOrder()
|
public BigDecimal getInvoiceTotal()
|
||||||
{
|
{
|
||||||
for (OrderItem oItem : this.getItems())
|
return invoiceTotal;
|
||||||
{
|
|
||||||
RequirementItem rItem = oItem.getReqItem();
|
|
||||||
|
|
||||||
if (rItem != null)
|
|
||||||
{
|
|
||||||
String orderNum = rItem.getOrderNum();
|
|
||||||
boolean isIncluded = ((orderNum != null) && !orderNum.isEmpty());
|
|
||||||
boolean isFromAnotherOrder = (isIncluded && !this.numser.equals(orderNum));
|
|
||||||
return isFromAnotherOrder;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
public void setInvoiceTotal(BigDecimal invoiceTotal)
|
||||||
|
{
|
||||||
|
this.invoiceTotal = invoiceTotal;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Object clone() throws CloneNotSupportedException
|
|
||||||
{
|
|
||||||
Order cloned = (Order) super.clone();
|
|
||||||
cloned.setTotal(new BigDecimal(this.getTotal().toString()));
|
|
||||||
return cloned;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,8 +14,7 @@ import javax.persistence.Table;
|
|||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "ORDER_ITEM")
|
@Table(name = "ORDER_ITEM")
|
||||||
public class OrderItem
|
public class OrderItem {
|
||||||
{
|
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
@Column(name="ID")
|
@Column(name="ID")
|
||||||
@@ -54,13 +53,11 @@ public class OrderItem
|
|||||||
@JoinColumn(name = "ORDER_ID")
|
@JoinColumn(name = "ORDER_ID")
|
||||||
private Order order;
|
private Order order;
|
||||||
|
|
||||||
public OrderItem()
|
public OrderItem() {
|
||||||
{
|
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
public OrderItem(RequirementItem reqItem)
|
public OrderItem(RequirementItem reqItem) {
|
||||||
{
|
|
||||||
super();
|
super();
|
||||||
this.reqItem = reqItem;
|
this.reqItem = reqItem;
|
||||||
this.code = reqItem.getCode();
|
this.code = reqItem.getCode();
|
||||||
@@ -73,113 +70,91 @@ public class OrderItem
|
|||||||
this.description = reqItem.getDescription();
|
this.description = reqItem.getDescription();
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getId()
|
public int getId() {
|
||||||
{
|
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setId(int id)
|
public void setId(int id) {
|
||||||
{
|
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getCode()
|
public String getCode() {
|
||||||
{
|
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCode(String code)
|
public void setCode(String code) {
|
||||||
{
|
|
||||||
this.code = code;
|
this.code = code;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName()
|
public String getName() {
|
||||||
{
|
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setName(String name)
|
public void setName(String name) {
|
||||||
{
|
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getTextItem()
|
public String getTextItem() {
|
||||||
{
|
|
||||||
return textItem;
|
return textItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTextItem(String textItem)
|
public void setTextItem(String textItem) {
|
||||||
{
|
|
||||||
this.textItem = textItem;
|
this.textItem = textItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getQuantity()
|
public BigDecimal getQuantity() {
|
||||||
{
|
|
||||||
return quantity;
|
return quantity;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setQuantity(BigDecimal quantity)
|
public void setQuantity(BigDecimal quantity) {
|
||||||
{
|
|
||||||
this.quantity = quantity;
|
this.quantity = quantity;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MUnitEmb getMunit()
|
public MUnitEmb getMunit() {
|
||||||
{
|
|
||||||
return munit;
|
return munit;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMunit(MUnitEmb munit)
|
public void setMunit(MUnitEmb munit) {
|
||||||
{
|
|
||||||
this.munit = munit;
|
this.munit = munit;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getUnitPrice()
|
public BigDecimal getUnitPrice() {
|
||||||
{
|
|
||||||
return unitPrice;
|
return unitPrice;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUnitPrice(BigDecimal unitPrice)
|
public void setUnitPrice(BigDecimal unitPrice) {
|
||||||
{
|
|
||||||
this.unitPrice = unitPrice;
|
this.unitPrice = unitPrice;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal getTotal()
|
public BigDecimal getTotal() {
|
||||||
{
|
|
||||||
return total;
|
return total;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTotal(BigDecimal total)
|
public void setTotal(BigDecimal total) {
|
||||||
{
|
|
||||||
this.total = total;
|
this.total = total;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDescription()
|
public String getDescription() {
|
||||||
{
|
|
||||||
return description;
|
return description;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDescription(String description)
|
public void setDescription(String description) {
|
||||||
{
|
|
||||||
this.description = description;
|
this.description = description;
|
||||||
}
|
}
|
||||||
|
|
||||||
public RequirementItem getReqItem()
|
public RequirementItem getReqItem() {
|
||||||
{
|
|
||||||
return reqItem;
|
return reqItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setReqItem(RequirementItem reqItem)
|
public void setReqItem(RequirementItem reqItem) {
|
||||||
{
|
|
||||||
this.reqItem = reqItem;
|
this.reqItem = reqItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Order getOrder()
|
public Order getOrder() {
|
||||||
{
|
|
||||||
return order;
|
return order;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setOrder(Order order)
|
public void setOrder(Order order) {
|
||||||
{
|
|
||||||
this.order = order;
|
this.order = order;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ import javax.persistence.Table;
|
|||||||
@Table(name = "REQUIREMENT")
|
@Table(name = "REQUIREMENT")
|
||||||
public class Requirement extends RequirementBase
|
public class Requirement extends RequirementBase
|
||||||
{
|
{
|
||||||
@OneToMany(fetch = FetchType.LAZY, mappedBy = "requirement", cascade = CascadeType.ALL, orphanRemoval = true)
|
@OneToMany(fetch = FetchType.EAGER, mappedBy = "requirement", cascade = CascadeType.ALL, orphanRemoval = true)
|
||||||
private List<RequirementItem> items;
|
private List<RequirementItem> items;
|
||||||
|
|
||||||
@Column(name = "DELIVERYDATE")
|
@Column(name = "DELIVERYDATE")
|
||||||
@@ -28,9 +28,6 @@ public class Requirement extends RequirementBase
|
|||||||
@Column(name = "KIND")
|
@Column(name = "KIND")
|
||||||
private Long kind;
|
private Long kind;
|
||||||
|
|
||||||
@Column(name = "PROJECT")
|
|
||||||
private Boolean project;
|
|
||||||
|
|
||||||
public Requirement()
|
public Requirement()
|
||||||
{
|
{
|
||||||
this.setItems(new ArrayList<RequirementItem>());
|
this.setItems(new ArrayList<RequirementItem>());
|
||||||
@@ -81,39 +78,4 @@ public class Requirement extends RequirementBase
|
|||||||
{
|
{
|
||||||
this.kind = kind;
|
this.kind = kind;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Boolean getProject()
|
|
||||||
{
|
|
||||||
return project;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setProject(Boolean project)
|
|
||||||
{
|
|
||||||
this.project = project;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object obj)
|
|
||||||
{
|
|
||||||
if (obj != null)
|
|
||||||
{
|
|
||||||
if (obj instanceof Requirement)
|
|
||||||
{
|
|
||||||
Requirement item = (Requirement) obj;
|
|
||||||
|
|
||||||
int thisId = this.getId();
|
|
||||||
int itemId = item.getId();
|
|
||||||
boolean equalsId = (thisId == itemId);
|
|
||||||
|
|
||||||
if (equalsId && (thisId == 0))
|
|
||||||
{
|
|
||||||
return super.equals(obj);
|
|
||||||
}
|
|
||||||
|
|
||||||
return equalsId;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -56,12 +56,6 @@ public class RequirementItem
|
|||||||
@Column(name = "DELIVERED")
|
@Column(name = "DELIVERED")
|
||||||
private Boolean delivered;
|
private Boolean delivered;
|
||||||
|
|
||||||
@Column(name = "ORDERNUM")
|
|
||||||
private String orderNum;
|
|
||||||
|
|
||||||
@Column(name = "PAID")
|
|
||||||
private Boolean paid;
|
|
||||||
|
|
||||||
public int getId()
|
public int getId()
|
||||||
{
|
{
|
||||||
return id;
|
return id;
|
||||||
@@ -169,22 +163,7 @@ public class RequirementItem
|
|||||||
{
|
{
|
||||||
RequirementItem item = (RequirementItem)obj;
|
RequirementItem item = (RequirementItem)obj;
|
||||||
|
|
||||||
int thisId = this.getId();
|
return (this.getId() == item.getId());
|
||||||
int itemId = item.getId();
|
|
||||||
boolean equalsId = (thisId == itemId);
|
|
||||||
|
|
||||||
if (equalsId && (thisId == 0))
|
|
||||||
{
|
|
||||||
// Při zadávání položek do gridu zatím nové položky nemají
|
|
||||||
// přiřazeno ID, takže se rozlišují podle reference
|
|
||||||
// Při hledání položky v seznamu nebo zjišťování indexu pak
|
|
||||||
// byly veškeré položky s ID = 0 a grid nevybíral aktivní
|
|
||||||
// položku správně, stejně tak nepřekresloval ani scrollbar
|
|
||||||
// a pod.
|
|
||||||
return super.equals(obj);
|
|
||||||
}
|
|
||||||
|
|
||||||
return equalsId;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -208,22 +187,4 @@ public class RequirementItem
|
|||||||
public void setDelivered(Boolean delivered) {
|
public void setDelivered(Boolean delivered) {
|
||||||
this.delivered = delivered;
|
this.delivered = delivered;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getOrderNum()
|
|
||||||
{
|
|
||||||
return orderNum;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setOrderNum(String orderNum)
|
|
||||||
{
|
|
||||||
this.orderNum = orderNum;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Boolean getPaid() {
|
|
||||||
return paid;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPaid(Boolean paid) {
|
|
||||||
this.paid = paid;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ public abstract class RequirementSubject implements OwnedDataModel {
|
|||||||
@Column(name = "DESCRIPTION")
|
@Column(name = "DESCRIPTION")
|
||||||
private String description;
|
private String description;
|
||||||
|
|
||||||
|
|
||||||
@NotEmpty(message = "{MaterialFormCodeConstr}")
|
@NotEmpty(message = "{MaterialFormCodeConstr}")
|
||||||
public String getCode() {
|
public String getCode() {
|
||||||
return code;
|
return code;
|
||||||
@@ -139,16 +140,7 @@ public abstract class RequirementSubject implements OwnedDataModel {
|
|||||||
{
|
{
|
||||||
RequirementSubject item = (RequirementSubject) obj;
|
RequirementSubject item = (RequirementSubject) obj;
|
||||||
|
|
||||||
int thisId = this.getId();
|
return (this.getId() == item.getId());
|
||||||
int itemId = item.getId();
|
|
||||||
boolean equalsId = (thisId == itemId);
|
|
||||||
|
|
||||||
if (equalsId && (thisId == 0))
|
|
||||||
{
|
|
||||||
return super.equals(obj);
|
|
||||||
}
|
|
||||||
|
|
||||||
return equalsId;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ public class TripRequirement extends RequirementBase {
|
|||||||
private String to;
|
private String to;
|
||||||
@Column(name = "TRIP_DATE")
|
@Column(name = "TRIP_DATE")
|
||||||
private Date tripDate;
|
private Date tripDate;
|
||||||
@Column(name = "END")
|
@Column(name = "TRIP_END")
|
||||||
private String end;
|
private String end;
|
||||||
@Column(name = "END_DATE")
|
@Column(name = "END_DATE")
|
||||||
private Date endDate;
|
private Date endDate;
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ import javax.persistence.Table;
|
|||||||
import org.springframework.security.core.userdetails.UserDetails;
|
import org.springframework.security.core.userdetails.UserDetails;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name="USER")
|
@Table(name="USER_LOGIN")
|
||||||
public class User extends Member implements UserDetails, DataModel {
|
public class User extends Member implements UserDetails, DataModel {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,74 +0,0 @@
|
|||||||
package info.bukova.isspst.filters;
|
|
||||||
|
|
||||||
import info.bukova.isspst.DateTimeUtils;
|
|
||||||
import info.bukova.isspst.StringUtils;
|
|
||||||
import info.bukova.isspst.data.Invoicing;
|
|
||||||
import info.bukova.isspst.data.Requirement;
|
|
||||||
import info.bukova.isspst.data.Workgroup;
|
|
||||||
|
|
||||||
import org.hamcrest.Description;
|
|
||||||
import org.hamcrest.Factory;
|
|
||||||
import org.hamcrest.Matcher;
|
|
||||||
import org.hamcrest.TypeSafeMatcher;
|
|
||||||
|
|
||||||
public class InvoicingFilter implements Filter<Invoicing>
|
|
||||||
{
|
|
||||||
|
|
||||||
private Invoicing condition;
|
|
||||||
|
|
||||||
public InvoicingFilter(Invoicing cond)
|
|
||||||
{
|
|
||||||
this.condition = cond;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static class InvoicingMatcher extends TypeSafeMatcher<Invoicing>
|
|
||||||
{
|
|
||||||
|
|
||||||
private Invoicing condition;
|
|
||||||
|
|
||||||
public InvoicingMatcher(Invoicing cond)
|
|
||||||
{
|
|
||||||
this.condition = cond;
|
|
||||||
|
|
||||||
if (condition.getRequirement() == null) {
|
|
||||||
condition.setRequirement(new Requirement());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void describeTo(Description desc)
|
|
||||||
{
|
|
||||||
desc.appendText("Invoicing matches");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean matchesSafely(Invoicing item)
|
|
||||||
{
|
|
||||||
boolean foundNumser = StringUtils.isEqualForFilter(item.getRequirement().getNumser(), condition.getRequirement().getNumser());
|
|
||||||
boolean foundReqDate = DateTimeUtils.isEqualByDateForFilter(item.getRequirement().getReqDate(), condition.getRequirement().getReqDate());
|
|
||||||
boolean foundCenter = Workgroup.isEqualByWorkgroupForFilter(item.getRequirement().getCentre(), condition.getRequirement().getCentre());
|
|
||||||
boolean foundWorkgroup = Workgroup.isEqualByWorkgroupForFilter(item.getRequirement().getWorkgroup(), condition.getRequirement().getWorkgroup());
|
|
||||||
boolean foundDescription = StringUtils.isEqualForFilter(item.getRequirement().getDescription(), condition.getRequirement().getDescription());
|
|
||||||
return (foundNumser && foundReqDate && foundCenter && foundDescription && foundWorkgroup);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Factory
|
|
||||||
public static Matcher<Invoicing> matchBuilding(Invoicing building)
|
|
||||||
{
|
|
||||||
return new InvoicingMatcher(building);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public InvoicingMatcher matcher()
|
|
||||||
{
|
|
||||||
return new InvoicingMatcher(condition);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String queryString()
|
|
||||||
{
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -42,24 +42,27 @@ public class OrderFilter implements Filter<Order>
|
|||||||
@Override
|
@Override
|
||||||
public boolean matchesSafely(Order item)
|
public boolean matchesSafely(Order item)
|
||||||
{
|
{
|
||||||
boolean foundOrdered = (item.isOrdered() == condition.isOrdered());
|
|
||||||
boolean foundNumSer = StringUtils.isEqualForFilter(item.getNumser(), condition.getNumser());
|
boolean foundNumSer = StringUtils.isEqualForFilter(item.getNumser(), condition.getNumser());
|
||||||
boolean foundOrderDate = DateTimeUtils.isEqualByDateForFilter(item.getOrderDate(), condition.getOrderDate());
|
boolean foundOrderDate = DateTimeUtils.isEqualByDateForFilter(item.getOrderDate(), condition.getOrderDate());
|
||||||
boolean foundTotal = true;// BigDecimalUtils.isEqualByDecimalForFilter(item.getTotal(),
|
boolean foundTotal = true;// BigDecimalUtils.isEqualByDecimalForFilter(item.getTotal(),
|
||||||
// condition.getTotal());
|
// condition.getTotal());
|
||||||
boolean foundDeliveryDate = DateTimeUtils.isEqualByDateForFilter(item.getDeliveryDate(), condition.getDeliveryDate());
|
boolean foundDeliveryDate = DateTimeUtils.isEqualByDateForFilter(item.getDeliveryDate(), condition.getDeliveryDate());
|
||||||
boolean foundDeliveredDate = DateTimeUtils.isEqualByDateForFilter(item.getDeliveredDate(), condition.getDeliveredDate());
|
boolean foundDeliveredDate = DateTimeUtils.isEqualByDateForFilter(item.getDeliveredDate(), condition.getDeliveredDate());
|
||||||
|
boolean foundInvoiceNumber = StringUtils.isEqualForFilter(item.getInvoiceNumber(), condition.getInvoiceNumber());
|
||||||
|
boolean foundInvoiceTotal = true;// BigDecimalUtils.isEqualByDecimalForFilter(item.getInvoiceTotal(),
|
||||||
|
// condition.getInvoiceTotal());
|
||||||
boolean foundSupplierAddr = AddressEmb.isEqualByAddressEmbForFilter(item.getSuplier(), condition.getSuplier());
|
boolean foundSupplierAddr = AddressEmb.isEqualByAddressEmbForFilter(item.getSuplier(), condition.getSuplier());
|
||||||
boolean foundDeliveryAddr = AddressEmb.isEqualByAddressEmbForFilter(item.getDeliveryAddress(), condition.getDeliveryAddress());
|
boolean foundDeliveryAddr = AddressEmb.isEqualByAddressEmbForFilter(item.getDeliveryAddress(), condition.getDeliveryAddress());
|
||||||
boolean foundInvoiceAddr = AddressEmb.isEqualByAddressEmbForFilter(item.getAddress(), condition.getAddress());
|
boolean foundInvoiceAddr = AddressEmb.isEqualByAddressEmbForFilter(item.getAddress(), condition.getAddress());
|
||||||
boolean foundOwnedBy = User.isEqualByUserForFilter(item.getOwnedBy(), condition.getOwnedBy());
|
boolean foundOwnedBy = User.isEqualByUserForFilter(item.getOwnedBy(), condition.getOwnedBy());
|
||||||
boolean foundDescription = StringUtils.isEqualForFilter(item.getDescription(), condition.getDescription());
|
boolean foundDescription = StringUtils.isEqualForFilter(item.getDescription(), condition.getDescription());
|
||||||
return (foundOrdered
|
return (foundNumSer
|
||||||
&& foundNumSer
|
|
||||||
&& foundOrderDate
|
&& foundOrderDate
|
||||||
&& foundTotal
|
&& foundTotal
|
||||||
&& foundDeliveryDate
|
&& foundDeliveryDate
|
||||||
&& foundDeliveredDate
|
&& foundDeliveredDate
|
||||||
|
&& foundInvoiceNumber
|
||||||
|
&& foundInvoiceTotal
|
||||||
&& foundSupplierAddr
|
&& foundSupplierAddr
|
||||||
&& foundDeliveryAddr
|
&& foundDeliveryAddr
|
||||||
&& foundInvoiceAddr
|
&& foundInvoiceAddr
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package info.bukova.isspst.filters;
|
package info.bukova.isspst.filters;
|
||||||
|
|
||||||
import info.bukova.isspst.BooleanUtils;
|
|
||||||
import info.bukova.isspst.DateTimeUtils;
|
import info.bukova.isspst.DateTimeUtils;
|
||||||
import info.bukova.isspst.StringUtils;
|
import info.bukova.isspst.StringUtils;
|
||||||
import info.bukova.isspst.data.Requirement;
|
import info.bukova.isspst.data.Requirement;
|
||||||
@@ -47,8 +46,7 @@ public class RequirementFilter implements Filter<Requirement>
|
|||||||
boolean foundDescription = StringUtils.isEqualForFilter(item.getDescription(), condition.getDescription());
|
boolean foundDescription = StringUtils.isEqualForFilter(item.getDescription(), condition.getDescription());
|
||||||
boolean foundDeliveryDate = DateTimeUtils.isEqualByDateForFilter(item.getDeliveryDate(), condition.getDeliveryDate());
|
boolean foundDeliveryDate = DateTimeUtils.isEqualByDateForFilter(item.getDeliveryDate(), condition.getDeliveryDate());
|
||||||
boolean foundUser = User.isEqualByUserForFilter(item.getOwnedBy(), condition.getOwnedBy());
|
boolean foundUser = User.isEqualByUserForFilter(item.getOwnedBy(), condition.getOwnedBy());
|
||||||
boolean foundProject = BooleanUtils.isEqualByBoolean(item.getProject(), condition.getProject());
|
return (foundNumser && foundReqDate && foundCenter && foundDescription && foundDeliveryDate && foundUser);
|
||||||
return (foundNumser && foundReqDate && foundCenter && foundDescription && foundDeliveryDate && foundUser && foundProject);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Factory
|
@Factory
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ package info.bukova.isspst.filters;
|
|||||||
import info.bukova.isspst.DateTimeUtils;
|
import info.bukova.isspst.DateTimeUtils;
|
||||||
import info.bukova.isspst.StringUtils;
|
import info.bukova.isspst.StringUtils;
|
||||||
import info.bukova.isspst.data.TripRequirement;
|
import info.bukova.isspst.data.TripRequirement;
|
||||||
import info.bukova.isspst.data.User;
|
|
||||||
|
|
||||||
import org.hamcrest.Description;
|
import org.hamcrest.Description;
|
||||||
import org.hamcrest.Factory;
|
import org.hamcrest.Factory;
|
||||||
@@ -46,7 +45,7 @@ public class TripRequirementFilter implements Filter<TripRequirement>
|
|||||||
boolean foundTo = StringUtils.isEqualForFilter(item.getTo(), condition.getTo());
|
boolean foundTo = StringUtils.isEqualForFilter(item.getTo(), condition.getTo());
|
||||||
boolean foundWorkgroup = (condition.getWorkgroup() == null ||(item.getWorkgroup() != null && item.getWorkgroup().equals(condition.getWorkgroup())));
|
boolean foundWorkgroup = (condition.getWorkgroup() == null ||(item.getWorkgroup() != null && item.getWorkgroup().equals(condition.getWorkgroup())));
|
||||||
boolean foundCentre = (condition.getCentre() == null || (item.getCentre() != null && item.getCentre().equals(condition.getCentre())));
|
boolean foundCentre = (condition.getCentre() == null || (item.getCentre() != null && item.getCentre().equals(condition.getCentre())));
|
||||||
boolean foundOwner = User.isEqualByUserForFilter(item.getOwnedBy(), condition.getOwnedBy());
|
boolean foundOwner = StringUtils.isEqualForFilter(item.getOwnedBy().getLastName(), condition.getOwnedBy().getLastName());
|
||||||
return foundNumser && foundReqDate && foundDescription && foundFrom && foundTo && foundWorkgroup && foundCentre && foundOwner;
|
return foundNumser && foundReqDate && foundDescription && foundFrom && foundTo && foundWorkgroup && foundCentre && foundOwner;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
package info.bukova.isspst.mail;
|
package info.bukova.isspst.mail;
|
||||||
|
|
||||||
import info.bukova.isspst.EntityUrlResolver;
|
|
||||||
import info.bukova.isspst.UrlResolverHolder;
|
|
||||||
|
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -15,7 +12,6 @@ public class EntityMessageBuilder implements MessageBuilder {
|
|||||||
|
|
||||||
private final static Logger logger = LoggerFactory.getLogger(EntityMessageBuilder.class);
|
private final static Logger logger = LoggerFactory.getLogger(EntityMessageBuilder.class);
|
||||||
private boolean html;
|
private boolean html;
|
||||||
private UrlResolverHolder urlResolverHolder;
|
|
||||||
|
|
||||||
public void setHtml(boolean html) {
|
public void setHtml(boolean html) {
|
||||||
this.html = html;
|
this.html = html;
|
||||||
@@ -57,11 +53,7 @@ public class EntityMessageBuilder implements MessageBuilder {
|
|||||||
|
|
||||||
for (String p : properties) {
|
for (String p : properties) {
|
||||||
try {
|
try {
|
||||||
if (p.equals("-url-")) {
|
|
||||||
ret = ret.replaceAll("\\[" + p + "\\]", getUrl(data));
|
|
||||||
} else {
|
|
||||||
ret = ret.replaceAll("\\[" + p + "\\]", BeanUtils.getProperty(data, p));
|
ret = ret.replaceAll("\\[" + p + "\\]", BeanUtils.getProperty(data, p));
|
||||||
}
|
|
||||||
} catch (IllegalAccessException e) {
|
} catch (IllegalAccessException e) {
|
||||||
logger.error(e.getMessage());
|
logger.error(e.getMessage());
|
||||||
} catch (InvocationTargetException e) {
|
} catch (InvocationTargetException e) {
|
||||||
@@ -76,17 +68,4 @@ public class EntityMessageBuilder implements MessageBuilder {
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getUrl(Object data) {
|
|
||||||
if (urlResolverHolder == null) {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
EntityUrlResolver res = urlResolverHolder.resolverFor(data.getClass());
|
|
||||||
return res.entityUrl(data);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUrlResolverHolder(UrlResolverHolder urlResolverHolder) {
|
|
||||||
this.urlResolverHolder = urlResolverHolder;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,10 +43,6 @@ public class MailerWithAttachement implements Mailer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (message.getReplyTo() == null) {
|
|
||||||
message.setReplyTo(message.getFrom());
|
|
||||||
}
|
|
||||||
|
|
||||||
helper.setFrom(message.getFrom());
|
helper.setFrom(message.getFrom());
|
||||||
helper.setReplyTo(message.getReplyTo());
|
helper.setReplyTo(message.getReplyTo());
|
||||||
helper.setTo(message.getTo());
|
helper.setTo(message.getTo());
|
||||||
@@ -67,7 +63,6 @@ public class MailerWithAttachement implements Mailer {
|
|||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
sender.send(mimeMessage);
|
sender.send(mimeMessage);
|
||||||
logger.info("Mail queued for send");
|
|
||||||
} catch (MailAuthenticationException e) {
|
} catch (MailAuthenticationException e) {
|
||||||
logger.error("Authentication error");
|
logger.error("Authentication error");
|
||||||
} catch (MailSendException e) {
|
} catch (MailSendException e) {
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package info.bukova.isspst.services.orders;
|
package info.bukova.isspst.services.approved;
|
||||||
|
|
||||||
import info.bukova.isspst.data.JoinedItem;
|
import info.bukova.isspst.data.JoinedItem;
|
||||||
import info.bukova.isspst.services.Service;
|
import info.bukova.isspst.services.Service;
|
||||||
+3
-8
@@ -1,4 +1,4 @@
|
|||||||
package info.bukova.isspst.services.orders;
|
package info.bukova.isspst.services.approved;
|
||||||
|
|
||||||
import info.bukova.isspst.data.JoinedItem;
|
import info.bukova.isspst.data.JoinedItem;
|
||||||
import info.bukova.isspst.data.RequirementItem;
|
import info.bukova.isspst.data.RequirementItem;
|
||||||
@@ -34,13 +34,8 @@ public class ApprovedServiceImpl extends AbstractService<JoinedItem> implements
|
|||||||
public List<JoinedItem> getAll()
|
public List<JoinedItem> getAll()
|
||||||
{
|
{
|
||||||
List<Workgroup> wgList = workgroupService.getUserCentres(userService.getCurrent());
|
List<Workgroup> wgList = workgroupService.getUserCentres(userService.getCurrent());
|
||||||
Query q = queryDao.getQuery("select item "
|
Query q = queryDao
|
||||||
+ "from RequirementItem item left join item.requirement rq join rq.centre c "
|
.getQuery("select item from RequirementItem item left join item.requirement rq join rq.centre c where rq.kind is not null and rq.state = :state and c in (:wgList)");
|
||||||
+ "where rq.kind is not null "
|
|
||||||
+ "and rq.state = :state "
|
|
||||||
+ "and (rq.project Is Null or rq.project = false) "
|
|
||||||
+ "and c in (:wgList) "
|
|
||||||
+ "and (item.orderNum Is Null or item.orderNum = '')");
|
|
||||||
q.setParameterList("wgList", wgList);
|
q.setParameterList("wgList", wgList);
|
||||||
q.setParameter("state", RequirementState.APPROVED);
|
q.setParameter("state", RequirementState.APPROVED);
|
||||||
List<JoinedItem> items = new ArrayList<JoinedItem>();
|
List<JoinedItem> items = new ArrayList<JoinedItem>();
|
||||||
+1
-2
@@ -1,4 +1,4 @@
|
|||||||
package info.bukova.isspst.services.orders;
|
package info.bukova.isspst.services.approved;
|
||||||
|
|
||||||
import info.bukova.isspst.data.JoinedItem;
|
import info.bukova.isspst.data.JoinedItem;
|
||||||
import info.bukova.isspst.data.Order;
|
import info.bukova.isspst.data.Order;
|
||||||
@@ -22,5 +22,4 @@ public interface OrderService extends Service<Order> {
|
|||||||
|
|
||||||
public BigDecimal calcSumTotalFromItems(List<OrderItem> items);
|
public BigDecimal calcSumTotalFromItems(List<OrderItem> items);
|
||||||
|
|
||||||
public void updateApprovedItems(Order order, boolean orderedChanged);
|
|
||||||
}
|
}
|
||||||
+3
-31
@@ -1,11 +1,9 @@
|
|||||||
package info.bukova.isspst.services.orders;
|
package info.bukova.isspst.services.approved;
|
||||||
|
|
||||||
import info.bukova.isspst.dao.RequirementItemDao;
|
|
||||||
import info.bukova.isspst.data.AddressEmb;
|
import info.bukova.isspst.data.AddressEmb;
|
||||||
import info.bukova.isspst.data.JoinedItem;
|
import info.bukova.isspst.data.JoinedItem;
|
||||||
import info.bukova.isspst.data.Order;
|
import info.bukova.isspst.data.Order;
|
||||||
import info.bukova.isspst.data.OrderItem;
|
import info.bukova.isspst.data.OrderItem;
|
||||||
import info.bukova.isspst.data.RequirementItem;
|
|
||||||
import info.bukova.isspst.data.Workgroup;
|
import info.bukova.isspst.data.Workgroup;
|
||||||
import info.bukova.isspst.services.AbstractOwnedService;
|
import info.bukova.isspst.services.AbstractOwnedService;
|
||||||
import info.bukova.isspst.services.LazyLoader;
|
import info.bukova.isspst.services.LazyLoader;
|
||||||
@@ -26,9 +24,6 @@ public class OrderServiceImpl extends AbstractOwnedService<Order> implements
|
|||||||
@Autowired
|
@Autowired
|
||||||
private GlobalSettingsService globalSettings;
|
private GlobalSettingsService globalSettings;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private RequirementItemDao requirementItemDao;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@PreAuthorize("hasPermission(this, 'PERM_ADD')")
|
@PreAuthorize("hasPermission(this, 'PERM_ADD')")
|
||||||
public Order createOrder(List<JoinedItem> items) {
|
public Order createOrder(List<JoinedItem> items) {
|
||||||
@@ -52,11 +47,8 @@ public class OrderServiceImpl extends AbstractOwnedService<Order> implements
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
public BigDecimal totalOrderedForWorkgroup(Workgroup workgroup)
|
public BigDecimal totalOrderedForWorkgroup(Workgroup workgroup) {
|
||||||
{
|
Query q = dao.getQuery("select sum(oi.total) from OrderItem oi join oi.reqItem ri join ri.requirement rq join rq.workgroup w where ri.delivered = true and w = :workgroup");
|
||||||
Query q = dao.getQuery("select sum(oi.total) "
|
|
||||||
+ "from OrderItem oi join oi.reqItem ri join ri.requirement rq join rq.workgroup w "
|
|
||||||
+ "where (ri.orderNum is not null or ri.orderNum = '') and w = :workgroup ");
|
|
||||||
q.setParameter("workgroup", workgroup);
|
q.setParameter("workgroup", workgroup);
|
||||||
return (BigDecimal)q.uniqueResult();
|
return (BigDecimal)q.uniqueResult();
|
||||||
}
|
}
|
||||||
@@ -179,24 +171,4 @@ public class OrderServiceImpl extends AbstractOwnedService<Order> implements
|
|||||||
|
|
||||||
return sumTotal;
|
return sumTotal;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
|
||||||
public void updateApprovedItems(Order order, boolean orderedChanged)
|
|
||||||
{
|
|
||||||
if (orderedChanged)
|
|
||||||
{
|
|
||||||
for (OrderItem item : order.getItems())
|
|
||||||
{
|
|
||||||
RequirementItem rItem = item.getReqItem();
|
|
||||||
|
|
||||||
if (rItem != null)
|
|
||||||
{
|
|
||||||
rItem.setOrderNum(order.isOrdered() ? order.getNumser() : null);
|
|
||||||
requirementItemDao.modify(rItem);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
super.update(order);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
package info.bukova.isspst.services.invoicing;
|
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
|
|
||||||
import info.bukova.isspst.data.Invoicing;
|
|
||||||
import info.bukova.isspst.data.Workgroup;
|
|
||||||
import info.bukova.isspst.services.Service;
|
|
||||||
|
|
||||||
public interface InvoicingService extends Service<Invoicing> {
|
|
||||||
|
|
||||||
public BigDecimal totalInvoicedForWorkgroup(Workgroup workgroup);
|
|
||||||
|
|
||||||
public void loadReqItems(Invoicing invoicing);
|
|
||||||
|
|
||||||
public void loadItems(Invoicing invoicing);
|
|
||||||
|
|
||||||
public void calculate(Invoicing invoicing);
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,57 +0,0 @@
|
|||||||
package info.bukova.isspst.services.invoicing;
|
|
||||||
|
|
||||||
import info.bukova.isspst.data.Invoicing;
|
|
||||||
import info.bukova.isspst.data.InvoicingItem;
|
|
||||||
import info.bukova.isspst.data.Workgroup;
|
|
||||||
import info.bukova.isspst.services.AbstractOwnedService;
|
|
||||||
import info.bukova.isspst.services.LazyLoader;
|
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
|
|
||||||
import org.hibernate.Hibernate;
|
|
||||||
import org.hibernate.Query;
|
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
|
|
||||||
public class InvoicingServiceImpl extends AbstractOwnedService<Invoicing> implements
|
|
||||||
InvoicingService {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Transactional
|
|
||||||
public BigDecimal totalInvoicedForWorkgroup(Workgroup workgroup) {
|
|
||||||
Query q = dao.getQuery("select sum(inv.totalInvoiced) "
|
|
||||||
+ "from Invoicing inv join inv.requirement rq join rq.workgroup w "
|
|
||||||
+ "where w = :workgroup ");
|
|
||||||
q.setParameter("workgroup", workgroup);
|
|
||||||
return (BigDecimal) q.uniqueResult();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Transactional
|
|
||||||
@LazyLoader("form")
|
|
||||||
public void loadReqItems(Invoicing invoicing) {
|
|
||||||
Invoicing inv = getById(invoicing.getId());
|
|
||||||
Hibernate.initialize(inv.getRequirement().getItems());
|
|
||||||
invoicing.getRequirement().setItems(inv.getRequirement().getItems());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Transactional
|
|
||||||
@LazyLoader({"form", "grid"})
|
|
||||||
public void loadItems(Invoicing invoicing) {
|
|
||||||
Invoicing inv = getById(invoicing.getId());
|
|
||||||
Hibernate.initialize(inv.getItems());
|
|
||||||
invoicing.setItems(inv.getItems());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void calculate(Invoicing invoicing) {
|
|
||||||
BigDecimal total = BigDecimal.ZERO;
|
|
||||||
|
|
||||||
for (InvoicingItem item : invoicing.getItems()) {
|
|
||||||
total = total.add(item.getAmount());
|
|
||||||
}
|
|
||||||
|
|
||||||
invoicing.setTotalInvoiced(total);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -6,14 +6,6 @@ import info.bukova.isspst.services.Service;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Pepa Rokos
|
|
||||||
* @author Franta Přibyl
|
|
||||||
*
|
|
||||||
* Základní rozhraní všech požadavků.
|
|
||||||
*
|
|
||||||
* @param <T> Třída požadavku.
|
|
||||||
*/
|
|
||||||
public interface RequirementBaseService<T extends RequirementBase> extends Service<T>
|
public interface RequirementBaseService<T extends RequirementBase> extends Service<T>
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|||||||
+3
-30
@@ -30,14 +30,6 @@ import org.springframework.security.access.prepost.PostFilter;
|
|||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Pepa Rokos
|
|
||||||
* @author Franta Přibyl
|
|
||||||
*
|
|
||||||
* Abstraktní bázová třída všech požadavků
|
|
||||||
*
|
|
||||||
* @param <T> Třída požadavku
|
|
||||||
*/
|
|
||||||
public abstract class RequirementBaseServiceImpl<T extends RequirementBase> extends
|
public abstract class RequirementBaseServiceImpl<T extends RequirementBase> extends
|
||||||
AbstractOwnedService<T> implements RequirementBaseService<T> {
|
AbstractOwnedService<T> implements RequirementBaseService<T> {
|
||||||
|
|
||||||
@@ -76,12 +68,8 @@ public abstract class RequirementBaseServiceImpl<T extends RequirementBase> exte
|
|||||||
|
|
||||||
super.add(entity);
|
super.add(entity);
|
||||||
|
|
||||||
if (canApprove(entity)) {
|
|
||||||
approve(entity);
|
|
||||||
} else {
|
|
||||||
this.sendToApprovers(entity);
|
this.sendToApprovers(entity);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private void checkEnable() {
|
private void checkEnable() {
|
||||||
if (!settingsService.getSettings().isEnableRequirements()) {
|
if (!settingsService.getSettings().isEnableRequirements()) {
|
||||||
@@ -232,10 +220,12 @@ public abstract class RequirementBaseServiceImpl<T extends RequirementBase> exte
|
|||||||
} else {
|
} else {
|
||||||
e.setState(RequirementState.PARTIALLY);
|
e.setState(RequirementState.PARTIALLY);
|
||||||
}
|
}
|
||||||
|
entity.setState(e.getState());
|
||||||
|
entity.getAuthorization().add(auth);
|
||||||
|
|
||||||
super.update(e);
|
super.update(e);
|
||||||
|
|
||||||
if (!autoApprove(e)) {
|
if (!autoApprove(entity)) {
|
||||||
this.sendToApprovers(e);
|
this.sendToApprovers(e);
|
||||||
|
|
||||||
SettingsData settings = settingsService.getSettings();
|
SettingsData settings = settingsService.getSettings();
|
||||||
@@ -257,8 +247,6 @@ public abstract class RequirementBaseServiceImpl<T extends RequirementBase> exte
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
postApprove(e);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -268,25 +256,10 @@ public abstract class RequirementBaseServiceImpl<T extends RequirementBase> exte
|
|||||||
approve(entity, getLoggedInUser());
|
approve(entity, getLoggedInUser());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Volá se z metody approve pro automatické schválení dalším schvalovatelem v pořadí. Metoda z báze nedělá nic.
|
|
||||||
*
|
|
||||||
* @param entity Požadavek
|
|
||||||
* @return true pokud se provedlo automatické schválení.
|
|
||||||
*/
|
|
||||||
protected boolean autoApprove(T entity) {
|
protected boolean autoApprove(T entity) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Činnost prováděná po schválení požadavku (i dílčím schválení).
|
|
||||||
*
|
|
||||||
* @param entity Požadavek
|
|
||||||
*/
|
|
||||||
protected void postApprove(T entity) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
public boolean canApprove(T entity) {
|
public boolean canApprove(T entity) {
|
||||||
|
|||||||
@@ -6,19 +6,10 @@ import info.bukova.isspst.data.RequirementItem;
|
|||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Pepa Rokos
|
|
||||||
* @author Franta Přibyl
|
|
||||||
*
|
|
||||||
* Základní rozhraní požadavků na služby a materiál.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public interface RequirementService extends RequirementBaseService<Requirement>
|
public interface RequirementService extends RequirementBaseService<Requirement>
|
||||||
{
|
{
|
||||||
public void loadGroups(Requirement req);
|
public void loadGroups(Requirement req);
|
||||||
|
|
||||||
public void loadItems(Requirement req);
|
|
||||||
|
|
||||||
public BigDecimal calcTotalFromItem(RequirementItem item);
|
public BigDecimal calcTotalFromItem(RequirementItem item);
|
||||||
|
|
||||||
public RequirementItem calcTotalInItem(RequirementItem item);
|
public RequirementItem calcTotalInItem(RequirementItem item);
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package info.bukova.isspst.services.requirement;
|
package info.bukova.isspst.services.requirement;
|
||||||
|
|
||||||
import info.bukova.isspst.Constants;
|
import info.bukova.isspst.Constants;
|
||||||
import info.bukova.isspst.data.Invoicing;
|
|
||||||
import info.bukova.isspst.data.Requirement;
|
import info.bukova.isspst.data.Requirement;
|
||||||
import info.bukova.isspst.data.RequirementItem;
|
import info.bukova.isspst.data.RequirementItem;
|
||||||
import info.bukova.isspst.data.RequirementState;
|
import info.bukova.isspst.data.RequirementState;
|
||||||
@@ -9,30 +8,22 @@ import info.bukova.isspst.data.RequirementSubject;
|
|||||||
import info.bukova.isspst.data.User;
|
import info.bukova.isspst.data.User;
|
||||||
import info.bukova.isspst.data.Workflow;
|
import info.bukova.isspst.data.Workflow;
|
||||||
import info.bukova.isspst.services.LazyLoader;
|
import info.bukova.isspst.services.LazyLoader;
|
||||||
import info.bukova.isspst.services.invoicing.InvoicingService;
|
import info.bukova.isspst.services.approved.OrderService;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.hibernate.Hibernate;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Pepa Rokos
|
|
||||||
* @author Franta Přibyl
|
|
||||||
*
|
|
||||||
* Bázová třída požadavků na materiál a služby.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class RequirementServiceImpl extends RequirementBaseServiceImpl<Requirement> implements RequirementService, RequirementBaseService<Requirement>
|
public class RequirementServiceImpl extends RequirementBaseServiceImpl<Requirement> implements RequirementService, RequirementBaseService<Requirement>
|
||||||
{
|
{
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private RequirementTypeService reqTypeService;
|
private RequirementTypeService reqTypeService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private InvoicingService invoicingService;
|
private OrderService orderService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Requirement createEntity()
|
protected Requirement createEntity()
|
||||||
@@ -57,8 +48,7 @@ public class RequirementServiceImpl extends RequirementBaseServiceImpl<Requireme
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((entity.getSumTotal() != null)
|
if (entity.getSumTotal().compareTo(nextWf.getLimit()) == -1)
|
||||||
&& (entity.getSumTotal().compareTo(nextWf.getLimit()) == -1))
|
|
||||||
{
|
{
|
||||||
approve(entity, approvers.get(0));
|
approve(entity, approvers.get(0));
|
||||||
return true;
|
return true;
|
||||||
@@ -73,7 +63,7 @@ public class RequirementServiceImpl extends RequirementBaseServiceImpl<Requireme
|
|||||||
if (entity.getWorkgroup() != null && entity.getWorkgroup().getLimit() != null && entity.getWorkgroup().getLimit().compareTo(BigDecimal.ZERO) != 0)
|
if (entity.getWorkgroup() != null && entity.getWorkgroup().getLimit() != null && entity.getWorkgroup().getLimit().compareTo(BigDecimal.ZERO) != 0)
|
||||||
{
|
{
|
||||||
|
|
||||||
BigDecimal total = invoicingService.totalInvoicedForWorkgroup(entity.getWorkgroup());
|
BigDecimal total = orderService.totalOrderedForWorkgroup(entity.getWorkgroup());
|
||||||
|
|
||||||
if (total == null)
|
if (total == null)
|
||||||
{
|
{
|
||||||
@@ -146,19 +136,6 @@ public class RequirementServiceImpl extends RequirementBaseServiceImpl<Requireme
|
|||||||
req.setItems(items);
|
req.setItems(items);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
@Transactional
|
|
||||||
@LazyLoader("form")
|
|
||||||
public void loadItems(Requirement req) {
|
|
||||||
if (req == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Requirement r = getById(req.getId());
|
|
||||||
Hibernate.initialize(r.getItems());
|
|
||||||
req.setItems(r.getItems());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BigDecimal calcTotalFromItem(RequirementItem item)
|
public BigDecimal calcTotalFromItem(RequirementItem item)
|
||||||
{
|
{
|
||||||
@@ -231,13 +208,4 @@ public class RequirementServiceImpl extends RequirementBaseServiceImpl<Requireme
|
|||||||
|
|
||||||
return sumTotal;
|
return sumTotal;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void postApprove(Requirement entity) {
|
|
||||||
if (entity.getState() == RequirementState.APPROVED) {
|
|
||||||
Invoicing inv = new Invoicing();
|
|
||||||
inv.setRequirement(entity);
|
|
||||||
invoicingService.add(inv);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-11
@@ -5,7 +5,6 @@ import info.bukova.isspst.data.NumberSeries;
|
|||||||
import info.bukova.isspst.data.RequirementState;
|
import info.bukova.isspst.data.RequirementState;
|
||||||
import info.bukova.isspst.data.TripBill;
|
import info.bukova.isspst.data.TripBill;
|
||||||
import info.bukova.isspst.data.TripRequirement;
|
import info.bukova.isspst.data.TripRequirement;
|
||||||
import info.bukova.isspst.data.User;
|
|
||||||
import info.bukova.isspst.services.LazyLoader;
|
import info.bukova.isspst.services.LazyLoader;
|
||||||
import info.bukova.isspst.services.tripbill.TripBillService;
|
import info.bukova.isspst.services.tripbill.TripBillService;
|
||||||
import info.bukova.isspst.services.workgroups.WorkgroupService;
|
import info.bukova.isspst.services.workgroups.WorkgroupService;
|
||||||
@@ -14,6 +13,7 @@ import java.util.Date;
|
|||||||
|
|
||||||
import org.hibernate.LazyInitializationException;
|
import org.hibernate.LazyInitializationException;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
public class TripRequirementServiceImpl extends RequirementBaseServiceImpl<TripRequirement>
|
public class TripRequirementServiceImpl extends RequirementBaseServiceImpl<TripRequirement>
|
||||||
@@ -54,21 +54,16 @@ public class TripRequirementServiceImpl extends RequirementBaseServiceImpl<TripR
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void postApprove(TripRequirement entity) {
|
@Transactional
|
||||||
|
@PreAuthorize("this.canApprove(#entity)")
|
||||||
|
public void approve(TripRequirement entity) {
|
||||||
|
super.approve(entity);
|
||||||
|
|
||||||
if (entity.getState() == RequirementState.APPROVED) {
|
if (entity.getState() == RequirementState.APPROVED) {
|
||||||
TripBill bill = tripBillService.createTripBill(entity);
|
TripBill bill = tripBillService.createTripBill(entity);
|
||||||
tripBillService.add(bill);
|
tripBillService.add(bill);
|
||||||
bill.setOwnedBy(entity.getOwnedBy());
|
bill.setOwnedBy(entity.getOwnedBy());
|
||||||
tripBillService.update(bill);
|
tripBillService.update(bill);
|
||||||
|
|
||||||
for (User u : entity.getPassengers()) {
|
|
||||||
if (!u.equals(entity.getOwnedBy())) {
|
|
||||||
TripBill passBill = tripBillService.createTripBill(entity);
|
|
||||||
tripBillService.add(passBill);
|
|
||||||
passBill.setOwnedBy(u);
|
|
||||||
tripBillService.update(passBill);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,6 @@ public class AdUserCtxMapper implements UserDetailsContextMapper {
|
|||||||
|
|
||||||
private UserService userService;
|
private UserService userService;
|
||||||
private RoleService roleService;
|
private RoleService roleService;
|
||||||
private String allowedGroup;
|
|
||||||
|
|
||||||
private final static Logger logger = LoggerFactory.getLogger(AdUserCtxMapper.class);
|
private final static Logger logger = LoggerFactory.getLogger(AdUserCtxMapper.class);
|
||||||
|
|
||||||
@@ -44,7 +43,7 @@ public class AdUserCtxMapper implements UserDetailsContextMapper {
|
|||||||
return user;
|
return user;
|
||||||
} catch (UsernameNotFoundException e) {
|
} catch (UsernameNotFoundException e) {
|
||||||
logger.info("Importing user from Active Directory");
|
logger.info("Importing user from Active Directory");
|
||||||
LdapUserImporter importer = new LdapUserImporter(userService, allowedGroup);
|
LdapUserImporter importer = new LdapUserImporter(userService);
|
||||||
importer.importUser(username, userData, roleService.getRoleByAuthority(Constants.ROLE_USER));
|
importer.importUser(username, userData, roleService.getRoleByAuthority(Constants.ROLE_USER));
|
||||||
|
|
||||||
return userService.loadUserByUsername(username);
|
return userService.loadUserByUsername(username);
|
||||||
@@ -57,8 +56,4 @@ public class AdUserCtxMapper implements UserDetailsContextMapper {
|
|||||||
"use a subclass if mapUserToContext() is required.");
|
"use a subclass if mapUserToContext() is required.");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAllowedGroup(String allowedGroup) {
|
|
||||||
this.allowedGroup = allowedGroup;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ import javax.naming.NamingException;
|
|||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.ldap.core.DirContextOperations;
|
import org.springframework.ldap.core.DirContextOperations;
|
||||||
import org.springframework.security.core.userdetails.UsernameNotFoundException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pomocná třída pro import uživatele z LDAP serveru (nebo Active Directory) do databáze aplikace
|
* Pomocná třída pro import uživatele z LDAP serveru (nebo Active Directory) do databáze aplikace
|
||||||
@@ -20,18 +19,12 @@ import org.springframework.security.core.userdetails.UsernameNotFoundException;
|
|||||||
public class LdapUserImporter {
|
public class LdapUserImporter {
|
||||||
|
|
||||||
private UserService userService;
|
private UserService userService;
|
||||||
private String allowedGroup;
|
|
||||||
private final static Logger logger = LoggerFactory.getLogger(LdapUserImporter.class);
|
private final static Logger logger = LoggerFactory.getLogger(LdapUserImporter.class);
|
||||||
|
|
||||||
public LdapUserImporter(UserService userService) {
|
public LdapUserImporter(UserService userService) {
|
||||||
this.userService = userService;
|
this.userService = userService;
|
||||||
}
|
}
|
||||||
|
|
||||||
public LdapUserImporter(UserService userService, String group) {
|
|
||||||
this.userService = userService;
|
|
||||||
this.allowedGroup = group;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provede import uživatele z LDAP do aplikační databáze
|
* Provede import uživatele z LDAP do aplikační databáze
|
||||||
*
|
*
|
||||||
@@ -44,21 +37,6 @@ public class LdapUserImporter {
|
|||||||
user.setUsername(login);
|
user.setUsername(login);
|
||||||
user.addAuthority(defaultRole);
|
user.addAuthority(defaultRole);
|
||||||
|
|
||||||
if (allowedGroup != null && !allowedGroup.isEmpty()) {
|
|
||||||
boolean isAllowed = false;
|
|
||||||
|
|
||||||
for (Object atr : userData.getObjectAttributes("memberOf")) {
|
|
||||||
if (atr.toString().startsWith("CN="+allowedGroup)) {
|
|
||||||
isAllowed = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isAllowed) {
|
|
||||||
throw new UsernameNotFoundException("User is not member of group '" + allowedGroup + "'");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (userData.attributeExists("givenName")) {
|
if (userData.attributeExists("givenName")) {
|
||||||
try {
|
try {
|
||||||
user.setFirstName(userData.getAttributes().get("givenName").get().toString());
|
user.setFirstName(userData.getAttributes().get("givenName").get().toString());
|
||||||
|
|||||||
@@ -3,13 +3,11 @@ package info.bukova.isspst.ui;
|
|||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
import java.util.Locale;
|
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.zkoss.bind.BindContext;
|
import org.zkoss.bind.BindContext;
|
||||||
import org.zkoss.bind.Converter;
|
import org.zkoss.bind.Converter;
|
||||||
import org.zkoss.util.Locales;
|
|
||||||
import org.zkoss.zk.ui.Component;
|
import org.zkoss.zk.ui.Component;
|
||||||
|
|
||||||
public class BigDecimalConverter implements Converter<String, BigDecimal, Component>
|
public class BigDecimalConverter implements Converter<String, BigDecimal, Component>
|
||||||
@@ -25,8 +23,7 @@ public class BigDecimalConverter implements Converter<String, BigDecimal, Compon
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Locale loc = Locales.getCurrent();
|
DecimalFormat format = new DecimalFormat();
|
||||||
DecimalFormat format = (DecimalFormat) DecimalFormat.getInstance(loc);
|
|
||||||
format.setParseBigDecimal(true);
|
format.setParseBigDecimal(true);
|
||||||
val = (BigDecimal) format.parse(str);
|
val = (BigDecimal) format.parse(str);
|
||||||
}
|
}
|
||||||
@@ -46,9 +43,6 @@ public class BigDecimalConverter implements Converter<String, BigDecimal, Compon
|
|||||||
@Override
|
@Override
|
||||||
public String coerceToUi(BigDecimal val, Component component, BindContext cx)
|
public String coerceToUi(BigDecimal val, Component component, BindContext cx)
|
||||||
{
|
{
|
||||||
// String lang = Executions.getCurrent().getHeader("accept-language");
|
|
||||||
Locale loc = Locales.getCurrent();
|
|
||||||
|
|
||||||
if (val == null)
|
if (val == null)
|
||||||
{
|
{
|
||||||
val = BigDecimal.ZERO;
|
val = BigDecimal.ZERO;
|
||||||
@@ -56,13 +50,13 @@ public class BigDecimalConverter implements Converter<String, BigDecimal, Compon
|
|||||||
|
|
||||||
val = val.setScale(2, BigDecimal.ROUND_DOWN);
|
val = val.setScale(2, BigDecimal.ROUND_DOWN);
|
||||||
|
|
||||||
DecimalFormat format = (DecimalFormat) DecimalFormat.getInstance(loc);
|
DecimalFormat format = new DecimalFormat();
|
||||||
format.setMaximumFractionDigits(2);
|
format.setMaximumFractionDigits(2);
|
||||||
format.setMinimumFractionDigits(2);
|
format.setMinimumFractionDigits(2);
|
||||||
format.setGroupingUsed(true);
|
format.setGroupingUsed(true);
|
||||||
format.setGroupingSize(3);
|
format.setGroupingSize(3);
|
||||||
String formatted = format.format(val);
|
|
||||||
return formatted;
|
return format.format(val);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package info.bukova.isspst.ui;
|
|||||||
|
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
|
|
||||||
import org.apache.commons.beanutils.PropertyUtils;
|
import org.apache.commons.beanutils.BeanUtils;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.zkoss.bind.SimpleForm;
|
import org.zkoss.bind.SimpleForm;
|
||||||
@@ -34,40 +34,12 @@ public class BindingForm<T> extends SimpleForm {
|
|||||||
*/
|
*/
|
||||||
public void bindTo(T object) {
|
public void bindTo(T object) {
|
||||||
for (String key : getFieldNames()) {
|
for (String key : getFieldNames()) {
|
||||||
// try {
|
try {
|
||||||
// BeanUtils.setProperty(object, key, getField(key));
|
BeanUtils.setProperty(object, key, getField(key));
|
||||||
//
|
} catch (IllegalAccessException e) {
|
||||||
// } catch (IllegalAccessException e) {
|
|
||||||
// logger.warn("Cannot bind value", e);
|
|
||||||
// } catch (InvocationTargetException e) {
|
|
||||||
// logger.warn("Cannot bind value", e);
|
|
||||||
// }
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (PropertyUtils.getPropertyType(object, key).isPrimitive()
|
|
||||||
&& (getField(key) == null))
|
|
||||||
{
|
|
||||||
PropertyUtils.setProperty(object, key, 0);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
PropertyUtils.setProperty(object, key, getField(key));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (NoSuchMethodException e)
|
|
||||||
{
|
|
||||||
logger.warn("Cannot bind value " + key + " (" + e.getMessage() + ")");
|
|
||||||
// e.printStackTrace();
|
|
||||||
}
|
|
||||||
catch (IllegalAccessException e)
|
|
||||||
{
|
|
||||||
logger.warn("Cannot bind value", e);
|
logger.warn("Cannot bind value", e);
|
||||||
e.printStackTrace();
|
} catch (InvocationTargetException e) {
|
||||||
}
|
|
||||||
catch (InvocationTargetException e)
|
|
||||||
{
|
|
||||||
logger.warn("Cannot bind value", e);
|
logger.warn("Cannot bind value", e);
|
||||||
e.printStackTrace();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,22 +6,16 @@ import org.zkoss.bind.BindContext;
|
|||||||
import org.zkoss.bind.Converter;
|
import org.zkoss.bind.Converter;
|
||||||
import org.zkoss.zk.ui.Component;
|
import org.zkoss.zk.ui.Component;
|
||||||
|
|
||||||
public class BoolConverter implements Converter<String, Boolean, Component>
|
public class BoolConverter implements Converter<String, Boolean, Component> {
|
||||||
{
|
|
||||||
@Override
|
@Override
|
||||||
public Boolean coerceToBean(String str, Component component, BindContext cx)
|
public Boolean coerceToBean(String str, Component component, BindContext cx) {
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String coerceToUi(Boolean val, Component component, BindContext cx)
|
public String coerceToUi(Boolean val, Component component, BindContext cx) {
|
||||||
{
|
|
||||||
if (val == null)
|
|
||||||
{
|
|
||||||
val = new Boolean(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
return StringUtils.localize(val.toString());
|
return StringUtils.localize(val.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,8 +17,6 @@ public class DocumentViewModel
|
|||||||
{
|
{
|
||||||
protected BigDecimalConverter standardBigDecimalConverter;
|
protected BigDecimalConverter standardBigDecimalConverter;
|
||||||
|
|
||||||
protected BoolConverter standardBoolConverter;
|
|
||||||
|
|
||||||
public BigDecimalConverter getStandardBigDecimalConverter()
|
public BigDecimalConverter getStandardBigDecimalConverter()
|
||||||
{
|
{
|
||||||
return standardBigDecimalConverter;
|
return standardBigDecimalConverter;
|
||||||
@@ -29,21 +27,10 @@ public class DocumentViewModel
|
|||||||
this.standardBigDecimalConverter = standardBigDecimalConverter;
|
this.standardBigDecimalConverter = standardBigDecimalConverter;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BoolConverter getStandardBoolConverter()
|
|
||||||
{
|
|
||||||
return standardBoolConverter;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setStandardBoolConverter(BoolConverter standardBoolConverter)
|
|
||||||
{
|
|
||||||
this.standardBoolConverter = standardBoolConverter;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Init
|
@Init
|
||||||
public void initDocumentViewModel()
|
public void initDocumentViewModel()
|
||||||
{
|
{
|
||||||
this.standardBigDecimalConverter = new BigDecimalConverter();
|
this.standardBigDecimalConverter = new BigDecimalConverter();
|
||||||
this.standardBoolConverter = new BoolConverter();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Command
|
@Command
|
||||||
|
|||||||
@@ -300,7 +300,6 @@ public class ListViewModel<T extends DataModel> extends DocumentViewModel
|
|||||||
|
|
||||||
if (selIndex > -1) {
|
if (selIndex > -1) {
|
||||||
this.setDataBean(dataList.get(selIndex));
|
this.setDataBean(dataList.get(selIndex));
|
||||||
afterSelect();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -308,10 +307,6 @@ public class ListViewModel<T extends DataModel> extends DocumentViewModel
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void afterSelect() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Command
|
@Command
|
||||||
@NotifyChange("dataBean")
|
@NotifyChange("dataBean")
|
||||||
public void onSort(@BindingParam("column") String column) {
|
public void onSort(@BindingParam("column") String column) {
|
||||||
@@ -340,6 +335,26 @@ public class ListViewModel<T extends DataModel> extends DocumentViewModel
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// private void loadFromDb() {
|
||||||
|
// Thread fillThread = new Thread(new Runnable() {
|
||||||
|
//
|
||||||
|
// @Override
|
||||||
|
// public void run() {
|
||||||
|
// tmpList = service.getAll();
|
||||||
|
//
|
||||||
|
// try {
|
||||||
|
// Thread.sleep(200);
|
||||||
|
// } catch (InterruptedException e) {
|
||||||
|
// e.printStackTrace();
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// fullFill = true;
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
//
|
||||||
|
// fillThread.start();
|
||||||
|
// }
|
||||||
|
|
||||||
@Command
|
@Command
|
||||||
public void onPrint() {
|
public void onPrint() {
|
||||||
Map<String, Object> params = new HashMap<String, Object>();
|
Map<String, Object> params = new HashMap<String, Object>();
|
||||||
@@ -385,9 +400,4 @@ public class ListViewModel<T extends DataModel> extends DocumentViewModel
|
|||||||
{
|
{
|
||||||
return this.isRecordSelected();
|
return this.isRecordSelected();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isAbleToAdd()
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package info.bukova.isspst.ui.dashboard;
|
|||||||
import info.bukova.isspst.data.Role;
|
import info.bukova.isspst.data.Role;
|
||||||
import info.bukova.isspst.data.User;
|
import info.bukova.isspst.data.User;
|
||||||
import info.bukova.isspst.data.Workgroup;
|
import info.bukova.isspst.data.Workgroup;
|
||||||
import info.bukova.isspst.services.invoicing.InvoicingService;
|
import info.bukova.isspst.services.approved.OrderService;
|
||||||
import info.bukova.isspst.services.users.UserService;
|
import info.bukova.isspst.services.users.UserService;
|
||||||
import info.bukova.isspst.services.workgroups.WorkgroupService;
|
import info.bukova.isspst.services.workgroups.WorkgroupService;
|
||||||
import info.bukova.isspst.ui.DocumentViewModel;
|
import info.bukova.isspst.ui.DocumentViewModel;
|
||||||
@@ -24,7 +24,7 @@ public class DashBoardVM extends DocumentViewModel {
|
|||||||
@WireVariable
|
@WireVariable
|
||||||
private UserService userService;
|
private UserService userService;
|
||||||
@WireVariable
|
@WireVariable
|
||||||
private InvoicingService invoicingService;
|
private OrderService orderService;
|
||||||
private User user;
|
private User user;
|
||||||
private Map<Workgroup, List<Role>> groupRoles;
|
private Map<Workgroup, List<Role>> groupRoles;
|
||||||
private Map<Workgroup, BigDecimal> workgroupSpent;
|
private Map<Workgroup, BigDecimal> workgroupSpent;
|
||||||
@@ -47,7 +47,7 @@ public class DashBoardVM extends DocumentViewModel {
|
|||||||
for (Workgroup w : wg) {
|
for (Workgroup w : wg) {
|
||||||
List<Role> r = workgroupService.getUserWorkgroupRoles(w, user);
|
List<Role> r = workgroupService.getUserWorkgroupRoles(w, user);
|
||||||
groupRoles.put(w, r);
|
groupRoles.put(w, r);
|
||||||
workgroupSpent.put(w, invoicingService.totalInvoicedForWorkgroup(w));
|
workgroupSpent.put(w, orderService.totalOrderedForWorkgroup(w));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,8 +5,8 @@ import info.bukova.isspst.data.Order;
|
|||||||
import info.bukova.isspst.data.User;
|
import info.bukova.isspst.data.User;
|
||||||
import info.bukova.isspst.data.Workgroup;
|
import info.bukova.isspst.data.Workgroup;
|
||||||
import info.bukova.isspst.filters.JoinedItemFilter;
|
import info.bukova.isspst.filters.JoinedItemFilter;
|
||||||
import info.bukova.isspst.services.orders.ApprovedService;
|
import info.bukova.isspst.services.approved.ApprovedService;
|
||||||
import info.bukova.isspst.services.orders.OrderService;
|
import info.bukova.isspst.services.approved.OrderService;
|
||||||
import info.bukova.isspst.services.users.UserService;
|
import info.bukova.isspst.services.users.UserService;
|
||||||
import info.bukova.isspst.services.workgroups.WorkgroupService;
|
import info.bukova.isspst.services.workgroups.WorkgroupService;
|
||||||
import info.bukova.isspst.ui.BigDecimalConverter;
|
import info.bukova.isspst.ui.BigDecimalConverter;
|
||||||
|
|||||||
@@ -1,80 +0,0 @@
|
|||||||
package info.bukova.isspst.ui.main.invoicing;
|
|
||||||
|
|
||||||
import info.bukova.isspst.data.Invoicing;
|
|
||||||
import info.bukova.isspst.data.InvoicingItem;
|
|
||||||
import info.bukova.isspst.services.invoicing.InvoicingService;
|
|
||||||
import info.bukova.isspst.ui.FormViewModel;
|
|
||||||
|
|
||||||
import org.zkoss.bind.annotation.BindingParam;
|
|
||||||
import org.zkoss.bind.annotation.Command;
|
|
||||||
import org.zkoss.bind.annotation.Init;
|
|
||||||
import org.zkoss.bind.annotation.NotifyChange;
|
|
||||||
import org.zkoss.zk.ui.select.annotation.WireVariable;
|
|
||||||
|
|
||||||
public class InvoicingForm extends FormViewModel<Invoicing> {
|
|
||||||
|
|
||||||
private InvoicingItem selectedItem;
|
|
||||||
private int selectedIndex;
|
|
||||||
@WireVariable
|
|
||||||
private InvoicingService invoicingService;
|
|
||||||
|
|
||||||
@Init(superclass = true)
|
|
||||||
public void init() {
|
|
||||||
selectedIndex = -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void selectItem(InvoicingItem item) {
|
|
||||||
if (item != null) {
|
|
||||||
selectedItem = item;
|
|
||||||
selectedIndex = getDataBean().getItems().indexOf(item);
|
|
||||||
} else {
|
|
||||||
selectedItem = null;
|
|
||||||
selectedIndex = -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Command
|
|
||||||
@NotifyChange({"dataBean", "selectedItem", "selectedIndex"})
|
|
||||||
public void addItem() {
|
|
||||||
InvoicingItem item = new InvoicingItem();
|
|
||||||
getDataBean().getItems().add(item);
|
|
||||||
selectItem(item);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Command
|
|
||||||
@NotifyChange({"dataBean", "selectedItem", "selectedIndex"})
|
|
||||||
public void removeItem(@BindingParam("item") InvoicingItem item) {
|
|
||||||
getDataBean().getItems().remove(item);
|
|
||||||
selectItem(null);
|
|
||||||
calculate();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Command
|
|
||||||
@NotifyChange({"selectedItem", "selectedIndex"})
|
|
||||||
public void onFocus(@BindingParam("item") InvoicingItem item) {
|
|
||||||
selectItem(item);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Command
|
|
||||||
@NotifyChange("dataBean")
|
|
||||||
public void calculate() {
|
|
||||||
invoicingService.calculate(getDataBean());
|
|
||||||
}
|
|
||||||
|
|
||||||
public InvoicingItem getSelectedItem() {
|
|
||||||
return selectedItem;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSelectedItem(InvoicingItem selectedItem) {
|
|
||||||
this.selectedItem = selectedItem;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getSelectedIndex() {
|
|
||||||
return selectedIndex;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSelectedIndex(int selectedIndex) {
|
|
||||||
this.selectedIndex = selectedIndex;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,48 +0,0 @@
|
|||||||
package info.bukova.isspst.ui.main.invoicing;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import info.bukova.isspst.data.Invoicing;
|
|
||||||
import info.bukova.isspst.data.Workgroup;
|
|
||||||
import info.bukova.isspst.filters.InvoicingFilter;
|
|
||||||
import info.bukova.isspst.services.invoicing.InvoicingService;
|
|
||||||
import info.bukova.isspst.services.workgroups.WorkgroupService;
|
|
||||||
import info.bukova.isspst.ui.ListViewModel;
|
|
||||||
|
|
||||||
import org.zkoss.bind.annotation.Init;
|
|
||||||
import org.zkoss.zk.ui.select.annotation.WireVariable;
|
|
||||||
|
|
||||||
public class InvoicingList extends ListViewModel<Invoicing> {
|
|
||||||
|
|
||||||
@WireVariable
|
|
||||||
private InvoicingService invoicingService;
|
|
||||||
@WireVariable
|
|
||||||
private WorkgroupService workgroupService;
|
|
||||||
|
|
||||||
@Init(superclass = true)
|
|
||||||
public void initInvoicing() {
|
|
||||||
service = invoicingService;
|
|
||||||
dataClass = Invoicing.class;
|
|
||||||
formZul = "invoicingForm.zul";
|
|
||||||
dataFilter = new InvoicingFilter(getFilterTemplate());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isAbleToAdd() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isAbleToDelete() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<Workgroup> getCentres() {
|
|
||||||
return workgroupService.getCentres();
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<Workgroup> getWorkgroups() {
|
|
||||||
return workgroupService.getWorkgroups();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -4,18 +4,14 @@ import info.bukova.isspst.data.Address;
|
|||||||
import info.bukova.isspst.data.AddressEmb;
|
import info.bukova.isspst.data.AddressEmb;
|
||||||
import info.bukova.isspst.data.Order;
|
import info.bukova.isspst.data.Order;
|
||||||
import info.bukova.isspst.data.OrderItem;
|
import info.bukova.isspst.data.OrderItem;
|
||||||
import info.bukova.isspst.services.IsspstException;
|
|
||||||
import info.bukova.isspst.services.addressbook.AdbService;
|
import info.bukova.isspst.services.addressbook.AdbService;
|
||||||
import info.bukova.isspst.services.addressbook.AddressFinder;
|
import info.bukova.isspst.services.approved.OrderService;
|
||||||
import info.bukova.isspst.services.orders.OrderService;
|
|
||||||
import info.bukova.isspst.services.settings.GlobalSettingsService;
|
import info.bukova.isspst.services.settings.GlobalSettingsService;
|
||||||
import info.bukova.isspst.ui.FormViewModel;
|
import info.bukova.isspst.ui.FormViewModel;
|
||||||
import info.bukova.isspst.validators.OrderFormValidator;
|
import info.bukova.isspst.validators.OrderFormValidator;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@@ -23,13 +19,9 @@ import org.zkoss.bind.BindUtils;
|
|||||||
import org.zkoss.bind.SimpleForm;
|
import org.zkoss.bind.SimpleForm;
|
||||||
import org.zkoss.bind.annotation.BindingParam;
|
import org.zkoss.bind.annotation.BindingParam;
|
||||||
import org.zkoss.bind.annotation.Command;
|
import org.zkoss.bind.annotation.Command;
|
||||||
import org.zkoss.bind.annotation.GlobalCommand;
|
|
||||||
import org.zkoss.bind.annotation.Init;
|
import org.zkoss.bind.annotation.Init;
|
||||||
import org.zkoss.bind.annotation.NotifyChange;
|
import org.zkoss.bind.annotation.NotifyChange;
|
||||||
import org.zkoss.zk.ui.Executions;
|
|
||||||
import org.zkoss.zk.ui.select.annotation.WireVariable;
|
import org.zkoss.zk.ui.select.annotation.WireVariable;
|
||||||
import org.zkoss.zul.Messagebox;
|
|
||||||
import org.zkoss.zul.Window;
|
|
||||||
import org.zkoss.zul.impl.InputElement;
|
import org.zkoss.zul.impl.InputElement;
|
||||||
|
|
||||||
public class OrderForm extends FormViewModel<Order>
|
public class OrderForm extends FormViewModel<Order>
|
||||||
@@ -37,11 +29,7 @@ public class OrderForm extends FormViewModel<Order>
|
|||||||
private final static Logger log = LoggerFactory.getLogger(OrderForm.class.getName());
|
private final static Logger log = LoggerFactory.getLogger(OrderForm.class.getName());
|
||||||
|
|
||||||
@WireVariable
|
@WireVariable
|
||||||
private AdbService adbService;
|
protected AdbService adbService;
|
||||||
@WireVariable
|
|
||||||
private AddressFinder addressFinderAres;
|
|
||||||
@WireVariable
|
|
||||||
private AddressFinder addressFinderTaxID;
|
|
||||||
|
|
||||||
@WireVariable
|
@WireVariable
|
||||||
protected GlobalSettingsService settingsService;
|
protected GlobalSettingsService settingsService;
|
||||||
@@ -63,29 +51,19 @@ public class OrderForm extends FormViewModel<Order>
|
|||||||
|
|
||||||
protected List<OrderItem> syncOrderItems;
|
protected List<OrderItem> syncOrderItems;
|
||||||
|
|
||||||
/**
|
|
||||||
* Obsah záznamu před editací
|
|
||||||
*/
|
|
||||||
protected Order recordBeforeEdit;
|
|
||||||
|
|
||||||
@Init(superclass = true)
|
@Init(superclass = true)
|
||||||
public void initOrderForm()
|
public void initOrderForm()
|
||||||
{
|
{
|
||||||
this.orderFormValidator = new OrderFormValidator();
|
this.orderFormValidator = new OrderFormValidator();
|
||||||
|
|
||||||
if (getDataBean().getSuplier() != null)
|
if (this.getDataBean().getSuplier() == null)
|
||||||
{
|
|
||||||
if (getDataBean().getSuplier().getAddress().getId() != 0)
|
|
||||||
{
|
|
||||||
this.selectedSuppAddrItem = this.getDataBean().getSuplier().getAddress();
|
|
||||||
}
|
|
||||||
this.suppCompany = getDataBean().getSuplier().getCompany();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
this.getDataBean().setSuplier(new AddressEmb());
|
this.getDataBean().setSuplier(new AddressEmb());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.selectedSuppAddrItem = this.getDataBean().getSuplier().getAddress();
|
||||||
|
this.suppCompany = this.selectedSuppAddrItem.getCompany();
|
||||||
|
|
||||||
if (this.getDataBean().getDeliveryAddress() == null)
|
if (this.getDataBean().getDeliveryAddress() == null)
|
||||||
{
|
{
|
||||||
this.getDataBean().setDeliveryAddress(new AddressEmb());
|
this.getDataBean().setDeliveryAddress(new AddressEmb());
|
||||||
@@ -100,16 +78,6 @@ public class OrderForm extends FormViewModel<Order>
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.syncOrderItems = this.getDataBean().getItems();
|
this.syncOrderItems = this.getDataBean().getItems();
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
this.recordBeforeEdit = (Order) this.getDataBean().clone();
|
|
||||||
}
|
|
||||||
catch (CloneNotSupportedException e)
|
|
||||||
{
|
|
||||||
log.error("Nelze provést hlubokou kopii objednávky!");
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public OrderFormValidator getOrderFormValidator()
|
public OrderFormValidator getOrderFormValidator()
|
||||||
@@ -197,21 +165,10 @@ public class OrderForm extends FormViewModel<Order>
|
|||||||
this.syncOrderItems = syncOrderItems;
|
this.syncOrderItems = syncOrderItems;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Order getRecordBeforeEdit()
|
|
||||||
{
|
|
||||||
return recordBeforeEdit;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRecordBeforeEdit(Order recordBeforeEdit)
|
|
||||||
{
|
|
||||||
this.recordBeforeEdit = recordBeforeEdit;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Command
|
@Command
|
||||||
@NotifyChange("dataBean")
|
@NotifyChange("dataBean")
|
||||||
public void doFillSuppAddress()
|
public void doFillSuppAddress()
|
||||||
{
|
{
|
||||||
this.getDataForm().bind();
|
|
||||||
AddressEmb addr;
|
AddressEmb addr;
|
||||||
|
|
||||||
if (this.selectedSuppAddrItem == null)
|
if (this.selectedSuppAddrItem == null)
|
||||||
@@ -233,7 +190,6 @@ public class OrderForm extends FormViewModel<Order>
|
|||||||
@NotifyChange("dataBean")
|
@NotifyChange("dataBean")
|
||||||
public void doFillDeliveryAddress()
|
public void doFillDeliveryAddress()
|
||||||
{
|
{
|
||||||
this.getDataForm().bind();
|
|
||||||
AddressEmb addr;
|
AddressEmb addr;
|
||||||
|
|
||||||
if (this.selectedDeliveryAddrItem == null)
|
if (this.selectedDeliveryAddrItem == null)
|
||||||
@@ -296,70 +252,4 @@ public class OrderForm extends FormViewModel<Order>
|
|||||||
// Calculate total price at form
|
// Calculate total price at form
|
||||||
this.calcAndUpdateFormTotalPrice(form);
|
this.calcAndUpdateFormTotalPrice(form);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void doSave()
|
|
||||||
{
|
|
||||||
// Zjisti, zda se změnil příznak objednávky (objednáno/neobjednáno)
|
|
||||||
boolean orderedChanged = (this.recordBeforeEdit.isOrdered() != this.getDataBean().isOrdered());
|
|
||||||
// Aktualizovat příznak schválených položek, aby se nemohli vložit do
|
|
||||||
// jiných objednávek
|
|
||||||
orderService.updateApprovedItems(this.getDataBean(), orderedChanged);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Command
|
|
||||||
@NotifyChange({"dataBean", "suppCompany"})
|
|
||||||
public void searchAddress()
|
|
||||||
{
|
|
||||||
getDataForm().bind();
|
|
||||||
|
|
||||||
Address adr = getDataBean().getSuplier().getAddress();
|
|
||||||
|
|
||||||
if (adr.getIc() != 0)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
adbService.fillFoundData(addressFinderTaxID, adr);
|
|
||||||
getDataBean().setSuplier(new AddressEmb(adr));
|
|
||||||
suppCompany = adr.getCompany();
|
|
||||||
}
|
|
||||||
catch (IsspstException e)
|
|
||||||
{
|
|
||||||
Messagebox.show("Chyba při hledání adresy", "Chyba", Messagebox.OK, Messagebox.ERROR);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Map<String, List<Address>> arg = new HashMap<String, List<Address>>();
|
|
||||||
try {
|
|
||||||
arg.put("result", adbService.lookForAddr(addressFinderAres, adr));
|
|
||||||
} catch (IsspstException e) {
|
|
||||||
Messagebox.show("Chyba při hledání adresy", "Chyba", Messagebox.OK, Messagebox.ERROR);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Window resWin = (Window) Executions.createComponents("/lists/addressbook/addrFindResult.zul", null, arg);
|
|
||||||
resWin.doModal();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@GlobalCommand
|
|
||||||
@NotifyChange({"dataBean", "suppCompany"})
|
|
||||||
public void selectAddress(@BindingParam("selected") Address selected, @BindingParam("window") Window window) {
|
|
||||||
try {
|
|
||||||
adbService.fillFoundData(addressFinderTaxID, selected);
|
|
||||||
} catch (IsspstException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
Address adr = getDataBean().getSuplier().getAddress();
|
|
||||||
adbService.mergeAddress(adr, selected, true);
|
|
||||||
getDataBean().setSuplier(new AddressEmb(adr));
|
|
||||||
suppCompany = adr.getCompany();
|
|
||||||
|
|
||||||
if (window != null)
|
|
||||||
window.detach();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,11 +9,10 @@ import info.bukova.isspst.data.SettingsData;
|
|||||||
import info.bukova.isspst.data.User;
|
import info.bukova.isspst.data.User;
|
||||||
import info.bukova.isspst.filters.OrderFilter;
|
import info.bukova.isspst.filters.OrderFilter;
|
||||||
import info.bukova.isspst.services.addressbook.AdbService;
|
import info.bukova.isspst.services.addressbook.AdbService;
|
||||||
import info.bukova.isspst.services.orders.OrderService;
|
import info.bukova.isspst.services.approved.OrderService;
|
||||||
import info.bukova.isspst.services.settings.GlobalSettingsService;
|
import info.bukova.isspst.services.settings.GlobalSettingsService;
|
||||||
import info.bukova.isspst.services.users.UserService;
|
import info.bukova.isspst.services.users.UserService;
|
||||||
import info.bukova.isspst.ui.ListViewModel;
|
import info.bukova.isspst.ui.ListViewModel;
|
||||||
import info.bukova.isspst.ui.renderers.OrderCreatedItemRenderer;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -48,8 +47,6 @@ public class OrderList extends ListViewModel<Order>
|
|||||||
|
|
||||||
protected List<OrderItem> orderItems;
|
protected List<OrderItem> orderItems;
|
||||||
|
|
||||||
protected OrderCreatedItemRenderer orderCreatedItemRenderer;
|
|
||||||
|
|
||||||
@Init(superclass = true)
|
@Init(superclass = true)
|
||||||
public void initOrderList()
|
public void initOrderList()
|
||||||
{
|
{
|
||||||
@@ -58,7 +55,6 @@ public class OrderList extends ListViewModel<Order>
|
|||||||
formZul = "orderForm.zul";
|
formZul = "orderForm.zul";
|
||||||
dataFilter = new OrderFilter(getFilterTemplate());
|
dataFilter = new OrderFilter(getFilterTemplate());
|
||||||
this.orderItems = new ArrayList<OrderItem>();
|
this.orderItems = new ArrayList<OrderItem>();
|
||||||
this.orderCreatedItemRenderer = new OrderCreatedItemRenderer();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<AddressEmb> getSuppAddresses()
|
public List<AddressEmb> getSuppAddresses()
|
||||||
@@ -121,16 +117,6 @@ public class OrderList extends ListViewModel<Order>
|
|||||||
this.orderItems = orderItems;
|
this.orderItems = orderItems;
|
||||||
}
|
}
|
||||||
|
|
||||||
public OrderCreatedItemRenderer getOrderCreatedItemRenderer()
|
|
||||||
{
|
|
||||||
return orderCreatedItemRenderer;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setOrderCreatedItemRenderer(OrderCreatedItemRenderer orderCreatedItemRenderer)
|
|
||||||
{
|
|
||||||
this.orderCreatedItemRenderer = orderCreatedItemRenderer;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Command
|
@Command
|
||||||
@NotifyChange("orderItems")
|
@NotifyChange("orderItems")
|
||||||
public void onChangeSelectOrder(@BindingParam("ctrl") Listbox lb)
|
public void onChangeSelectOrder(@BindingParam("ctrl") Listbox lb)
|
||||||
|
|||||||
@@ -17,9 +17,10 @@ public class ReqMaterialListMy extends ReqListMy
|
|||||||
@WireVariable
|
@WireVariable
|
||||||
protected RequirementService reqMaterialService;
|
protected RequirementService reqMaterialService;
|
||||||
|
|
||||||
@Init(superclass = true)
|
@Init
|
||||||
public void initReqMaterialListMy()
|
public void init()
|
||||||
{
|
{
|
||||||
|
super.init();
|
||||||
service = reqMaterialService;
|
service = reqMaterialService;
|
||||||
formZul = "/main/orders/material/reqHeadForm.zul";
|
formZul = "/main/orders/material/reqHeadForm.zul";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,9 +17,10 @@ public class ReqMaterialListMyAll extends ReqListMyAll
|
|||||||
@WireVariable
|
@WireVariable
|
||||||
protected RequirementService reqMaterialService;
|
protected RequirementService reqMaterialService;
|
||||||
|
|
||||||
@Init(superclass = true)
|
@Init
|
||||||
public void initReqMaterialListMyAll()
|
public void init()
|
||||||
{
|
{
|
||||||
|
super.init();
|
||||||
service = reqMaterialService;
|
service = reqMaterialService;
|
||||||
formZul = "/main/orders/material/reqHeadForm.zul";
|
formZul = "/main/orders/material/reqHeadForm.zul";
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-2
@@ -17,9 +17,10 @@ public class ReqMaterialListMyCenters extends ReqListMyCenters
|
|||||||
@WireVariable
|
@WireVariable
|
||||||
protected RequirementService reqMaterialService;
|
protected RequirementService reqMaterialService;
|
||||||
|
|
||||||
@Init(superclass = true)
|
@Init
|
||||||
public void initReqMaterialListMyCenters()
|
public void init()
|
||||||
{
|
{
|
||||||
|
super.init();
|
||||||
service = reqMaterialService;
|
service = reqMaterialService;
|
||||||
formZul = "/main/orders/material/reqHeadForm.zul";
|
formZul = "/main/orders/material/reqHeadForm.zul";
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-2
@@ -17,9 +17,10 @@ public class ReqMaterialListMyWorkgroups extends ReqListMyWorkgroups
|
|||||||
@WireVariable
|
@WireVariable
|
||||||
protected RequirementService reqMaterialService;
|
protected RequirementService reqMaterialService;
|
||||||
|
|
||||||
@Init(superclass = true)
|
@Init
|
||||||
public void initReqMaterialListMyWorkgroups()
|
public void init()
|
||||||
{
|
{
|
||||||
|
super.init();
|
||||||
service = reqMaterialService;
|
service = reqMaterialService;
|
||||||
formZul = "/main/orders/material/reqHeadForm.zul";
|
formZul = "/main/orders/material/reqHeadForm.zul";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,9 +28,10 @@ public class ReqListMy extends RequirementSubpage<Requirement>
|
|||||||
return workgroupService.getCentres();
|
return workgroupService.getCentres();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Init(superclass = true)
|
@Init
|
||||||
public void initReqListMy()
|
public void init()
|
||||||
{
|
{
|
||||||
|
super.init();
|
||||||
service = requirementService;
|
service = requirementService;
|
||||||
dataClass = Requirement.class;
|
dataClass = Requirement.class;
|
||||||
formZul = "/main/orders/requirements/reqForm.zul";
|
formZul = "/main/orders/requirements/reqForm.zul";
|
||||||
|
|||||||
@@ -30,9 +30,10 @@ public class ReqListMyAll extends RequirementSubpage<Requirement>
|
|||||||
return workgroupService.getCentres();
|
return workgroupService.getCentres();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Init(superclass = true)
|
@Init
|
||||||
public void initReqListMyAll()
|
public void init()
|
||||||
{
|
{
|
||||||
|
super.init();
|
||||||
service = requirementService;
|
service = requirementService;
|
||||||
dataClass = Requirement.class;
|
dataClass = Requirement.class;
|
||||||
formZul = "/main/orders/requirements/reqForm.zul";
|
formZul = "/main/orders/requirements/reqForm.zul";
|
||||||
|
|||||||
@@ -30,9 +30,10 @@ public class ReqListMyCenters extends RequirementSubpage<Requirement>
|
|||||||
return workgroupService.getUserCentres(userService.getCurrent());
|
return workgroupService.getUserCentres(userService.getCurrent());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Init(superclass = true)
|
@Init
|
||||||
public void initReqListMyCenters()
|
public void init()
|
||||||
{
|
{
|
||||||
|
super.init();
|
||||||
service = requirementService;
|
service = requirementService;
|
||||||
dataClass = Requirement.class;
|
dataClass = Requirement.class;
|
||||||
formZul = "/main/orders/requirements/reqForm.zul";
|
formZul = "/main/orders/requirements/reqForm.zul";
|
||||||
|
|||||||
+3
-2
@@ -30,9 +30,10 @@ public class ReqListMyWorkgroups extends RequirementSubpage<Requirement>
|
|||||||
return workgroupService.getCentres();
|
return workgroupService.getCentres();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Init(superclass = true)
|
@Init
|
||||||
public void initReqListMyWorkgroups()
|
public void init()
|
||||||
{
|
{
|
||||||
|
super.init();
|
||||||
service = requirementService;
|
service = requirementService;
|
||||||
dataClass = Requirement.class;
|
dataClass = Requirement.class;
|
||||||
formZul = "/main/orders/requirements/reqForm.zul";
|
formZul = "/main/orders/requirements/reqForm.zul";
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package info.bukova.isspst.ui.main.orders.requirements;
|
package info.bukova.isspst.ui.main.orders.requirements;
|
||||||
|
|
||||||
import info.bukova.isspst.data.MUnitEmb;
|
|
||||||
import info.bukova.isspst.data.Material;
|
import info.bukova.isspst.data.Material;
|
||||||
import info.bukova.isspst.data.Requirement;
|
import info.bukova.isspst.data.Requirement;
|
||||||
import info.bukova.isspst.data.RequirementItem;
|
import info.bukova.isspst.data.RequirementItem;
|
||||||
@@ -126,7 +125,6 @@ public class RequirementForm extends FormViewModel<Requirement>
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Command
|
@Command
|
||||||
@NotifyChange({ "selItemIndex", "selectedItem" })
|
|
||||||
public void onFocusItem(@BindingParam("item") RequirementItem item, @BindingParam("ctrl") InputElement ctrl)
|
public void onFocusItem(@BindingParam("item") RequirementItem item, @BindingParam("ctrl") InputElement ctrl)
|
||||||
{
|
{
|
||||||
this.selItemIndex = this.getDataBean().getItems().indexOf(item);
|
this.selItemIndex = this.getDataBean().getItems().indexOf(item);
|
||||||
@@ -149,20 +147,19 @@ public class RequirementForm extends FormViewModel<Requirement>
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Command
|
@Command
|
||||||
@NotifyChange({ "syncItems", "selItemIndex", "selectedItem" })
|
@NotifyChange({ "syncItems", "selItemIndex" })
|
||||||
public void removeItem(@BindingParam("form") SimpleForm form, @BindingParam("item") RequirementItem item)
|
public void removeItem(@BindingParam("form") SimpleForm form, @BindingParam("item") RequirementItem item)
|
||||||
{
|
{
|
||||||
if (item != null)
|
if (item != null)
|
||||||
{
|
{
|
||||||
this.getDataBean().getItems().remove(item);
|
this.getDataBean().getItems().remove(item);
|
||||||
this.selItemIndex = -1;
|
this.setSelItemIndex(-1);
|
||||||
this.selectedItem = null;
|
|
||||||
this.calcAndUpdateFormTotalPrice(form);
|
this.calcAndUpdateFormTotalPrice(form);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@GlobalCommand("insertSelectedItem")
|
@GlobalCommand("insertSelectedItem")
|
||||||
@NotifyChange({ "syncItems", "selItemIndex", "selectedItem" })
|
@NotifyChange({ "syncItems", "selItemIndex" })
|
||||||
public void insertSelectedItem(@BindingParam("selected") RequirementSubject selected, @BindingParam("window") Window window)
|
public void insertSelectedItem(@BindingParam("selected") RequirementSubject selected, @BindingParam("window") Window window)
|
||||||
{
|
{
|
||||||
if (selected != null)
|
if (selected != null)
|
||||||
@@ -198,7 +195,7 @@ public class RequirementForm extends FormViewModel<Requirement>
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Command
|
@Command
|
||||||
@NotifyChange({ "selectedItem" })
|
@NotifyChange({ "selectedItem", "syncItems" })
|
||||||
public void recalculate(@BindingParam("form") SimpleForm form, @BindingParam("changed") String source)
|
public void recalculate(@BindingParam("form") SimpleForm form, @BindingParam("changed") String source)
|
||||||
{
|
{
|
||||||
if (this.selectedItem == null)
|
if (this.selectedItem == null)
|
||||||
@@ -222,7 +219,7 @@ public class RequirementForm extends FormViewModel<Requirement>
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Command
|
@Command
|
||||||
@NotifyChange({ "selectedItem" })
|
@NotifyChange({ "selectedItem", "syncItems" })
|
||||||
public void onChangeGroup()
|
public void onChangeGroup()
|
||||||
{
|
{
|
||||||
// Někdo změnil skupinu materiálu nebo služby
|
// Někdo změnil skupinu materiálu nebo služby
|
||||||
@@ -237,15 +234,6 @@ public class RequirementForm extends FormViewModel<Requirement>
|
|||||||
|
|
||||||
if (subject != null)
|
if (subject != null)
|
||||||
{
|
{
|
||||||
boolean isMaterial = (subject instanceof Material);
|
|
||||||
|
|
||||||
if (isMaterial)
|
|
||||||
{
|
|
||||||
Material materialItem = (Material) subject;
|
|
||||||
MUnitEmb munit = materialItem.getMunit();
|
|
||||||
this.selectedItem.setMunit(munit);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Skupina materiálu nebo služeb je propojená, nastavit k zadanému
|
// Skupina materiálu nebo služeb je propojená, nastavit k zadanému
|
||||||
// kódu i správný název skupiny materiálu nebo služby
|
// kódu i správný název skupiny materiálu nebo služby
|
||||||
this.selectedItem.setName(subject.getName());
|
this.selectedItem.setName(subject.getName());
|
||||||
@@ -253,7 +241,7 @@ public class RequirementForm extends FormViewModel<Requirement>
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Command
|
@Command
|
||||||
@NotifyChange({ "syncItems", "selectedItem", "selItemIndex" })
|
@NotifyChange({ "selectedItem", "syncItems" })
|
||||||
public void addNewItem()
|
public void addNewItem()
|
||||||
{
|
{
|
||||||
RequirementItem item = new RequirementItem();
|
RequirementItem item = new RequirementItem();
|
||||||
@@ -266,11 +254,10 @@ public class RequirementForm extends FormViewModel<Requirement>
|
|||||||
item.setUnitPrice(BigDecimal.valueOf(0));
|
item.setUnitPrice(BigDecimal.valueOf(0));
|
||||||
item.setTotal(BigDecimal.valueOf(0));
|
item.setTotal(BigDecimal.valueOf(0));
|
||||||
item.setDescription("");
|
item.setDescription("");
|
||||||
item.setMunit(new MUnitEmb());
|
item.setMunit(null);
|
||||||
|
|
||||||
|
this.setSelectedItem(item);
|
||||||
this.getDataBean().addItem(item);
|
this.getDataBean().addItem(item);
|
||||||
|
this.setSelItemIndex(this.getDataBean().getItems().indexOf(item));
|
||||||
this.selItemIndex = this.getDataBean().getItems().indexOf(item);
|
|
||||||
this.selectedItem = item;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,9 +17,10 @@ public class ReqServicesListMy extends ReqListMy
|
|||||||
@WireVariable
|
@WireVariable
|
||||||
protected RequirementService reqServicesService;
|
protected RequirementService reqServicesService;
|
||||||
|
|
||||||
@Init(superclass = true)
|
@Init
|
||||||
public void initReqServicesListMy()
|
public void init()
|
||||||
{
|
{
|
||||||
|
super.init();
|
||||||
service = reqServicesService;
|
service = reqServicesService;
|
||||||
formZul = "/main/orders/services/reqHeadForm.zul";
|
formZul = "/main/orders/services/reqHeadForm.zul";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,9 +17,10 @@ public class ReqServicesListMyAll extends ReqListMyAll
|
|||||||
@WireVariable
|
@WireVariable
|
||||||
protected RequirementService reqServicesService;
|
protected RequirementService reqServicesService;
|
||||||
|
|
||||||
@Init(superclass = true)
|
@Init
|
||||||
public void initReqServicesListMyAll()
|
public void init()
|
||||||
{
|
{
|
||||||
|
super.init();
|
||||||
service = reqServicesService;
|
service = reqServicesService;
|
||||||
formZul = "/main/orders/services/reqHeadForm.zul";
|
formZul = "/main/orders/services/reqHeadForm.zul";
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-2
@@ -17,9 +17,10 @@ public class ReqServicesListMyCenters extends ReqListMyCenters
|
|||||||
@WireVariable
|
@WireVariable
|
||||||
protected RequirementService reqServicesService;
|
protected RequirementService reqServicesService;
|
||||||
|
|
||||||
@Init(superclass = true)
|
@Init
|
||||||
public void initReqServicesListMyCenters()
|
public void init()
|
||||||
{
|
{
|
||||||
|
super.init();
|
||||||
service = reqServicesService;
|
service = reqServicesService;
|
||||||
formZul = "/main/orders/services/reqHeadForm.zul";
|
formZul = "/main/orders/services/reqHeadForm.zul";
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-2
@@ -17,9 +17,10 @@ public class ReqServicesListMyWorkgroups extends ReqListMyWorkgroups
|
|||||||
@WireVariable
|
@WireVariable
|
||||||
protected RequirementService reqServicesService;
|
protected RequirementService reqServicesService;
|
||||||
|
|
||||||
@Init(superclass = true)
|
@Init
|
||||||
public void initReqServicesListMyWorkgroups()
|
public void init()
|
||||||
{
|
{
|
||||||
|
super.init();
|
||||||
service = reqServicesService;
|
service = reqServicesService;
|
||||||
formZul = "/main/orders/services/reqHeadForm.zul";
|
formZul = "/main/orders/services/reqHeadForm.zul";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,50 +0,0 @@
|
|||||||
package info.bukova.isspst.ui.renderers;
|
|
||||||
|
|
||||||
import org.zkoss.bind.impl.BindListitemRenderer;
|
|
||||||
import org.zkoss.zk.ui.Component;
|
|
||||||
import org.zkoss.zul.Listbox;
|
|
||||||
import org.zkoss.zul.Listitem;
|
|
||||||
|
|
||||||
@SuppressWarnings("serial")
|
|
||||||
public abstract class GenericListitemRenderer<T> extends BindListitemRenderer
|
|
||||||
{
|
|
||||||
protected abstract void changeProperties(Listbox lb, Listitem li, int index, String varnm);
|
|
||||||
|
|
||||||
protected T objectOfStates;
|
|
||||||
|
|
||||||
public T getObjectOfStates()
|
|
||||||
{
|
|
||||||
return objectOfStates;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setObjectOfStates(T objectOfStates)
|
|
||||||
{
|
|
||||||
this.objectOfStates = objectOfStates;
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
@Override
|
|
||||||
public void render(Listitem item, Object data, int index) throws Exception
|
|
||||||
{
|
|
||||||
this.objectOfStates = (T) data;
|
|
||||||
|
|
||||||
super.render(item, data, index);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void addItemReference(Component modelOwner, Component comp, int index, String varnm)
|
|
||||||
{
|
|
||||||
if (this.objectOfStates != null)
|
|
||||||
{
|
|
||||||
if (modelOwner != null && modelOwner instanceof Listbox)
|
|
||||||
{
|
|
||||||
if (comp != null && comp instanceof Listitem)
|
|
||||||
{
|
|
||||||
this.changeProperties((Listbox) modelOwner, (Listitem) comp, index, varnm);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
super.addItemReference(modelOwner, comp, index, varnm);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
package info.bukova.isspst.ui.renderers;
|
|
||||||
|
|
||||||
import info.bukova.isspst.data.Order;
|
|
||||||
|
|
||||||
import org.zkoss.zul.Listbox;
|
|
||||||
import org.zkoss.zul.Listitem;
|
|
||||||
|
|
||||||
@SuppressWarnings("serial")
|
|
||||||
public class OrderCreatedItemRenderer extends GenericListitemRenderer<Order>
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
protected void changeProperties(Listbox lb, Listitem li, int index, String varnm)
|
|
||||||
{
|
|
||||||
Order order = this.getObjectOfStates();
|
|
||||||
|
|
||||||
boolean objednano = order.isOrdered();
|
|
||||||
|
|
||||||
boolean doruceno = (order.getDeliveredDate() != null);
|
|
||||||
|
|
||||||
if (doruceno)
|
|
||||||
{
|
|
||||||
li.setSclass("order-select-delivered");
|
|
||||||
}
|
|
||||||
else if (objednano)
|
|
||||||
{
|
|
||||||
li.setSclass("order-select-ordered");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,39 +0,0 @@
|
|||||||
package info.bukova.isspst.ui.renderers;
|
|
||||||
|
|
||||||
import info.bukova.isspst.data.Requirement;
|
|
||||||
import info.bukova.isspst.data.RequirementState;
|
|
||||||
|
|
||||||
import org.zkoss.zul.Listbox;
|
|
||||||
import org.zkoss.zul.Listitem;
|
|
||||||
|
|
||||||
@SuppressWarnings("serial")
|
|
||||||
public class RequirementsItemRenderer extends GenericListitemRenderer<Requirement>
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
protected void changeProperties(Listbox lb, Listitem li, int index, String varnm)
|
|
||||||
{
|
|
||||||
Requirement requirement = this.getObjectOfStates();
|
|
||||||
RequirementState state = requirement.getState();
|
|
||||||
|
|
||||||
if (state != null)
|
|
||||||
{
|
|
||||||
if (state == RequirementState.PARTIALLY)
|
|
||||||
{
|
|
||||||
li.setSclass("req-select-partially");
|
|
||||||
}
|
|
||||||
else if (state == RequirementState.APPROVED)
|
|
||||||
{
|
|
||||||
Boolean isProject = requirement.getProject();
|
|
||||||
|
|
||||||
if ((isProject != null) && (isProject.booleanValue() == true))
|
|
||||||
{
|
|
||||||
li.setSclass("req-select-approved-project");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
li.setSclass("req-select-approved");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -6,7 +6,6 @@ import info.bukova.isspst.services.requirement.RequirementBaseService;
|
|||||||
import info.bukova.isspst.services.users.UserService;
|
import info.bukova.isspst.services.users.UserService;
|
||||||
import info.bukova.isspst.ui.BigDecimalConverter;
|
import info.bukova.isspst.ui.BigDecimalConverter;
|
||||||
import info.bukova.isspst.ui.ListViewModel;
|
import info.bukova.isspst.ui.ListViewModel;
|
||||||
import info.bukova.isspst.ui.renderers.RequirementsItemRenderer;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -21,8 +20,6 @@ public class RequirementSubpage<T extends RequirementBase> extends ListViewModel
|
|||||||
@WireVariable
|
@WireVariable
|
||||||
protected UserService userService;
|
protected UserService userService;
|
||||||
|
|
||||||
protected RequirementsItemRenderer requirementsItemRenderer;
|
|
||||||
|
|
||||||
public List<User> getAllUsers()
|
public List<User> getAllUsers()
|
||||||
{
|
{
|
||||||
return userService.getAll();
|
return userService.getAll();
|
||||||
@@ -40,11 +37,10 @@ public class RequirementSubpage<T extends RequirementBase> extends ListViewModel
|
|||||||
this.bigDecimalConverter = bigDecimalConverter;
|
this.bigDecimalConverter = bigDecimalConverter;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Init(superclass = true)
|
@Init
|
||||||
public void initRequirementSubpage()
|
public void init()
|
||||||
{
|
{
|
||||||
this.bigDecimalConverter = new BigDecimalConverter();
|
this.bigDecimalConverter = new BigDecimalConverter();
|
||||||
this.requirementsItemRenderer = new RequirementsItemRenderer();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private RequirementBaseService<T> getReqService()
|
private RequirementBaseService<T> getReqService()
|
||||||
@@ -72,19 +68,4 @@ public class RequirementSubpage<T extends RequirementBase> extends ListViewModel
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public RequirementsItemRenderer getRequirementsItemRenderer()
|
|
||||||
{
|
|
||||||
return requirementsItemRenderer;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRequirementsItemRenderer(RequirementsItemRenderer requirementsItemRenderer)
|
|
||||||
{
|
|
||||||
this.requirementsItemRenderer = requirementsItemRenderer;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void afterSelect() {
|
|
||||||
BindUtils.postNotifyChange(null, null, this, "canApprove");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -94,12 +94,6 @@ public class GlobalSettingsVM {
|
|||||||
message.setText(message.getText() + "[" + field + "]");
|
message.setText(message.getText() + "[" + field + "]");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Command
|
|
||||||
@NotifyChange("settings")
|
|
||||||
public void insertUrl(@BindingParam("message") MailMessage message) {
|
|
||||||
message.setText(message.getText() + "[-url-]");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Command
|
@Command
|
||||||
@NotifyChange("settings")
|
@NotifyChange("settings")
|
||||||
public void addAddress() {
|
public void addAddress() {
|
||||||
|
|||||||
@@ -1,14 +1,15 @@
|
|||||||
package info.bukova.isspst.ui.tripbill;
|
package info.bukova.isspst.ui.tripbill;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import info.bukova.isspst.data.TripBill;
|
import info.bukova.isspst.data.TripBill;
|
||||||
import info.bukova.isspst.data.Vehicle;
|
import info.bukova.isspst.data.Vehicle;
|
||||||
import info.bukova.isspst.services.settings.GlobalSettingsService;
|
import info.bukova.isspst.services.settings.GlobalSettingsService;
|
||||||
import info.bukova.isspst.services.tripbill.TripBillService;
|
import info.bukova.isspst.services.tripbill.TripBillService;
|
||||||
|
import info.bukova.isspst.ui.BigDecimalConverter;
|
||||||
import info.bukova.isspst.ui.FormViewModel;
|
import info.bukova.isspst.ui.FormViewModel;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.zkoss.bind.annotation.Command;
|
import org.zkoss.bind.annotation.Command;
|
||||||
import org.zkoss.bind.annotation.Init;
|
import org.zkoss.bind.annotation.Init;
|
||||||
import org.zkoss.bind.annotation.NotifyChange;
|
import org.zkoss.bind.annotation.NotifyChange;
|
||||||
@@ -16,6 +17,7 @@ import org.zkoss.zk.ui.select.annotation.WireVariable;
|
|||||||
|
|
||||||
public class TripBillForm extends FormViewModel<TripBill> {
|
public class TripBillForm extends FormViewModel<TripBill> {
|
||||||
|
|
||||||
|
private BigDecimalConverter bigDecimalConverter;
|
||||||
@WireVariable
|
@WireVariable
|
||||||
private TripBillService tripBillService;
|
private TripBillService tripBillService;
|
||||||
private List<Vehicle> vehicles;
|
private List<Vehicle> vehicles;
|
||||||
@@ -24,11 +26,16 @@ public class TripBillForm extends FormViewModel<TripBill> {
|
|||||||
|
|
||||||
@Init(superclass = true)
|
@Init(superclass = true)
|
||||||
public void init() {
|
public void init() {
|
||||||
|
bigDecimalConverter = new BigDecimalConverter();
|
||||||
vehicles = new ArrayList<Vehicle>();
|
vehicles = new ArrayList<Vehicle>();
|
||||||
vehicles.add(null);
|
vehicles.add(null);
|
||||||
vehicles.addAll(settingsService.getSettings().getVehicles());
|
vehicles.addAll(settingsService.getSettings().getVehicles());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public BigDecimalConverter getBigDecimalConverter() {
|
||||||
|
return bigDecimalConverter;
|
||||||
|
}
|
||||||
|
|
||||||
@Command
|
@Command
|
||||||
@NotifyChange("dataBean")
|
@NotifyChange("dataBean")
|
||||||
public void calculate() {
|
public void calculate() {
|
||||||
@@ -38,5 +45,4 @@ public class TripBillForm extends FormViewModel<TripBill> {
|
|||||||
public List<Vehicle> getVehicles() {
|
public List<Vehicle> getVehicles() {
|
||||||
return vehicles;
|
return vehicles;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,8 +16,8 @@ public class TripBillList extends ListViewModel<TripBill> {
|
|||||||
private TripBillService tripBillService;
|
private TripBillService tripBillService;
|
||||||
private BigDecimalConverter converter;
|
private BigDecimalConverter converter;
|
||||||
|
|
||||||
@Init(superclass = true)
|
@Init
|
||||||
public void initTripBill() {
|
public void init() {
|
||||||
service = tripBillService;
|
service = tripBillService;
|
||||||
dataClass = TripBill.class;
|
dataClass = TripBill.class;
|
||||||
formZul = "tripBillForm.zul";
|
formZul = "tripBillForm.zul";
|
||||||
@@ -33,10 +33,4 @@ public class TripBillList extends ListViewModel<TripBill> {
|
|||||||
public BigDecimalConverter getConverter() {
|
public BigDecimalConverter getConverter() {
|
||||||
return converter;
|
return converter;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isAbleToAdd() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,7 +30,5 @@
|
|||||||
<mapping class="info.bukova.isspst.data.TripBillItem"></mapping>
|
<mapping class="info.bukova.isspst.data.TripBillItem"></mapping>
|
||||||
<mapping class="info.bukova.isspst.data.Order"></mapping>
|
<mapping class="info.bukova.isspst.data.Order"></mapping>
|
||||||
<mapping class="info.bukova.isspst.data.OrderItem"></mapping>
|
<mapping class="info.bukova.isspst.data.OrderItem"></mapping>
|
||||||
<mapping class="info.bukova.isspst.data.Invoicing"></mapping>
|
|
||||||
<mapping class="info.bukova.isspst.data.InvoicingItem"></mapping>
|
|
||||||
</session-factory>
|
</session-factory>
|
||||||
</hibernate-configuration>
|
</hibernate-configuration>
|
||||||
@@ -1,3 +1,2 @@
|
|||||||
ad.domain=bukova.net
|
ad.domain=bukova.net
|
||||||
ad.ldapUrl=ldap://192.168.25.110/
|
ad.ldapUrl=ldap://192.168.25.110/
|
||||||
ad.allowedGroup=ucitele
|
|
||||||
@@ -1,5 +1,11 @@
|
|||||||
jdbc.driverClassName=com.mysql.jdbc.Driver
|
#jdbc.driverClassName=com.mysql.jdbc.Driver
|
||||||
jdbc.dialect=org.hibernate.dialect.MySQLDialect
|
#jdbc.dialect=org.hibernate.dialect.MySQLDialect
|
||||||
jdbc.databaseurl=jdbc:mysql://127.0.0.1:3306/isspst?characterEncoding=latin2&autoReconnect=true
|
#jdbc.databaseurl=jdbc:mysql://127.0.0.1:3306/isspst?characterEncoding=latin2&autoReconnect=true
|
||||||
|
#jdbc.username=isspst
|
||||||
|
#jdbc.password=xsacfgd
|
||||||
|
|
||||||
|
jdbc.driverClassName=org.postgresql.Driver
|
||||||
|
jdbc.dialect=org.hibernate.dialect.PostgreSQLDialect
|
||||||
|
jdbc.databaseurl=jdbc:postgresql://127.0.0.1:5432/isspst
|
||||||
jdbc.username=isspst
|
jdbc.username=isspst
|
||||||
jdbc.password=xsacfgd
|
jdbc.password=xsacfgd
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
<!DOCTYPE xml>
|
|
||||||
<language-addon>
|
<language-addon>
|
||||||
<addon-name>CzechSortListheader</addon-name>
|
<addon-name>CzechSortListheader</addon-name>
|
||||||
<language-name>xul/html</language-name>
|
<language-name>xul/html</language-name>
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE xml>
|
|
||||||
<language-addon>
|
<language-addon>
|
||||||
<!-- The name of this addon. It must be unique -->
|
<!-- The name of this addon. It must be unique -->
|
||||||
<addon-name>ckezbind</addon-name>
|
<addon-name>ckezbind</addon-name>
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE xml>
|
|
||||||
<language-addon>
|
<language-addon>
|
||||||
<addon-name>mapa</addon-name>
|
<addon-name>mapa</addon-name>
|
||||||
<language-name>xul/html</language-name>
|
<language-name>xul/html</language-name>
|
||||||
|
|||||||
@@ -172,7 +172,6 @@ GlobalSettingsHours=Hodin
|
|||||||
GlobalSettingsUploadStamp=Nahrát obrázek razítka
|
GlobalSettingsUploadStamp=Nahrát obrázek razítka
|
||||||
GlobalSettingsStamp=Razítko
|
GlobalSettingsStamp=Razítko
|
||||||
GlobalSettingsReqEnable=Povolení požadavků
|
GlobalSettingsReqEnable=Povolení požadavků
|
||||||
GlobalSettingsInsertUrl=Vložit URL záznamu
|
|
||||||
|
|
||||||
UserSettings=Uživatelské nastavení
|
UserSettings=Uživatelské nastavení
|
||||||
|
|
||||||
@@ -280,7 +279,6 @@ false=Ne
|
|||||||
Information=Informace
|
Information=Informace
|
||||||
Order=Objednávka
|
Order=Objednávka
|
||||||
Orders=Objednávky
|
Orders=Objednávky
|
||||||
OrderAbr=Obj.
|
|
||||||
|
|
||||||
MaterialRequirement=Požadavek na materiál
|
MaterialRequirement=Požadavek na materiál
|
||||||
MaterialRequirements=Požadavky na materiál
|
MaterialRequirements=Požadavky na materiál
|
||||||
@@ -312,9 +310,6 @@ AddItem=Přidat položku
|
|||||||
SelectGroup=Vybrat skupinu...
|
SelectGroup=Vybrat skupinu...
|
||||||
RemoveItem=Smazat
|
RemoveItem=Smazat
|
||||||
|
|
||||||
StudentProject = Studentský projekt
|
|
||||||
StudentProjectAbr = St. projekt
|
|
||||||
|
|
||||||
Amount=Částka
|
Amount=Částka
|
||||||
Owner=Vlastník
|
Owner=Vlastník
|
||||||
CreateOrder=Vytvořit objednávku
|
CreateOrder=Vytvořit objednávku
|
||||||
@@ -334,18 +329,6 @@ OrderFormInvoiceNumber=Číslo faktury
|
|||||||
OrderFormInvoiceTotal=Částka faktury
|
OrderFormInvoiceTotal=Částka faktury
|
||||||
OrderPrintPrices=Tisknout ceny
|
OrderPrintPrices=Tisknout ceny
|
||||||
|
|
||||||
Invoicing=Fakturace požadavků
|
|
||||||
InvoicingRequirementNumber=Číslo požadavku
|
|
||||||
InvoicingRequirementPrice=Cena požadavku
|
|
||||||
InvoicingInvoicedPrice=Vyfakturovaná cena
|
|
||||||
InvoicingFormTitle=Zadání fakturace
|
|
||||||
InvoicingAdd=Přidat fakturaci
|
|
||||||
InvoicingDate=Datum
|
|
||||||
InvoicingInvoiceNumber=Číslo faktury
|
|
||||||
InvoicingAmount=Částka
|
|
||||||
InvoicingDescription=Popis
|
|
||||||
InvoicingInvoiced=Fakturováno
|
|
||||||
|
|
||||||
HandleComboKeyFilter=#del
|
HandleComboKeyFilter=#del
|
||||||
HandleComboKey=$#del
|
HandleComboKey=$#del
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
<!DOCTYPE xml>
|
|
||||||
<taglib>
|
<taglib>
|
||||||
<uri>http://www.zkoss.org/demo/integration/security</uri>
|
<uri>http://www.zkoss.org/demo/integration/security</uri>
|
||||||
<description>
|
<description>
|
||||||
|
|||||||
@@ -18,7 +18,6 @@
|
|||||||
<bean id="adUserMapper" class="info.bukova.isspst.services.users.AdUserCtxMapper">
|
<bean id="adUserMapper" class="info.bukova.isspst.services.users.AdUserCtxMapper">
|
||||||
<constructor-arg name="userService" ref="userService"/>
|
<constructor-arg name="userService" ref="userService"/>
|
||||||
<constructor-arg name="roleService" ref="roleService"/>
|
<constructor-arg name="roleService" ref="roleService"/>
|
||||||
<property name="allowedGroup" value="${ad.allowedGroup}"/>
|
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
</beans>
|
</beans>
|
||||||
|
|||||||
@@ -30,20 +30,6 @@
|
|||||||
|
|
||||||
<bean id="messageBuilder" class="info.bukova.isspst.mail.EntityMessageBuilder">
|
<bean id="messageBuilder" class="info.bukova.isspst.mail.EntityMessageBuilder">
|
||||||
<property name="html" value="true"/>
|
<property name="html" value="true"/>
|
||||||
<property name="urlResolverHolder" ref="urlResolverHolder"/>
|
|
||||||
</bean>
|
|
||||||
|
|
||||||
<bean id="commonUrlResolver" class="info.bukova.isspst.CommonUrlResolver"/>
|
|
||||||
|
|
||||||
<bean id="requirementUrlResolver" class="info.bukova.isspst.RequirementUrlResolver"/>
|
|
||||||
|
|
||||||
<bean id="urlResolverHolder" class="info.bukova.isspst.UrlResolverHolder">
|
|
||||||
<constructor-arg ref="commonUrlResolver"/>
|
|
||||||
<property name="resolvers">
|
|
||||||
<map>
|
|
||||||
<entry key="#{T(info.bukova.isspst.data.Requirement)}" value-ref="requirementUrlResolver"/>
|
|
||||||
</map>
|
|
||||||
</property>
|
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<!-- <bean id="mailer" class="info.bukova.rsfaktura.services.mail.ThreadMailer"> -->
|
<!-- <bean id="mailer" class="info.bukova.rsfaktura.services.mail.ThreadMailer"> -->
|
||||||
|
|||||||
@@ -50,19 +50,36 @@
|
|||||||
<value>classpath:hibernate.cfg.xml</value>
|
<value>classpath:hibernate.cfg.xml</value>
|
||||||
</property>
|
</property>
|
||||||
<property name="hibernateProperties">
|
<property name="hibernateProperties">
|
||||||
<props>
|
<map>
|
||||||
<prop key="hibernate.dialect">${jdbc.dialect}</prop>
|
<entry key="hibernate.dialect" value="${jdbc.dialect}"/>
|
||||||
|
<entry key="hibernate.show_sql" value="false"/>
|
||||||
|
<entry key="hibernate.multiTenancy" value="SCHEMA"/>
|
||||||
|
<entry key="hibernate.tenant_identifier_resolver" value-ref="clientResolver"/>
|
||||||
|
<entry key="hibernate.multi_tenant_connection_provider" value-ref="conProvider"/>
|
||||||
|
</map>
|
||||||
|
|
||||||
|
<!-- <props>
|
||||||
|
<prop key="hibernate.dialect"></prop>
|
||||||
<prop key="hibernate.show_sql">false</prop>
|
<prop key="hibernate.show_sql">false</prop>
|
||||||
<prop key="hibernate.hbm2ddl.auto">update</prop>
|
<prop key="hibernate.hbm2ddl.auto">update</prop>
|
||||||
<!-- <prop key="hibernate.enable_lazy_load_no_trans">true</prop> -->
|
</props> -->
|
||||||
</props>
|
|
||||||
</property>
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
|
<bean id="clientResolver" class="info.bukova.isspst.ClientResolver" scope="request">
|
||||||
|
<aop:scoped-proxy/>
|
||||||
|
</bean>
|
||||||
|
|
||||||
|
<bean id="conProvider" class="info.bukova.isspst.ClientConnectionPrivider">
|
||||||
|
<constructor-arg ref="dataSource"/>
|
||||||
|
</bean>
|
||||||
|
|
||||||
<tx:annotation-driven transaction-manager="transactionManager"/>
|
<tx:annotation-driven transaction-manager="transactionManager"/>
|
||||||
<bean id="transactionManager"
|
<bean id="transactionManager"
|
||||||
class="org.springframework.orm.hibernate4.HibernateTransactionManager">
|
class="org.springframework.orm.hibernate4.HibernateTransactionManager">
|
||||||
<property name="sessionFactory" ref="sessionFactory"></property>
|
<property name="sessionFactory" ref="sessionFactory"/>
|
||||||
|
<property name="autodetectDataSource" value="false"/>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<!-- Security -->
|
<!-- Security -->
|
||||||
@@ -219,10 +236,6 @@
|
|||||||
<property name="sessionFactory" ref="sessionFactory"/>
|
<property name="sessionFactory" ref="sessionFactory"/>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean id="requirementItemDao" class="info.bukova.isspst.dao.jpa.RequirementItemDaoJPA">
|
|
||||||
<property name="sessionFactory" ref="sessionFactory"/>
|
|
||||||
</bean>
|
|
||||||
|
|
||||||
<bean id="numericSeriesDao" class="info.bukova.isspst.dao.jpa.NumberSeriesDaoJPA">
|
<bean id="numericSeriesDao" class="info.bukova.isspst.dao.jpa.NumberSeriesDaoJPA">
|
||||||
<property name="sessionFactory" ref="sessionFactory"/>
|
<property name="sessionFactory" ref="sessionFactory"/>
|
||||||
</bean>
|
</bean>
|
||||||
@@ -251,10 +264,6 @@
|
|||||||
<property name="sessionFactory" ref="sessionFactory"/>
|
<property name="sessionFactory" ref="sessionFactory"/>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean id="invoicingDao" class="info.bukova.isspst.dao.jpa.InvoicingDaoJPA">
|
|
||||||
<property name="sessionFactory" ref="sessionFactory"/>
|
|
||||||
</bean>
|
|
||||||
|
|
||||||
<!-- Business logic -->
|
<!-- Business logic -->
|
||||||
<bean id="validator" class="org.springframework.validation.beanvalidation.LocalValidatorFactoryBean"/>
|
<bean id="validator" class="org.springframework.validation.beanvalidation.LocalValidatorFactoryBean"/>
|
||||||
|
|
||||||
@@ -321,7 +330,7 @@
|
|||||||
<property name="xmlContext" ref="xmlCtxAres" />
|
<property name="xmlContext" ref="xmlCtxAres" />
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean id="approvedService" class="info.bukova.isspst.services.orders.ApprovedServiceImpl"/>
|
<bean id="approvedService" class="info.bukova.isspst.services.approved.ApprovedServiceImpl"/>
|
||||||
|
|
||||||
<bean id="permissionService" class="info.bukova.isspst.services.users.PermissionServiceImpl">
|
<bean id="permissionService" class="info.bukova.isspst.services.users.PermissionServiceImpl">
|
||||||
<property name="dao" ref="permissionDao"/>
|
<property name="dao" ref="permissionDao"/>
|
||||||
@@ -412,15 +421,10 @@
|
|||||||
<property name="validator" ref="validator"/>
|
<property name="validator" ref="validator"/>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean id="orderService" class="info.bukova.isspst.services.orders.OrderServiceImpl">
|
<bean id="orderService" class="info.bukova.isspst.services.approved.OrderServiceImpl">
|
||||||
<property name="dao" ref="orderDao"/>
|
<property name="dao" ref="orderDao"/>
|
||||||
<property name="validator" ref="validator"/>
|
<property name="validator" ref="validator"/>
|
||||||
<property name="numberSeriesService" ref="numericSeriesService"/>
|
<property name="numberSeriesService" ref="numericSeriesService"/>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean id="invoicingService" class="info.bukova.isspst.services.invoicing.InvoicingServiceImpl">
|
|
||||||
<property name="dao" ref="invoicingDao"/>
|
|
||||||
<property name="validator" ref="validator"/>
|
|
||||||
</bean>
|
|
||||||
|
|
||||||
</beans>
|
</beans>
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
autodrop="true">
|
autodrop="true">
|
||||||
<menuitem
|
<menuitem
|
||||||
label="${labels.Information}"
|
label="${labels.Information}"
|
||||||
href="/app/" />
|
href="/" />
|
||||||
<menuseparator />
|
<menuseparator />
|
||||||
<menu label="${labels.Orders}">
|
<menu label="${labels.Orders}">
|
||||||
<menupopup>
|
<menupopup>
|
||||||
@@ -34,12 +34,6 @@
|
|||||||
label="${labels.CreatedOrders}"
|
label="${labels.CreatedOrders}"
|
||||||
href="/main/orders/created/"
|
href="/main/orders/created/"
|
||||||
disabled="${not sec:isAllGranted('PERM_READ_ORDER')}" />
|
disabled="${not sec:isAllGranted('PERM_READ_ORDER')}" />
|
||||||
<menuseparator/>
|
|
||||||
<menuitem
|
|
||||||
image="/img/invoicing-016.png"
|
|
||||||
label="${labels.Invoicing}"
|
|
||||||
href="/main/invoicing/"
|
|
||||||
disabled="${not sec:isAllGranted('PERM_READ_INVOICING')}" />
|
|
||||||
</menupopup>
|
</menupopup>
|
||||||
</menu>
|
</menu>
|
||||||
<menu label="${labels.BussinessTrips}">
|
<menu label="${labels.BussinessTrips}">
|
||||||
|
|||||||
@@ -51,6 +51,6 @@
|
|||||||
<div id="mainData">
|
<div id="mainData">
|
||||||
<u:include src="${gridZul}" />
|
<u:include src="${gridZul}" />
|
||||||
</div>
|
</div>
|
||||||
<div id="footer"> Verze 1.0 </div>
|
<div id="footer"> </div>
|
||||||
</div>
|
</div>
|
||||||
</html>
|
</html>
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
<?page title="toolbar" contentType="text/html;charset=UTF-8"?>
|
<?page title="toolbar" contentType="text/html;charset=UTF-8"?>
|
||||||
<zk>
|
<zk>
|
||||||
<toolbar>
|
<toolbar>
|
||||||
<toolbarbutton image="/img/add.png" tooltiptext="${labels.ToolbarRecNew}" id="btnNew" onClick="@command('addNew')" disabled="@load(vm.filter or not vm.ableToAdd)" />
|
<toolbarbutton image="/img/add.png" tooltiptext="${labels.ToolbarRecNew}" id="btnNew" onClick="@command('addNew')" disabled="@load(vm.filter)" />
|
||||||
<toolbarbutton image="/img/edit.png" tooltiptext="${labels.ToolbarRecEdit}" id="btnEdit" onClick="@command('edit')" disabled="@load(empty vm.dataBean ? 'true' : 'false')"/>
|
<toolbarbutton image="/img/edit.png" tooltiptext="${labels.ToolbarRecEdit}" id="btnEdit" onClick="@command('edit')" disabled="@load(empty vm.dataBean ? 'true' : 'false')"/>
|
||||||
<toolbarbutton image="/img/delete.png" tooltiptext="${labels.ToolbarRecDelete}" id="btnDelete" onClick="@command('delete')" disabled="@load(not vm.ableToDelete)" />
|
<toolbarbutton image="/img/delete.png" tooltiptext="${labels.ToolbarRecDelete}" id="btnDelete" onClick="@command('delete')" disabled="@load(not vm.ableToDelete)" />
|
||||||
<toolbarbutton image="/img/funnel.png" tooltiptext="${labels.ToolbarRecFilter}" id="btnFilter" onClick="@command('filter')" />
|
<toolbarbutton image="/img/funnel.png" tooltiptext="${labels.ToolbarRecFilter}" id="btnFilter" onClick="@command('filter')" />
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ html, body {
|
|||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
.form-caption, .form-caption-highlight {
|
.form-caption {
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
font-size: 20px;
|
font-size: 20px;
|
||||||
@@ -82,14 +82,6 @@ html, body {
|
|||||||
padding-right: 5px;
|
padding-right: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.form-caption-highlight {
|
|
||||||
background-color: red;
|
|
||||||
}
|
|
||||||
.form-caption-highlight-content {
|
|
||||||
float: left;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
html, body { background-color: red; }
|
html, body { background-color: red; }
|
||||||
#screen { background-color: lightgreen; }
|
#screen { background-color: lightgreen; }
|
||||||
|
|||||||
@@ -9,7 +9,9 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.addScrollbar {
|
.addScrollbar {
|
||||||
|
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.find-grid-cell {
|
.find-grid-cell {
|
||||||
@@ -65,27 +67,3 @@
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
min-width: 0;
|
min-width: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.order-select-ordered {
|
|
||||||
background-color: #98fb98 !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.order-select-invoiced {
|
|
||||||
background-color: #fff44f !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.order-select-delivered {
|
|
||||||
background-color: #d19fe8 !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.req-select-partially {
|
|
||||||
background-color: #fffb90 !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.req-select-approved {
|
|
||||||
background-color: #afffb5 !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.req-select-approved-project {
|
|
||||||
background-color: #87cefa !important;
|
|
||||||
}
|
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 774 B |
Binary file not shown.
|
Before Width: | Height: | Size: 2.1 KiB |
@@ -13,7 +13,7 @@
|
|||||||
<row>
|
<row>
|
||||||
<label value="${labels.SuppliersFormCompany}" />
|
<label value="${labels.SuppliersFormCompany}" />
|
||||||
<textbox id="company" value="@bind(fx.company)" instant="true" width="320px" />
|
<textbox id="company" value="@bind(fx.company)" instant="true" width="320px" />
|
||||||
<button image="/img/search.png" label="${labels.SuppliersFormFindInARES}" onClick="@command('searchAres')" sclass="nicebutton" disabled="@load((fx.ic == 0) && (empty fx.company))" />
|
<button image="/img/search.png" label="${labels.SuppliersFormFindInARES}" onClick="@command('searchAres')" sclass="nicebutton" disabled="@load((vm.dataBean.ic == 0) && (empty vm.dataBean.company))" />
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<label value="${labels.SuppliersFormIC}" />
|
<label value="${labels.SuppliersFormIC}" />
|
||||||
|
|||||||
@@ -1,10 +0,0 @@
|
|||||||
<?page title="${labels.Invoicing}" contentType="text/html;charset=UTF-8"?>
|
|
||||||
<zk>
|
|
||||||
|
|
||||||
<zscript>
|
|
||||||
String gridZul = "invoicingGrid.zul";
|
|
||||||
</zscript>
|
|
||||||
|
|
||||||
<include src="/app/template.zhtml"/>
|
|
||||||
|
|
||||||
</zk>
|
|
||||||
@@ -1,199 +0,0 @@
|
|||||||
<?page title="${labels.Invoicing}" contentType="text/html;charset=UTF-8"?>
|
|
||||||
<zk>
|
|
||||||
<window
|
|
||||||
id="editWin"
|
|
||||||
closable="true"
|
|
||||||
width="95%"
|
|
||||||
height="95%"
|
|
||||||
border="normal"
|
|
||||||
position="center"
|
|
||||||
apply="org.zkoss.bind.BindComposer"
|
|
||||||
viewModel="@id('vm') @init('info.bukova.isspst.ui.main.invoicing.InvoicingForm')">
|
|
||||||
<caption
|
|
||||||
src="/img/invoicing-032.png"
|
|
||||||
zclass="form-caption"
|
|
||||||
label="${labels.InvoicingFormTitle}" />
|
|
||||||
<vlayout vflex="1">
|
|
||||||
<hbox>
|
|
||||||
|
|
||||||
<vbox height="300px">
|
|
||||||
<button
|
|
||||||
image="/img/item-add.png"
|
|
||||||
label="${labels.InvoicingAdd}"
|
|
||||||
sclass="nicebutton"
|
|
||||||
onClick="@command('addItem')"/>
|
|
||||||
|
|
||||||
<listbox
|
|
||||||
model="@load(vm.dataBean.items)"
|
|
||||||
vflex="1"
|
|
||||||
selectedItem="@bind(vm.selectedItem)"
|
|
||||||
selectedIndex="@bind(vm.selectedIndex)">
|
|
||||||
<listhead>
|
|
||||||
<listheader
|
|
||||||
label="${labels.InvoicingDate}"
|
|
||||||
width="150px"/>
|
|
||||||
<listheader label="${labels.InvoicingInvoiceNumber}" />
|
|
||||||
<listheader
|
|
||||||
label="${labels.InvoicingAmount}"
|
|
||||||
align="right"
|
|
||||||
width="90px"/>
|
|
||||||
<listheader/>
|
|
||||||
</listhead>
|
|
||||||
<template name="model">
|
|
||||||
<listitem>
|
|
||||||
<listcell>
|
|
||||||
<datebox
|
|
||||||
value="@bind(each.invoiceDate)"
|
|
||||||
inplace="true"
|
|
||||||
onFocus="@command('onFocus', item=each)"/>
|
|
||||||
</listcell>
|
|
||||||
<listcell>
|
|
||||||
<textbox
|
|
||||||
value="@bind(each.invoiceNumber)"
|
|
||||||
sclass="grid-textbox-max"
|
|
||||||
inplace="true"
|
|
||||||
onFocus="@command('onFocus', item=each)"/>
|
|
||||||
</listcell>
|
|
||||||
<listcell>
|
|
||||||
<textbox
|
|
||||||
value="@bind(each.amount) @converter(vm.standardBigDecimalConverter)"
|
|
||||||
sclass="grid-textbox-max"
|
|
||||||
inplace="true"
|
|
||||||
onFocus="@command('onFocus', item=each)"
|
|
||||||
onChange="@command('calculate')"/>
|
|
||||||
</listcell>
|
|
||||||
<listcell>
|
|
||||||
<button label="${labels.RemoveItem}" sclass="nicebutton" onClick="@command('removeItem', item=each)"/>
|
|
||||||
</listcell>
|
|
||||||
</listitem>
|
|
||||||
</template>
|
|
||||||
</listbox>
|
|
||||||
</vbox>
|
|
||||||
|
|
||||||
<grid hflex="min">
|
|
||||||
<columns>
|
|
||||||
<column
|
|
||||||
align="right"
|
|
||||||
hflex="min" />
|
|
||||||
<column />
|
|
||||||
</columns>
|
|
||||||
<rows>
|
|
||||||
<row>
|
|
||||||
<cell sclass="row-title">${labels.InvoicingRequirementNumber} :</cell>
|
|
||||||
<cell>
|
|
||||||
<textbox
|
|
||||||
width="200px"
|
|
||||||
value="@bind(vm.dataBean.requirement.numser)"
|
|
||||||
style="font-weight: bold;"
|
|
||||||
readonly="true"/>
|
|
||||||
</cell>
|
|
||||||
</row>
|
|
||||||
<row>
|
|
||||||
<cell sclass="row-title">${labels.InvoicingDescription} :</cell>
|
|
||||||
<cell>
|
|
||||||
<textbox
|
|
||||||
width="350px"
|
|
||||||
rows="5"
|
|
||||||
value="@bind(vm.dataBean.requirement.description)"
|
|
||||||
readonly="true" />
|
|
||||||
</cell>
|
|
||||||
</row>
|
|
||||||
<row>
|
|
||||||
<cell sclass="row-title">${labels.InvoicingRequirementPrice} :</cell>
|
|
||||||
<cell>
|
|
||||||
<textbox
|
|
||||||
width="150px"
|
|
||||||
value="@bind(vm.dataBean.requirement.sumTotal) @converter(vm.standardBigDecimalConverter)"
|
|
||||||
readonly="true"/>
|
|
||||||
</cell>
|
|
||||||
</row>
|
|
||||||
<row>
|
|
||||||
<cell sclass="row-title">${labels.InvoicingInvoicedPrice} :</cell>
|
|
||||||
<cell>
|
|
||||||
<textbox
|
|
||||||
width="150px"
|
|
||||||
value="@bind(vm.dataBean.totalInvoiced) @converter(vm.standardBigDecimalConverter)"
|
|
||||||
readonly="true"
|
|
||||||
style="@load(vm.dataBean.totalInvoiced gt vm.dataBean.requirement.sumTotal ? ' color: red;' : '' )"/>
|
|
||||||
</cell>
|
|
||||||
</row>
|
|
||||||
</rows>
|
|
||||||
</grid>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</hbox>
|
|
||||||
|
|
||||||
<listbox
|
|
||||||
vflex="1"
|
|
||||||
model="@load(vm.dataBean.requirement.items)">
|
|
||||||
<listhead>
|
|
||||||
<listheader
|
|
||||||
hflex="10"
|
|
||||||
label="${labels.RequirementItemCode}" />
|
|
||||||
<listheader
|
|
||||||
hflex="15"
|
|
||||||
label="${labels.RequirementItemName}" />
|
|
||||||
<listheader
|
|
||||||
hflex="30"
|
|
||||||
label="${labels.RequirementItemText}" />
|
|
||||||
<listheader
|
|
||||||
hflex="10"
|
|
||||||
align="right"
|
|
||||||
label="${labels.RequirementItemQuantity}" />
|
|
||||||
<listheader
|
|
||||||
hflex="10"
|
|
||||||
label="${labels.RequirementItemMUnit}" />
|
|
||||||
<listheader
|
|
||||||
hflex="10"
|
|
||||||
align="right"
|
|
||||||
label="${labels.RequirementItemUnitPrice}" />
|
|
||||||
<listheader
|
|
||||||
hflex="10"
|
|
||||||
align="right"
|
|
||||||
label="${labels.RequirementItemTotal}" />
|
|
||||||
<listheader
|
|
||||||
hflex="10"
|
|
||||||
align="right"
|
|
||||||
label="${labels.InvoicingInvoiced}" />
|
|
||||||
<listheader
|
|
||||||
hflex="15"
|
|
||||||
label="${labels.RequirementItemDescription}" />
|
|
||||||
</listhead>
|
|
||||||
<template name="model">
|
|
||||||
<listitem>
|
|
||||||
<listcell>
|
|
||||||
<label value="@load(each.code)"/>
|
|
||||||
</listcell>
|
|
||||||
<listcell>
|
|
||||||
<label value="@load(each.name)" />
|
|
||||||
</listcell>
|
|
||||||
<listcell>
|
|
||||||
<label value="@load(each.textItem)" />
|
|
||||||
</listcell>
|
|
||||||
<listcell>
|
|
||||||
<label value="@bind(each.quantity) @converter(vm.standardBigDecimalConverter)" />
|
|
||||||
</listcell>
|
|
||||||
<listcell>
|
|
||||||
<label value="@bind(each.munit.name)" />
|
|
||||||
</listcell>
|
|
||||||
<listcell>
|
|
||||||
<label value="@bind(each.unitPrice) @converter(vm.standardBigDecimalConverter)" />
|
|
||||||
</listcell>
|
|
||||||
<listcell>
|
|
||||||
<label value="@bind(each.total) @converter(vm.standardBigDecimalConverter)" />
|
|
||||||
</listcell>
|
|
||||||
<listcell>
|
|
||||||
<checkbox checked="@bind(each.paid)"/>
|
|
||||||
</listcell>
|
|
||||||
<listcell>
|
|
||||||
<label value="@bind(each.description)" />
|
|
||||||
</listcell>
|
|
||||||
</listitem>
|
|
||||||
</template>
|
|
||||||
</listbox>
|
|
||||||
|
|
||||||
<include src="/app/formButtons.zul" />
|
|
||||||
</vlayout>
|
|
||||||
</window>
|
|
||||||
</zk>
|
|
||||||
@@ -1,172 +0,0 @@
|
|||||||
<?page title="${labels.Invoicing}" contentType="text/html;charset=UTF-8"?>
|
|
||||||
<zk>
|
|
||||||
<?variable-resolver class="org.zkoss.zkplus.spring.DelegatingVariableResolver"?>
|
|
||||||
<window
|
|
||||||
vflex="1"
|
|
||||||
border="normal"
|
|
||||||
apply="org.zkoss.bind.BindComposer"
|
|
||||||
viewModel="@id('vm') @init('info.bukova.isspst.ui.main.invoicing.InvoicingList')">
|
|
||||||
<caption
|
|
||||||
src="/img/invoicing-032.png"
|
|
||||||
zclass="form-caption"
|
|
||||||
label="${labels.Invoicing}" />
|
|
||||||
<include src="/app/toolbar.zul" />
|
|
||||||
<listbox
|
|
||||||
vflex="1"
|
|
||||||
model="@load(vm.dataList)"
|
|
||||||
selectedItem="@bind(vm.dataBean)">
|
|
||||||
<listhead menupopup="auto">
|
|
||||||
<listheader
|
|
||||||
label="${labels.InvoicingRequirementNumber}"
|
|
||||||
width="130px" />
|
|
||||||
<listheader
|
|
||||||
label="${labels.RequirementsGridReqDate}"
|
|
||||||
width="150px"/>
|
|
||||||
<listheader
|
|
||||||
label="${labels.RequirementsGridCenter}"
|
|
||||||
width="180px"/>
|
|
||||||
<listheader
|
|
||||||
label="${labels.RequirementsGridWorkgroup}"
|
|
||||||
width="180px"/>
|
|
||||||
<listheader
|
|
||||||
label="${labels.InvoicingDescription}"
|
|
||||||
width=""/>
|
|
||||||
<listheader
|
|
||||||
label="${labels.InvoicingRequirementPrice}"
|
|
||||||
align="right"
|
|
||||||
width="130px" />
|
|
||||||
<listheader
|
|
||||||
label="${labels.InvoicingInvoicedPrice}"
|
|
||||||
align="right"
|
|
||||||
width="130px" />
|
|
||||||
</listhead>
|
|
||||||
<auxhead
|
|
||||||
sclass="category-center"
|
|
||||||
visible="@load(vm.filter)">
|
|
||||||
|
|
||||||
<auxheader>
|
|
||||||
<div sclass="find-grid-cell">
|
|
||||||
<div sclass="find-grid-divtextbox">
|
|
||||||
<textbox
|
|
||||||
value="@bind(vm.filterTemplate.requirement.numser)"
|
|
||||||
instant="true"
|
|
||||||
onChange="@command('doFilter')"
|
|
||||||
sclass="find-grid-textbox" />
|
|
||||||
</div>
|
|
||||||
<div sclass="find-grid-img">
|
|
||||||
<image src="/img/funnel.png" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</auxheader>
|
|
||||||
<auxheader>
|
|
||||||
<div sclass="find-grid-cell">
|
|
||||||
<div sclass="find-grid-divtextbox">
|
|
||||||
<datebox
|
|
||||||
value="@bind(vm.filterTemplate.requirement.reqDate)"
|
|
||||||
format="${labels.DateFormat}"
|
|
||||||
instant="true"
|
|
||||||
onChange="@command('doFilter')"
|
|
||||||
sclass="find-grid-textbox" />
|
|
||||||
</div>
|
|
||||||
<div sclass="find-grid-img">
|
|
||||||
<image src="/img/funnel.png" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</auxheader>
|
|
||||||
<auxheader>
|
|
||||||
<div sclass="find-grid-cell">
|
|
||||||
<combobox
|
|
||||||
ctrlKeys="${labels.HandleComboKeyFilter}"
|
|
||||||
onCtrlKey="@command('handleComboKeyFilter', ctrl=self, keyEvent=event)"
|
|
||||||
onChange="@command('doFilter')"
|
|
||||||
model="@load(vm.centres)"
|
|
||||||
readonly="true"
|
|
||||||
width="100%"
|
|
||||||
selectedItem="@bind(vm.filterTemplate.requirement.centre)">
|
|
||||||
<template name="model">
|
|
||||||
<comboitem label="@load(each.fullName)" />
|
|
||||||
</template>
|
|
||||||
</combobox>
|
|
||||||
<div sclass="find-grid-img">
|
|
||||||
<image src="/img/funnel.png" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</auxheader>
|
|
||||||
<auxheader>
|
|
||||||
<div sclass="find-grid-cell">
|
|
||||||
<combobox
|
|
||||||
ctrlKeys="${labels.HandleComboKeyFilter}"
|
|
||||||
onCtrlKey="@command('handleComboKeyFilter', ctrl=self, keyEvent=event)"
|
|
||||||
onChange="@command('doFilter')"
|
|
||||||
model="@load(vm.workgroups)"
|
|
||||||
readonly="true"
|
|
||||||
width="100%"
|
|
||||||
selectedItem="@bind(vm.filterTemplate.requirement.workgroup)">
|
|
||||||
<template name="model">
|
|
||||||
<comboitem label="@load(each.fullName)" />
|
|
||||||
</template>
|
|
||||||
</combobox>
|
|
||||||
<div sclass="find-grid-img">
|
|
||||||
<image src="/img/funnel.png" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</auxheader>
|
|
||||||
<auxheader>
|
|
||||||
<div sclass="find-grid-cell">
|
|
||||||
<div sclass="find-grid-divtextbox">
|
|
||||||
<textbox
|
|
||||||
value="@bind(vm.filterTemplate.requirement.description)"
|
|
||||||
instant="true"
|
|
||||||
onChange="@command('doFilter')"
|
|
||||||
sclass="find-grid-textbox" />
|
|
||||||
</div>
|
|
||||||
<div sclass="find-grid-img">
|
|
||||||
<image src="/img/funnel.png" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</auxheader>
|
|
||||||
<auxheader>
|
|
||||||
<!-- div sclass="find-grid-cell">
|
|
||||||
<div sclass="find-grid-divtextbox">
|
|
||||||
<textbox
|
|
||||||
value="@bind(vm.filterTemplate.requirement.sumTotal) @converter(vm.standardBigDecimalConverter)"
|
|
||||||
instant="true"
|
|
||||||
onChange="@command('doFilter')"
|
|
||||||
sclass="find-grid-textbox" />
|
|
||||||
</div>
|
|
||||||
<div sclass="find-grid-img">
|
|
||||||
<image src="/img/funnel.png" />
|
|
||||||
</div>
|
|
||||||
</div -->
|
|
||||||
</auxheader>
|
|
||||||
<auxheader>
|
|
||||||
<!-- div sclass="find-grid-cell">
|
|
||||||
<div sclass="find-grid-divtextbox">
|
|
||||||
<textbox
|
|
||||||
value="@bind(vm.filterTemplate.totalInvoiced) @converter(vm.standardBigDecimalConverter)"
|
|
||||||
instant="true"
|
|
||||||
onChange="@command('doFilter')"
|
|
||||||
sclass="find-grid-textbox" />
|
|
||||||
</div>
|
|
||||||
<div sclass="find-grid-img">
|
|
||||||
<image src="/img/funnel.png" />
|
|
||||||
</div>
|
|
||||||
</div-->
|
|
||||||
</auxheader>
|
|
||||||
|
|
||||||
</auxhead>
|
|
||||||
<template name="model">
|
|
||||||
<listitem>
|
|
||||||
<listcell label="@load(each.requirement.numser)" />
|
|
||||||
<listcell label="@load(each.requirement.reqDate) @converter('formatedDate', format=labels.DateFormat)" />
|
|
||||||
<listcell label="@load(each.requirement.centre)" />
|
|
||||||
<listcell label="@load(each.requirement.workgroup)" />
|
|
||||||
<listcell label="@load(each.requirement.description)" />
|
|
||||||
<listcell label="@load(each.requirement.sumTotal) @converter(vm.standardBigDecimalConverter)" />
|
|
||||||
<listcell label="@load(each.totalInvoiced) @converter(vm.standardBigDecimalConverter)"
|
|
||||||
style="@load(vm.dataBean.totalInvoiced gt vm.dataBean.requirement.sumTotal ? ' color: red;' : '' )" />
|
|
||||||
</listitem>
|
|
||||||
</template>
|
|
||||||
</listbox>
|
|
||||||
</window>
|
|
||||||
</zk>
|
|
||||||
@@ -21,20 +21,15 @@
|
|||||||
<tabpanel>
|
<tabpanel>
|
||||||
<include src="/main/toolbar.zul" />
|
<include src="/main/toolbar.zul" />
|
||||||
<listbox
|
<listbox
|
||||||
itemRenderer="@load(vm.orderCreatedItemRenderer)"
|
|
||||||
vflex="1"
|
vflex="1"
|
||||||
onSelect="@command('onChangeSelectOrder', ctrl=self)"
|
onSelect="@command('onChangeSelectOrder', ctrl=self)"
|
||||||
selectedItem="@bind(vm.dataBean)"
|
selectedItem="@bind(vm.dataBean)"
|
||||||
model="@load(vm.dataList)">
|
model="@load(vm.dataList)">
|
||||||
<listhead menupopup="auto">
|
<listhead menupopup="auto">
|
||||||
<listheader
|
<listheader
|
||||||
hflex="3"
|
hflex="10"
|
||||||
sort="auto(ordered)"
|
|
||||||
label="${labels.OrderAbr}" />
|
|
||||||
<listheader
|
|
||||||
hflex="7"
|
|
||||||
sort="czech(numser)"
|
sort="czech(numser)"
|
||||||
label="${labels.number}" />
|
label="${labels.OrderFormNumber}" />
|
||||||
<listheader
|
<listheader
|
||||||
hflex="10"
|
hflex="10"
|
||||||
sort="auto(orderDate)"
|
sort="auto(orderDate)"
|
||||||
@@ -52,6 +47,15 @@
|
|||||||
hflex="10"
|
hflex="10"
|
||||||
sort="auto(deliveredDate))"
|
sort="auto(deliveredDate))"
|
||||||
label="${labels.OrderFormDeliveredDate}" />
|
label="${labels.OrderFormDeliveredDate}" />
|
||||||
|
<listheader
|
||||||
|
hflex="10"
|
||||||
|
sort="auto(invoiceNumber)"
|
||||||
|
label="${labels.OrderFormInvoiceNumber}" />
|
||||||
|
<listheader
|
||||||
|
hflex="7"
|
||||||
|
align="right"
|
||||||
|
sort="auto(invoiceTotal)"
|
||||||
|
label="${labels.OrderFormInvoiceTotal}" />
|
||||||
<listheader
|
<listheader
|
||||||
hflex="15"
|
hflex="15"
|
||||||
sort="auto(suplier.company)"
|
sort="auto(suplier.company)"
|
||||||
@@ -75,19 +79,6 @@
|
|||||||
label="${labels.OrderFormDescription}" />
|
label="${labels.OrderFormDescription}" />
|
||||||
</listhead>
|
</listhead>
|
||||||
<auxhead visible="@load(vm.filter)">
|
<auxhead visible="@load(vm.filter)">
|
||||||
<auxheader>
|
|
||||||
<div sclass="find-grid-cell">
|
|
||||||
<div sclass="find-grid-divtextbox">
|
|
||||||
<checkbox
|
|
||||||
label="${labels.OrderFormOrdered}"
|
|
||||||
checked="@bind(vm.filterTemplate.ordered)"
|
|
||||||
onClick="@command('doFilter')" />
|
|
||||||
</div>
|
|
||||||
<div sclass="find-grid-img">
|
|
||||||
<image src="/img/funnel.png" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</auxheader>
|
|
||||||
<auxheader>
|
<auxheader>
|
||||||
<div sclass="find-grid-cell">
|
<div sclass="find-grid-cell">
|
||||||
<div sclass="find-grid-divtextbox">
|
<div sclass="find-grid-divtextbox">
|
||||||
@@ -151,6 +142,21 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</auxheader>
|
</auxheader>
|
||||||
|
<auxheader>
|
||||||
|
<div sclass="find-grid-cell">
|
||||||
|
<div sclass="find-grid-divtextbox">
|
||||||
|
<textbox
|
||||||
|
value="@bind(vm.filterTemplate.invoiceNumber)"
|
||||||
|
instant="true"
|
||||||
|
onChange="@command('doFilter')"
|
||||||
|
sclass="find-grid-textbox" />
|
||||||
|
</div>
|
||||||
|
<div sclass="find-grid-img">
|
||||||
|
<image src="/img/funnel.png" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</auxheader>
|
||||||
|
<auxheader></auxheader>
|
||||||
<auxheader>
|
<auxheader>
|
||||||
<div zclass="find-grid-cell">
|
<div zclass="find-grid-cell">
|
||||||
<div sclass="find-grid-divtextbox">
|
<div sclass="find-grid-divtextbox">
|
||||||
@@ -245,12 +251,13 @@
|
|||||||
</auxhead>
|
</auxhead>
|
||||||
<template name="model">
|
<template name="model">
|
||||||
<listitem>
|
<listitem>
|
||||||
<listcell label="@load(each.ordered) @converter(vm.standardBoolConverter)" />
|
|
||||||
<listcell label="@load(each.numser)" />
|
<listcell label="@load(each.numser)" />
|
||||||
<listcell label="@load(each.orderDate) @converter('formatedDate', format=labels.DateFormat)" />
|
<listcell label="@load(each.orderDate) @converter('formatedDate', format=labels.DateFormat)" />
|
||||||
<listcell label="@load(each.total) @converter(vm.standardBigDecimalConverter)" />
|
<listcell label="@load(each.total) @converter(vm.standardBigDecimalConverter)" />
|
||||||
<listcell label="@load(each.deliveryDate) @converter('formatedDate', format=labels.DateFormat)" />
|
<listcell label="@load(each.deliveryDate) @converter('formatedDate', format=labels.DateFormat)" />
|
||||||
<listcell label="@load(each.deliveredDate) @converter('formatedDate', format=labels.DateFormat)" />
|
<listcell label="@load(each.deliveredDate) @converter('formatedDate', format=labels.DateFormat)" />
|
||||||
|
<listcell label="@load(each.invoiceNumber)" />
|
||||||
|
<listcell label="@load(each.invoiceTotal) @converter(vm.standardBigDecimalConverter)" />
|
||||||
<listcell label="@load(each.suplier)" />
|
<listcell label="@load(each.suplier)" />
|
||||||
<listcell label="@load(each.deliveryAddress)" />
|
<listcell label="@load(each.deliveryAddress)" />
|
||||||
<listcell label="@load(each.address)" />
|
<listcell label="@load(each.address)" />
|
||||||
@@ -301,10 +308,6 @@
|
|||||||
hflex="15"
|
hflex="15"
|
||||||
sort="czech(description)"
|
sort="czech(description)"
|
||||||
label="${labels.RequirementItemDescription}" />
|
label="${labels.RequirementItemDescription}" />
|
||||||
<listheader
|
|
||||||
hflex="5"
|
|
||||||
sort="auto(reqItem.orderNum)"
|
|
||||||
label="${labels.OrderAbr}" />
|
|
||||||
</listhead>
|
</listhead>
|
||||||
<template name="model">
|
<template name="model">
|
||||||
<listitem>
|
<listitem>
|
||||||
@@ -316,7 +319,6 @@
|
|||||||
<listcell label="@load(each.unitPrice) @converter(vm.standardBigDecimalConverter)" />
|
<listcell label="@load(each.unitPrice) @converter(vm.standardBigDecimalConverter)" />
|
||||||
<listcell label="@load(each.total) @converter(vm.standardBigDecimalConverter)" />
|
<listcell label="@load(each.total) @converter(vm.standardBigDecimalConverter)" />
|
||||||
<listcell label="@load(each.description)" />
|
<listcell label="@load(each.description)" />
|
||||||
<listcell label="@load(each.reqItem.orderNum)" />
|
|
||||||
</listitem>
|
</listitem>
|
||||||
</template>
|
</template>
|
||||||
</listbox>
|
</listbox>
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
label="${labels.Order}" />
|
label="${labels.Order}" />
|
||||||
<vlayout
|
<vlayout
|
||||||
sclass="addScrollbar"
|
sclass="addScrollbar"
|
||||||
form="@id('fx') @init(vm.dataForm) @load(vm.dataBean) @save(vm.dataBean, before='save') @validator(vm.orderFormValidator)"
|
form="@id('fx') @load(vm.dataBean) @save(vm.dataBean, before='save') @validator(vm.orderFormValidator)"
|
||||||
hflex="1"
|
hflex="1"
|
||||||
vflex="1">
|
vflex="1">
|
||||||
<hlayout
|
<hlayout
|
||||||
@@ -42,16 +42,6 @@
|
|||||||
<column />
|
<column />
|
||||||
</columns>
|
</columns>
|
||||||
<rows vflex="max">
|
<rows vflex="max">
|
||||||
<row>
|
|
||||||
<cell sclass="row-title"></cell>
|
|
||||||
<cell>
|
|
||||||
<checkbox
|
|
||||||
id="idOrderOrdered"
|
|
||||||
disabled="@load(fx.icludedRequirementItemFromAnotherOrder)"
|
|
||||||
label="${labels.OrderFormOrdered}"
|
|
||||||
checked="@bind(fx.ordered)" />
|
|
||||||
</cell>
|
|
||||||
</row>
|
|
||||||
<row>
|
<row>
|
||||||
<cell sclass="row-title">${labels.OrderFormNumber} :</cell>
|
<cell sclass="row-title">${labels.OrderFormNumber} :</cell>
|
||||||
<cell>
|
<cell>
|
||||||
@@ -104,6 +94,26 @@
|
|||||||
format="${labels.DateFormat}" />
|
format="${labels.DateFormat}" />
|
||||||
</cell>
|
</cell>
|
||||||
</row>
|
</row>
|
||||||
|
<row>
|
||||||
|
<cell sclass="row-title">${labels.OrderFormInvoiceNumber} :</cell>
|
||||||
|
<cell>
|
||||||
|
<textbox
|
||||||
|
id="idInvoiceNumber"
|
||||||
|
width="150px"
|
||||||
|
value="@bind(fx.invoiceNumber)"
|
||||||
|
placeholder="${labels.NotYetFilled}..."
|
||||||
|
readonly="@load(empty fx.created)" />
|
||||||
|
</cell>
|
||||||
|
</row>
|
||||||
|
<row>
|
||||||
|
<cell sclass="row-title">${labels.OrderFormInvoiceTotal} :</cell>
|
||||||
|
<cell>
|
||||||
|
<textbox
|
||||||
|
id="idOrderInvoiceTotal"
|
||||||
|
width="150px"
|
||||||
|
value="@bind(fx.invoiceTotal) @converter(vm.standardBigDecimalConverter)" />
|
||||||
|
</cell>
|
||||||
|
</row>
|
||||||
<row>
|
<row>
|
||||||
<cell sclass="row-title">${labels.OrderFormDescription} :</cell>
|
<cell sclass="row-title">${labels.OrderFormDescription} :</cell>
|
||||||
<cell>
|
<cell>
|
||||||
@@ -146,29 +156,19 @@
|
|||||||
<row>
|
<row>
|
||||||
<cell sclass="row-title">${labels.SuppliersFormCompany} :</cell>
|
<cell sclass="row-title">${labels.SuppliersFormCompany} :</cell>
|
||||||
<cell colspan="3">
|
<cell colspan="3">
|
||||||
<hbox hflex="1">
|
|
||||||
<combobox
|
<combobox
|
||||||
ctrlKeys="${labels.HandleComboKey}"
|
ctrlKeys="${labels.HandleComboKey}"
|
||||||
onCtrlKey="@command('handleComboKey', ctrl=self, keyEvent=event)"
|
onCtrlKey="@command('handleComboKey', ctrl=self, keyEvent=event)"
|
||||||
onChange="@command('doFillSuppAddress')"
|
onChange="@command('doFillSuppAddress')"
|
||||||
hflex="4"
|
width="100%"
|
||||||
selectedItem="@bind(vm.selectedSuppAddrItem)"
|
selectedItem="@bind(vm.selectedSuppAddrItem)"
|
||||||
value="@bind(vm.suppCompany)"
|
value="@bind(vm.suppCompany)"
|
||||||
model="@load(vm.suppAddresses)"
|
model="@load(vm.suppAddresses)"
|
||||||
instant="true"
|
|
||||||
readonly="false">
|
readonly="false">
|
||||||
<template name="model">
|
<template name="model">
|
||||||
<comboitem label="@load(each)" />
|
<comboitem label="@load(each)" />
|
||||||
</template>
|
</template>
|
||||||
</combobox>
|
</combobox>
|
||||||
<hbox hflex="2">
|
|
||||||
<button image="/img/search.png"
|
|
||||||
label="${labels.SuppliersFormFindInARES}"
|
|
||||||
sclass="nicebutton"
|
|
||||||
disabled="@load((not empty vm.selectedSuppAddrItem) or ((empty vm.suppCompany) and (fx.suplier.ic eq 0)))"
|
|
||||||
onClick="@command('searchAddress')"/>
|
|
||||||
</hbox>
|
|
||||||
</hbox>
|
|
||||||
</cell>
|
</cell>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
@@ -176,8 +176,7 @@
|
|||||||
<cell>
|
<cell>
|
||||||
<textbox
|
<textbox
|
||||||
id="idSuppIC"
|
id="idSuppIC"
|
||||||
value="@bind(fx.suplier.ic)"
|
value="@bind(fx.suplier.ic)" />
|
||||||
instant="true" />
|
|
||||||
</cell>
|
</cell>
|
||||||
<cell sclass="row-title">${labels.SuppliersFormDIC} :</cell>
|
<cell sclass="row-title">${labels.SuppliersFormDIC} :</cell>
|
||||||
<cell>
|
<cell>
|
||||||
@@ -533,10 +532,6 @@
|
|||||||
hflex="15"
|
hflex="15"
|
||||||
sort="czech(description)"
|
sort="czech(description)"
|
||||||
label="${labels.RequirementItemDescription}" />
|
label="${labels.RequirementItemDescription}" />
|
||||||
<listheader
|
|
||||||
hflex="5"
|
|
||||||
sort="auto(reqItem.orderNum)"
|
|
||||||
label="${labels.OrderAbr}" />
|
|
||||||
</listhead>
|
</listhead>
|
||||||
<template name="model">
|
<template name="model">
|
||||||
<listitem>
|
<listitem>
|
||||||
@@ -547,7 +542,7 @@
|
|||||||
<textbox
|
<textbox
|
||||||
inplace="true"
|
inplace="true"
|
||||||
sclass="grid-textbox-max-right"
|
sclass="grid-textbox-max-right"
|
||||||
readonly="true"
|
readonly="${not sec:isAllGranted('ROLE_ADMIN')}"
|
||||||
onFocus="@command('onFocusItem', item=each, ctrl=self)"
|
onFocus="@command('onFocusItem', item=each, ctrl=self)"
|
||||||
onChange="@command('recalculate', form=fx, changed='quantity')"
|
onChange="@command('recalculate', form=fx, changed='quantity')"
|
||||||
value="@bind(each.quantity) @converter(vm.standardBigDecimalConverter)" />
|
value="@bind(each.quantity) @converter(vm.standardBigDecimalConverter)" />
|
||||||
@@ -572,7 +567,6 @@
|
|||||||
value="@bind(each.total) @converter(vm.standardBigDecimalConverter)" />
|
value="@bind(each.total) @converter(vm.standardBigDecimalConverter)" />
|
||||||
</listcell>
|
</listcell>
|
||||||
<listcell label="@load(each.description)" />
|
<listcell label="@load(each.description)" />
|
||||||
<listcell label="@load(each.reqItem.orderNum)" />
|
|
||||||
</listitem>
|
</listitem>
|
||||||
</template>
|
</template>
|
||||||
</listbox>
|
</listbox>
|
||||||
|
|||||||
@@ -2,11 +2,10 @@
|
|||||||
<zk>
|
<zk>
|
||||||
<window
|
<window
|
||||||
id="selectItemsWnd"
|
id="selectItemsWnd"
|
||||||
width="95%"
|
|
||||||
height="95%"
|
|
||||||
closable="true"
|
closable="true"
|
||||||
border="normal"
|
border="normal"
|
||||||
position="center"
|
position="center"
|
||||||
|
vflex="1"
|
||||||
apply="org.zkoss.bind.BindComposer"
|
apply="org.zkoss.bind.BindComposer"
|
||||||
viewModel="@id('vm') @init('info.bukova.isspst.ui.main.orders.material.SelectMaterialItems')">
|
viewModel="@id('vm') @init('info.bukova.isspst.ui.main.orders.material.SelectMaterialItems')">
|
||||||
<caption
|
<caption
|
||||||
@@ -119,7 +118,9 @@
|
|||||||
</listbox>
|
</listbox>
|
||||||
</vlayout>
|
</vlayout>
|
||||||
<vlayout>
|
<vlayout>
|
||||||
<div align="right">
|
<div
|
||||||
|
hflex="max"
|
||||||
|
align="right">
|
||||||
<button
|
<button
|
||||||
image="~./zul/img/misc/drag-disallow.png"
|
image="~./zul/img/misc/drag-disallow.png"
|
||||||
label="${labels.ButtonStorno}"
|
label="${labels.ButtonStorno}"
|
||||||
|
|||||||
@@ -10,14 +10,6 @@
|
|||||||
<column />
|
<column />
|
||||||
</columns>
|
</columns>
|
||||||
<rows>
|
<rows>
|
||||||
<row>
|
|
||||||
<cell sclass="row-title"></cell>
|
|
||||||
<cell>
|
|
||||||
<checkbox
|
|
||||||
label="${labels.StudentProject}"
|
|
||||||
checked="@bind(fx.project)" />
|
|
||||||
</cell>
|
|
||||||
</row>
|
|
||||||
<row>
|
<row>
|
||||||
<cell sclass="row-title">${labels.RequirementsFormNumberSerie} :</cell>
|
<cell sclass="row-title">${labels.RequirementsFormNumberSerie} :</cell>
|
||||||
<cell>
|
<cell>
|
||||||
@@ -182,7 +174,7 @@
|
|||||||
<textbox
|
<textbox
|
||||||
inplace="true"
|
inplace="true"
|
||||||
sclass="grid-textbox-max"
|
sclass="grid-textbox-max"
|
||||||
readonly="false"
|
readonly="true"
|
||||||
onFocus="@command('onFocusItem', item=each, ctrl=self)"
|
onFocus="@command('onFocusItem', item=each, ctrl=self)"
|
||||||
value="@bind(each.munit.name)" />
|
value="@bind(each.munit.name)" />
|
||||||
</listcell>
|
</listcell>
|
||||||
@@ -215,7 +207,7 @@
|
|||||||
<button
|
<button
|
||||||
image="~./zul/img/misc/drag-disallow.png"
|
image="~./zul/img/misc/drag-disallow.png"
|
||||||
label="${labels.RemoveItem}"
|
label="${labels.RemoveItem}"
|
||||||
onClick="@command('removeItem', form=fx, item=each)"
|
onClick="@command('removeItem', item=each, form=fx, ctrl=self)"
|
||||||
sclass="nicebutton" />
|
sclass="nicebutton" />
|
||||||
</listcell>
|
</listcell>
|
||||||
</listitem>
|
</listitem>
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user