Lines 12074-12079
if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
Link Here
|
12074 |
SetVersion($DBversion); |
12074 |
SetVersion($DBversion); |
12075 |
} |
12075 |
} |
12076 |
|
12076 |
|
|
|
12077 |
$DBversion = "3.23.00.XXX"; |
12078 |
if ( CheckVersion($DBversion) ) { |
12079 |
|
12080 |
$sth = $dbh->prepare(q{ |
12081 |
SELECT s.itemnumber, i.itype, b.itemtype FROM |
12082 |
( SELECT DISTINCT itemnumber |
12083 |
FROM statistics |
12084 |
WHERE type="return" AND itemtype IS NULL ) s |
12085 |
LEFT JOIN |
12086 |
( SELECT itemnumber,biblionumber, itype |
12087 |
FROM items ) i |
12088 |
ON (s.itemnumber=i.itemnumber) |
12089 |
LEFT JOIN |
12090 |
( SELECT biblionumber, itemtype |
12091 |
FROM biblioitems ) b |
12092 |
ON (i.biblionumber=b.biblionumber) |
12093 |
}); |
12094 |
$sth->execute(); |
12095 |
|
12096 |
my $update_sth = $dbh->prepare(q{ |
12097 |
UPDATE statistics |
12098 |
SET itemtype=? |
12099 |
WHERE itemnumber=? AND itemtype IS NULL |
12100 |
}); |
12101 |
my $ilevel_itypes = C4::Context->preference('item-level_itypes'); |
12102 |
|
12103 |
while ( my ($itemnumber,$item_itype,$biblio_itype) = $sth->fetchrow_array ) { |
12104 |
|
12105 |
my $effective_itemtype = $ilevel_itypes |
12106 |
? $item_itype // $biblio_itype |
12107 |
: $biblio_itype; |
12108 |
warn "item-level_itypes set but no itype defined for item ($itemnumber)" |
12109 |
if $ilevel_itypes and !defined $item_itype; |
12110 |
$update_sth->execute( $effective_itemtype, $itemnumber ); |
12111 |
} |
12112 |
|
12113 |
print "Upgrade to $DBversion done (Bug 14598: itemtype is not set on statistics by C4::Circulation::AddReturn)\n"; |
12114 |
SetVersion($DBversion); |
12115 |
} |
12077 |
|
12116 |
|
12078 |
# DEVELOPER PROCESS, search for anything to execute in the db_update directory |
12117 |
# DEVELOPER PROCESS, search for anything to execute in the db_update directory |
12079 |
# SEE bug 13068 |
12118 |
# SEE bug 13068 |
12080 |
- |
|
|