Bug 7677 [QA Followup] - Replace GetItemnumberFromSerialId with use of Koha::Serial...
[koha.git] / tools / letter.pl
index 9f8ac95..2e5c037 100755 (executable)
@@ -46,7 +46,6 @@ use CGI qw ( -utf8 );
 use C4::Auth;
 use C4::Context;
 use C4::Output;
-use C4::Branch; # GetBranches
 use C4::Letters;
 use C4::Members::Attributes;
 
@@ -104,7 +103,6 @@ if ($op eq 'copy_form') {
     $template->param(
         oldbranchcode => $oldbranchcode,
         branchcode => $branchcode,
-        branchloop => _branchloop($branchcode),
         copying => 1,
         modify => 0,
     );
@@ -240,7 +238,6 @@ sub add_form {
 
     $template->param(
         module     => $module,
-        branchloop => _branchloop($branchcode),
         SQLfieldnames => $field_selection,
         branchcode => $branchcode,
     );
@@ -360,7 +357,7 @@ sub default_display {
 
     unless ( defined $branchcode ) {
         if ( C4::Context->preference('DefaultToLoggedInLibraryNoticesSlips') ) {
-            $branchcode = C4::Branch::mybranch();
+            $branchcode = C4::Context::mybranch();
         }
     }
 
@@ -379,26 +376,10 @@ sub default_display {
 
     $template->param(
         letter => $loop_data,
-        branchloop => _branchloop($branchcode),
+        branchcode => $branchcode,
     );
 }
 
-sub _branchloop {
-    my ($branchcode) = @_;
-
-    my $branches = GetBranches();
-    my @branchloop;
-    for my $thisbranch (sort { $branches->{$a}->{branchname} cmp $branches->{$b}->{branchname} } keys %$branches) {
-        push @branchloop, {
-            value      => $thisbranch,
-            selected   => $branchcode && $thisbranch eq $branchcode,
-            branchname => $branches->{$thisbranch}->{'branchname'},
-        };
-    }
-
-    return \@branchloop;
-}
-
 sub add_fields {
     my @tables = @_;
     my @fields = ();