print "Upgrade to $DBversion done (Bug 8701 - Update OpacHiddenItems system preference description)\n";
}
+$DBversion = '18.12.00.057';
+if( CheckVersion( $DBversion ) ) {
+ if( column_exists('statistics', 'associatedborrower') ) {
+ $dbh->do(q{ ALTER TABLE statistics DROP COLUMN associatedborrower });
+ }
+ if( column_exists('statistics', 'usercode') ) {
+ $dbh->do(q{ ALTER TABLE statistics DROP COLUMN usercode });
+ }
+
+ SetVersion($DBversion);
+ print "Upgrade to $DBversion done (Bug 13795 - Delete unused fields from statistics table)\n";
+}
+
+$DBversion = '18.12.00.058';
+if( CheckVersion( $DBversion ) ) {
+ my $opaclang = C4::Context->preference("opaclanguages");
+ my @langs;
+ push @langs, split ( '\,', $opaclang );
+ # Get any existing value from the OpacNavRight system preference
+ my ($OpacNavRight) = $dbh->selectrow_array( q|
+ SELECT value FROM systempreferences WHERE variable='OpacNavRight';
+ |);
+ if( $OpacNavRight ){
+ # If there is a value in the OpacNavRight preference, insert it into opac_news
+ $dbh->do("INSERT INTO opac_news (branchcode, lang, title, content ) VALUES (NULL, 'OpacNavRight_$langs[0]', '', '$OpacNavRight')");
+ }
+ # Remove the OpacNavRight system preference
+ $dbh->do("DELETE FROM systempreferences WHERE variable='OpacNavRight'");
+ SetVersion ($DBversion);
+ print "Upgrade to $DBversion done (Bug 22318: Move contents of OpacNavRight preference to Koha news system)\n";
+}
+
+$DBversion = '18.12.00.059';
+if( CheckVersion( $DBversion ) ) {
+ if( column_exists( 'import_records', 'z3950random' ) ) {
+ $dbh->do( "ALTER TABLE import_records DROP COLUMN z3950random" );
+ }
+
+ # Always end with this (adjust the bug info)
+ SetVersion( $DBversion );
+ print "Upgrade to $DBversion done (Bug 22532 - Remove import_records z3950random column)\n";
+}
+
+$DBversion = '18.12.00.060';
+if ( CheckVersion($DBversion) ) {
+
+ my $rows = $dbh->do(
+ qq{
+ UPDATE `accountlines`
+ SET
+ `accounttype` = 'L',
+ `status` = 'REPLACED'
+ WHERE
+ `accounttype` = 'Rep'
+ }
+ );
+
+ SetVersion($DBversion);
+ printf "Upgrade to $DBversion done (Bug 22564 - Fix accounttype 'Rep' - %d updated)\n", $rows;
+}
+
+$DBversion = '18.12.00.061';
+if( CheckVersion( $DBversion ) ) {
+
+ if ( column_exists( 'borrowers', 'flgAnonymized' ) ) {
+ $dbh->do(q{
+ UPDATE borrowers SET flgAnonymized = 0 WHERE flgAnonymized IS NULL
+ });
+ $dbh->do(q{
+ ALTER TABLE borrowers
+ CHANGE `flgAnonymized` `anonymized` TINYINT(1) NOT NULL DEFAULT 0
+ });
+ }
+
+ if ( column_exists( 'deletedborrowers', 'flgAnonymized' ) ) {
+ $dbh->do(q{
+ UPDATE deletedborrowers SET flgAnonymized = 0 WHERE flgAnonymized IS NULL
+ });
+ $dbh->do(q{
+ ALTER TABLE deletedborrowers
+ CHANGE `flgAnonymized` `anonymized` TINYINT(1) NOT NULL DEFAULT 0
+ });
+ }
+
+ SetVersion( $DBversion );
+ print "Upgrade to $DBversion done (Bug 21336 - (follow-up) Rename flgAnonymized column)\n";
+}
+
+$DBversion = '18.12.00.062';
+if( CheckVersion( $DBversion ) ) {
+ $dbh->do( q|
+ UPDATE search_marc_map SET marc_field='007_/0'
+ WHERE marc_type IN ('marc21', 'normarc') AND marc_field='007_/1' AND id IN
+ (SELECT search_marc_map_id FROM search_marc_to_field WHERE search_field_id IN
+ (SELECT id FROM search_field WHERE label='ff7-00')
+ )
+ |);
+
+ $dbh->do( q|
+ UPDATE search_marc_map SET marc_field='007_/1'
+ WHERE marc_type IN ('marc21', 'normarc') AND marc_field='007_/2' AND id IN
+ (SELECT search_marc_map_id FROM search_marc_to_field WHERE search_field_id IN
+ (SELECT id FROM search_field WHERE label='ff7-01')
+ )
+ |);
+
+ $dbh->do( q|
+ UPDATE search_marc_map SET marc_field='007_/2'
+ WHERE marc_type IN ('marc21', 'normarc') AND marc_field='007_/3' AND id IN
+ (SELECT search_marc_map_id FROM search_marc_to_field WHERE search_field_id IN
+ (SELECT id FROM search_field WHERE label='ff7-02')
+ )
+ |);
+
+ # N.B. ff7-01-02 really is 00-01!
+ $dbh->do( q|
+ UPDATE search_marc_map SET marc_field='007_/0-1'
+ WHERE marc_type IN ('marc21', 'normarc') AND marc_field='007_/1-2' AND id IN
+ (SELECT search_marc_map_id FROM search_marc_to_field WHERE search_field_id IN
+ (SELECT id FROM search_field WHERE label='ff7-01-02')
+ )
+ |);
+
+ $dbh->do( q|
+ UPDATE search_marc_map SET marc_field='008_/0-5'
+ WHERE marc_type IN ('marc21', 'normarc') AND marc_field='008_/1-5' AND id IN
+ (SELECT search_marc_map_id FROM search_marc_to_field WHERE search_field_id IN
+ (SELECT id FROM search_field WHERE label='date-entered-on-file')
+ )
+ |);
+
+ $dbh->do( q|
+ UPDATE search_marc_map SET marc_field='leader_/0-4'
+ WHERE marc_type IN ('marc21', 'normarc') AND marc_field='leader_/1-5' AND id IN
+ (SELECT search_marc_map_id FROM search_marc_to_field WHERE search_field_id IN
+ (SELECT id FROM search_field WHERE label='llength')
+ )
+ |);
+
+ # Always end with this (adjust the bug info)
+ SetVersion( $DBversion );
+ print "Upgrade to $DBversion done (Bug 22339 - Fix search field mappings of MARC fixed fields)\n";
+}
+
# SEE bug 13068
# if there is anything in the atomicupdate, read and execute it.