Bug 24706: Fix ergonomic issue on the list view if empty
[koha.git] / misc / migration_tools / fix_onloan.pl
blobd70c3a59322ca3d32d0519abe63bea27a41e6235
1 #!/usr/bin/perl
3 use strict;
4 #use warnings; FIXME - Bug 2505
6 use Koha::Script;
7 use C4::Context;
8 use C4::Items;
9 use C4::Biblio;
12 # the items.onloan field did not exist in koha 2.2
13 # in koha 3.0, it's used to define item availability
14 # this script takes the items.onloan field
15 # and put it in the MARC::Record of the item
18 my $dbh=C4::Context->dbh;
20 # if (C4::Context->preference("marcflavour") ne "UNIMARC") {
21 # print "this script is for UNIMARC only\n";
22 # exit;
23 # }
24 my $rqbiblios=$dbh->prepare("SELECT biblionumber,itemnumber,onloan FROM items WHERE items.onloan IS NOT NULL");
25 $rqbiblios->execute;
26 $|=1;
27 while (my ($biblionumber,$itemnumber,$onloan)= $rqbiblios->fetchrow){
28 ModItem({onloan => "$onloan"}, $biblionumber, $itemnumber);
29 print "Onloan : $onloan for $biblionumber / $itemnumber\n";