Josef Rokos 10 years ago
commit f94afbc3ed

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

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

@ -297,6 +297,17 @@ public class OrderForm extends FormViewModel<Order>
this.calcAndUpdateFormTotalPrice(form); 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 @Override
protected void doSave() protected void doSave()
{ {

@ -135,6 +135,8 @@
href="/j_spring_security_logout" /> href="/j_spring_security_logout" />
</menupopup> </menupopup>
</menu> </menu>
href="https://drive.google.com/folderview?id=0B2inqAvr2t-TODg4ZWZoSThYbGM&amp;usp=sharing_eid"
tooltiptext="${labels.GoogleDriveUrl}" />
<menuseparator /> <menuseparator />
<menuitem <menuitem
image="/img/search.png" image="/img/search.png"
@ -142,8 +144,5 @@
href="/app/search" href="/app/search"
visible="${module:isActive('SEARCH') }" visible="${module:isActive('SEARCH') }"
disabled="${not sec:isAllGranted('PERM_SEARCH_SEARCH')}" /> disabled="${not sec:isAllGranted('PERM_SEARCH_SEARCH')}" />
<menuitem label="${labels.Help}" target="blank"
href="https://drive.google.com/folderview?id=0B2inqAvr2t-TODg4ZWZoSThYbGM&amp;usp=sharing_eid"
tooltiptext="${labels.GoogleDriveUrl}" />
</menubar> </menubar>
</zk> </zk>
Loading…
Cancel
Save