|
Lines 11669-11674
if ( CheckVersion($DBversion) ) {
Link Here
|
| 11669 |
SetVersion($DBversion); |
11669 |
SetVersion($DBversion); |
| 11670 |
} |
11670 |
} |
| 11671 |
|
11671 |
|
|
|
11672 |
$DBversion = "3.21.00.XXX"; |
| 11673 |
if ( CheckVersion($DBversion) ) { |
| 11674 |
|
| 11675 |
$sth = $dbh->prepare(q{ |
| 11676 |
SELECT s.itemnumber, i.itype, b.itemtype FROM |
| 11677 |
( SELECT DISTINCT itemnumber |
| 11678 |
FROM statistics |
| 11679 |
WHERE type="return" AND itemtype IS NULL ) s |
| 11680 |
LEFT JOIN |
| 11681 |
( SELECT itemnumber,biblionumber, itype |
| 11682 |
FROM items ) i |
| 11683 |
ON (s.itemnumber=i.itemnumber) |
| 11684 |
LEFT JOIN |
| 11685 |
( SELECT biblionumber, itemtype |
| 11686 |
FROM biblioitems ) b |
| 11687 |
ON (i.biblionumber=b.biblionumber) |
| 11688 |
}); |
| 11689 |
$sth->execute(); |
| 11690 |
|
| 11691 |
my $update_sth = $dbh->prepare(q{ |
| 11692 |
UPDATE statistics |
| 11693 |
SET itemtype=? |
| 11694 |
WHERE itemnumber=? AND itemtype IS NULL |
| 11695 |
}); |
| 11696 |
my $ilevel_itypes = C4::Context->preference('item-level_itypes'); |
| 11697 |
|
| 11698 |
while ( my ($itemnumber,$item_itype,$biblio_itype) = $sth->fetchrow_array ) { |
| 11699 |
|
| 11700 |
my $effective_itemtype = $ilevel_itypes |
| 11701 |
? $item_itype // $biblio_itype |
| 11702 |
: $biblio_itype; |
| 11703 |
warn "item-level_itypes set but no itype defined for item ($itemnumber)" |
| 11704 |
if $ilevel_itypes and !defined $item_itype; |
| 11705 |
$update_sth->execute( $effective_itemtype, $itemnumber ); |
| 11706 |
} |
| 11707 |
|
| 11708 |
print "Upgrade to $DBversion done (Bug 14598: itemtype is not set on statistics by C4::Circulation::AddReturn)\n"; |
| 11709 |
SetVersion($DBversion); |
| 11710 |
} |
| 11711 |
|
| 11672 |
# DEVELOPER PROCESS, search for anything to execute in the db_update directory |
11712 |
# DEVELOPER PROCESS, search for anything to execute in the db_update directory |
| 11673 |
# SEE bug 13068 |
11713 |
# SEE bug 13068 |
| 11674 |
# if there is anything in the atomicupdate, read and execute it. |
11714 |
# if there is anything in the atomicupdate, read and execute it. |
| 11675 |
- |
|
|