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

(-)a/installer/data/mysql/updatedatabase.pl (-1 / +25 lines)
Lines 39-44 use C4::Installer; Link Here
39
use C4::Dates;
39
use C4::Dates;
40
use Koha::Database;
40
use Koha::Database;
41
use Koha;
41
use Koha;
42
use Koha::Items;
42
43
43
use MARC::Record;
44
use MARC::Record;
44
use MARC::File::XML ( BinaryEncoding => 'utf8' );
45
use MARC::File::XML ( BinaryEncoding => 'utf8' );
Lines 10761-10766 if ( CheckVersion($DBversion) ) { Link Here
10761
    SetVersion ($DBversion);
10762
    SetVersion ($DBversion);
10762
}
10763
}
10763
10764
10765
$DBversion = "3.21.00.XXX";
10766
if ( CheckVersion($DBversion) ) {
10767
    # Fix return statistic itemtypes
10768
    my $stats = $schema->resultset('Statistic')->search({
10769
            type       => 'return',
10770
            itemtype   => undef });
10771
10772
    while ( my $stat = $stats->next() ) {
10773
10774
        my $itemnumber = $stat->itemnumber();
10775
        my $itemtype = Koha::Items->find( $itemnumber )->effective_itemtype();
10776
10777
        $sth = $dbh->prepare(q{
10778
            UPDATE statistics
10779
            SET itemtype=?
10780
            WHERE type='return' AND itemnumber=? AND itemtype IS NULL
10781
        });
10782
        $sth->execute( $itemtype, $itemnumber );
10783
    }
10784
10785
    print "Upgrade to $DBversion done (Bug 14598: itemtype is not set on statistics by C4::Circulation::AddReturn)\n";
10786
    SetVersion ($DBversion);
10787
}
10788
10764
# DEVELOPER PROCESS, search for anything to execute in the db_update directory
10789
# DEVELOPER PROCESS, search for anything to execute in the db_update directory
10765
# SEE bug 13068
10790
# SEE bug 13068
10766
# if there is anything in the atomicupdate, read and execute it.
10791
# if there is anything in the atomicupdate, read and execute it.
10767
- 

Return to bug 14598