|
Lines 12206-12211
if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
Link Here
|
| 12206 |
SetVersion($DBversion); |
12206 |
SetVersion($DBversion); |
| 12207 |
} |
12207 |
} |
| 12208 |
|
12208 |
|
|
|
12209 |
$DBversion = "3.23.00.XXX"; |
| 12210 |
if ( CheckVersion($DBversion) ) { |
| 12211 |
|
| 12212 |
$sth = $dbh->prepare(q{ |
| 12213 |
SELECT s.itemnumber, i.itype, b.itemtype FROM |
| 12214 |
( SELECT DISTINCT itemnumber |
| 12215 |
FROM statistics |
| 12216 |
WHERE type="return" AND itemtype IS NULL ) s |
| 12217 |
LEFT JOIN |
| 12218 |
( SELECT itemnumber,biblionumber, itype |
| 12219 |
FROM items ) i |
| 12220 |
ON (s.itemnumber=i.itemnumber) |
| 12221 |
LEFT JOIN |
| 12222 |
( SELECT biblionumber, itemtype |
| 12223 |
FROM biblioitems ) b |
| 12224 |
ON (i.biblionumber=b.biblionumber) |
| 12225 |
}); |
| 12226 |
$sth->execute(); |
| 12227 |
|
| 12228 |
my $update_sth = $dbh->prepare(q{ |
| 12229 |
UPDATE statistics |
| 12230 |
SET itemtype=? |
| 12231 |
WHERE itemnumber=? AND itemtype IS NULL |
| 12232 |
}); |
| 12233 |
my $ilevel_itypes = C4::Context->preference('item-level_itypes'); |
| 12234 |
|
| 12235 |
while ( my ($itemnumber,$item_itype,$biblio_itype) = $sth->fetchrow_array ) { |
| 12236 |
|
| 12237 |
my $effective_itemtype = $ilevel_itypes |
| 12238 |
? $item_itype // $biblio_itype |
| 12239 |
: $biblio_itype; |
| 12240 |
warn "item-level_itypes set but no itype defined for item ($itemnumber)" |
| 12241 |
if $ilevel_itypes and !defined $item_itype; |
| 12242 |
$update_sth->execute( $effective_itemtype, $itemnumber ); |
| 12243 |
} |
| 12244 |
|
| 12245 |
print "Upgrade to $DBversion done (Bug 14598: itemtype is not set on statistics by C4::Circulation::AddReturn)\n"; |
| 12246 |
SetVersion($DBversion); |
| 12247 |
} |
| 12248 |
|
| 12209 |
# DEVELOPER PROCESS, search for anything to execute in the db_update directory |
12249 |
# DEVELOPER PROCESS, search for anything to execute in the db_update directory |
| 12210 |
# SEE bug 13068 |
12250 |
# SEE bug 13068 |
| 12211 |
# if there is anything in the atomicupdate, read and execute it. |
12251 |
# if there is anything in the atomicupdate, read and execute it. |
| 12212 |
- |
|
|