@@ -4,25 +4,38 @@ angular.module('virtoCommerce.orderModule')
44 var blade = $scope . blade ;
55 blade . updatePermission = 'order:update' ;
66
7- blade . refresh = function ( ) {
7+ blade . refresh = function ( entity ) {
88 if ( blade . id === 'operationDetail' ) {
99 if ( ! blade . isNew )
10- blade . initialize ( blade . currentEntity ) ;
10+ blade . initialize ( blade . currentEntity , entity ) ;
1111 }
1212 else {
13- blade . isLoading = true ;
14- customerOrders . get ( { id : blade . customerOrder . id } , function ( result ) {
15- blade . initialize ( result ) ;
13+ if ( entity == null ) {
14+ blade . isLoading = true ;
15+ customerOrders . get ( { id : blade . customerOrder . id } ,
16+ function ( result ) {
17+ blade . initialize ( result ) ;
18+ blade . customerOrder = blade . currentEntity ;
19+ //necessary for scope bounded ACL checks
20+ blade . securityScopes = result . scopes ;
21+ } ) ;
22+ } else {
23+ blade . initialize ( blade . currentEntity , entity ) ;
1624 blade . customerOrder = blade . currentEntity ;
17- //necessary for scope bounded ACL checks
18- blade . securityScopes = result . scopes ;
19- } ) ;
25+ //necessary for scope bounded ACL checks
26+ blade . securityScopes = entity . scopes ;
27+ }
2028 }
2129 }
2230
23- blade . initialize = function ( operation ) {
24- blade . origEntity = operation ;
25- blade . currentEntity = angular . copy ( operation ) ;
31+ blade . initialize = function ( originalEntity , updatedEntity ) {
32+ if ( updatedEntity != null ) {
33+ blade . origEntity = angular . copy ( updatedEntity ) ;
34+ blade . currentEntity = updatedEntity ;
35+ } else {
36+ blade . origEntity = originalEntity ;
37+ blade . currentEntity = angular . copy ( originalEntity ) ;
38+ }
2639 $scope . $broadcast ( "blade.currentEntity.documentLoaded" ) ;
2740 blade . isLoading = false ;
2841 } ;
0 commit comments