Umožněno zadání limitu nákupů u komisí.

Příprava na kontrolu limitu při přidávání požadavku.
ZK framework povýšen na verzi 7.0.2
refs #137
multitenant
Josef Rokos 10 years ago
parent 9387ac6d69
commit e93a99aa25

@ -9,7 +9,7 @@
<version>1.0.0-BUILD-SNAPSHOT</version>
<properties>
<java-version>1.6</java-version>
<zk.version>7.0.1</zk.version>
<zk.version>7.0.2</zk.version>
<org.springframework-version>3.1.1.RELEASE</org.springframework-version>
<org.aspectj-version>1.6.10</org.aspectj-version>
<org.slf4j-version>1.6.6</org.slf4j-version>

@ -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<JobMapping> 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")
@ -142,4 +145,12 @@ public class Workgroup extends Member implements OwnedDataModel, Serializable {
return removed;
}
public BigDecimal getLimit() {
return limit;
}
public void setLimit(BigDecimal limit) {
this.limit = limit;
}
}

@ -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;
}
}

@ -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);
}
}

@ -59,11 +59,19 @@ public abstract class RequirementBaseServiceImpl<T extends RequirementBase> 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<User> approvers = this.getNextApprover(entity);

@ -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<T extends DataModel>
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);

@ -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<Workgroup> {
private List<Member> users;
private String findUser;
private List<Member> selectedUsers;
private BigDecimalConverter bdConverter;
@Init(superclass = true)
public void init() {
users = new ArrayList<Member>();
users.addAll(userService.getAll());
selectedUsers = new ArrayList<Member>();
bdConverter = new BigDecimalConverter();
}
public List<Member> getUsers() {
@ -90,6 +93,8 @@ public class WorkgroupForm extends FormViewModel<Workgroup> {
}
}
}
getDataBean().setLimit(null);
}
}
@ -230,4 +235,8 @@ public class WorkgroupForm extends FormViewModel<Workgroup> {
}
}
public BigDecimalConverter getBdConverter() {
return bdConverter;
}
}

@ -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ů

@ -27,6 +27,12 @@
<checkbox label="Středisko" checked="@bind(vm.centre)" disabled="@load(not empty vm.dataBean.created)"/>
</cell>
</row>
<row>
<cell sclass="row-title">${labels.WorkgroupFormOrderLimit} :</cell>
<cell>
<textbox id="limit" width="200px" value="@bind(vm.dataBean.limit) @converter(vm.bdConverter)" disabled="@load(vm.centre)"/>
</cell>
</row>
</rows>
</grid>
<label value="Přetáhněte myší:"/>

Loading…
Cancel
Save