ItEr42S14CUAsignarUsuarioAProxectoTraballoItEr41S17: Implemented deletion of order authorizations from the web interface
This commit is contained in:
parent
ab1c86f867
commit
85dc8d240e
2 changed files with 17 additions and 1 deletions
|
|
@ -38,6 +38,8 @@ public class OrderAuthorizationModel implements IOrderAuthorizationModel {
|
|||
|
||||
private List<UserOrderAuthorization> userOrderAuthorizationList;
|
||||
|
||||
private List<OrderAuthorization> orderAuthorizationRemovalList;
|
||||
|
||||
@Autowired
|
||||
private IOrderAuthorizationDAO dao;
|
||||
|
||||
|
|
@ -106,6 +108,12 @@ public class OrderAuthorizationModel implements IOrderAuthorizationModel {
|
|||
for(OrderAuthorization authorization : userOrderAuthorizationList) {
|
||||
dao.save(authorization);
|
||||
}
|
||||
for(OrderAuthorization authorization : orderAuthorizationRemovalList) {
|
||||
try {
|
||||
dao.remove(authorization.getId());
|
||||
}
|
||||
catch(InstanceNotFoundException e) {}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -126,6 +134,8 @@ public class OrderAuthorizationModel implements IOrderAuthorizationModel {
|
|||
new ArrayList<ProfileOrderAuthorization>();
|
||||
userOrderAuthorizationList =
|
||||
new ArrayList<UserOrderAuthorization>();
|
||||
orderAuthorizationRemovalList =
|
||||
new ArrayList<OrderAuthorization>();
|
||||
|
||||
if(!order.isNewObject()) {
|
||||
//Retrieve the OrderAuthorizations associated with this order
|
||||
|
|
@ -163,6 +173,9 @@ public class OrderAuthorizationModel implements IOrderAuthorizationModel {
|
|||
profileOrderAuthorizationList.remove(
|
||||
(ProfileOrderAuthorization) orderAuthorization);
|
||||
}
|
||||
if(!orderAuthorization.isNewObject()) {
|
||||
orderAuthorizationRemovalList.add(orderAuthorization);
|
||||
}
|
||||
}
|
||||
|
||||
private ProfileOrderAuthorization createProfileOrderAuthorization(
|
||||
|
|
|
|||
|
|
@ -48,7 +48,8 @@
|
|||
<hbox>
|
||||
<button sclass="icono" image="/common/img/ico_borrar1.png"
|
||||
hoverImage="/common/img/ico_borrar.png"
|
||||
onClick="controller.removeOrderAuthorization(self.parent.parent.value);"
|
||||
onClick="orderAuthorizationController.
|
||||
removeOrderAuthorization(self.parent.parent.value);"
|
||||
tooltiptext="${i18n:_('Delete')}" />
|
||||
</hbox>
|
||||
</row>
|
||||
|
|
@ -83,6 +84,8 @@
|
|||
<label value="@{authorization.authorizationType.displayName}" />
|
||||
<hbox>
|
||||
<button sclass="icono" image="/common/img/ico_borrar1.png"
|
||||
onClick="orderAuthorizationController.
|
||||
removeOrderAuthorization(self.parent.parent.value);"
|
||||
hoverImage="/common/img/ico_borrar.png"
|
||||
tooltiptext="${i18n:_('Delete')}" />
|
||||
</hbox>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue