View | Details | Raw Unified | Return to bug 14598
Collapse All | Expand All

(-)a/installer/data/mysql/updatedatabase.pl (-1 / +40 lines)
Lines 13344-13349 if ( CheckVersion($DBversion) ) { Link Here
13344
    SetVersion($DBversion);
13344
    SetVersion($DBversion);
13345
}
13345
}
13346
13346
13347
$DBversion = "3.23.00.XXX";
13348
if ( CheckVersion($DBversion) ) {
13349
13350
    $sth = $dbh->prepare(q{
13351
     SELECT s.itemnumber, i.itype, b.itemtype FROM
13352
      ( SELECT DISTINCT itemnumber
13353
        FROM statistics
13354
        WHERE type="return" AND itemtype IS NULL ) s
13355
      LEFT JOIN
13356
      ( SELECT itemnumber,biblionumber, itype
13357
        FROM items ) i
13358
      ON (s.itemnumber=i.itemnumber)
13359
      LEFT JOIN
13360
      ( SELECT biblionumber, itemtype
13361
        FROM biblioitems ) b
13362
      ON (i.biblionumber=b.biblionumber)
13363
    });
13364
    $sth->execute();
13365
13366
    my $update_sth = $dbh->prepare(q{
13367
        UPDATE statistics
13368
        SET itemtype=?
13369
        WHERE itemnumber=? AND itemtype IS NULL
13370
    });
13371
    my $ilevel_itypes = C4::Context->preference('item-level_itypes');
13372
13373
    while ( my ($itemnumber,$item_itype,$biblio_itype) = $sth->fetchrow_array ) {
13374
13375
        my $effective_itemtype = $ilevel_itypes
13376
                                    ? $item_itype // $biblio_itype
13377
                                    : $biblio_itype;
13378
        warn "item-level_itypes set but no itype defined for item ($itemnumber)"
13379
            if $ilevel_itypes and !defined $item_itype;
13380
        $update_sth->execute( $effective_itemtype, $itemnumber );
13381
    }
13382
13383
    print "Upgrade to $DBversion done (Bug 14598: itemtype is not set on statistics by C4::Circulation::AddReturn)\n";
13384
    SetVersion($DBversion);
13385
}
13386
13347
# DEVELOPER PROCESS, search for anything to execute in the db_update directory
13387
# DEVELOPER PROCESS, search for anything to execute in the db_update directory
13348
# SEE bug 13068
13388
# SEE bug 13068
13349
# if there is anything in the atomicupdate, read and execute it.
13389
# if there is anything in the atomicupdate, read and execute it.
13350
- 

Return to bug 14598