Fix limit Manage Reservations by resource barcode
authorJane Sandberg <sandbej@linnbenton.edu>
Tue, 22 Jan 2019 22:20:43 +0000 (14:20 -0800)
committerJane Sandberg <sandbej@linnbenton.edu>
Wed, 23 Jan 2019 23:08:13 +0000 (15:08 -0800)
Signed-off-by: Jane Sandberg <sandbej@linnbenton.edu>
Open-ILS/src/eg2/src/app/staff/booking/manage-reservations.component.ts

index 2d5f7a8..b5a64cb 100644 (file)
@@ -22,6 +22,7 @@ export class ManageReservationsComponent implements OnInit {
   gridSource: GridDataSource;
   patronId: number;
   resourceBarcode: string;
+  resourceId: number;
   numRowsSelected: number;
 
   @ViewChild('grid') grid: GridComponent;
@@ -50,8 +51,8 @@ export class ManageReservationsComponent implements OnInit {
          orderBy.bresv = sort[0].name + ' ' + sort[0].dir;
       }
       return this.pcrud.search('bresv', {
-        "usr" : (this.patronId ? this.patronId : {">" : 1}),
-       "target_resource" : {"barcode" : (this.resourceBarcode ? this.resourceBarcode : {"!=" : null})}
+        "usr" : (this.patronId ? this.patronId : {">" : 0}),
+        "target_resource" : (this.resourceId ? this.resourceId : {">" : 0}),
           }, {   
         order_by: orderBy,
         limit: pager.limit,
@@ -99,8 +100,13 @@ export class ManageReservationsComponent implements OnInit {
     }
 
     this.editDialog.mode = 'update'; // this fmeditor is not used for creating objects, just updates
+
+    if (this.resourceBarcode) {
+      this.pcrud.search('brsrc', {'barcode' : this.resourceBarcode}, {"limit": 1, "select": ["id"]}).subscribe((res) => this.resourceId = res.id());
+    }
   }
 
+
   showEditDialog(idlThing: IdlObject) {
     this.editDialog.recId = idlThing.id();
     return this.editDialog.open({size: 'lg'}).then(