5 angular.module('egItemReplaceBarcode',
6 ['ngRoute', 'ui.bootstrap', 'egCoreMod','egUiMod'])
8 .controller('ReplaceItemBarcodeCtrl',
10 function($scope , egCore) {
13 $scope.focusBarcode = true;
15 $scope.updateBarcode = function() {
16 $scope.copyNotFound = false;
17 $scope.duplicateBarcode = false;
18 $scope.updateOK = false;
20 egCore.pcrud.search('acp',
21 {deleted : 'f', barcode : $scope.barcode1})
22 .then(function(copy) {
25 $scope.focusBarcode = true;
26 $scope.copyNotFound = true;
30 egCore.pcrud.search('acp',
31 {deleted : 'f', barcode : $scope.barcode2})
32 .then(function(newBarcodeCopy) {
35 $scope.duplicateBarcode = true;
39 $scope.copyId = copy.id();
40 copy.barcode($scope.barcode2);
42 egCore.pcrud.update(copy).then(function(stat) {
43 $scope.updateOK = stat;
44 $scope.focusBarcode = true;