Bug 8030 - (QA Folllowup) Use Koha::Libraries
authorNick Clemens <nick@bywatersolutions.com>
Fri, 9 Sep 2016 16:35:49 +0000 (16:35 +0000)
committerKyle M Hall <kyle@bywatersolutions.com>
Mon, 12 Sep 2016 08:47:46 +0000 (08:47 +0000)
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
koha-tmpl/intranet-tmpl/prog/js/holds.js
svc/holds

index b95cac0..8d51474 100644 (file)
@@ -106,6 +106,7 @@ $(document).ready(function() {
                                     var selectedbranch;
                                     var setbranch;
                                     if( oObj.branches[i].selected ){
+
                                         selectedbranch = " selected='selected' ";
                                         setbranch = CURRENT;
                                     }
@@ -113,7 +114,7 @@ $(document).ready(function() {
                                         selectedbranch = '';
                                         setbranch = '';
                                     }
-                                    branchSelect += '<option value="'+ oObj.branches[i].value +'"'+selectedbranch+'>'+oObj.branches[i].branchname+setbranch+'</option>';
+                                    branchSelect += '<option value="'+ oObj.branches[i].branchcode +'"'+selectedbranch+'>'+oObj.branches[i].branchname+setbranch+'</option>';
                                 }
                                 branchSelect +='</select>';
                                 return branchSelect;
index 4a9e3af..3c3a2b0 100755 (executable)
--- a/svc/holds
+++ b/svc/holds
@@ -24,7 +24,6 @@ use JSON qw(to_json);
 
 use C4::Auth qw(check_cookie_auth);
 use C4::Biblio qw(GetMarcBiblio GetFrameworkCode GetRecordValue );
-use C4::Branch qw(GetBranchName GetBranchesLoop);
 use C4::Charset;
 use C4::Circulation qw(GetTransfers);
 use C4::Context;
@@ -80,6 +79,10 @@ while ( my $h = $holds_rs->next() ) {
         $itemtype_limit = $itemtype->{translated_description};
     }
 
+    my $libraries = Koha::Libraries->search({}, { order_by => ['branchname'] })->unblessed;
+    for my $library ( @$libraries ) {
+        $library->{selected} = 1 if $library->{branchcode} eq $h->branchcode();
+    }
     my $hold = {
         DT_RowId       => $h->reserve_id(),
         biblionumber   => $biblionumber,
@@ -87,7 +90,7 @@ while ( my $h = $holds_rs->next() ) {
         author         => $h->biblio()->author(),
         reserve_id     => $h->reserve_id(),
         branchcode     => $h->branch()->branchname(),
-        branches       => GetBranchesLoop($h->branch()->branchcode()),
+        branches       => $libraries,
         reservedate    => $h->reservedate(),
         expirationdate => $h->expirationdate(),
         suspend        => $h->suspend(),