script to dump items to csv file
authorMason James <mtj@kohaaloha.com>
Thu, 12 Jan 2012 03:51:16 +0000 (16:51 +1300)
committerMason James <mtj@kohaaloha.com>
Thu, 12 Jan 2012 03:51:16 +0000 (16:51 +1300)
new file:   all-rpt.pl

all-rpt.pl [new file with mode: 0755]

diff --git a/all-rpt.pl b/all-rpt.pl
new file mode 100755 (executable)
index 0000000..9473a71
--- /dev/null
@@ -0,0 +1,79 @@
+#!/usr/bin/perl
+use strict;
+
+use C4::Context;
+use C4::Biblio;
+use C4::Items;
+
+use C4::Circulation;
+use C4::Koha;
+
+use C4::Members;
+use Date::Manip;
+
+# use C4::Debug;
+
+#use Data::Dumper;
+#use Smart::Comments '####';
+
+my $dbh = C4::Context->dbh();
+
+my $q   = "select distinct(homebranch) as hme from items";
+my $sth = $dbh->prepare($q);
+$sth->execute();
+
+while ( my $rec11 = $sth->fetchrow_hashref() ) {
+
+    my $q =
+"select biblionumber, itemnumber, itype, location, ccode, itemcallnumber, enumchron, barcode, homebranch  from items";
+
+    my $sth = $dbh->prepare($q);
+
+    # $sth->trace(3);
+    $sth->execute( );
+
+    my $i  = 0;
+    my $i2 = 0;
+    while ( my $rec = $sth->fetchrow_hashref() ) {
+
+## ## $rec
+        my $bibnum  = $rec->{'biblionumber'};
+        my $itemnum = $rec->{'itemnumber'};
+        my $enum    = $rec->{'enumchron'};
+        my $ccode   = $rec->{'ccode'};
+
+        #    next if $rec->{'status_flag'} == '8';
+
+        my $q2   = "select *  from biblio  where  biblionumber = ? ";
+        my $sth2 = $dbh->prepare($q2);
+
+        #    $sth2->trace(3);
+        $sth2->execute($bibnum);
+
+        while ( my $rec2 = $sth2->fetchrow_hashref() ) {
+
+            my $bib = GetBiblioData($bibnum);
+####  $bib
+
+            #        print "$rec2->{'biblionumber'}, $bib->{'title'}, $rec2->{'itemcallnumber'}\n" if $rec2->{'ccode'} !~ /LGPFIC/;
+
+        my $loc   = $rec->{'location'};
+        my $bc   = $rec->{'barcode'};
+
+
+my  $loc2  =GetAuthorisedValueDesc( '','', $loc ,'','','LOC');
+
+ ####  $loc
+ ####  $loc2
+
+
+        my $ccode   = $rec->{'ccode'};
+
+            print "$rec2->{'biblionumber'}\t$bib->{'title'}\t$rec2->{'itemcallnumber'}\t$bib->{'author'}\t$bib->{'publishercode'}\t$loc2\t$bc\n" ;
+
+
+            $i2++;
+        }
+
+    }
+}