From 1d9d7b5f03b3e7b6af5600574a0ae6053843b77b Mon Sep 17 00:00:00 2001
From: rsanchez <rsanchez@curisit.net>
Date: Tue, 28 Oct 2014 13:07:05 +0000
Subject: [PATCH] #2021 feature - Fixing pack cacnellation and deletion actions

---
 securis/src/main/resources/static/js/licenses.js |   20 ++++++++++++++------
 1 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/securis/src/main/resources/static/js/licenses.js b/securis/src/main/resources/static/js/licenses.js
index 6dfe849..2e250fa 100644
--- a/securis/src/main/resources/static/js/licenses.js
+++ b/securis/src/main/resources/static/js/licenses.js
@@ -105,11 +105,12 @@
 			var _error = _createErrorCallback(pack, $L.get('Put on hold'), _onerror);
 			packResource.putonhold({id: pack.id}, _success, _error);
 		}
-		this.cancel = function(pack, _onsuccess, _onerror) {
+		this.cancel = function(pack, extra_data, _onsuccess, _onerror) {
 			console.log('Cancellation on pack: ' + pack.id);
 			var _success = _createSuccessCallback($L.get('Cancellation'), $L.get("Pack '{0}' {1} successfully", pack.code, $L.get("cancelled")), _onsuccess);
 			var _error = _createErrorCallback(pack, $L.get('Cancellation'), _onerror);
-			packResource.cancel({id: pack.id}, _success, _error);
+			var params = angular.extend({id: pack.id}, extra_data);
+			packResource.cancel(params, _success, _error);
 		}
 		this.delete = function(pack, _onsuccess, _onerror) {
 			console.log('Delete on pack: ' + pack.id);
@@ -334,10 +335,17 @@
 				 */
 				$scope.execute = function(action, pack) {
 					var _execute = function(extra_data) {
-						Packs[action](pack || $scope.pack, extra_data, function() {
-						    if (!$scope.isNew) $scope.showForm = false;
-							$scope.packs = Packs.getPacksList();
-						});
+						if (extra_data) {
+							Packs[action](pack || $scope.pack, extra_data, function() {
+							    if (!$scope.isNew) $scope.showForm = false;
+								$scope.packs = Packs.getPacksList();
+							});
+						} else {
+							Packs[action](pack || $scope.pack, function() {
+							    if (!$scope.isNew) $scope.showForm = false;
+								$scope.packs = Packs.getPacksList();
+							});
+						}
 					}
 					if (action === 'delete') {
 						BootstrapDialog.confirm($L.get("The pack '{0}' will be deleted, are you sure ?", $scope.pack.code), function(answer) {

--
Gitblit v1.3.2