Workaround pro zápis číselné řady.

Vznikaly duplicity nad unikátním indexem.
Nyní se číslo nezapisuje a načítá se z vazby na požadavku na cesťák.

closes #221
Verze_2.0
František Přibyl 10 years ago
parent fbc7a02161
commit aaa89a2653

@ -18,6 +18,22 @@ public class TripBillApproval extends RequirementBase {
@JoinColumn(name = "TRIPBILL_ID") @JoinColumn(name = "TRIPBILL_ID")
private TripBill bill; private TripBill bill;
@Override
public String getNumser() {
if (bill == null) {
return "";
}
TripRequirement tr = bill.getRequirement();
if (tr == null) {
return "";
}
return tr.getNumser();
}
public TripBill getBill() { public TripBill getBill() {
return bill; return bill;
} }

@ -8,12 +8,13 @@ import info.bukova.isspst.data.TripBillApproval;
import info.bukova.isspst.services.IsspstException; import info.bukova.isspst.services.IsspstException;
import info.bukova.isspst.services.requirement.RequirementBaseServiceImpl; import info.bukova.isspst.services.requirement.RequirementBaseServiceImpl;
import info.bukova.isspst.services.requirement.RequirementTypeService; import info.bukova.isspst.services.requirement.RequirementTypeService;
import java.util.Date;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
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;
import java.util.Date;
/** /**
* @author Pepa Rokos * @author Pepa Rokos
*/ */
@ -34,7 +35,7 @@ public class TripBillApprovalServiceImpl extends RequirementBaseServiceImpl<Trip
approval.setReqDate(new Date()); approval.setReqDate(new Date());
approval.setType(reqTypeService.getTypeById(Constants.REQTYPE_BUSINESSTRIP)); approval.setType(reqTypeService.getTypeById(Constants.REQTYPE_BUSINESSTRIP));
approval.setState(RequirementState.NEW); approval.setState(RequirementState.NEW);
approval.setNumser(bill.getRequirement().getNumser()); // approval.setNumser(bill.getRequirement().getNumser());
approval.setDescription(StringUtils.localize("TravelOrdersFormTitle") + " \"" + bill.getOwnedBy() + "\" - " + bill.getRequirement().getDescription()); approval.setDescription(StringUtils.localize("TravelOrdersFormTitle") + " \"" + bill.getOwnedBy() + "\" - " + bill.getRequirement().getDescription());
approval.setBill(bill); approval.setBill(bill);
bill.setApproval(approval); bill.setApproval(approval);

Loading…
Cancel
Save