<li><a href ng-click="cancel_transit()">[% l('Cancel Transit') %]</a></li>
<li><a href ng-click="update_inventory()">[% l('Update Inventory') %]</a></li>
+ <p><b>[% l('Find') %]</b></p>
+ <li><a href ng-click="findAcquisition()">[% l('Originating Acquisition') %]</a></li>
+
<p><b>[% l('Mark') %]</b></p>
<li><a href ng-click="selectedHoldingsDamaged()">[% l('Item as Damaged') %]</a></li>
<li><a href ng-click="selectedHoldingsMissing()">[% l('Item as Missing') %]</a></li>
* Parent scope for list and detail views
*/
.controller('SearchCtrl',
- ['$scope','$location','$timeout','egCore','egGridDataProvider','egItem',
-function($scope , $location , $timeout , egCore , egGridDataProvider , itemSvc) {
+ ['$scope','$q','$window','$location','$timeout','egCore','egNet','egGridDataProvider','egItem',
+function($scope , $q, $window , $location , $timeout , egCore , egNet , egGridDataProvider , itemSvc) {
$scope.args = {}; // search args
// sub-scopes (search / detail-view) apply their version
}]);
}
+ $scope.findAcquisition = function() {
+ var acqData;
+ var promises = [];
+ promises.push(
+ egCore.pcrud.search('jub', {eg_bib_id: $scope.args.copyId}).then(
+ null,
+ null,
+ function (data) {
+ acqData = data;
+ }
+ )
+ );
+
+ $q.all(promises).then(function() {
+ if (acqData) {
+ acqData = egCore.idl.toHash(acqData);
+ var url = '/eg/acq/po/view/' + acqData.purchase_order + '/' + acqData.id;
+ $timeout(
+ function() {
+ $window.open(url, '_blank')
+ }).then(
+ function() {$timeout(function(){$window.close()});}
+ );
+ } else {
+ alert('There is no corresponding purchase order for this item.');
+ }
+ });
+ }
+
$scope.requestItems = function() {
itemSvc.requestItems([$scope.args.copyId]);
}