]> git.evergreen-ils.org Git - working/Evergreen.git/blob - Open-ILS/web/js/ui/default/staff/cat/item/replace_barcode/app.js
LP#1736269: Mark Missing Pieces is non-functional
[working/Evergreen.git] / Open-ILS / web / js / ui / default / staff / cat / item / replace_barcode / app.js
1 /**
2  * Item Display
3  */
4
5 angular.module('egItemReplaceBarcode', 
6     ['ngRoute', 'ui.bootstrap', 'egCoreMod','egUiMod'])
7
8 .controller('ReplaceItemBarcodeCtrl',
9        ['$scope','egCore',
10 function($scope , egCore) {
11     egCore.startup.go();
12
13     $scope.focusBarcode = true;
14
15     $scope.updateBarcode = function() {
16         $scope.copyNotFound = false;
17         $scope.updateOK = false;
18
19         egCore.pcrud.search('acp', 
20             {deleted : 'f', barcode : $scope.barcode1})
21         .then(function(copy) {
22
23             if (!copy) {
24                 $scope.focusBarcode = true;
25                 $scope.copyNotFound = true;
26                 return;
27             }
28
29             $scope.copyId = copy.id();
30             copy.barcode($scope.barcode2);
31
32             egCore.pcrud.update(copy).then(function(stat) {
33                 $scope.updateOK = stat;
34                 $scope.focusBarcode = true;
35             });
36         });
37     }
38 }]);
39