U nových objednávek lze nyní zatrhout, že je rovnou objednáno...

closes #196
Verze_1.0 1.4
František Přibyl 10 years ago
parent ecbc2be47c
commit 884bc8267d

@ -22,5 +22,7 @@ public interface OrderService extends Service<Order> {
public BigDecimal calcSumTotalFromItems(List<OrderItem> items);
public void addApprovedItems(Order order, boolean orderedChanged);
public void updateApprovedItems(Order order, boolean orderedChanged);
}

@ -180,16 +180,14 @@ public class OrderServiceImpl extends AbstractOwnedService<Order> implements
return sumTotal;
}
@Transactional
@PreAuthorize("hasPermission(this, 'PERM_EDIT') or hasPermission(#entity, this.getUpdateEntityPermission())")
public void updateApprovedItems(Order order, boolean orderedChanged)
protected void setApprovedItems(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);
@ -197,7 +195,23 @@ public class OrderServiceImpl extends AbstractOwnedService<Order> implements
}
}
}
}
@Override
@Transactional
@PreAuthorize("hasPermission(this, 'PERM_ADD')")
public void addApprovedItems(Order order, boolean orderedChanged)
{
this.add(order);
this.setApprovedItems(order, orderedChanged);
}
@Override
@Transactional
@PreAuthorize("hasPermission(this, 'PERM_EDIT') or hasPermission(#entity, this.getUpdateEntityPermission())")
public void updateApprovedItems(Order order, boolean orderedChanged)
{
this.setApprovedItems(order, orderedChanged);
super.update(order);
}

@ -297,6 +297,17 @@ public class OrderForm extends FormViewModel<Order>
this.calcAndUpdateFormTotalPrice(form);
}
@Override
protected void doAdd()
{
// 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.addApprovedItems(this.getDataBean(), orderedChanged);
BindUtils.postGlobalCommand(null, null, "reload", null);
}
@Override
protected void doSave()
{

Loading…
Cancel
Save