Bug 12539: PROG/CCSR deprecation: Remove hardcoded theme from C4/Templates.pm
[koha-ffzg.git] / installer / data / mysql / updatedatabase.pl
index 421e772..3739f38 100755 (executable)
@@ -7984,28 +7984,32 @@ if ( CheckVersion($DBversion) ) {
     $dbh->{AutoCommit} = 0;
     $dbh->{RaiseError} = 1;
 
-    my $av_added = $dbh->do(q|
-        INSERT INTO authorised_values(category, authorised_value, lib, lib_opac)
-            SELECT 'ROADTYPE', roadtypeid, road_type, road_type
-            FROM roadtype;
-    |);
-
-    my $rt_deleted = $dbh->do(q|
-        DELETE FROM roadtype
-    |);
+    eval {
+        $dbh->selectcol_arrayref(q|SELECT COUNT(*) FROM roadtype|);
+    };
+    unless ( $@ ) {
+        my $av_added = $dbh->do(q|
+            INSERT INTO authorised_values(category, authorised_value, lib, lib_opac)
+                SELECT 'ROADTYPE', roadtypeid, road_type, road_type
+                FROM roadtype;
+        |);
 
-    if ( $av_added == $rt_deleted or $rt_deleted eq "0E0" ) {
-        $dbh->do(q|
-            DROP TABLE roadtype;
+        my $rt_deleted = $dbh->do(q|
+            DELETE FROM roadtype
         |);
-        $dbh->commit;
-        print "Upgrade to $DBversion done (Bug 7372: Move road types from the roadtype table to the ROADTYPE authorised values)\n";
-        SetVersion($DBversion);
-    } else {
-        print "Upgrade to $DBversion failed (Bug 7372: Move road types from the roadtype table to the ROADTYPE authorised values.\nTransaction aborted because $@\n)";
-        $dbh->rollback;
-    }
 
+        if ( $av_added == $rt_deleted or $rt_deleted eq "0E0" ) {
+            $dbh->do(q|
+                DROP TABLE roadtype;
+            |);
+            $dbh->commit;
+            print "Upgrade to $DBversion done (Bug 7372: Move road types from the roadtype table to the ROADTYPE authorised values)\n";
+            SetVersion($DBversion);
+        } else {
+            print "Upgrade to $DBversion failed (Bug 7372: Move road types from the roadtype table to the ROADTYPE authorised values.\nTransaction aborted because $@\n)";
+            $dbh->rollback;
+        }
+    }
     $dbh->{AutoCommit} = 1;
     $dbh->{RaiseError} = 0;
 }
@@ -8471,6 +8475,450 @@ if ( CheckVersion($DBversion) ) {
     SetVersion($DBversion);
 }
 
+$DBversion = "3.16.00.000";
+if ( CheckVersion($DBversion) ) {
+    print "Upgrade to $DBversion done (3.16.0 release)\n";
+    SetVersion ($DBversion);
+}
+
+$DBversion = '3.17.00.000';
+if ( CheckVersion($DBversion) ) {
+    print "Upgrade to $DBversion done (there is no time to rest on our laurels)\n";
+    SetVersion ($DBversion);
+}
+
+$DBversion = '3.17.00.001';
+if ( CheckVersion($DBversion) ) {
+   $dbh->do("UPDATE systempreferences SET variable = 'AuthoritySeparator' WHERE variable = 'authoritysep'");
+   print "Upgrade to $DBversion done (Bug 10330 - Rename system preference authoritysep to AuthoritySeparator)\n";
+   SetVersion ($DBversion);
+}
+
+$DBversion = "3.17.00.002";
+if (CheckVersion($DBversion)) {
+    $dbh->do("INSERT INTO systempreferences (variable,value,explanation,type) VALUES('AcqEnableFiles','0','If enabled, allows librarians to upload and attach arbitrary files to invoice records.','YesNo')");
+    $dbh->do("
+CREATE TABLE IF NOT EXISTS `misc_files` (
+  `file_id` int(11) NOT NULL AUTO_INCREMENT,
+  `table_tag` varchar(255) NOT NULL,
+  `record_id` int(11) NOT NULL,
+  `file_name` varchar(255) NOT NULL,
+  `file_type` varchar(255) NOT NULL,
+  `file_description` varchar(255) DEFAULT NULL,
+  `file_content` longblob NOT NULL, -- file content
+  `date_uploaded` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
+  PRIMARY KEY (`file_id`),
+  KEY `table_tag` (`table_tag`),
+  KEY `record_id` (`record_id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+    ");
+    print "Upgrade to $DBversion done (Bug 3050 - Add an option to upload scanned invoices)\n";
+    SetVersion($DBversion);
+}
+
+$DBversion = "3.17.00.003";
+if (CheckVersion($DBversion)) {
+    $dbh->do("UPDATE systempreferences SET type = 'Choice', options = '0|1|force' WHERE variable = 'OPACItemHolds'");
+    print "Upgrade to $DBversion done (Bug 7825 - Changed OPACItemHolds syspref to Choice)\n";
+    SetVersion($DBversion);
+}
+
+$DBversion = "3.17.00.004";
+if (CheckVersion($DBversion)) {
+    $dbh->do("ALTER TABLE categories ADD default_privacy ENUM( 'default', 'never', 'forever' ) NOT NULL DEFAULT 'default' AFTER category_type");
+    print "Upgrade to $DBversion done (Bug 6254 - can't set patron privacy by default)\n";
+    SetVersion($DBversion);
+}
+
+$DBversion = "3.17.00.005";
+if (CheckVersion($DBversion)) {
+    $dbh->do(q|
+        ALTER TABLE issuingrules
+        ADD maxsuspensiondays INT(11) DEFAULT NULL AFTER finedays;
+    |);
+    print "Upgrade to $DBversion done (Bug 12230: Add new issuing rule maxsuspensiondays)\n";
+    SetVersion($DBversion);
+}
+
+$DBversion = "3.17.00.006";
+if ( CheckVersion($DBversion) ) {
+    $dbh->do("INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ('OpacLocationBranchToDisplay',  'holding',  'holding|home|both',  'In the OPAC, under location show which branch for Location in the record details.',  'Choice')");
+    $dbh->do("INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ('OpacLocationBranchToDisplayShelving',  'holding',  'holding|home|both',  'In the OPAC, display the shelving location under which which column',  'Choice')");
+    print "Upgrade to $DBversion done (Bug 7720 - Ambiguity in OPAC Details location.)\n";
+    SetVersion($DBversion);
+}
+
+$DBversion = "3.17.00.007";
+if (CheckVersion($DBversion)) {
+    $dbh->do("INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES('UpdateNotForLoanStatusOnCheckin', '', 'NULL', 'This is a list of value pairs. When an item is checked in, if the not for loan value on the left matches the items not for loan value it will be updated to the right-hand value. E.g. ''-1: 0'' will cause an item that was set to ''Ordered'' to now be available for loan. Each pair of values should be on a separate line.', 'Free');");
+    print "Upgrade to $DBversion done (Bug 11629 - Add ability to update not for loan status on checkin)\n";
+    SetVersion($DBversion);
+}
+
+$DBversion = "3.17.00.008";
+if ( CheckVersion($DBversion) ) {
+    $dbh->do(q|
+        INSERT IGNORE INTO systempreferences (variable,value,options,explanation,type) VALUES('OPACAcquisitionDetails','0', '','Show the acquisition details at the OPAC','YesNo')
+    |);
+    print "Upgrade to $DBversion done (Bug 11169 - Add OPACAcquisitionDetails syspref)\n";
+    SetVersion($DBversion);
+}
+
+$DBversion = "3.17.00.009";
+if ( CheckVersion($DBversion) ) {
+    $dbh->do(q{
+        DELETE FROM systempreferences WHERE variable = 'UseTablesortForCirc'
+    });
+
+    print "Upgrade to $DBversion done (Bug 11703 - Remove UseTablesortForCirc syspref)\n";
+    SetVersion($DBversion);
+}
+
+$DBversion = "3.17.00.010";
+if ( CheckVersion($DBversion) ) {
+    $dbh->do("DELETE FROM systempreferences WHERE variable='opacsmallimage'");
+    print "Upgrade to $DBversion done (Bug 11347 - PROG/CCSR deprecation: Remove opacsmallimage system preference)\n";
+    SetVersion($DBversion);
+}
+
+$DBversion = "3.17.00.011";
+if ( CheckVersion($DBversion) ) {
+    $dbh->do("INSERT INTO language_subtag_registry( subtag, type, description, added) VALUES ( 'hr', 'language', 'Croatian','2014-07-24' )");
+    $dbh->do("INSERT INTO language_rfc4646_to_iso639(rfc4646_subtag,iso639_2_code) VALUES( 'hr','hrv')");
+    $dbh->do("INSERT INTO language_descriptions(subtag, type, lang, description) VALUES( 'hr', 'language', 'hr', 'Hrvatski')");
+    $dbh->do("INSERT INTO language_descriptions(subtag, type, lang, description) VALUES( 'hr', 'language', 'en', 'Croatian')");
+    $dbh->do("INSERT INTO language_descriptions(subtag, type, lang, description) VALUES( 'hr', 'language', 'fr', 'Croate')");
+    $dbh->do("INSERT INTO language_descriptions(subtag, type, lang, description) VALUES( 'hr', 'language', 'de', 'Kroatisch')");
+    print "Upgrade to $DBversion done (Bug 12649: Add Croatian language)\n";
+    SetVersion ($DBversion);
+}
+
+$DBversion = "3.17.00.012";
+if ( CheckVersion($DBversion) ) {
+    $dbh->do("DELETE FROM systempreferences WHERE variable='OpacShowFiltersPulldownMobile'");
+    print "Upgrade to $DBversion done ( Bug 12512 - PROG/CCSR deprecation: Remove OpacShowFiltersPulldownMobile system preference )\n";
+    SetVersion ($DBversion);
+}
+
+$DBversion = "3.17.00.013";
+if ( CheckVersion($DBversion) ) {
+    $dbh->do("INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES ('maxreserves',50,'System-wide maximum number of holds a patron can place','','Integer')");
+    print "Upgrade to $DBversion done (Re-add system preference maxreserves)\n";
+    SetVersion ($DBversion);
+}
+
+$DBversion = '3.17.00.014';
+if ( CheckVersion($DBversion) ) {
+    $dbh->do("
+        INSERT INTO systempreferences (variable,value,explanation,type) VALUES
+        ('OverdueNoticeCalendar',0,'Take calendar into consideration when working out sending overdue notices','YesNo')
+    ");
+    print "Upgrade to $DBversion done (Bug 12529 - Adding a syspref to allow the overdue notices to consider the calendar when generating notices)\n";
+    SetVersion($DBversion);
+}
+
+$DBversion = "3.17.00.015";
+if ( CheckVersion($DBversion) ) {
+    $dbh->do(q{
+        CREATE TABLE IF NOT EXISTS columns_settings (
+            module varchar(255) NOT NULL,
+            page varchar(255) NOT NULL,
+            tablename varchar(255) NOT NULL,
+            columnname varchar(255) NOT NULL,
+            cannot_be_toggled int(1) NOT NULL DEFAULT 0,
+            is_hidden int(1) NOT NULL DEFAULT 0,
+            PRIMARY KEY(module, page, tablename, columnname)
+        ) ENGINE=InnoDB DEFAULT CHARSET=utf8
+    });
+    print "Upgrade to $DBversion done (Bug 10212 - Create new table columns_settings)\n";
+    SetVersion ($DBversion);
+}
+
+$DBversion = "3.17.00.016";
+if ( CheckVersion($DBversion) ) {
+    $dbh->do("CREATE TABLE aqcontacts (
+        id int(11) NOT NULL auto_increment,
+        name varchar(100) default NULL,
+        position varchar(100) default NULL,
+        phone varchar(100) default NULL,
+        altphone varchar(100) default NULL,
+        fax varchar(100) default NULL,
+        email varchar(100) default NULL,
+        notes mediumtext,
+        claimacquisition BOOLEAN NOT NULL DEFAULT 0,
+        claimissues BOOLEAN NOT NULL DEFAULT 0,
+        acqprimary BOOLEAN NOT NULL DEFAULT 0,
+        serialsprimary BOOLEAN NOT NULL DEFAULT 0,
+        booksellerid int(11) not NULL,
+        PRIMARY KEY  (id),
+        CONSTRAINT booksellerid_aqcontacts_fk FOREIGN KEY (booksellerid)
+            REFERENCES aqbooksellers (id) ON DELETE CASCADE ON UPDATE CASCADE
+        ) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;");
+    $dbh->do("INSERT INTO aqcontacts (name, position, phone, altphone, fax,
+            email, notes, booksellerid, claimacquisition, claimissues, acqprimary, serialsprimary)
+        SELECT contact, contpos, contphone, contaltphone, contfax, contemail,
+            contnotes, id, 1, 1, 1, 1 FROM aqbooksellers;");
+    $dbh->do("ALTER TABLE aqbooksellers DROP COLUMN contact,
+        DROP COLUMN contpos, DROP COLUMN contphone,
+        DROP COLUMN contaltphone, DROP COLUMN contfax,
+        DROP COLUMN contemail, DROP COLUMN contnotes;");
+    $dbh->do("UPDATE letter SET content = replace(content, '<<aqbooksellers.contact>>', '<<aqcontacts.name>>')");
+    $dbh->do("UPDATE letter SET content = replace(content, '<<aqbooksellers.contpos>>', '<<aqcontacts.position>>')");
+    $dbh->do("UPDATE letter SET content = replace(content, '<<aqbooksellers.contphone>>', '<<aqcontacts.phone>>')");
+    $dbh->do("UPDATE letter SET content = replace(content, '<<aqbooksellers.contaltphone>>', '<<aqcontacts.altphone>>')");
+    $dbh->do("UPDATE letter SET content = replace(content, '<<aqbooksellers.contfax>>', '<<aqcontacts.contfax>>')");
+    $dbh->do("UPDATE letter SET content = replace(content, '<<aqbooksellers.contemail>>', '<<aqcontacts.contemail>>')");
+    $dbh->do("UPDATE letter SET content = replace(content, '<<aqbooksellers.contnotes>>', '<<aqcontacts.contnotes>>')");
+    print "Upgrade to $DBversion done (Bug 10402: Move bookseller contacts to separate table)\n";
+    SetVersion($DBversion);
+}
+
+$DBversion = "3.17.00.017";
+if ( CheckVersion($DBversion) ) {
+    # Correct invalid recordtypes (should be very exceptional)
+    $dbh->do(q{
+        UPDATE z3950servers set recordtype='biblio' WHERE recordtype NOT IN ('authority','biblio')
+    });
+    # Correct invalid server types (should also be very exceptional)
+    $dbh->do(q{
+        UPDATE z3950servers set type='zed' WHERE type <> 'zed'
+    });
+    # Adjust table
+    $dbh->do(q{
+        ALTER TABLE z3950servers
+        DROP COLUMN icon,
+        DROP COLUMN description,
+        DROP COLUMN position,
+        MODIFY COLUMN id int NOT NULL AUTO_INCREMENT FIRST,
+        MODIFY COLUMN recordtype enum('authority','biblio') NOT NULL DEFAULT 'biblio',
+        CHANGE COLUMN name servername mediumtext NOT NULL,
+        CHANGE COLUMN type servertype enum('zed','sru') NOT NULL DEFAULT 'zed',
+        ADD COLUMN sru_options varchar(255) default NULL,
+        ADD COLUMN sru_fields mediumtext default NULL,
+        ADD COLUMN add_xslt mediumtext default NULL
+    });
+    print "Upgrade to $DBversion done (Bug 6536: Z3950 improvements)\n";
+    SetVersion ($DBversion);
+}
+
+$DBversion = "3.17.00.018";
+if ( CheckVersion($DBversion) ) {
+    $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('HoldsInNoissuesCharge', '0', 'Hold charges block checkouts (added to noissuescharge).',NULL,'YesNo');");
+    print "Upgrade to $DBversion done (Bug 12205: Add HoldsInNoissuesCharge systempreference)\n";
+    SetVersion($DBversion);
+}
+
+$DBversion = "3.17.00.019";
+if ( CheckVersion($DBversion) ) {
+    $dbh->do("INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('NotHighlightedWords','and|or|not',NULL,'List of words to NOT highlight when OpacHighlightedWords is enabled','free')"
+    );
+    print "Upgrade to $DBversion done (Bug 6149: Operator highlighted in search results)\n";
+    SetVersion($DBversion);
+}
+
+$DBversion = "3.17.00.020";
+if(C4::Context->preference("Version") < TransformToNum($DBversion) ) {
+    $dbh->do("INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ('ExpireReservesOnHolidays', '1', NULL, 'If false, reserves at a library will not be canceled on days the library is not open.', 'YesNo')");
+    print "Upgrade to $DBversion done (Bug 8735 - Expire holds waiting only on days the library is open)\n";
+    SetVersion ($DBversion);
+}
+
+$DBversion = "3.17.00.021";
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+    my $pref = C4::Context->preference('HomeOrHoldingBranch');
+    $dbh->do("INSERT INTO `systempreferences` (variable,value,options,explanation,type)
+       VALUES ('StaffSearchResultsDisplayBranch', ?,'homebranch|holdingbranch','Controls the display of the home or holding branch for staff search results','choice')", undef, $pref);
+    print "Upgrade to $DBversion done (Bug 12582 - Control of branch displayed in search results linked to HomeOrHoldingBranch)\n";
+    SetVersion ($DBversion);
+}
+
+$DBversion = '3.17.00.022';
+if ( CheckVersion($DBversion) ) {
+    my @temp= $dbh->selectrow_array(qq|
+        SELECT count(*)
+        FROM marc_subfield_structure
+        WHERE kohafield='permanent_location' OR kohafield='items.permanent_location'
+    |);
+    print "Upgrade to $DBversion done (Bug 7817: Check for permanent_location)\n";
+    if( $temp[0] ) {
+        print "WARNING for Koha administrator: Your database contains one or more mappings for permanent_location to the MARC structure. This item field however is for internal use and should not be linked to a MARC (sub)field. Please correct it. See also Bugzilla reports 7817 and 12818.\n";
+    }
+    SetVersion($DBversion);
+}
+
+$DBversion = "3.17.00.023";
+if ( CheckVersion($DBversion) ) {
+    $dbh->do(q{
+        INSERT IGNORE INTO systempreferences (variable,value,options,explanation,type) VALUES('AcqItemSetSubfieldsWhenReceiptIsCancelled','', '','Upon cancelling a receipt, update the items subfields if they were created when placing an order (e.g. o=5|a="bar foo")', 'Free')
+    });
+    print "Upgrade to $DBversion done (Bug 11169 - Add AcqItemSetSubfieldsWhenReceiptIsCancelled syspref)\n";
+    SetVersion($DBversion);
+}
+
+$DBversion = "3.17.00.024";
+if(CheckVersion($DBversion)) {
+    $dbh->do(q{
+        ALTER TABLE issues ADD auto_renew BOOLEAN default FALSE AFTER renewals
+    });
+    $dbh->do(q{
+        ALTER TABLE old_issues ADD auto_renew BOOLEAN default FALSE AFTER renewals
+    });
+    $dbh->do(q{
+        ALTER TABLE issuingrules ADD auto_renew BOOLEAN default FALSE AFTER norenewalbefore
+    });
+    print "Upgrade to $DBversion done (Bug 11577: [ENH] Automatic renewal feature)\n";
+    SetVersion($DBversion);
+}
+
+$DBversion = '3.17.00.025';
+if ( CheckVersion($DBversion) ) {
+    $dbh->do(qq{
+        INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES('StatisticsFields','location|itype|ccode','Define fields (from the items table) used for statistics members',NULL,'Free')
+    });
+    print "Upgrade to $DBversion done (Bug 12728: Checked syspref StatisticsFields)\n";
+}
+
+$DBversion = "3.17.00.026";
+if ( CheckVersion($DBversion) ) {
+    if ( C4::Context->preference('marcflavour') eq 'MARC21' ) {
+        $dbh->do("UPDATE marc_subfield_structure SET liblibrarian = 'Encoded bitrate', libopac = 'Encoded bitrate' WHERE tagfield = '347' AND tagsubfield = 'f'");
+        $dbh->do("UPDATE marc_subfield_structure SET repeatable = 1 WHERE tagfield IN ('110','111','610','611','710','711','810','811') AND tagsubfield = 'c'");
+        $dbh->do("UPDATE auth_subfield_structure SET repeatable = 1 WHERE tagfield IN ('110','111','410','411','510','511','710','711') AND tagsubfield = 'c'");
+        print "Upgrade to $DBversion done (Bug 12435 - Update MARC21 frameworks to Update No. 18 (April 2014))\n";
+    }
+    SetVersion($DBversion);
+}
+
+$DBversion = "3.17.00.027";
+if ( CheckVersion($DBversion) ) {
+    $dbh->do(q{
+        DELETE FROM systempreferences WHERE variable = 'SearchEngine'
+    });
+    print "Upgrade to $DBversion done (Bug 12538 - Remove SearchEngine syspref)\n";
+    SetVersion($DBversion);
+}
+
+$DBversion = "3.17.00.028";
+if ( CheckVersion($DBversion) ) {
+    $dbh->do(q{
+        INSERT INTO systempreferences (variable,value) VALUES('OpacCustomSearch','');
+    });
+    print "Upgrade to $DBversion done (Bug 12296 - search box replaceable with a system preference)\n";
+    SetVersion($DBversion);
+}
+
+$DBversion = "3.17.00.029";
+if ( CheckVersion($DBversion) ) {
+    $dbh->do("ALTER TABLE  `items` CHANGE  `cn_sort`  `cn_sort` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL");
+    $dbh->do("ALTER TABLE  `deleteditems` CHANGE  `cn_sort`  `cn_sort` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL");
+    $dbh->do("ALTER TABLE  `biblioitems` CHANGE  `cn_sort`  `cn_sort` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL");
+    $dbh->do("ALTER TABLE  `deletedbiblioitems` CHANGE  `cn_sort`  `cn_sort` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL");
+    print "Upgrade to $DBversion done (Bug 12424 - ddc sorting of call numbers truncates long Cutter parts)\n";
+    SetVersion ($DBversion);
+}
+
+$DBversion = "3.17.00.030";
+if ( CheckVersion($DBversion) ) {
+    $dbh->do(
+        q{
+       INSERT INTO systempreferences (variable, value, options, explanation, type )
+       VALUES
+        ('UsageStatsCountry', '', NULL, 'The country where your library is located, to be shown on the Hea Koha community website', 'YesNo'),
+        ('UsageStatsID', '', NULL, 'This preference is part of Koha but it should not be deleted or updated manually.',  'Free'),
+        ('UsageStatsLastUpdateTime', '', NULL, 'This preference is part of Koha but it should not be deleted or updated manually.', 'Free'),
+        ('UsageStatsLibraryName', '', NULL, 'The library name to be shown on Hea Koha community website', 'Free'),
+        ('UsageStatsLibraryType', 'public', 'public|university', 'The library type to be shown on the Hea Koha community website', 'Choice'),
+        ('UsageStatsLibraryUrl', '', NULL, 'The library URL to be shown on Hea Koha community website', 'Free'),
+        ('UsageStats', 0, NULL, 'Share anonymous usage data on the Hea Koha community website.', 'YesNo')
+    });
+    print "Upgrade to $DBversion done (Bug 11926: Add UsageStats systempreferences (HEA))\n";
+    SetVersion($DBversion);
+}
+
+$DBversion = "3.17.00.031";
+if ( CheckVersion($DBversion) ) {
+   $dbh->do("ALTER TABLE saved_sql CHANGE report_name report_name VARCHAR( 255 ) NOT NULL DEFAULT '' ");
+   print "Upgrade to $DBversion done (Bug 2969: Report Name should be mandatory for saved reports)\n";
+   SetVersion ($DBversion);
+}
+
+$DBversion = "3.17.00.032";
+if ( CheckVersion($DBversion) ) {
+    $dbh->do(
+"INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ('ReplytoDefault',  '',  NULL,  'The default email address to be set as replyto.',  'Free')"
+    );
+    $dbh->do(
+"INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ('ReturnpathDefault',  '',  NULL,  'The default email address to be set as return-path',  'Free')"
+    );
+    $dbh->do("ALTER TABLE branches ADD branchreplyto mediumtext AFTER branchemail");
+    $dbh->do("ALTER TABLE branches ADD branchreturnpath mediumtext AFTER branchreplyto");
+    print "Upgrade to $DBversion done (Bug 9530: Adding replyto and returnpath addresses.)\n";
+    SetVersion($DBversion);
+}
+
+$DBversion = "3.17.00.033";
+if ( CheckVersion($DBversion) ) {
+    $dbh->do(q{
+        INSERT IGNORE INTO systempreferences (variable, value, explanation, options, type)
+        VALUES('FacetMaxCount', '20','Specify the max facet count for each category',NULL,'Integer')
+    });
+    print "Upgrade to $DBversion done (Bug 13088 - Allow the user to specify a max amount of facets to show)\n";
+    SetVersion($DBversion);
+}
+
+$DBversion = "3.17.00.034";
+if ( CheckVersion($DBversion) ) {
+    $dbh->do(q|
+        ALTER TABLE aqorders DROP COLUMN cancelledby;
+    |);
+
+    print "Upgrade to $DBversion done (Bug 11007 - DROP column aqorders.cancelledby)\n";
+    SetVersion($DBversion);
+}
+
+$DBversion = "3.17.00.035";
+if ( CheckVersion($DBversion) ) {
+    $dbh->do(q|
+        ALTER TABLE serial ADD COLUMN claims_count INT(11) DEFAULT 0 after claimdate
+    |);
+    $dbh->do(q|
+        UPDATE serial
+        SET claims_count = 1
+        WHERE claimdate IS NOT NULL
+    |);
+    print "Upgrade to $DBversion done (Bug 5342: Add claims_count field in serial table)\n";
+    SetVersion($DBversion);
+}
+
+$DBversion = "3.17.00.XXX";
+if ( CheckVersion($DBversion) ) {
+    $dbh->do("DELETE FROM systempreferences WHERE variable='OpacShowLibrariesPulldownMobile'");
+    print "Upgrade to $DBversion done ( Bug 12513 - PROG/CCSR deprecation: Remove OpacShowLibrariesPulldownMobile system preference )\n";
+    SetVersion ($DBversion);
+}
+
+$DBversion = "3.17.00.XXX";
+if ( CheckVersion($DBversion) ) {
+    $dbh->do("DELETE FROM systempreferences WHERE variable='OpacMainUserBlockMobile'");
+    print "Upgrade to $DBversion done ( Bug 12246 - PROG/CCSR deprecation: Remove OpacMainUserBlockMobile system preference )\n";
+    SetVersion ($DBversion);
+}
+
+$DBversion = "3.17.00.XXX";
+if ( CheckVersion($DBversion) ) {
+    $dbh->do("DELETE FROM systempreferences WHERE variable='OPACMobileUserCSS'");
+    print "Upgrade to $DBversion done ( Bug 12245 - PROG/CCSR deprecation: Remove OPACMobileUserCSS system preference )\n";
+    SetVersion ($DBversion);
+}
+
+$DBversion = "3.17.00.XXX";
+if ( CheckVersion($DBversion) ) {
+    $dbh->do("INSERT IGNORE INTO systempreferences (variable, value, options, explanation, type) VALUES
+    ('OPACFallback', 'prog', 'bootstrap|prog', 'Define the fallback theme for the OPAC interface.', 'Themes')");
+    print "Upgrade to $DBversion done (Bug 12539 - PROG/CCSR deprecation: Remove hardcoded theme from C4/Templates.pm)\n";
+    SetVersion ($DBversion);
+}
+
 =head1 FUNCTIONS
 
 =head2 TableExists($table)