koha-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Koha-cvs] koha/C4 Biblio.pm Koha.pm [dev_week]


From: Joshua Ferraro
Subject: [Koha-cvs] koha/C4 Biblio.pm Koha.pm [dev_week]
Date: Sun, 24 Sep 2006 20:15:43 +0000

CVSROOT:        /sources/koha
Module name:    koha
Branch:         dev_week
Changes by:     Joshua Ferraro <kados>  06/09/24 20:15:43

Modified files:
        C4             : Biblio.pm Koha.pm 

Log message:
        moving get_itypes to GetCcodes from Biblio.pm to Koha.pm

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/C4/Biblio.pm?cvsroot=koha&only_with_tag=dev_week&r1=1.115.2.51.2.20&r2=1.115.2.51.2.21
http://cvs.savannah.gnu.org/viewcvs/koha/C4/Koha.pm?cvsroot=koha&only_with_tag=dev_week&r1=1.22.2.4.2.3&r2=1.22.2.4.2.4

Patches:
Index: Biblio.pm
===================================================================
RCS file: /sources/koha/koha/C4/Biblio.pm,v
retrieving revision 1.115.2.51.2.20
retrieving revision 1.115.2.51.2.21
diff -u -b -r1.115.2.51.2.20 -r1.115.2.51.2.21
--- Biblio.pm   24 Sep 2006 20:12:20 -0000      1.115.2.51.2.20
+++ Biblio.pm   24 Sep 2006 20:15:43 -0000      1.115.2.51.2.21
@@ -50,7 +50,6 @@
   &getbiblioitembybiblionumber
   &getbiblioitem &getitemsbybiblioitem
   &skip 
-  &get_itypes
 
   &MARCfind_MARCbibid_from_oldbiblionumber
   &MARCfind_marc_from_kohafield
@@ -2437,24 +2436,6 @@
     return ( $count, @results );
 }    # sub
 
-# this is temporary until we separate collection codes and item types
-sub get_itypes {
-       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} =~ /CCODE/) {
-                       $count++;
-                       $results[$count] = $data;
-                       #warn "data: $data";
-               }
-    }
-       $sth->finish;
-    return ($count,@results);
-}
-
 sub getstacks{
   my $dbh   = C4::Context->dbh;
   my $i=0;
@@ -2999,8 +2980,11 @@
 
 =cut
 
-# $Id: Biblio.pm,v 1.115.2.51.2.20 2006/09/24 20:12:20 kados Exp $
+# $Id: Biblio.pm,v 1.115.2.51.2.21 2006/09/24 20:15:43 kados Exp $
 # $Log: Biblio.pm,v $
+# Revision 1.115.2.51.2.21  2006/09/24 20:15:43  kados
+# moving get_itypes to GetCcodes from Biblio.pm to Koha.pm
+#
 # Revision 1.115.2.51.2.20  2006/09/24 20:12:20  kados
 # Removed the version data, it was getting too long to be useful, esp
 # with the new changes.

Index: Koha.pm
===================================================================
RCS file: /sources/koha/koha/C4/Koha.pm,v
retrieving revision 1.22.2.4.2.3
retrieving revision 1.22.2.4.2.4
diff -u -b -r1.22.2.4.2.3 -r1.22.2.4.2.4
--- Koha.pm     19 Sep 2006 04:45:13 -0000      1.22.2.4.2.3
+++ Koha.pm     24 Sep 2006 20:15:43 -0000      1.22.2.4.2.4
@@ -58,11 +58,16 @@
                        &subfield_is_koha_internal_p
                        &getbranches &getbranch
                        &getprinters &getprinter
+
+                       &GetItemtypes
+                       &GetCcodes
+
                        &getitemtypeinfo
                        &getframeworks &getframeworkinfo
                        &getauthtypes &getauthtype
                        &getallthemes &getalllanguages
                        &getallbranches 
+
                        &getFacets
                        &displaySortby
                        &displayIndexes
@@ -303,9 +308,9 @@
        return (\%branches);
 }
 
-=head2 getitemtypes
+=head2 GetItemtypes
 
-  $itemtypes = &getitemtypes();
+  $itemtypes = &GetItemtypes();
 
 Returns information about existing itemtypes.
 
@@ -313,7 +318,7 @@
 
 =head3 in PERL SCRIPT
 
-my $itemtypes = getitemtypes;
+my $itemtypes = GetItemtypes;
 my @itemtypesloop;
 foreach my $thisitemtype (keys %$itemtypes) {
        my $selected = 1 if $thisitemtype eq $itemtype;
@@ -341,16 +346,43 @@
 
 =cut
 
-sub getitemtypes {
-# returns a reference to a hash of references to branches...
-       my %itemtypes;
+sub GetItemtypes {
        my $dbh = C4::Context->dbh;
-       my $sth=$dbh->prepare("select * from itemtypes order by description");
+    my $query = "select * from itemtypes order by description";
+    my $sth   = $dbh->prepare($query);
+
+    # || die "Cannot prepare $query" . $dbh->errstr;      
+    my $count = 0;
+    my @results;
+
        $sth->execute;
-       while (my $IT=$sth->fetchrow_hashref) {
-                       $itemtypes{$IT->{'itemtype'}}=$IT;
+
+    # || die "Cannot execute $query\n" . $sth->errstr;
+    while ( my $data = $sth->fetchrow_hashref ) {
+        $results[$count] = $data;
+        $count++;
+    }    # while
+
+    $sth->finish;
+    return ( $count, @results );
+}    # sub getitemtypes
+
+# this is temporary until we separate collection codes and item types
+sub GetCcodes {
+       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} =/CCODE/) {
+                       $count++;
+                       $results[$count] = $data;
+                       #warn "data: $data";
        }
-       return (\%itemtypes);
+    }
+       $sth->finish;
+    return ($count,@results);
 }
 
 =head2 getauthtypes




reply via email to

[Prev in Thread] Current Thread [Next in Thread]