Bug 766: Move GetAuthvalueDropbox to C4::Koha
authorJonathan Druart <jonathan.druart@biblibre.com>
Thu, 6 Mar 2014 16:05:53 +0000 (17:05 +0100)
committerGalen Charlton <gmc@esilibrary.com>
Sun, 4 May 2014 23:01:44 +0000 (23:01 +0000)
GetAuthvalueDropbox is in C4::Budgets, this does not make sense.

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
C4/Budgets.pm
C4/Koha.pm

index 882172f..c0b6a2b 100644 (file)
@@ -58,8 +58,6 @@ BEGIN {
         &AddBudgetPeriod
            &DelBudgetPeriod
 
-        &GetAuthvalueDropbox
-
         &ModBudgetPlan
 
         &GetCurrency
@@ -402,44 +400,6 @@ sub GetBudgetAuthCats  {
 }
 
 # -------------------------------------------------------------------
-sub GetAuthvalueDropbox {
-    my ( $authcat, $default ) = @_;
-    my $branch_limit = C4::Context->userenv ? C4::Context->userenv->{"branch"} : "";
-    my $dbh = C4::Context->dbh;
-
-    my $query = qq{
-        SELECT *
-        FROM authorised_values
-    };
-    $query .= qq{
-          LEFT JOIN authorised_values_branches ON ( id = av_id )
-    } if $branch_limit;
-    $query .= qq{
-        WHERE category = ?
-    };
-    $query .= " AND ( branchcode = ? OR branchcode IS NULL )" if $branch_limit;
-    $query .= " GROUP BY lib ORDER BY category, lib, lib_opac";
-    my $sth = $dbh->prepare($query);
-    $sth->execute( $authcat, $branch_limit ? $branch_limit : () );
-
-
-    my $option_list = [];
-    my @authorised_values = ( q{} );
-    while (my $av = $sth->fetchrow_hashref) {
-        push @{$option_list}, {
-            value => $av->{authorised_value},
-            label => $av->{lib},
-            default => ($default eq $av->{authorised_value}),
-        };
-    }
-
-    if ( @{$option_list} ) {
-        return $option_list;
-    }
-    return;
-}
-
-# -------------------------------------------------------------------
 sub GetBudgetPeriods {
        my ($filters,$orderby) = @_;
     return SearchInTable("aqbudgetperiods",$filters, $orderby, undef,undef, undef, "wide");
index 4c70480..c7aa3ed 100644 (file)
@@ -1434,6 +1434,44 @@ sub GetNormalizedOCLCNumber {
     }
 }
 
+sub GetAuthvalueDropbox {
+    my ( $authcat, $default ) = @_;
+    my $branch_limit = C4::Context->userenv ? C4::Context->userenv->{"branch"} : "";
+    my $dbh = C4::Context->dbh;
+
+    my $query = qq{
+        SELECT *
+        FROM authorised_values
+    };
+    $query .= qq{
+          LEFT JOIN authorised_values_branches ON ( id = av_id )
+    } if $branch_limit;
+    $query .= qq{
+        WHERE category = ?
+    };
+    $query .= " AND ( branchcode = ? OR branchcode IS NULL )" if $branch_limit;
+    $query .= " GROUP BY lib ORDER BY category, lib, lib_opac";
+    my $sth = $dbh->prepare($query);
+    $sth->execute( $authcat, $branch_limit ? $branch_limit : () );
+
+
+    my $option_list = [];
+    my @authorised_values = ( q{} );
+    while (my $av = $sth->fetchrow_hashref) {
+        push @{$option_list}, {
+            value => $av->{authorised_value},
+            label => $av->{lib},
+            default => ($default eq $av->{authorised_value}),
+        };
+    }
+
+    if ( @{$option_list} ) {
+        return $option_list;
+    }
+    return;
+}
+
+
 =head2 GetDailyQuote($opts)
 
 Takes a hashref of options