warn on attempts to add duplicate item barcodes during batch import
[koha.git] / C4 / Koha.pm
index 40c3fcf..06ff7a3 100644 (file)
@@ -17,7 +17,6 @@ package C4::Koha;
 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
 # Suite 330, Boston, MA  02111-1307 USA
 
-# $Id$
 
 use strict;
 require Exporter;
@@ -25,7 +24,7 @@ use C4::Context;
 use C4::Output;
 our ($VERSION,@ISA,@EXPORT);
 
-$VERSION = do { my @v = '$Revision$' =~ /\d+/g; shift(@v) . "." . join( "_", map { sprintf "%03d", $_ } @v ); };
+$VERSION = 3.00;
 
 =head1 NAME
 
@@ -54,8 +53,6 @@ $VERSION = do { my @v = '$Revision$' =~ /\d+/g; shift(@v) . "." . join( "_", map
   &GetPrinters &GetPrinter
   &GetItemTypes &getitemtypeinfo
   &GetCcodes
-  &GetAuthItemlost
-  &GetAuthItembinding
   &get_itemtypeinfos_of
   &getframeworks &getframeworkinfo
   &getauthtypes &getauthtype
@@ -295,36 +292,6 @@ sub GetCcodes {
     return ( $count, @results );
 }
 
-=head2
-
-grab itemlost authorized values
-
-=cut
-
-sub GetAuthItemlost {
-    my $itemlost = shift;
-    my $count    = 0;
-    my @results;
-    my $dbh = C4::Context->dbh;
-    my $sth =
-      $dbh->prepare(
-        "SELECT * FROM authorised_values ORDER BY authorised_value");
-    $sth->execute;
-    while ( my $data = $sth->fetchrow_hashref ) {
-        if ( $data->{category} eq "ITEMLOST" ) {
-            $count++;
-            if ( $itemlost eq $data->{'authorised_value'} ) {
-                $data->{'selected'} = 1;
-            }
-            $results[$count] = $data;
-
-            #warn "data: $data";
-        }
-    }
-    $sth->finish;
-    return ( $count, @results );
-}
-
 =head2 getauthtypes
 
   $authtypes = &getauthtypes();
@@ -614,7 +581,7 @@ sub getFacets {
             },
             {
                 link_value  => 'branch',
-                label_value => 'Branches',
+                label_value => 'Libraries',
                 tags        => [ '995', ],
                 subfield    => 'b',
                 expanded    => '1',
@@ -662,7 +629,7 @@ sub getFacets {
             },
             {
                 link_value  => 'branch',
-                label_value => 'Branches',
+                label_value => 'Libraries',
                 tags        => [ '952', ],
                 subfield    => 'b',
                 expanded    => '1',
@@ -737,6 +704,8 @@ labels.
 
 =cut
 
+# FIXME - why not use GetAuthorisedValues ??
+#
 sub get_notforloan_label_of {
     my $dbh = C4::Context->dbh;
 
@@ -830,15 +799,24 @@ Set C<$category> on input args if you want to limits your query to this one. Thi
 =cut
 
 sub GetAuthorisedValues {
-    my $category = shift;
+    my ($category,$selected) = @_;
+       my $count = 0;
+       my @results;
     my $dbh      = C4::Context->dbh;
     my $query    = "SELECT * FROM authorised_values";
     $query .= " WHERE category = '" . $category . "'" if $category;
 
     my $sth = $dbh->prepare($query);
     $sth->execute;
-    my $data = $sth->fetchall_arrayref({});
-    return $data;
+       while (my $data=$sth->fetchrow_hashref) {
+               if ($selected eq $data->{'authorised_value'} ) {
+                       $data->{'selected'} = 1;
+               }
+               $results[$count] = $data;
+               $count++;
+       }
+    #my $data = $sth->fetchall_arrayref({});
+    return \@results; #$data;
 }
 
 =item fixEncoding