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

(-)a/installer/data/mysql/updatedatabase.pl (-51 / +36 lines)
Lines 20228-20248 if( CheckVersion( $DBversion ) ) { Link Here
20228
20228
20229
$DBversion = '19.11.00.000';
20229
$DBversion = '19.11.00.000';
20230
if( CheckVersion( $DBversion ) ) {
20230
if( CheckVersion( $DBversion ) ) {
20231
    SetVersion( $DBversion );
20231
    NewVersion( $DBversion, undef '19.11.00 release' );
20232
    print "Upgrade to $DBversion done (19.11.00 release)\n";
20233
}
20232
}
20234
20233
20235
$DBversion = '19.12.00.000';
20234
$DBversion = '19.12.00.000';
20236
if( CheckVersion( $DBversion ) ) {
20235
if( CheckVersion( $DBversion ) ) {
20237
    SetVersion( $DBversion );
20236
    NewVersion( $DBversion, undef, 'Dobbie is a free elf...' );
20238
    print "Upgrade to $DBversion done (Dobbie is a free elf...)\n";
20239
}
20237
}
20240
20238
20241
$DBversion = '19.12.00.001';
20239
$DBversion = '19.12.00.001';
20242
if( CheckVersion( $DBversion ) ) {
20240
if( CheckVersion( $DBversion ) ) {
20243
    $dbh->do( "UPDATE marc_subfield_structure SET kohafield = NULL WHERE kohafield = 'bibliosubject.subject';" );
20241
    $dbh->do( "UPDATE marc_subfield_structure SET kohafield = NULL WHERE kohafield = 'bibliosubject.subject';" );
20244
    SetVersion( $DBversion );
20242
    NewVersion( $DBversion, 17831, 'Remove non-existing bibliosubject.subject from frameworks' );
20245
    print "Upgrade to $DBversion done (Bug 17831 - Remove non-existing bibliosubject.subject from frameworks)\n";
20246
}
20243
}
20247
20244
20248
$DBversion = '19.12.00.002';
20245
$DBversion = '19.12.00.002';
Lines 20254-20261 if( CheckVersion( $DBversion ) ) { Link Here
20254
        WHERE variable = 'AllowItemsOnHoldCheckout'
20251
        WHERE variable = 'AllowItemsOnHoldCheckout'
20255
    });
20252
    });
20256
20253
20257
    SetVersion( $DBversion );
20254
    NewVersion( $DBversion, 23233, 'Rename AllowItemsOnHoldCheckout syspref' );
20258
    print "Upgrade to $DBversion done (Bug 23233 - Rename AllowItemsOnHoldCheckout syspref)\n";
20259
}
20255
}
20260
20256
20261
$DBversion = '19.12.00.003';
20257
$DBversion = '19.12.00.003';
Lines 20265-20273 if( CheckVersion( $DBversion ) ) { Link Here
20265
        $dbh->do( "ALTER TABLE library_groups ADD COLUMN ft_local_hold_group tinyint(1) NOT NULL DEFAULT 0 AFTER ft_search_groups_staff" );
20261
        $dbh->do( "ALTER TABLE library_groups ADD COLUMN ft_local_hold_group tinyint(1) NOT NULL DEFAULT 0 AFTER ft_search_groups_staff" );
20266
    }
20262
    }
20267
20263
20268
    # Always end with this (adjust the bug info)
20264
    NewVersion( $DBversion, 22284, 'Add ft_local_hold_group column to library_groups' );
20269
    SetVersion( $DBversion );
20270
    print "Upgrade to $DBversion done (Bug 22284 - Add ft_local_hold_group column to library_groups)\n";
20271
}
20265
}
20272
20266
20273
$DBversion = '19.12.00.004';
20267
$DBversion = '19.12.00.004';
Lines 20297-20315 if ( CheckVersion($DBversion) ) { Link Here
20297
        (10, 'payout', 'Perform account payout action')
20291
        (10, 'payout', 'Perform account payout action')
20298
    });
20292
    });
20299
20293
20300
    SetVersion($DBversion);
20294
    NewVersion( $DBversion, 24080, ['Add PAYOUT account_debit_type', 'Add PAYOUT account_offset_type', 'Add accounts payout permission'] );
20301
    print "Upgrade to $DBversion done (Bug 24080 - Add PAYOUT account_debit_type)\n";
20302
    print "Upgrade to $DBversion done (Bug 24080 - Add PAYOUT account_offset_type)\n";
20303
    print "Upgrade to $DBversion done (Bug 24080 - Add accounts payout permission)\n";
20304
}
20295
}
20305
20296
20306
$DBversion = '19.12.00.005';
20297
$DBversion = '19.12.00.005';
20307
if( CheckVersion( $DBversion ) ) {
20298
if( CheckVersion( $DBversion ) ) {
20308
    $dbh->do( "ALTER TABLE action_logs MODIFY COLUMN `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP" );
20299
    $dbh->do( "ALTER TABLE action_logs MODIFY COLUMN `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP" );
20309
20300
20310
    # Always end with this (adjust the bug info)
20301
    NewVersion( $DBversion, 24329, 'Do not update action_log.timestamp' );
20311
    SetVersion( $DBversion );
20312
    print "Upgrade to $DBversion done (Bug 24329 - Do not update action_log.timestamp)\n";
20313
}
20302
}
20314
20303
20315
$DBversion = '19.12.00.006';
20304
$DBversion = '19.12.00.006';
Lines 20319-20326 if( CheckVersion( $DBversion ) ) { Link Here
20319
        WHERE relationship = ""
20308
        WHERE relationship = ""
20320
    |);
20309
    |);
20321
20310
20322
    SetVersion( $DBversion );
20311
    NewVersion( $DBversion, 24263, 'Replace relationship with NULL when empty string' );
20323
    print "Upgrade to $DBversion done (Bug 24263 - Replace relationship with NULL when empty string)\n";
20324
}
20312
}
20325
20313
20326
$DBversion = '19.12.00.007';
20314
$DBversion = '19.12.00.007';
Lines 20344-20353 if ( CheckVersion($DBversion) ) { Link Here
20344
        (10, 'refund', 'Perform account refund action')
20332
        (10, 'refund', 'Perform account refund action')
20345
    });
20333
    });
20346
20334
20347
    SetVersion($DBversion);
20335
    NewVersion( $DBversion, 23442, ['Add REFUND to account_credit_types', 'Add REFUND to account_offset_types', 'Add accounts refund permission'] );
20348
    print "Upgrade to $DBversion done (Bug 23442 - Add REFUND to account_credit_types)\n";
20349
    print "Upgrade to $DBversion done (Bug 23442 - Add REFUND to account_offset_types)\n";
20350
    print "Upgrade to $DBversion done (Bug 23442 - Add accounts refund permission)\n";
20351
}
20336
}
20352
20337
20353
$DBversion = '19.12.00.008';
20338
$DBversion = '19.12.00.008';
Lines 20356-20363 if( CheckVersion( $DBversion ) ) { Link Here
20356
    $dbh->do( 'UPDATE systempreferences SET value = REPLACE(value, "http://www.bookfinder.com", "https://www.bookfinder.com") WHERE variable = "OPACSearchForTitleIn"' );
20341
    $dbh->do( 'UPDATE systempreferences SET value = REPLACE(value, "http://www.bookfinder.com", "https://www.bookfinder.com") WHERE variable = "OPACSearchForTitleIn"' );
20357
    $dbh->do( 'UPDATE systempreferences SET value = REPLACE(value, "https://openlibrary.org/search/?", "https://openlibrary.org/search?") WHERE variable = "OPACSearchForTitleIn"' );
20342
    $dbh->do( 'UPDATE systempreferences SET value = REPLACE(value, "https://openlibrary.org/search/?", "https://openlibrary.org/search?") WHERE variable = "OPACSearchForTitleIn"' );
20358
20343
20359
    SetVersion( $DBversion );
20344
    NewVersion( $DBversion, 24206, 'Update OpacSearchForTitleIn system preference' );
20360
    print "Upgrade to $DBversion done (Bug 24206 - Update OpacSearchForTitleIn system preference)\n";
20361
}
20345
}
20362
20346
20363
$DBversion = '19.12.00.009';
20347
$DBversion = '19.12.00.009';
Lines 20479-20488 INSERT IGNORE INTO `letter` (`module`, `code`, `branchcode`, `name`, `is_html`, Link Here
20479
        (25, 'takepayment', 'Access the point of sale page and take payments')
20463
        (25, 'takepayment', 'Access the point of sale page and take payments')
20480
    });
20464
    });
20481
20465
20482
    SetVersion( $DBversion );
20466
    NewVersion( $DBversion, 23354, [q|Add 'Purchase' account offset type|, q|Add 'RECEIPT' notice for Point of Sale|, q|Add point of sale permissions|] );
20483
    print "Upgrade to $DBversion done (Bug 23354 - Add 'Purchase' account offset type)\n";
20484
    print "Upgrade to $DBversion done (Bug 23354 - Add 'RECEIPT' notice for Point of Sale)\n";
20485
    print "Upgrade to $DBversion done (Bug 23354 - Add point of sale permissions)\n";
20486
}
20467
}
20487
20468
20488
$DBversion = '19.12.00.010';
20469
$DBversion = '19.12.00.010';
Lines 20511-20518 if( CheckVersion( $DBversion ) ) { Link Here
20511
        }
20492
        }
20512
    }
20493
    }
20513
20494
20514
    SetVersion( $DBversion );
20495
    NewVersion( $DBversion, 21520, 'Add rule_order and rule_operator fields to oai_sets_mappings table' );
20515
    print "Upgrade to $DBversion done (Bug 21520 - Add rule_order and rule_operator fields to oai_sets_mappings table)\n";
20516
}
20496
}
20517
20497
20518
$DBversion = '19.12.00.011';
20498
$DBversion = '19.12.00.011';
Lines 20543-20550 if( CheckVersion( $DBversion ) ) { Link Here
20543
        |);
20523
        |);
20544
    }
20524
    }
20545
20525
20546
    SetVersion( $DBversion );
20526
    NewVersion( $DBversion, 24289, 'Adding foreign keys on *_holidays.branchcode tables' );
20547
    print "Upgrade to $DBversion done (Bug 24289 - Adding foreign keys on *_holidays.branchcode tables)\n";
20548
}
20527
}
20549
20528
20550
$DBversion = '19.12.00.012';
20529
$DBversion = '19.12.00.012';
Lines 20559-20566 if( CheckVersion( $DBversion ) ) { Link Here
20559
          `code` = 'manage_cash_registers'
20538
          `code` = 'manage_cash_registers'
20560
    });
20539
    });
20561
20540
20562
    SetVersion( $DBversion );
20541
    NewVersion( $DBversion, 24481, 'Move permission to correct module_bit' );
20563
    print "Upgrade to $DBversion done (Bug 24481 - Move permission to correct module_bit)\n";
20564
}
20542
}
20565
20543
20566
$DBversion = '19.12.00.013';
20544
$DBversion = '19.12.00.013';
Lines 20572-20579 if( CheckVersion( $DBversion ) ) { Link Here
20572
          ('EnablePointOfSale','0',NULL,'Enable the point of sale feature to allow anonymous transactions with the accounting system. (Requires UseCashRegisters)','YesNo')
20550
          ('EnablePointOfSale','0',NULL,'Enable the point of sale feature to allow anonymous transactions with the accounting system. (Requires UseCashRegisters)','YesNo')
20573
    });
20551
    });
20574
20552
20575
    SetVersion( $DBversion );
20553
    NewVersion( $DBversion, 24478, 'Add `EnablePointOfSale` system preference to allow disabling the point of sale feature)' );
20576
    print "Upgrade to $DBversion done (Bug 24478 - Add `EnablePointOfSale` system preference to allow disabling the point of sale feature)\n";
20577
}
20554
}
20578
20555
20579
$DBversion = '19.12.00.014';
20556
$DBversion = '19.12.00.014';
Lines 20590-20597 if( CheckVersion( $DBversion ) ) { Link Here
20590
        );
20567
        );
20591
    }
20568
    }
20592
20569
20593
    SetVersion( $DBversion );
20570
    NewVersion( $DBversion, 24287, q|Add 'reason' field to transfers table| );
20594
    print "Upgrade to $DBversion done (Bug 24287 - Add 'reason' field to transfers table)\n";
20595
}
20571
}
20596
20572
20597
$DBversion = '19.12.00.015';
20573
$DBversion = '19.12.00.015';
Lines 20636-20643 if( CheckVersion( $DBversion ) ) { Link Here
20636
          }
20612
          }
20637
    );
20613
    );
20638
20614
20639
    SetVersion( $DBversion );
20615
    NewVersion( $DBversion, 24296, q|Update stockrotation to use 'reason' field in transfers table| );
20640
    print "Upgrade to $DBversion done (Bug 24296 - Update stockrotation to use 'reason' field in transfers table)\n";
20641
}
20616
}
20642
20617
20643
$DBversion = '19.12.00.016';
20618
$DBversion = '19.12.00.016';
Lines 20656-20663 if( CheckVersion( $DBversion ) ) { Link Here
20656
        UPDATE borrowers SET flags = flags + (1<<12) WHERE flags & (1 << 11)
20631
        UPDATE borrowers SET flags = flags + (1<<12) WHERE flags & (1 << 11)
20657
    });
20632
    });
20658
20633
20659
    SetVersion( $DBversion );
20634
    NewVersion( $DBversion, 22868, 'Move suggestions_manage subpermission out of acquisition permission' );
20660
    print "Upgrade to $DBversion done (Bug 22868 - Move suggestions_manage subpermission out of acquisition permission)\n";
20661
}
20635
}
20662
20636
20663
$DBversion = '19.12.00.017';
20637
$DBversion = '19.12.00.017';
Lines 20678-20685 if( CheckVersion( $DBversion ) ) { Link Here
20678
        |);
20652
        |);
20679
    }
20653
    }
20680
20654
20681
    SetVersion( $DBversion );
20655
    NewVersion( $DBversion, 21674, 'Add unique key (parent_id, branchcode) to library_group' );
20682
    print "Upgrade to $DBversion done (Bug 21674 - Add unique key (parent_id, branchcode) to library_group)\n";
20683
}
20656
}
20684
20657
20685
$DBversion = '19.12.00.018';
20658
$DBversion = '19.12.00.018';
Lines 20727-20734 if( CheckVersion( $DBversion ) ) { Link Here
20727
        $dbh->do("DROP TABLE issuingrules");
20700
        $dbh->do("DROP TABLE issuingrules");
20728
    }
20701
    }
20729
20702
20730
    SetVersion( $DBversion );
20703
    NewVersion( $DBversion, 18936, 'Convert issuingrules fields to circulation_rules' );
20731
    print "Upgrade to $DBversion done (Bug 18936: Convert issuingrules fields to circulation_rules)\n";
20732
}
20704
}
20733
20705
20734
$DBversion = '19.12.00.019';
20706
$DBversion = '19.12.00.019';
Lines 20741-20748 if( CheckVersion( $DBversion ) ) { Link Here
20741
        $dbh->do("UPDATE message_queue SET updated_on=time_queued");
20713
        $dbh->do("UPDATE message_queue SET updated_on=time_queued");
20742
    }
20714
    }
20743
20715
20744
    SetVersion( $DBversion );
20716
    NewVersion( $DBversion, 23673, 'modify time_queued and add updated_on to message_queue' );
20745
    print "Upgrade to $DBversion done (Bug 23673 - modify time_queued and add updated_on to message_queue)\n";
20746
}
20717
}
20747
20718
20748
$DBversion = '19.12.00.020';
20719
$DBversion = '19.12.00.020';
Lines 21186-21191 sub SetVersion { Link Here
21186
    C4::Context::clear_syspref_cache(); # invalidate cached preferences
21157
    C4::Context::clear_syspref_cache(); # invalidate cached preferences
21187
}
21158
}
21188
21159
21160
sub NewVersion {
21161
    my ( $DBversion, $bug_number, $descriptions ) = @_;
21162
    SetVersion($DBversion);
21163
    unless ( ref($descriptions) ) {
21164
        $descriptions = [ $descriptions ];
21165
    }
21166
    for my $description ( @$descriptions ) {
21167
        unless ( $bug_number ) {
21168
            say sprintf "Upgrade to %s done (%s)", $DBversion, $description;
21169
        } else {
21170
            say sprintf "Upgrade to %s done (Bug %s - %s)", $DBversion, $bug_number, $description;
21171
        }
21172
    }
21173
}
21174
21189
=head2 CheckVersion
21175
=head2 CheckVersion
21190
21176
21191
Check whether a given update should be run when passed the proposed version
21177
Check whether a given update should be run when passed the proposed version
21192
- 

Return to bug 24131