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

(-)a/installer/data/mysql/updatedatabase.pl (-12 / +11 lines)
Lines 157-163 if (C4::Context->preference("Version") < TransformToNum($DBversion)) { Link Here
157
157
158
$DBversion = "3.00.00.006";
158
$DBversion = "3.00.00.006";
159
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
159
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
160
    $dbh->do("UPDATE issues SET issuedate=timestamp WHERE issuedate='0000-00-00'");
160
    $dbh->do("UPDATE issues SET issuedate=timestamp WHERE issuedate=0");
161
    print "Upgrade to $DBversion done (filled issues.issuedate with timestamp)\n";
161
    print "Upgrade to $DBversion done (filled issues.issuedate with timestamp)\n";
162
    SetVersion ($DBversion);
162
    SetVersion ($DBversion);
163
}
163
}
Lines 1955-1961 if (C4::Context->preference("Version") < TransformToNum($DBversion)) { Link Here
1955
1955
1956
    print "Upgrade to $DBversion done (remove default '0000-00-00' in subscriptionhistory.enddate field)\n";
1956
    print "Upgrade to $DBversion done (remove default '0000-00-00' in subscriptionhistory.enddate field)\n";
1957
    $dbh->do("ALTER TABLE `subscriptionhistory` CHANGE `enddate` `enddate` DATE NULL DEFAULT NULL ");
1957
    $dbh->do("ALTER TABLE `subscriptionhistory` CHANGE `enddate` `enddate` DATE NULL DEFAULT NULL ");
1958
    $dbh->do("UPDATE subscriptionhistory SET enddate=NULL WHERE enddate='0000-00-00'");
1958
    $dbh->do("UPDATE subscriptionhistory SET enddate=NULL WHERE enddate=0");
1959
    SetVersion ($DBversion);
1959
    SetVersion ($DBversion);
1960
}
1960
}
1961
1961
Lines 2909-2915 if (C4::Context->preference("Version") < TransformToNum($DBversion)) { Link Here
2909
    # match the new type of the corresponding field
2909
    # match the new type of the corresponding field
2910
    $dbh->do('ALTER TABLE fundmapping modify column bookfundid varchar(30)');
2910
    $dbh->do('ALTER TABLE fundmapping modify column bookfundid varchar(30)');
2911
    # System did not ensure budgetdate was valid historically
2911
    # System did not ensure budgetdate was valid historically
2912
    $dbh->do(q|UPDATE fundmapping SET budgetdate = entrydate WHERE budgetdate = '0000-00-00' OR budgetdate IS NULL|);
2912
    $dbh->do(q|UPDATE fundmapping SET budgetdate = entrydate WHERE budgetdate = 0 OR budgetdate IS NULL|);
2913
    # We save the map in fundmapping in case you need later processing
2913
    # We save the map in fundmapping in case you need later processing
2914
    $dbh->do(q|ALTER TABLE fundmapping add column aqbudgetid integer|);
2914
    $dbh->do(q|ALTER TABLE fundmapping add column aqbudgetid integer|);
2915
    # these can speed processing up
2915
    # these can speed processing up
Lines 3632-3638 if (C4::Context->preference("Version") < TransformToNum($DBversion)) { Link Here
3632
3632
3633
$DBversion = "3.01.00.130";
3633
$DBversion = "3.01.00.130";
3634
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
3634
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
3635
    $dbh->do("UPDATE reserves SET expirationdate = NULL WHERE expirationdate = '0000-00-00'");
3635
    $dbh->do("UPDATE reserves SET expirationdate = NULL WHERE expirationdate = 0");
3636
    print "Upgrade to $DBversion done (change reserves.expirationdate values of 0000-00-00 to NULL (bug 1532)\n";
3636
    print "Upgrade to $DBversion done (change reserves.expirationdate values of 0000-00-00 to NULL (bug 1532)\n";
3637
    SetVersion ($DBversion);
3637
    SetVersion ($DBversion);
3638
}
3638
}
Lines 4580-4586 if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { Link Here
4580
4580
4581
$DBversion = "3.07.00.002";
4581
$DBversion = "3.07.00.002";
4582
if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
4582
if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
4583
    $dbh->do("UPDATE borrowers SET debarred=NULL WHERE debarred='0000-00-00';");
4583
    $dbh->do("UPDATE borrowers SET debarred=NULL WHERE debarred=0;");
4584
    print "Setting NULL to debarred where 0000-00-00 is stored (bug 7272)\n";
4584
    print "Setting NULL to debarred where 0000-00-00 is stored (bug 7272)\n";
4585
    SetVersion($DBversion);
4585
    SetVersion($DBversion);
4586
}
4586
}
Lines 7613-7619 if ( CheckVersion($DBversion) ) { Link Here
7613
        SELECT subscriptionid, startdate
7613
        SELECT subscriptionid, startdate
7614
        FROM subscription
7614
        FROM subscription
7615
        WHERE firstacquidate IS NULL
7615
        WHERE firstacquidate IS NULL
7616
          OR firstacquidate = '0000-00-00'
7616
          OR firstacquidate = 0
7617
    |);
7617
    |);
7618
    $get_subscriptions_sth->execute;
7618
    $get_subscriptions_sth->execute;
7619
    while ( my ($subscriptionid, $startdate) = $get_subscriptions_sth->fetchrow ) {
7619
    while ( my ($subscriptionid, $startdate) = $get_subscriptions_sth->fetchrow ) {
Lines 10607-10613 if ( CheckVersion($DBversion) ) { Link Here
10607
    $dbh->do(q|
10607
    $dbh->do(q|
10608
        UPDATE aqorders SET orderstatus='cancelled'
10608
        UPDATE aqorders SET orderstatus='cancelled'
10609
        WHERE (datecancellationprinted IS NOT NULL OR
10609
        WHERE (datecancellationprinted IS NOT NULL OR
10610
               datecancellationprinted<>'0000-00-00');
10610
               datecancellationprinted<>0);
10611
    |);
10611
    |);
10612
    print "Upgrade to $DBversion done (Bug 13993: Correct orderstatus for transferred orders)\n";
10612
    print "Upgrade to $DBversion done (Bug 13993: Correct orderstatus for transferred orders)\n";
10613
    SetVersion($DBversion);
10613
    SetVersion($DBversion);
Lines 10833-10848 if ( CheckVersion($DBversion) ) { Link Here
10833
$DBversion = "3.21.00.023";
10833
$DBversion = "3.21.00.023";
10834
if ( CheckVersion($DBversion) ) {
10834
if ( CheckVersion($DBversion) ) {
10835
    $dbh->do(q{
10835
    $dbh->do(q{
10836
        UPDATE borrowers SET debarred=NULL WHERE debarred='0000-00-00'
10836
        UPDATE borrowers SET debarred=NULL WHERE debarred=0
10837
    });
10837
    });
10838
    $dbh->do(q{
10838
    $dbh->do(q{
10839
        UPDATE borrowers SET dateexpiry=NULL where dateexpiry='0000-00-00'
10839
        UPDATE borrowers SET dateexpiry=NULL where dateexpiry=0
10840
    });
10840
    });
10841
    $dbh->do(q{
10841
    $dbh->do(q{
10842
        UPDATE borrowers SET dateofbirth=NULL where dateofbirth='0000-00-00'
10842
        UPDATE borrowers SET dateofbirth=NULL where dateofbirth=0
10843
    });
10843
    });
10844
    $dbh->do(q{
10844
    $dbh->do(q{
10845
        UPDATE borrowers SET dateenrolled=NULL where dateenrolled='0000-00-00'
10845
        UPDATE borrowers SET dateenrolled=NULL where dateenrolled=0
10846
    });
10846
    });
10847
    print "Upgrade to $DBversion done (Bug 14717: Prevent 0000-00-00 dates in patron data)\n";
10847
    print "Upgrade to $DBversion done (Bug 14717: Prevent 0000-00-00 dates in patron data)\n";
10848
    SetVersion($DBversion);
10848
    SetVersion($DBversion);
10849
- 

Return to bug 17320