ItEr31S14CUConfiguracionDeOrganizacionsDeTraballoConUnidadesTraballoItEr19S09: [FixBug] Save Advances for Order
This commit is contained in:
parent
c0fe516ce3
commit
dfe306aa64
4 changed files with 26 additions and 22 deletions
|
|
@ -47,7 +47,7 @@ public interface IManageOrderElementAdvancesModel {
|
|||
|
||||
public List<AdvanceAssignment> getAdvanceAssignments();
|
||||
|
||||
public void init(OrderElement orderElement);
|
||||
public void initEdit(OrderElement orderElement);
|
||||
|
||||
public void addNewLineAdvaceAssignment();
|
||||
|
||||
|
|
@ -80,7 +80,7 @@ public interface IManageOrderElementAdvancesModel {
|
|||
|
||||
public String getInfoAdvanceAssignment();
|
||||
|
||||
public void accept()throws InstanceNotFoundException,
|
||||
public void confirmSave()throws InstanceNotFoundException,
|
||||
DuplicateAdvanceAssignmentForOrderElementException,
|
||||
DuplicateValueTrueReportGlobalAdvanceException;
|
||||
|
||||
|
|
|
|||
|
|
@ -109,27 +109,30 @@ public class ManageOrderElementAdvancesController extends
|
|||
}
|
||||
|
||||
public void close() {
|
||||
validate();
|
||||
save();
|
||||
}
|
||||
|
||||
public void validate() {
|
||||
if (!validateDataForm()){
|
||||
messagesForUser.showMessage(
|
||||
Level.ERROR, _("Values are not valid, the values must not be null"));
|
||||
private void validate() {
|
||||
if (!validateDataForm()) {
|
||||
messagesForUser.showMessage(
|
||||
Level.ERROR, _("values are not valid, the values must not be null"));
|
||||
return;
|
||||
}
|
||||
if (!validateReportGlobalAdvance()){
|
||||
messagesForUser.showMessage(
|
||||
Level.ERROR, _("The Spread values are not valid, must be exist at least one value of spread to true"));
|
||||
return;
|
||||
if (!validateReportGlobalAdvance()) {
|
||||
messagesForUser.showMessage(
|
||||
Level.ERROR, _("spread values are not valid, at least one value should be true"));
|
||||
}
|
||||
}
|
||||
|
||||
public void save() {
|
||||
validate();
|
||||
try {
|
||||
manageOrderElementAdvancesModel.accept();
|
||||
manageOrderElementAdvancesModel.confirmSave();
|
||||
} catch (DuplicateAdvanceAssignmentForOrderElementException e) {
|
||||
messagesForUser.showMessage(Level.ERROR, _("It not must be include Advance with the same advance type."));
|
||||
messagesForUser.showMessage(Level.ERROR, _("cannot include an Advance of the same Advance type twice"));
|
||||
} catch(DuplicateValueTrueReportGlobalAdvanceException e) {
|
||||
messagesForUser.showMessage(
|
||||
Level.ERROR, _("The Spread values are not valid, There are several spread values to true"));
|
||||
Level.ERROR, _("spread values are not valid, at least one value should be true"));
|
||||
} catch (InstanceNotFoundException e) {
|
||||
messagesForUser.showMessage(
|
||||
Level.ERROR, e.getMessage());
|
||||
|
|
@ -141,7 +144,7 @@ public class ManageOrderElementAdvancesController extends
|
|||
|
||||
public void openWindow(IOrderElementModel orderElementModel) {
|
||||
setOrderElementModel(orderElementModel);
|
||||
manageOrderElementAdvancesModel.init(getOrderElement());
|
||||
manageOrderElementAdvancesModel.initEdit(getOrderElement());
|
||||
this.indexSelectedItem = -1;
|
||||
selectedAdvances.clear();
|
||||
Util.reloadBindings(self);
|
||||
|
|
|
|||
|
|
@ -150,7 +150,7 @@ public class ManageOrderElementAdvancesModel implements
|
|||
|
||||
@Override
|
||||
@Transactional(readOnly = true)
|
||||
public void init(OrderElement orderElement) {
|
||||
public void initEdit(OrderElement orderElement) {
|
||||
this.orderElement = orderElement;
|
||||
this.advanceAssignment = null;
|
||||
if (orderElement != null){
|
||||
|
|
@ -294,12 +294,12 @@ public class ManageOrderElementAdvancesModel implements
|
|||
|
||||
@Override
|
||||
@Transactional(readOnly = true)
|
||||
public void accept()throws InstanceNotFoundException,
|
||||
DuplicateAdvanceAssignmentForOrderElementException,
|
||||
DuplicateValueTrueReportGlobalAdvanceException{
|
||||
orderElementDAO.checkVersion(orderElement);
|
||||
reattachmentOrderElement();
|
||||
validateBasicData();
|
||||
public void confirmSave()throws InstanceNotFoundException,
|
||||
DuplicateAdvanceAssignmentForOrderElementException,
|
||||
DuplicateValueTrueReportGlobalAdvanceException{
|
||||
orderElementDAO.checkVersion(orderElement);
|
||||
reattachmentOrderElement();
|
||||
validateBasicData();
|
||||
}
|
||||
|
||||
private void validateBasicData() throws InstanceNotFoundException,
|
||||
|
|
|
|||
|
|
@ -151,6 +151,7 @@ public class OrderCRUDController extends GenericForwardComposer {
|
|||
|
||||
public void save() {
|
||||
try {
|
||||
manageOrderElementAdvancesController.save();
|
||||
orderModel.save();
|
||||
messagesForUser.showMessage(Level.INFO, _("Order saved"));
|
||||
goToList();
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue