From feae120738d529a8faf81db611fa9b223b4b62e9 Mon Sep 17 00:00:00 2001 From: Paul POULAIN Date: Wed, 7 May 2008 19:15:52 +0200 Subject: [PATCH] BUGFIX : script to fix & fill onloan field in items table. Signed-off-by: Joshua Ferraro --- misc/migration_tools/fix_onloan.pl | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100755 misc/migration_tools/fix_onloan.pl diff --git a/misc/migration_tools/fix_onloan.pl b/misc/migration_tools/fix_onloan.pl new file mode 100755 index 0000000000..1dc5246af7 --- /dev/null +++ b/misc/migration_tools/fix_onloan.pl @@ -0,0 +1,27 @@ +#!/usr/bin/perl + +use strict; +use C4::Context; +use C4::Items; +use C4::Biblio; + +# +# the items.onloan field did not exist in koha 2.2 +# in koha 3.0, it's used to define item availability +# this script takes the items.onloan field +# and put it in the MARC::Record of the item +# + +my $dbh=C4::Context->dbh; + +# if (C4::Context->preference("marcflavour") ne "UNIMARC") { +# print "this script is for UNIMARC only\n"; +# exit; +# } +my $rqbiblios=$dbh->prepare("SELECT biblionumber,itemnumber,onloan FROM items WHERE items.onloan IS NOT NULL"); +$rqbiblios->execute; +$|=1; +while (my ($biblionumber,$itemnumber,$onloan)= $rqbiblios->fetchrow){ + ModItem({onloan => "$onloan"}, $biblionumber, $itemnumber); + print "Onloan : $onloan for $biblionumber / $itemnumber\n"; +} \ No newline at end of file -- 2.39.5