diff --git a/pom.xml b/pom.xml
index ba907f2c..49b8dfcb 100644
--- a/pom.xml
+++ b/pom.xml
@@ -9,7 +9,7 @@
1.0.0-BUILD-SNAPSHOT
1.6
- 7.0.1
+ 7.0.2
3.1.1.RELEASE
1.6.10
1.6.6
diff --git a/src/main/java/info/bukova/isspst/data/Workgroup.java b/src/main/java/info/bukova/isspst/data/Workgroup.java
index 4e5dccd8..0163d69b 100644
--- a/src/main/java/info/bukova/isspst/data/Workgroup.java
+++ b/src/main/java/info/bukova/isspst/data/Workgroup.java
@@ -1,6 +1,7 @@
package info.bukova.isspst.data;
import java.io.Serializable;
+import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
@@ -37,6 +38,8 @@ public class Workgroup extends Member implements OwnedDataModel, Serializable {
private List members;
@Column(name = "CENTRE")
private boolean centre;
+ @Column(name = "REQ_LIMIT", precision = 15, scale = 4)
+ private BigDecimal limit;
//BaseData
@ManyToOne(fetch=FetchType.LAZY)
@JoinColumn(name="OWNED_BY_ID")
@@ -141,5 +144,13 @@ public class Workgroup extends Member implements OwnedDataModel, Serializable {
public List getRemoved() {
return removed;
}
+
+ public BigDecimal getLimit() {
+ return limit;
+ }
+
+ public void setLimit(BigDecimal limit) {
+ this.limit = limit;
+ }
}
diff --git a/src/main/java/info/bukova/isspst/services/IsspstException.java b/src/main/java/info/bukova/isspst/services/IsspstException.java
index 449f45c2..4b8fb63f 100644
--- a/src/main/java/info/bukova/isspst/services/IsspstException.java
+++ b/src/main/java/info/bukova/isspst/services/IsspstException.java
@@ -5,6 +5,7 @@ public class IsspstException extends RuntimeException {
private static final long serialVersionUID = 1L;
private final static String MSG = "IS Exception. ";
+ private String reason;
public IsspstException() {
super(MSG);
@@ -22,4 +23,12 @@ public class IsspstException extends RuntimeException {
super(MSG + message, cause);
}
+ public String getReason() {
+ return reason;
+ }
+
+ protected void setReason(String reason) {
+ this.reason = reason;
+ }
+
}
diff --git a/src/main/java/info/bukova/isspst/services/requirement/AddRequirementException.java b/src/main/java/info/bukova/isspst/services/requirement/AddRequirementException.java
new file mode 100644
index 00000000..e98068ac
--- /dev/null
+++ b/src/main/java/info/bukova/isspst/services/requirement/AddRequirementException.java
@@ -0,0 +1,21 @@
+package info.bukova.isspst.services.requirement;
+
+import info.bukova.isspst.services.IsspstException;
+
+public class AddRequirementException extends IsspstException {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -3794779381621324826L;
+
+ public AddRequirementException() {
+ super();
+ }
+
+ public AddRequirementException(String message) {
+ super(message);
+ this.setReason(message);
+ }
+
+}
diff --git a/src/main/java/info/bukova/isspst/services/requirement/RequirementBaseServiceImpl.java b/src/main/java/info/bukova/isspst/services/requirement/RequirementBaseServiceImpl.java
index 0a84ae74..d338f7dd 100644
--- a/src/main/java/info/bukova/isspst/services/requirement/RequirementBaseServiceImpl.java
+++ b/src/main/java/info/bukova/isspst/services/requirement/RequirementBaseServiceImpl.java
@@ -59,11 +59,19 @@ public abstract class RequirementBaseServiceImpl exte
entity.setNumser(this.getNumberSerie());
this.addWorkflow(entity);
+ if (!canAdd(entity)) {
+ throw new AddRequirementException();
+ }
+
super.add(entity);
this.sendToApprovers(entity);
}
+ protected boolean canAdd(T entity) {
+ return true;
+ }
+
private void sendToApprovers(T entity) {
SettingsData settings = settingsService.getSettings();
List approvers = this.getNextApprover(entity);
diff --git a/src/main/java/info/bukova/isspst/ui/FormViewModel.java b/src/main/java/info/bukova/isspst/ui/FormViewModel.java
index b6dd3e98..f16ed5d9 100644
--- a/src/main/java/info/bukova/isspst/ui/FormViewModel.java
+++ b/src/main/java/info/bukova/isspst/ui/FormViewModel.java
@@ -2,6 +2,7 @@ package info.bukova.isspst.ui;
import info.bukova.isspst.StringUtils;
import info.bukova.isspst.data.DataModel;
+import info.bukova.isspst.services.IsspstException;
import info.bukova.isspst.services.Service;
import info.bukova.isspst.services.ValidationException;
@@ -94,6 +95,18 @@ public class FormViewModel
Messagebox.show(StringUtils.localize("DbValidationError"), StringUtils.localize("Error"), Messagebox.OK, Messagebox.ERROR);
}
+ catch (IsspstException e)
+ {
+ if (e.getReason() != null)
+ {
+ Messagebox.show(StringUtils.localize(e.getReason()), StringUtils.localize("Error"), Messagebox.OK, Messagebox.ERROR);
+ }
+ else
+ {
+ Messagebox.show(StringUtils.localize("DbSaveError"), StringUtils.localize("Error"), Messagebox.OK, Messagebox.ERROR);
+ }
+ dataBean.setValid(false);
+ }
catch (AccessDeniedException e)
{
Messagebox.show(StringUtils.localize("ErrorRights"), StringUtils.localize("Error"), Messagebox.OK, Messagebox.ERROR);
diff --git a/src/main/java/info/bukova/isspst/ui/workgroups/WorkgroupForm.java b/src/main/java/info/bukova/isspst/ui/workgroups/WorkgroupForm.java
index 8673a0ee..017a1b41 100644
--- a/src/main/java/info/bukova/isspst/ui/workgroups/WorkgroupForm.java
+++ b/src/main/java/info/bukova/isspst/ui/workgroups/WorkgroupForm.java
@@ -11,6 +11,7 @@ import info.bukova.isspst.services.users.RoleService;
import info.bukova.isspst.services.users.UserService;
import info.bukova.isspst.services.workgroups.WorkgroupException;
import info.bukova.isspst.services.workgroups.WorkgroupService;
+import info.bukova.isspst.ui.BigDecimalConverter;
import info.bukova.isspst.ui.FormViewModel;
import java.util.ArrayList;
@@ -40,12 +41,14 @@ public class WorkgroupForm extends FormViewModel {
private List users;
private String findUser;
private List selectedUsers;
+ private BigDecimalConverter bdConverter;
@Init(superclass = true)
public void init() {
users = new ArrayList();
users.addAll(userService.getAll());
selectedUsers = new ArrayList();
+ bdConverter = new BigDecimalConverter();
}
public List getUsers() {
@@ -90,6 +93,8 @@ public class WorkgroupForm extends FormViewModel {
}
}
}
+
+ getDataBean().setLimit(null);
}
}
@@ -229,5 +234,9 @@ public class WorkgroupForm extends FormViewModel {
}
}
}
+
+ public BigDecimalConverter getBdConverter() {
+ return bdConverter;
+ }
}
diff --git a/src/main/webapp/WEB-INF/locales/zk-label.properties b/src/main/webapp/WEB-INF/locales/zk-label.properties
index 9e9ead4f..53503b22 100644
--- a/src/main/webapp/WEB-INF/locales/zk-label.properties
+++ b/src/main/webapp/WEB-INF/locales/zk-label.properties
@@ -295,3 +295,4 @@ WorkgroupFormUserIsCenterMember=Uživatel je členem střediska, jehož je komis
WorkgroupFormMemberIsCenterMember=Některý ze členů přidávané komise je členem tohoto střediska!
WorkgroupFormCannotAddUser=Uživatele nelze přidat
WorkgroupFormCannotAddWorkgroup=Komisi nelze přidat
+WorkgroupFormOrderLimit=Limit nákupů
diff --git a/src/main/webapp/admin/workgroups/workgroupForm.zul b/src/main/webapp/admin/workgroups/workgroupForm.zul
index 29f50d90..343656b5 100644
--- a/src/main/webapp/admin/workgroups/workgroupForm.zul
+++ b/src/main/webapp/admin/workgroups/workgroupForm.zul
@@ -27,6 +27,12 @@
+
+ ${labels.WorkgroupFormOrderLimit} : |
+
+
+ |
+